diff options
author | snf <snf@users.noreply.github.com> | 2015-03-25 19:28:02 +0000 |
---|---|---|
committer | snf <snf@users.noreply.github.com> | 2015-03-25 19:31:36 +0000 |
commit | e1f34b827d0d2122750818e380438218e727ad3e (patch) | |
tree | ef8577c78f7f3badf773768152f883ac788a5c3f /components/script/script_task.rs | |
parent | da2231a8fa4bebc226a11def6784dbf4b08c00bc (diff) | |
download | servo-e1f34b827d0d2122750818e380438218e727ad3e.tar.gz servo-e1f34b827d0d2122750818e380438218e727ad3e.zip |
implementing MainThreadRunnable in ScriptTask
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r-- | components/script/script_task.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 35e57eacfa3..8aa3ccd0259 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -155,6 +155,10 @@ pub trait Runnable { fn handler(self: Box<Self>); } +pub trait MainThreadRunnable { + fn handler(self: Box<Self>, script_task: &ScriptTask); +} + /// Messages used to control script event loops, such as ScriptTask and /// DedicatedWorkerGlobalScope. pub enum ScriptMsg { @@ -176,6 +180,8 @@ pub enum ScriptMsg { DOMMessage(StructuredCloneData), /// Generic message that encapsulates event handling. RunnableMsg(Box<Runnable+Send>), + /// Generic message for running tasks in the ScriptTask + MainThreadRunnableMsg(Box<MainThreadRunnable+Send>), /// A DOM object's last pinned reference was removed (dispatched to all tasks). RefcountCleanup(TrustedReference), /// The final network response for a page has arrived. @@ -675,6 +681,8 @@ impl ScriptTask { panic!("unexpected message"), ScriptMsg::RunnableMsg(runnable) => runnable.handler(), + ScriptMsg::MainThreadRunnableMsg(runnable) => + runnable.handler(self), ScriptMsg::RefcountCleanup(addr) => LiveDOMReferences::cleanup(self.get_cx(), addr), ScriptMsg::PageFetchComplete(id, subpage, response) => |