servo: Merge #11084 - move trait ConvertPipelineIdToWebRender to a better place (from kevgs:layout_traits); r=Ms2ger
authorKosov Eugene <claprix@yandex.ru>
Mon, 09 May 2016 03:14:03 -0700
changeset 338745 cff6b77d6931beec48d40a516332258e77add0f0
parent 338744 390d0a55f86bf213796e166c89da3233fd2c6677
child 338746 5fe9397042859d10a8b847310a4814a769089d1c
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)
reviewersMs2ger
servo: Merge #11084 - move trait ConvertPipelineIdToWebRender to a better place (from kevgs:layout_traits); r=Ms2ger Source-Repo: https://github.com/servo/servo Source-Revision: 9a8c81773a7dc51301e52ce3f02f8ea55984365a
servo/components/compositing/compositor.rs
servo/components/layout/layout_thread.rs
servo/components/layout/webrender_helpers.rs
servo/components/layout_traits/lib.rs
servo/components/msg/constellation_msg.rs
--- a/servo/components/compositing/compositor.rs
+++ b/servo/components/compositing/compositor.rs
@@ -23,18 +23,18 @@ use image::{DynamicImage, ImageFormat, R
 use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
 use ipc_channel::router::ROUTER;
 use layers::geometry::{DevicePixel, LayerPixel};
 use layers::layers::{BufferRequest, Layer, LayerBuffer, LayerBufferSet};
 use layers::platform::surface::NativeDisplay;
 use layers::rendergl;
 use layers::rendergl::RenderContext;
 use layers::scene::Scene;
-use layout_traits::LayoutControlChan;
-use msg::constellation_msg::{ConvertPipelineIdFromWebRender, ConvertPipelineIdToWebRender, Image, PixelFormat};
+use layout_traits::{ConvertPipelineIdToWebRender, LayoutControlChan};
+use msg::constellation_msg::{ConvertPipelineIdFromWebRender, Image, PixelFormat};
 use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
 use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData, WindowSizeType};
 use pipeline::CompositionPipeline;
 use profile_traits::mem::{self, ReportKind, Reporter, ReporterRequest};
 use profile_traits::time::{self, ProfilerCategory, profile};
 use script_traits::CompositorEvent::{MouseMoveEvent, MouseButtonEvent, TouchEvent};
 use script_traits::{AnimationState, ConstellationControlMsg, LayoutControlMsg};
 use script_traits::{MouseButton, MouseEventType, TouchpadPressurePhase, TouchEventType, TouchId};
--- a/servo/components/layout/layout_thread.rs
+++ b/servo/components/layout/layout_thread.rs
@@ -30,19 +30,19 @@ use gfx::font_context;
 use gfx::paint_thread::LayoutToPaintMsg;
 use gfx_traits::{color, Epoch, LayerId, ScrollPolicy};
 use heapsize::HeapSizeOf;
 use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REFLOW_OUT_OF_FLOW};
 use incremental::{REPAINT};
 use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
 use ipc_channel::router::ROUTER;
 use layout_debug;
-use layout_traits::LayoutThreadFactory;
+use layout_traits::{ConvertPipelineIdToWebRender, LayoutThreadFactory};
 use log;
-use msg::constellation_msg::{ConstellationChan, ConvertPipelineIdToWebRender, PanicMsg, PipelineId};
+use msg::constellation_msg::{ConstellationChan, PanicMsg, PipelineId};
 use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
 use net_traits::image_cache_thread::{UsePlaceholder};
 use parallel;
 use profile_traits::mem::{self, Report, ReportKind, ReportsChan};
 use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
 use profile_traits::time::{self, TimerMetadata, profile};
 use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request};
 use query::{process_node_geometry_request, process_node_layer_id_request, process_node_scroll_area_request};
--- a/servo/components/layout/webrender_helpers.rs
+++ b/servo/components/layout/webrender_helpers.rs
@@ -10,17 +10,17 @@
 use app_units::Au;
 use azure::azure_hl::Color;
 use euclid::num::Zero;
 use euclid::{Point2D, Rect, Size2D};
 use gfx::display_list::{BorderRadii, BoxShadowClipMode, ClippingRegion};
 use gfx::display_list::{DisplayItem, DisplayList};
 use gfx::display_list::{DisplayListTraversal, GradientStop, StackingContext, StackingContextType};
 use gfx_traits::ScrollPolicy;
-use msg::constellation_msg::ConvertPipelineIdToWebRender;
+use layout_traits::ConvertPipelineIdToWebRender;
 use style::computed_values::filter::{self, Filter};
 use style::computed_values::{image_rendering, mix_blend_mode};
 use style::values::computed::BorderStyle;
 use webrender_traits::{self, AuxiliaryListsBuilder, DisplayListId, PipelineId, StackingContextId};
 
 trait WebRenderStackingContextConverter {
     fn convert_to_webrender<'a>(&self,
                                 traversal: &mut DisplayListTraversal<'a>,
--- a/servo/components/layout_traits/lib.rs
+++ b/servo/components/layout_traits/lib.rs
@@ -21,17 +21,17 @@ extern crate webrender_traits;
 // This module contains traits in layout used generically
 //   in the rest of Servo.
 // The traits are here instead of in layout so
 //   that these modules won't have to depend on layout.
 
 use gfx::font_cache_thread::FontCacheThread;
 use gfx::paint_thread::LayoutToPaintMsg;
 use ipc_channel::ipc::{IpcReceiver, IpcSender};
-use msg::constellation_msg::{ConstellationChan, PanicMsg, PipelineId};
+use msg::constellation_msg::{ConstellationChan, PanicMsg, PipelineId, PipelineNamespaceId, PipelineIndex};
 use net_traits::image_cache_thread::ImageCacheThread;
 use profile_traits::{mem, time};
 use script_traits::LayoutMsg as ConstellationMsg;
 use script_traits::{LayoutControlMsg, ConstellationControlMsg, OpaqueScriptLayoutChannel};
 use url::Url;
 use util::ipc::OptionalIpcSender;
 
 /// A channel wrapper for constellation messages
@@ -55,8 +55,20 @@ pub trait LayoutThreadFactory {
               image_cache_thread: ImageCacheThread,
               font_cache_thread: FontCacheThread,
               time_profiler_chan: time::ProfilerChan,
               mem_profiler_chan: mem::ProfilerChan,
               shutdown_chan: IpcSender<()>,
               content_process_shutdown_chan: IpcSender<()>,
               webrender_api_sender: Option<webrender_traits::RenderApiSender>);
 }
+
+pub trait ConvertPipelineIdToWebRender {
+    fn to_webrender(&self) -> webrender_traits::PipelineId;
+}
+
+impl ConvertPipelineIdToWebRender for PipelineId {
+    fn to_webrender(&self) -> webrender_traits::PipelineId {
+        let PipelineNamespaceId(namespace_id) = self.namespace_id;
+        let PipelineIndex(index) = self.index;
+        webrender_traits::PipelineId(namespace_id, index)
+    }
+}
--- a/servo/components/msg/constellation_msg.rs
+++ b/servo/components/msg/constellation_msg.rs
@@ -354,32 +354,20 @@ impl fmt::Display for PipelineId {
         let PipelineIndex(index) = self.index;
         write!(fmt, "({},{})", namespace_id, index)
     }
 }
 
 #[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize, HeapSizeOf)]
 pub struct SubpageId(pub u32);
 
-pub trait ConvertPipelineIdToWebRender {
-    fn to_webrender(&self) -> webrender_traits::PipelineId;
-}
-
 pub trait ConvertPipelineIdFromWebRender {
     fn from_webrender(&self) -> PipelineId;
 }
 
-impl ConvertPipelineIdToWebRender for PipelineId {
-    fn to_webrender(&self) -> webrender_traits::PipelineId {
-        let PipelineNamespaceId(namespace_id) = self.namespace_id;
-        let PipelineIndex(index) = self.index;
-        webrender_traits::PipelineId(namespace_id, index)
-    }
-}
-
 impl ConvertPipelineIdFromWebRender for webrender_traits::PipelineId {
     fn from_webrender(&self) -> PipelineId {
         PipelineId {
             namespace_id: PipelineNamespaceId(self.0),
             index: PipelineIndex(self.1),
         }
     }
 }