Bug 1607697 - Box the memory reports in enums. r=Gankro
☠☠ backed out by c2dd65b196d3 ☠ ☠
authorNicolas Silva <nsilva@mozilla.com>
Wed, 08 Jan 2020 15:41:24 +0000
changeset 509368 6bf3305bb6893affecdbde816a7bf856a7ed13f1
parent 509367 3af5a9700d47aedf0db0457d86046b6bda1c178b
child 509369 a3942fa2644c5881a4d92770f0850229c3996fc8
push id36995
push userapavel@mozilla.com
push dateWed, 08 Jan 2020 21:56:06 +0000
treeherdermozilla-central@374a48ce8690 [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();
     }