servo: Merge #11569 - compositing: Remove CompositorThread struct (from talklittle:remove_struct_10261); r=metajack
authorAndrew Shu <talklittle@gmail.com>
Fri, 03 Jun 2016 02:44:07 -0500
changeset 338998 7fd1d00cb1ebe8d7764893799550fffd2d65540d
parent 338997 258b6dd147cf6779fd5230fdcf9a7e34d89868cd
child 338999 a4cb10a7386f9fdeddfa2f919d23adbc7fee2302
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmetajack
servo: Merge #11569 - compositing: Remove CompositorThread struct (from talklittle:remove_struct_10261); r=metajack <!-- Please describe your changes on the following line: --> Remove `CompositorThread` struct, since it wraps only `IOCompositor`. Use `IOCompositor` directly. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #10261 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 6c5f5d35f56f75e5a235836c042a55b67da553d6
servo/components/compositing/compositor_thread.rs
servo/components/compositing/lib.rs
servo/components/servo/lib.rs
--- a/servo/components/compositing/compositor_thread.rs
+++ b/servo/components/compositing/compositor_thread.rs
@@ -1,35 +1,33 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! Communication with the compositor thread.
 
 use SendableFrameTree;
-use compositor::{CompositingReason, IOCompositor};
+use compositor::CompositingReason;
 use euclid::point::Point2D;
 use euclid::size::Size2D;
 use gfx_traits::{Epoch, FrameTreeId, LayerId, LayerProperties, PaintListener};
 use ipc_channel::ipc::IpcSender;
 use layers::layers::{BufferRequest, LayerBufferSet};
 use layers::platform::surface::{NativeDisplay, NativeSurface};
 use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState, PipelineId};
 use profile_traits::mem;
 use profile_traits::time;
 use script_traits::{AnimationState, ConstellationMsg, EventResult};
 use std::fmt::{Debug, Error, Formatter};
-use std::rc::Rc;
 use std::sync::mpsc::{Receiver, Sender, channel};
 use style_traits::cursor::Cursor;
 use style_traits::viewport::ViewportConstraints;
 use url::Url;
 use webrender;
 use webrender_traits;
-use windowing::WindowMethods;
 
 /// Sends messages to the compositor. This is a trait supplied by the port because the method used
 /// to communicate with the compositor may have to kick OS event loops awake, communicate cross-
 /// process, and so forth.
 pub trait CompositorProxy : 'static + Send {
     /// Sends a message to the compositor.
     fn send(&self, msg: Msg);
     /// Clones the compositor proxy.
@@ -226,27 +224,16 @@ impl Debug for Msg {
             Msg::MoveTo(..) => write!(f, "MoveTo"),
             Msg::ResizeTo(..) => write!(f, "ResizeTo"),
             Msg::PipelineExited(..) => write!(f, "PipelineExited"),
             Msg::GetScrollOffset(..) => write!(f, "GetScrollOffset"),
         }
     }
 }
 
-pub struct CompositorThread;
-
-impl CompositorThread {
-    pub fn create<Window>(window: Rc<Window>,
-                          state: InitialCompositorState)
-                          -> IOCompositor<Window>
-                          where Window: WindowMethods + 'static {
-        IOCompositor::create(window, state)
-    }
-}
-
 /// Data used to construct a compositor.
 pub struct InitialCompositorState {
     /// A channel to the compositor.
     pub sender: Box<CompositorProxy + Send>,
     /// A port on which messages inbound to the compositor can be received.
     pub receiver: Box<CompositorReceiver>,
     /// A channel to the constellation.
     pub constellation_chan: Sender<ConstellationMsg>,
--- a/servo/components/compositing/lib.rs
+++ b/servo/components/compositing/lib.rs
@@ -31,17 +31,17 @@ extern crate script_traits;
 extern crate style_traits;
 extern crate time;
 extern crate url;
 #[macro_use]
 extern crate util;
 extern crate webrender;
 extern crate webrender_traits;
 
-pub use compositor_thread::{CompositorProxy, CompositorThread};
+pub use compositor_thread::CompositorProxy;
 pub use compositor::IOCompositor;
 use euclid::size::TypedSize2D;
 use gfx::paint_thread::ChromeToPaintMsg;
 use ipc_channel::ipc::IpcSender;
 use msg::constellation_msg::PipelineId;
 use script_traits::{ConstellationControlMsg, LayoutControlMsg};
 use std::sync::mpsc::Sender;
 use util::geometry::PagePx;
--- a/servo/components/servo/lib.rs
+++ b/servo/components/servo/lib.rs
@@ -55,17 +55,17 @@ fn webdriver(port: u16, constellation: S
 }
 
 #[cfg(not(feature = "webdriver"))]
 fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) { }
 
 use compositing::compositor_thread::InitialCompositorState;
 use compositing::windowing::WindowEvent;
 use compositing::windowing::WindowMethods;
-use compositing::{CompositorProxy, CompositorThread, IOCompositor};
+use compositing::{CompositorProxy, IOCompositor};
 #[cfg(not(target_os = "windows"))]
 use constellation::content_process_sandbox_profile;
 use constellation::{Constellation, InitialConstellationState, UnprivilegedPipelineContent};
 #[cfg(not(target_os = "windows"))]
 use gaol::sandbox::{ChildSandbox, ChildSandboxMethods};
 use gfx::font_cache_thread::FontCacheThread;
 use ipc_channel::ipc::{self, IpcSender};
 use net::bluetooth_thread::BluetoothThreadFactory;
@@ -162,17 +162,17 @@ impl<Window> Browser<Window> where Windo
         if cfg!(feature = "webdriver") {
             if let Some(port) = opts.webdriver_port {
                 webdriver(port, constellation_chan.clone());
             }
         }
 
         // The compositor coordinates with the client window to create the final
         // rendered page and display it somewhere.
-        let compositor = CompositorThread::create(window, InitialCompositorState {
+        let compositor = IOCompositor::create(window, InitialCompositorState {
             sender: compositor_proxy,
             receiver: compositor_receiver,
             constellation_chan: constellation_chan,
             time_profiler_chan: time_profiler_chan,
             mem_profiler_chan: mem_profiler_chan,
             webrender: webrender,
             webrender_api_sender: webrender_api_sender,
         });