diff options
Diffstat (limited to 'components/script/dom/serviceworkerglobalscope.rs')
-rw-r--r-- | components/script/dom/serviceworkerglobalscope.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs index 97573df279a..50080f9925b 100644 --- a/components/script/dom/serviceworkerglobalscope.rs +++ b/components/script/dom/serviceworkerglobalscope.rs @@ -27,7 +27,7 @@ use js::jsapi::{JSAutoCompartment, JSContext, JS_AddInterruptCallback}; use js::jsval::UndefinedValue; use net_traits::{load_whole_resource, IpcSend, CustomResponseMediator}; use net_traits::request::{CredentialsMode, Destination, RequestInit}; -use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory, new_rt_and_cx, Runtime}; +use script_runtime::{CommonScriptMsg, ScriptChan, new_rt_and_cx, Runtime}; use script_traits::{TimerEvent, WorkerGlobalScopeInit, ScopeThings, ServiceWorkerMsg, WorkerScriptLoadOrigin}; use servo_config::prefs::PREFS; use servo_rand::random; @@ -37,6 +37,7 @@ use std::thread; use std::time::Duration; use style::thread_state::{self, ThreadState}; use task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; +use task_source::TaskSourceName; /// Messages used to control service worker event loop pub enum ServiceWorkerScriptMsg { @@ -49,16 +50,15 @@ pub enum ServiceWorkerScriptMsg { } impl QueuedTaskConversion for ServiceWorkerScriptMsg { - fn task_category(&self) -> Option<&ScriptThreadEventCategory> { + fn task_source_name(&self) -> Option<&TaskSourceName> { let script_msg = match self { ServiceWorkerScriptMsg::CommonWorker(WorkerScriptMsg::Common(script_msg)) => script_msg, _ => return None, }; - let category = match script_msg { - CommonScriptMsg::Task(category, _boxed, _pipeline_id) => category, + match script_msg { + CommonScriptMsg::Task(_category, _boxed, _pipeline_id, task_source) => Some(&task_source), _ => return None, - }; - Some(&category) + } } fn into_queued_task(self) -> Option<QueuedTask> { @@ -66,17 +66,17 @@ impl QueuedTaskConversion for ServiceWorkerScriptMsg { ServiceWorkerScriptMsg::CommonWorker(WorkerScriptMsg::Common(script_msg)) => script_msg, _ => return None, }; - let (category, boxed, pipeline_id) = match script_msg { - CommonScriptMsg::Task(category, boxed, pipeline_id) => - (category, boxed, pipeline_id), + let (category, boxed, pipeline_id, task_source) = match script_msg { + CommonScriptMsg::Task(category, boxed, pipeline_id, task_source) => + (category, boxed, pipeline_id, task_source), _ => return None, }; - Some((None, category, boxed, pipeline_id)) + Some((None, category, boxed, pipeline_id, task_source)) } fn from_queued_task(queued_task: QueuedTask) -> Self { - let (_worker, category, boxed, pipeline_id) = queued_task; - let script_msg = CommonScriptMsg::Task(category, boxed, pipeline_id); + let (_worker, category, boxed, pipeline_id, task_source) = queued_task; + let script_msg = CommonScriptMsg::Task(category, boxed, pipeline_id, task_source); ServiceWorkerScriptMsg::CommonWorker(WorkerScriptMsg::Common(script_msg)) } |