Move Epoch to gfx_traits

Resolves #9222. Moved Epoch from components/msg/compositor_msg to
components/gfx_traits/lib. Updated use statements to reflect the move.
This commit is contained in:
John DeSilva 2016-01-09 15:26:58 -05:00
parent 85792d2819
commit f32995543d
12 changed files with 26 additions and 28 deletions

View file

@ -14,7 +14,7 @@ use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D; use euclid::size::TypedSize2D;
use euclid::{Matrix4, Point2D, Rect, Size2D}; use euclid::{Matrix4, Point2D, Rect, Size2D};
use gfx::paint_thread::{ChromeToPaintMsg, PaintRequest}; use gfx::paint_thread::{ChromeToPaintMsg, PaintRequest};
use gfx_traits::{color, LayerId, LayerKind, LayerProperties, ScrollPolicy}; use gfx_traits::{color, Epoch, LayerId, LayerKind, LayerProperties, ScrollPolicy};
use gleam::gl; use gleam::gl;
use gleam::gl::types::{GLint, GLsizei}; use gleam::gl::types::{GLint, GLsizei};
use image::{DynamicImage, ImageFormat, RgbImage}; use image::{DynamicImage, ImageFormat, RgbImage};
@ -27,7 +27,7 @@ use layers::rendergl;
use layers::rendergl::RenderContext; use layers::rendergl::RenderContext;
use layers::scene::Scene; use layers::scene::Scene;
use layout_traits::LayoutControlChan; use layout_traits::LayoutControlChan;
use msg::compositor_msg::{Epoch, FrameTreeId}; use msg::compositor_msg::FrameTreeId;
use msg::constellation_msg::{AnimationState, Image, PixelFormat}; use msg::constellation_msg::{AnimationState, Image, PixelFormat};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton};
use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData}; use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData};

View file

@ -8,11 +8,10 @@ use euclid::length::Length;
use euclid::point::{Point2D, TypedPoint2D}; use euclid::point::{Point2D, TypedPoint2D};
use euclid::rect::Rect; use euclid::rect::Rect;
use euclid::size::TypedSize2D; use euclid::size::TypedSize2D;
use gfx_traits::{LayerId, LayerProperties, ScrollPolicy}; use gfx_traits::{Epoch, LayerId, LayerProperties, ScrollPolicy};
use layers::color::Color; use layers::color::Color;
use layers::geometry::LayerPixel; use layers::geometry::LayerPixel;
use layers::layers::{Layer, LayerBufferSet}; use layers::layers::{Layer, LayerBufferSet};
use msg::compositor_msg::Epoch;
use msg::constellation_msg::{MouseEventType, PipelineId}; use msg::constellation_msg::{MouseEventType, PipelineId};
use script_traits::CompositorEvent; use script_traits::CompositorEvent;
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent}; use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent};

View file

@ -8,12 +8,12 @@ use CompositorMsg as ConstellationMsg;
use compositor; use compositor;
use euclid::point::Point2D; use euclid::point::Point2D;
use euclid::size::Size2D; use euclid::size::Size2D;
use gfx_traits::{LayerId, LayerProperties, PaintListener}; use gfx_traits::{Epoch, LayerId, LayerProperties, PaintListener};
use headless; use headless;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use layers::layers::{BufferRequest, LayerBufferSet}; use layers::layers::{BufferRequest, LayerBufferSet};
use layers::platform::surface::{NativeDisplay, NativeSurface}; use layers::platform::surface::{NativeDisplay, NativeSurface};
use msg::compositor_msg::{Epoch, FrameTreeId}; use msg::compositor_msg::FrameTreeId;
use msg::constellation_msg::{AnimationState, PipelineId}; use msg::constellation_msg::{AnimationState, PipelineId};
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState}; use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState};
use profile_traits::mem; use profile_traits::mem;

View file

@ -22,11 +22,10 @@ use euclid::size::{Size2D, TypedSize2D};
use gaol; use gaol;
use gaol::sandbox::{self, Sandbox, SandboxMethods}; use gaol::sandbox::{self, Sandbox, SandboxMethods};
use gfx::font_cache_thread::FontCacheThread; use gfx::font_cache_thread::FontCacheThread;
use gfx_traits::PaintMsg as FromPaintMsg; use gfx_traits::{Epoch, PaintMsg as FromPaintMsg};
use ipc_channel::ipc::{self, IpcOneShotServer, IpcSender}; use ipc_channel::ipc::{self, IpcOneShotServer, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use layout_traits::{LayoutControlChan, LayoutThreadFactory}; use layout_traits::{LayoutControlChan, LayoutThreadFactory};
use msg::compositor_msg::Epoch;
use msg::constellation_msg::AnimationState; use msg::constellation_msg::AnimationState;
use msg::constellation_msg::WebDriverCommandMsg; use msg::constellation_msg::WebDriverCommandMsg;
use msg::constellation_msg::{DocumentState, FrameId, PipelineId}; use msg::constellation_msg::{DocumentState, FrameId, PipelineId};

View file

@ -53,8 +53,8 @@ extern crate util;
pub use compositor_thread::{CompositorEventListener, CompositorProxy, CompositorThread}; pub use compositor_thread::{CompositorEventListener, CompositorProxy, CompositorThread};
pub use constellation::Constellation; pub use constellation::Constellation;
use euclid::size::{Size2D}; use euclid::size::{Size2D};
use gfx_traits::Epoch;
use ipc_channel::ipc::{IpcSender}; use ipc_channel::ipc::{IpcSender};
use msg::compositor_msg::Epoch;
use msg::constellation_msg::{FrameId, Key, KeyState, KeyModifiers, LoadData}; use msg::constellation_msg::{FrameId, Key, KeyState, KeyModifiers, LoadData};
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId}; use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
use msg::constellation_msg::{WebDriverCommandMsg, WindowSizeData}; use msg::constellation_msg::{WebDriverCommandMsg, WindowSizeData};

View file

@ -15,11 +15,12 @@ use euclid::rect::Rect;
use euclid::size::Size2D; use euclid::size::Size2D;
use font_cache_thread::FontCacheThread; use font_cache_thread::FontCacheThread;
use font_context::FontContext; use font_context::FontContext;
use gfx_traits::{color, LayerId, LayerKind, LayerProperties, PaintListener, PaintMsg as ConstellationMsg, ScrollPolicy}; use gfx_traits::color;
use gfx_traits::{Epoch, LayerId, LayerKind, LayerProperties, PaintListener, PaintMsg as ConstellationMsg, ScrollPolicy};
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet}; use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use layers::platform::surface::{NativeDisplay, NativeSurface}; use layers::platform::surface::{NativeDisplay, NativeSurface};
use msg::compositor_msg::{Epoch, FrameTreeId}; use msg::compositor_msg::FrameTreeId;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use paint_context::PaintContext; use paint_context::PaintContext;
use profile_traits::mem::{self, ReportsChan}; use profile_traits::mem::{self, ReportsChan};

View file

@ -125,3 +125,14 @@ pub struct LayerProperties {
/// Whether this layer scrolls its overflow area. /// Whether this layer scrolls its overflow area.
pub scrolls_overflow_area: bool, pub scrolls_overflow_area: bool,
} }
/// A newtype struct for denoting the age of messages; prevents race conditions.
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
pub struct Epoch(pub u32);
impl Epoch {
pub fn next(&mut self) {
let Epoch(ref mut u) = *self;
*u += 1;
}
}

View file

@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use Epoch;
use LayerId; use LayerId;
use LayerProperties; use LayerProperties;
use layers::layers::{BufferRequest, LayerBufferSet}; use layers::layers::{BufferRequest, LayerBufferSet};
use layers::platform::surface::NativeDisplay; use layers::platform::surface::NativeDisplay;
use msg::compositor_msg::{Epoch, FrameTreeId}; use msg::compositor_msg::FrameTreeId;
use msg::constellation_msg::PipelineId; use msg::constellation_msg::PipelineId;
/// The interface used by the painter to acquire draw targets for each paint frame and /// The interface used by the painter to acquire draw targets for each paint frame and

View file

@ -27,7 +27,7 @@ use gfx::font;
use gfx::font_cache_thread::FontCacheThread; use gfx::font_cache_thread::FontCacheThread;
use gfx::font_context; use gfx::font_context;
use gfx::paint_thread::{LayoutToPaintMsg, PaintLayer}; use gfx::paint_thread::{LayoutToPaintMsg, PaintLayer};
use gfx_traits::{color, LayerId, ScrollPolicy}; use gfx_traits::{color, Epoch, LayerId, ScrollPolicy};
use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT}; use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
@ -35,7 +35,6 @@ use layout_debug;
use layout_traits::LayoutThreadFactory; use layout_traits::LayoutThreadFactory;
use log; use log;
use msg::ParseErrorReporter; use msg::ParseErrorReporter;
use msg::compositor_msg::Epoch;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread}; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
use parallel; use parallel;

View file

@ -2,17 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// A newtype struct for denoting the age of messages; prevents race conditions.
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
pub struct Epoch(pub u32);
impl Epoch {
pub fn next(&mut self) {
let Epoch(ref mut u) = *self;
*u += 1;
}
}
#[derive(PartialEq, Eq, Debug, Copy, Clone)] #[derive(PartialEq, Eq, Debug, Copy, Clone)]
pub struct FrameTreeId(pub u32); pub struct FrameTreeId(pub u32);

View file

@ -10,9 +10,8 @@ use app_units::Au;
use dom::node::OpaqueStyleAndLayoutData; use dom::node::OpaqueStyleAndLayoutData;
use euclid::point::Point2D; use euclid::point::Point2D;
use euclid::rect::Rect; use euclid::rect::Rect;
use gfx_traits::LayerId; use gfx_traits::{Epoch, LayerId};
use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::ipc::{IpcReceiver, IpcSender};
use msg::compositor_msg::Epoch;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use msg::constellation_msg::{WindowSizeData}; use msg::constellation_msg::{WindowSizeData};
use net_traits::image_cache_thread::ImageCacheThread; use net_traits::image_cache_thread::ImageCacheThread;

View file

@ -35,10 +35,10 @@ use euclid::Size2D;
use euclid::length::Length; use euclid::length::Length;
use euclid::point::Point2D; use euclid::point::Point2D;
use euclid::rect::Rect; use euclid::rect::Rect;
use gfx_traits::Epoch;
use gfx_traits::LayerId; use gfx_traits::LayerId;
use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::c_void; use libc::c_void;
use msg::compositor_msg::Epoch;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId};
use msg::constellation_msg::{MouseButton, MouseEventType}; use msg::constellation_msg::{MouseButton, MouseEventType};