servo: Merge #12970 - Move thread_state to style (from servo:thread-state); r=nox
authorMs2ger <Ms2ger@gmail.com>
Mon, 22 Aug 2016 10:39:51 -0500
changeset 339540 a26b0004d05e62ee4761f60c9e563606578fbd29
parent 339539 5b3956922721f9e32a54cf215a51095e1bd19b28
child 339541 a3934a0d1a9563d09b7bc56a574261c2802fefad
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)
reviewersnox
servo: Merge #12970 - Move thread_state to style (from servo:thread-state); r=nox Source-Repo: https://github.com/servo/servo Source-Revision: 1911606e5c7d81e41b79fa25c41b1d7def7aef62
servo/components/gfx/paint_thread.rs
servo/components/layout_thread/lib.rs
servo/components/script/dom/bindings/cell.rs
servo/components/script/dom/bindings/js.rs
servo/components/script/dom/dedicatedworkerglobalscope.rs
servo/components/script/dom/node.rs
servo/components/script/dom/serviceworkerglobalscope.rs
servo/components/script/script_runtime.rs
servo/components/script/script_thread.rs
servo/components/style/lib.rs
servo/components/style/thread_state.rs
servo/components/style/workqueue.rs
servo/components/util/lib.rs
servo/components/util/thread_state.rs
servo/ports/geckolib/data.rs
--- a/servo/components/gfx/paint_thread.rs
+++ b/servo/components/gfx/paint_thread.rs
@@ -24,21 +24,21 @@ use paint_context::PaintContext;
 use profile_traits::mem;
 use profile_traits::time;
 use rand::{self, Rng};
 use std::borrow::ToOwned;
 use std::collections::HashMap;
 use std::mem as std_mem;
 use std::sync::Arc;
 use std::sync::mpsc::{Receiver, Sender, channel};
+use style::thread_state;
 use url::Url;
 use util::geometry::ExpandToPixelBoundaries;
 use util::opts;
 use util::thread;
-use util::thread_state;
 
 #[derive(Clone, HeapSizeOf)]
 struct PaintLayer {
     /// The LayerProperties, which describe the layer in a way that the Compositor
     /// can consume.
     pub layer_properties: LayerProperties,
 
     /// The StackingContextId of the StackingContext that is the immediate
--- a/servo/components/layout_thread/lib.rs
+++ b/servo/components/layout_thread/lib.rs
@@ -105,25 +105,25 @@ use style::dom::{TDocument, TElement, TN
 use style::error_reporting::ParseErrorReporter;
 use style::logical_geometry::LogicalPoint;
 use style::media_queries::{Device, MediaType};
 use style::parallel::WorkQueueData;
 use style::refcell::RefCell;
 use style::selector_matching::Stylist;
 use style::servo_selector_impl::USER_OR_USER_AGENT_STYLESHEETS;
 use style::stylesheets::{Stylesheet, CSSRuleIteratorExt};
+use style::thread_state;
 use style::timer::Timer;
 use style::workqueue::WorkQueue;
 use url::Url;
 use util::geometry::max_rect;
 use util::ipc::OptionalIpcSender;
 use util::opts;
 use util::prefs::PREFS;
 use util::thread;
-use util::thread_state;
 
 /// The number of screens we have to traverse before we decide to generate new display lists.
 const DISPLAY_PORT_THRESHOLD_SIZE_FACTOR: i32 = 4;
 
 /// Information needed by the layout thread.
 pub struct LayoutThread {
     /// The ID of the pipeline that we belong to.
     id: PipelineId,
--- a/servo/components/script/dom/bindings/cell.rs
+++ b/servo/components/script/dom/bindings/cell.rs
@@ -2,18 +2,18 @@
  * 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/. */
 
 //! A shareable mutable container for the DOM.
 
 use dom::bindings::trace::JSTraceable;
 use js::jsapi::JSTracer;
 use std::cell::{BorrowError, BorrowMutError, Ref, RefCell, RefMut};
-use util::thread_state;
-use util::thread_state::SCRIPT;
+use style::thread_state;
+use style::thread_state::SCRIPT;
 
 /// A mutable field in the DOM.
 ///
 /// This extends the API of `core::cell::RefCell` to allow unsafe access in
 /// certain situations, with dynamic checking in debug builds.
 #[derive(Clone, HeapSizeOf)]
 pub struct DOMRefCell<T> {
     value: RefCell<T>,
--- a/servo/components/script/dom/bindings/js.rs
+++ b/servo/components/script/dom/bindings/js.rs
@@ -38,17 +38,17 @@ use script_thread::STACK_ROOTS;
 use std::cell::UnsafeCell;
 use std::default::Default;
 use std::hash::{Hash, Hasher};
 #[cfg(debug_assertions)]
 use std::intrinsics::type_name;
 use std::mem;
 use std::ops::Deref;
 use std::ptr;
-use util::thread_state;
+use style::thread_state;
 
 /// A traced reference to a DOM object
 ///
 /// This type is critical to making garbage collection work with the DOM,
 /// but it is very dangerous; if garbage collection happens with a `JS<T>`
 /// on the stack, the `JS<T>` can point to freed memory.
 ///
 /// This should only be used as a field in other DOM objects.
--- a/servo/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/servo/components/script/dom/dedicatedworkerglobalscope.rs
@@ -32,19 +32,19 @@ use net_traits::{LoadContext, load_whole
 use rand::random;
 use script_runtime::ScriptThreadEventCategory::WorkerEvent;
 use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, StackRootTLS, get_reports, new_rt_and_cx};
 use script_traits::{TimerEvent, TimerSource, WorkerScriptLoadOrigin, WorkerGlobalScopeInit};
 use std::mem::replace;
 use std::sync::atomic::AtomicBool;
 use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
 use std::sync::{Arc, Mutex};
+use style::thread_state;
 use url::Url;
 use util::thread::spawn_named;
-use util::thread_state;
 
 /// Set the `worker` field of a related DedicatedWorkerGlobalScope object to a particular
 /// value for the duration of this object's lifetime. This ensures that the related Worker
 /// object only lives as long as necessary (ie. while events are being executed), while
 /// providing a reference that can be cloned freely.
 struct AutoWorkerReset<'a> {
     workerscope: &'a DedicatedWorkerGlobalScope,
     old_worker: Option<TrustedWorkerAddress>,
--- a/servo/components/script/dom/node.rs
+++ b/servo/components/script/dom/node.rs
@@ -71,18 +71,18 @@ use std::cell::{Cell, UnsafeCell};
 use std::cmp::max;
 use std::default::Default;
 use std::iter;
 use std::mem;
 use std::ops::Range;
 use string_cache::{Atom, Namespace, QualName};
 use style::dom::OpaqueNode;
 use style::selector_impl::ServoSelectorImpl;
+use style::thread_state;
 use url::Url;
-use util::thread_state;
 use uuid::Uuid;
 
 //
 // The basic Node structure
 //
 
 /// An HTML node.
 #[dom_struct]
--- a/servo/components/script/dom/serviceworkerglobalscope.rs
+++ b/servo/components/script/dom/serviceworkerglobalscope.rs
@@ -27,21 +27,21 @@ use js::rust::Runtime;
 use msg::constellation_msg::PipelineId;
 use net_traits::{LoadContext, load_whole_resource, IpcSend, CustomResponseMediator};
 use rand::random;
 use script_runtime::{CommonScriptMsg, StackRootTLS, get_reports, new_rt_and_cx};
 use script_traits::{TimerEvent, WorkerGlobalScopeInit, ScopeThings, ServiceWorkerMsg};
 use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
 use std::thread;
 use std::time::Duration;
+use style::thread_state;
+use style::thread_state::{IN_WORKER, SCRIPT};
 use url::Url;
 use util::prefs::PREFS;
 use util::thread::spawn_named;
-use util::thread_state;
-use util::thread_state::{IN_WORKER, SCRIPT};
 
 /// Messages used to control service worker event loop
 pub enum ServiceWorkerScriptMsg {
     /// Message common to all workers
     CommonWorker(WorkerScriptMsg),
     // Message to request a custom response by the service worker
     Response(CustomResponseMediator)
 }
--- a/servo/components/script/script_runtime.rs
+++ b/servo/components/script/script_runtime.rs
@@ -20,20 +20,20 @@ use js::rust::Runtime;
 use profile_traits::mem::{Report, ReportKind, ReportsChan};
 use script_thread::{Runnable, STACK_ROOTS, trace_thread};
 use std::any::Any;
 use std::cell::{RefCell, Cell};
 use std::io::{Write, stdout};
 use std::marker::PhantomData;
 use std::os;
 use std::ptr;
+use style::thread_state;
 use time::{Tm, now};
 use util::opts;
 use util::prefs::PREFS;
-use util::thread_state;
 
 /// Common messages used to control the event loops in both the script and the worker
 pub enum CommonScriptMsg {
     /// Requests that the script thread measure its memory usage. The results are sent back via the
     /// supplied channel.
     CollectReports(ReportsChan),
     /// A DOM object's last pinned reference was removed (dispatched to all threads).
     RefcountCleanup(TrustedReference),
--- a/servo/components/script/script_thread.rs
+++ b/servo/components/script/script_thread.rs
@@ -94,27 +94,27 @@ use std::collections::{HashMap, HashSet}
 use std::option::Option;
 use std::ptr;
 use std::rc::Rc;
 use std::result::Result;
 use std::sync::atomic::{Ordering, AtomicBool};
 use std::sync::mpsc::{Receiver, Select, Sender, channel};
 use std::sync::{Arc, Mutex};
 use style::context::ReflowGoal;
+use style::thread_state;
 use task_source::TaskSource;
 use task_source::dom_manipulation::{DOMManipulationTaskSource, DOMManipulationTask};
 use task_source::file_reading::FileReadingTaskSource;
 use task_source::history_traversal::HistoryTraversalTaskSource;
 use task_source::networking::NetworkingTaskSource;
 use task_source::user_interaction::{UserInteractionTaskSource, UserInteractionTask};
 use time::Tm;
 use url::{Url, Position};
 use util::opts;
 use util::thread;
-use util::thread_state;
 use webdriver_handlers;
 
 thread_local!(pub static STACK_ROOTS: Cell<Option<RootCollectionPtr>> = Cell::new(None));
 thread_local!(static SCRIPT_THREAD_ROOT: Cell<Option<*const ScriptThread>> = Cell::new(None));
 
 pub unsafe fn trace_thread(tr: *mut JSTracer) {
     SCRIPT_THREAD_ROOT.with(|root| {
         if let Some(script_thread) = root.get() {
--- a/servo/components/style/lib.rs
+++ b/servo/components/style/lib.rs
@@ -96,16 +96,17 @@ pub mod refcell;
 pub mod restyle_hints;
 pub mod selector_impl;
 pub mod selector_matching;
 pub mod sequential;
 #[cfg(feature = "servo")] pub mod servo_selector_impl;
 pub mod sink;
 pub mod str;
 pub mod stylesheets;
+pub mod thread_state;
 mod tid;
 pub mod timer;
 pub mod traversal;
 #[macro_use]
 #[allow(non_camel_case_types)]
 pub mod values;
 pub mod viewport;
 pub mod workqueue;
rename from servo/components/util/thread_state.rs
rename to servo/components/style/thread_state.rs
--- a/servo/components/style/workqueue.rs
+++ b/servo/components/style/workqueue.rs
@@ -13,18 +13,18 @@
 extern crate kernel32;
 #[cfg(not(windows))]
 extern crate libc;
 
 use deque::{self, Abort, Data, Empty, Stealer, Worker};
 use rand::{Rng, XorShiftRng, weak_rng};
 use std::sync::atomic::{AtomicUsize, Ordering};
 use std::sync::mpsc::{Receiver, Sender, channel};
+use thread_state;
 use util::thread::spawn_named;
-use util::thread_state;
 
 /// A unit of work.
 ///
 /// # Type parameters
 ///
 /// - `QueueData`: global custom data for the entire work queue.
 /// - `WorkData`: custom data specific to each unit of work.
 pub struct WorkUnit<QueueData, WorkData: Send> {
--- a/servo/components/util/lib.rs
+++ b/servo/components/util/lib.rs
@@ -30,13 +30,12 @@ extern crate xdg;
 pub mod basedir;
 pub mod geometry;
 #[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod ipc;
 #[allow(unsafe_code)] pub mod opts;
 pub mod prefs;
 #[cfg(feature = "servo")] pub mod remutex;
 pub mod resource_files;
 pub mod thread;
-pub mod thread_state;
 
 pub fn servo_version() -> &'static str {
     concat!("Servo ", env!("CARGO_PKG_VERSION"), env!("GIT_INFO"))
 }
--- a/servo/ports/geckolib/data.rs
+++ b/servo/ports/geckolib/data.rs
@@ -12,19 +12,19 @@ use std::sync::mpsc::{channel, Receiver,
 use std::sync::{Arc, RwLock};
 use style::animation::Animation;
 use style::context::SharedStyleContext;
 use style::dom::OpaqueNode;
 use style::media_queries::{Device, MediaType};
 use style::parallel::WorkQueueData;
 use style::selector_matching::Stylist;
 use style::stylesheets::Stylesheet;
+use style::thread_state;
 use style::workqueue::WorkQueue;
 use style_traits::ViewportPx;
-use util::thread_state;
 
 pub struct PerDocumentStyleData {
     /// Rule processor.
     pub stylist: Arc<Stylist>,
 
     /// List of stylesheets, mirrored from Gecko.
     pub stylesheets: Vec<Arc<Stylesheet>>,