Skip to content

Commit

Permalink
refactors entities from script_thread into script_runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
creativcoder committed Apr 2, 2016
1 parent 71428b5 commit 793e22a
Show file tree
Hide file tree
Showing 28 changed files with 298 additions and 252 deletions.
2 changes: 1 addition & 1 deletion components/script/cors.rs
Expand Up @@ -20,7 +20,7 @@ use hyper::mime::{Mime, SubLevel, TopLevel};
use hyper::status::StatusClass::Success;
use net_traits::{AsyncResponseListener, Metadata, ResponseAction};
use network_listener::{NetworkListener, PreInvoke};
use script_thread::ScriptChan;
use script_runtime::ScriptChan;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::sync::{Arc, Mutex};
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/bindings/global.rs
Expand Up @@ -21,7 +21,8 @@ use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
use msg::constellation_msg::{ConstellationChan, PipelineId};
use net_traits::ResourceThread;
use profile_traits::mem;
use script_thread::{CommonScriptMsg, MainThreadScriptChan, ScriptChan, ScriptPort, ScriptThread};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
use script_thread::{MainThreadScriptChan, ScriptThread};
use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TimerEventRequest};
use task_source::TaskSource;
use task_source::dom_manipulation::DOMManipulationTask;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/bindings/refcounted.rs
Expand Up @@ -28,7 +28,7 @@ use dom::bindings::reflector::{Reflectable, Reflector};
use dom::bindings::trace::trace_reflector;
use js::jsapi::JSTracer;
use libc;
use script_thread::{CommonScriptMsg, ScriptChan};
use script_runtime::{CommonScriptMsg, ScriptChan};
use std::cell::RefCell;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::hash_map::HashMap;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/bindings/trace.rs
Expand Up @@ -63,7 +63,7 @@ use net_traits::response::HttpsState;
use net_traits::storage_thread::StorageType;
use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::time::ProfilerChan as TimeProfilerChan;
use script_thread::ScriptChan;
use script_runtime::ScriptChan;
use script_traits::{LayoutMsg, ScriptMsg, TimerEventId, TimerSource, UntrustedNodeAddress};
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/closeevent.rs
Expand Up @@ -11,7 +11,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object;
use dom::event::{Event, EventBubbles, EventCancelable};
use script_thread::ScriptChan;
use script_runtime::ScriptChan;
use string_cache::Atom;
use util::str::DOMString;

Expand Down
8 changes: 4 additions & 4 deletions components/script/dom/dedicatedworkerglobalscope.rs
Expand Up @@ -28,8 +28,8 @@ use js::rust::Runtime;
use msg::constellation_msg::PipelineId;
use net_traits::{LoadContext, load_whole_resource};
use rand::random;
use script_thread::ScriptThreadEventCategory::WorkerEvent;
use script_thread::{ScriptThread, ScriptChan, ScriptPort, StackRootTLS, CommonScriptMsg};
use script_runtime::ScriptThreadEventCategory::WorkerEvent;
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, StackRootTLS, get_reports, new_rt_and_cx};
use script_traits::{TimerEvent, TimerSource};
use std::mem::replace;
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
Expand Down Expand Up @@ -236,7 +236,7 @@ impl DedicatedWorkerGlobalScope {
}
};

let runtime = ScriptThread::new_rt_and_cx();
let runtime = new_rt_and_cx();

let (devtools_mpsc_chan, devtools_mpsc_port) = channel();
ROUTER.route_ipc_receiver_to_mpsc_sender(from_devtools_receiver, devtools_mpsc_chan);
Expand Down Expand Up @@ -347,7 +347,7 @@ impl DedicatedWorkerGlobalScope {
let scope = self.upcast::<WorkerGlobalScope>();
let cx = scope.get_cx();
let path_seg = format!("url({})", scope.get_url());
let reports = ScriptThread::get_reports(cx, path_seg);
let reports = get_reports(cx, path_seg);
reports_chan.send(reports);
},
}
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/document.rs
Expand Up @@ -93,7 +93,8 @@ use net_traits::CookieSource::NonHTTP;
use net_traits::response::HttpsState;
use net_traits::{AsyncResponseTarget, PendingAsyncLoad};
use num::ToPrimitive;
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable, ScriptChan};
use script_runtime::ScriptChan;
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable};
use script_traits::{AnimationState, MouseButton, MouseEventType, MozBrowserEvent};
use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg};
use script_traits::{TouchEventType, TouchId};
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/filereader.rs
Expand Up @@ -22,8 +22,9 @@ use encoding::label::encoding_from_whatwg_label;
use encoding::types::{DecoderTrap, EncodingRef};
use hyper::mime::{Attr, Mime};
use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64};
use script_thread::ScriptThreadEventCategory::FileRead;
use script_thread::{CommonScriptMsg, Runnable, ScriptChan};
use script_runtime::ScriptThreadEventCategory::FileRead;
use script_runtime::{ScriptChan, CommonScriptMsg};
use script_thread::Runnable;
use std::cell::Cell;
use string_cache::Atom;
use util::str::DOMString;
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/htmldetailselement.rs
Expand Up @@ -14,7 +14,8 @@ use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use script_thread::{MainThreadScriptChan, Runnable, ScriptChan};
use script_runtime::ScriptChan;
use script_thread::{MainThreadScriptChan, Runnable};
use std::cell::Cell;
use string_cache::Atom;
use task_source::dom_manipulation::DOMManipulationTask;
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/htmlformelement.rs
Expand Up @@ -37,7 +37,8 @@ use hyper::header::ContentType;
use hyper::method::Method;
use hyper::mime;
use msg::constellation_msg::{LoadData, PipelineId};
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable, ScriptChan};
use script_runtime::ScriptChan;
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable};
use std::borrow::ToOwned;
use std::cell::Cell;
use std::sync::mpsc::Sender;
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlimageelement.rs
Expand Up @@ -25,8 +25,9 @@ use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use net_traits::image::base::{Image, ImageMetadata};
use net_traits::image_cache_thread::{ImageResponder, ImageResponse};
use script_thread::ScriptThreadEventCategory::UpdateReplacedElement;
use script_thread::{CommonScriptMsg, Runnable, ScriptChan};
use script_runtime::ScriptThreadEventCategory::UpdateReplacedElement;
use script_runtime::{CommonScriptMsg, ScriptChan};
use script_thread::Runnable;
use std::sync::Arc;
use string_cache::Atom;
use url::Url;
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlinputelement.rs
Expand Up @@ -32,8 +32,9 @@ use dom::validation::Validatable;
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan;
use range::Range;
use script_thread::ScriptThreadEventCategory::InputEvent;
use script_thread::{CommonScriptMsg, Runnable};
use script_runtime::CommonScriptMsg;
use script_runtime::ScriptThreadEventCategory::InputEvent;
use script_thread::Runnable;
use script_traits::ScriptMsg as ConstellationMsg;
use std::borrow::ToOwned;
use std::cell::Cell;
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/htmlscriptelement.rs
Expand Up @@ -34,7 +34,8 @@ use js::jsapi::RootedValue;
use js::jsval::UndefinedValue;
use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata};
use network_listener::{NetworkListener, PreInvoke};
use script_thread::{MainThreadScriptChan, ScriptChan};
use script_runtime::ScriptChan;
use script_thread::MainThreadScriptChan;
use std::ascii::AsciiExt;
use std::cell::Cell;
use std::mem;
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/servohtmlparser.rs
Expand Up @@ -29,7 +29,8 @@ use msg::constellation_msg::{PipelineId, SubpageId};
use net_traits::{AsyncResponseListener, Metadata};
use network_listener::PreInvoke;
use parse::Parser;
use script_thread::{ScriptChan, ScriptThread};
use script_runtime::ScriptChan;
use script_thread::ScriptThread;
use std::cell::Cell;
use std::cell::UnsafeCell;
use std::default::Default;
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/storage.rs
Expand Up @@ -16,7 +16,8 @@ use dom::urlhelper::UrlHelper;
use ipc_channel::ipc;
use net_traits::storage_thread::{StorageThread, StorageThreadMsg, StorageType};
use page::IterablePage;
use script_thread::{MainThreadRunnable, MainThreadScriptChan, ScriptChan, ScriptThread};
use script_runtime::ScriptChan;
use script_thread::{MainThreadRunnable, MainThreadScriptChan, ScriptThread};
use task_source::dom_manipulation::DOMManipulationTask;
use url::Url;
use util::str::DOMString;
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/websocket.rs
Expand Up @@ -35,8 +35,9 @@ use net_traits::MessageData;
use net_traits::hosts::replace_hosts;
use net_traits::unwrap_websocket_protocol;
use net_traits::{WebSocketCommunicate, WebSocketConnectData, WebSocketDomAction, WebSocketNetworkEvent};
use script_thread::ScriptThreadEventCategory::WebSocketEvent;
use script_thread::{CommonScriptMsg, Runnable, ScriptChan};
use script_runtime::ScriptThreadEventCategory::WebSocketEvent;
use script_runtime::{CommonScriptMsg, ScriptChan};
use script_thread::Runnable;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::Cell;
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/window.rs
Expand Up @@ -53,8 +53,9 @@ use page::Page;
use profile_traits::mem;
use reporter::CSSErrorReporter;
use rustc_serialize::base64::{FromBase64, STANDARD, ToBase64};
use script_runtime::{ScriptChan, ScriptPort};
use script_thread::SendableMainThreadScriptChan;
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, RunnableWrapper};
use script_thread::{SendableMainThreadScriptChan, ScriptChan, ScriptPort};
use script_traits::{ConstellationControlMsg, UntrustedNodeAddress};
use script_traits::{DocumentState, MsDuration, ScriptToCompositorMsg, TimerEvent, TimerEventId};
use script_traits::{MozBrowserEvent, ScriptMsg as ConstellationMsg, TimerEventRequest, TimerSource};
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/worker.rs
Expand Up @@ -24,7 +24,8 @@ use ipc_channel::ipc;
use js::jsapi::{HandleValue, JSContext, RootedValue};
use js::jsapi::{JSAutoCompartment, JSAutoRequest};
use js::jsval::UndefinedValue;
use script_thread::{Runnable, ScriptChan};
use script_runtime::ScriptChan;
use script_thread::Runnable;
use std::sync::mpsc::{Sender, channel};
use util::str::DOMString;

Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/workerglobalscope.rs
Expand Up @@ -23,7 +23,7 @@ use js::rust::Runtime;
use msg::constellation_msg::{ConstellationChan, PipelineId};
use net_traits::{LoadContext, ResourceThread, load_whole_resource};
use profile_traits::mem;
use script_thread::{CommonScriptMsg, ScriptChan, ScriptPort};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
use script_traits::ScriptMsg as ConstellationMsg;
use script_traits::{MsDuration, TimerEvent, TimerEventId, TimerEventRequest, TimerSource};
use std::cell::Cell;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/xmlhttprequest.rs
Expand Up @@ -50,7 +50,7 @@ use net_traits::{LoadConsumer, LoadContext, LoadData, ResourceCORSData, Resource
use network_listener::{NetworkListener, PreInvoke};
use parse::html::{ParseContext, parse_html};
use parse::xml::{self, parse_xml};
use script_thread::{ScriptChan, ScriptPort};
use script_runtime::{ScriptChan, ScriptPort};
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::{Cell, RefCell};
Expand Down
1 change: 1 addition & 0 deletions components/script/lib.rs
Expand Up @@ -92,6 +92,7 @@ mod network_listener;
pub mod page;
pub mod parse;
pub mod reporter;
pub mod script_runtime;
#[allow(unsafe_code)]
pub mod script_thread;
mod task_source;
Expand Down
5 changes: 3 additions & 2 deletions components/script/network_listener.rs
Expand Up @@ -3,8 +3,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use net_traits::{AsyncResponseListener, ResponseAction};
use script_thread::ScriptThreadEventCategory::NetworkEvent;
use script_thread::{CommonScriptMsg, Runnable, ScriptChan};
use script_runtime::ScriptThreadEventCategory::NetworkEvent;
use script_runtime::{CommonScriptMsg, ScriptChan};
use script_thread::Runnable;
use std::sync::{Arc, Mutex};

/// An off-thread sink for async network event runnables. All such events are forwarded to
Expand Down

0 comments on commit 793e22a

Please sign in to comment.