Bug 1607697 - Box the memory reports in enums. r=Gankro
authorNicolas Silva <nsilva@mozilla.com>
Fri, 10 Jan 2020 10:12:41 +0000
changeset 509686 921c9f58037bf7c0c89b7c45c3f8a94f50b5814f
parent 509685 596d83b7671291fb344924f7c434c428f6f28b04
child 509687 9d134f75df84ba0b2a4650e5c69e944fbfa84ad6
push id37002
push userccoroiu@mozilla.com
push dateFri, 10 Jan 2020 21:49:10 +0000
treeherdermozilla-central@7fa78b1baf59 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGankro
bugs1607697
milestone74.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1607697 - Box the memory reports in enums. r=Gankro Clippy warns against it being much larger than the other enum variants. Differential Revision: https://phabricator.services.mozilla.com/D59117
gfx/wr/webrender/src/scene_builder_thread.rs
gfx/wr/webrender_api/src/api.rs
--- a/gfx/wr/webrender/src/scene_builder_thread.rs
+++ b/gfx/wr/webrender/src/scene_builder_thread.rs
@@ -139,17 +139,17 @@ pub enum SceneBuilderRequest {
     DeleteDocument(DocumentId),
     WakeUp,
     Flush(MsgSender<()>),
     ClearNamespace(IdNamespace),
     SetFrameBuilderConfig(FrameBuilderConfig),
     SimulateLongSceneBuild(u32),
     SimulateLongLowPrioritySceneBuild(u32),
     Stop,
-    ReportMemory(MemoryReport, MsgSender<MemoryReport>),
+    ReportMemory(Box<MemoryReport>, MsgSender<Box<MemoryReport>>),
     #[cfg(feature = "capture")]
     SaveScene(CaptureConfig),
     #[cfg(feature = "replay")]
     LoadScenes(Vec<LoadScene>),
     DocumentsForDebugger
 }
 
 // Message from scene builder to render backend.
@@ -357,17 +357,17 @@ impl SceneBuilderThread {
                 }
                 Ok(SceneBuilderRequest::Stop) => {
                     self.tx.send(SceneBuilderResult::Stopped).unwrap();
                     // We don't need to send a WakeUp to api_tx because we only
                     // get the Stop when the RenderBackend loop is exiting.
                     break;
                 }
                 Ok(SceneBuilderRequest::ReportMemory(mut report, tx)) => {
-                    report += self.report_memory();
+                    (*report) += self.report_memory();
                     tx.send(report).unwrap();
                 }
                 Ok(SceneBuilderRequest::SimulateLongSceneBuild(time_ms)) => {
                     self.simulate_slow_ms = time_ms
                 }
                 Ok(SceneBuilderRequest::SimulateLongLowPrioritySceneBuild(_)) => {}
                 Err(_) => {
                     break;
--- a/gfx/wr/webrender_api/src/api.rs
+++ b/gfx/wr/webrender_api/src/api.rs
@@ -1004,17 +1004,17 @@ pub enum ApiMsg {
     /// to forward gecko-specific messages to the render thread preserving the ordering
     /// within the other messages.
     ExternalEvent(ExternalEvent),
     /// Removes all resources associated with a namespace.
     ClearNamespace(IdNamespace),
     /// Flush from the caches anything that isn't necessary, to free some memory.
     MemoryPressure,
     /// Collects a memory report.
-    ReportMemory(MsgSender<MemoryReport>),
+    ReportMemory(MsgSender<Box<MemoryReport>>),
     /// Change debugging options.
     DebugCommand(DebugCommand),
     /// Wakes the render backend's event loop up. Needed when an event is communicated
     /// through another channel.
     WakeUp,
     /// See `RenderApi::wake_scene_builder`.
     WakeSceneBuilder,
     /// Block until a round-trip to the scene builder thread has completed. This
@@ -1533,17 +1533,17 @@ impl RenderApi {
     pub fn notify_memory_pressure(&self) {
         self.api_sender.send(ApiMsg::MemoryPressure).unwrap();
     }
 
     /// Synchronously requests memory report.
     pub fn report_memory(&self) -> MemoryReport {
         let (tx, rx) = channel::msg_channel().unwrap();
         self.api_sender.send(ApiMsg::ReportMemory(tx)).unwrap();
-        rx.recv().unwrap()
+        *rx.recv().unwrap()
     }
 
     /// Update debugging flags.
     pub fn set_debug_flags(&self, flags: DebugFlags) {
         let cmd = DebugCommand::SetFlags(flags);
         self.api_sender.send(ApiMsg::DebugCommand(cmd)).unwrap();
     }