Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp

Issue 2806623004: Worker: Introduce per-global-scope task scheduler (Closed)
Patch Set: remove unused header Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "core/workers/InProcessWorkerObjectProxy.h" 31 #include "core/workers/InProcessWorkerObjectProxy.h"
32 32
33 #include <memory> 33 #include <memory>
34 #include "bindings/core/v8/SerializedScriptValue.h" 34 #include "bindings/core/v8/SerializedScriptValue.h"
35 #include "bindings/core/v8/SourceLocation.h" 35 #include "bindings/core/v8/SourceLocation.h"
36 #include "bindings/core/v8/V8GCController.h" 36 #include "bindings/core/v8/V8GCController.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/ExecutionContext.h" 38 #include "core/dom/ExecutionContext.h"
39 #include "core/dom/TaskRunnerHelper.h"
39 #include "core/events/MessageEvent.h" 40 #include "core/events/MessageEvent.h"
40 #include "core/inspector/ConsoleMessage.h" 41 #include "core/inspector/ConsoleMessage.h"
41 #include "core/workers/InProcessWorkerMessagingProxy.h" 42 #include "core/workers/InProcessWorkerMessagingProxy.h"
42 #include "core/workers/ParentFrameTaskRunners.h" 43 #include "core/workers/ParentFrameTaskRunners.h"
43 #include "core/workers/WorkerGlobalScope.h" 44 #include "core/workers/WorkerGlobalScope.h"
44 #include "core/workers/WorkerThread.h" 45 #include "core/workers/WorkerThread.h"
45 #include "platform/CrossThreadFunctional.h" 46 #include "platform/CrossThreadFunctional.h"
46 #include "platform/WebTaskRunner.h" 47 #include "platform/WebTaskRunner.h"
47 #include "platform/wtf/Functional.h" 48 #include "platform/wtf/Functional.h"
48 #include "platform/wtf/PtrUtil.h" 49 #include "platform/wtf/PtrUtil.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 CrossThreadBind(&InProcessWorkerMessagingProxy::DispatchErrorEvent, 116 CrossThreadBind(&InProcessWorkerMessagingProxy::DispatchErrorEvent,
116 messaging_proxy_weak_ptr_, error_message, 117 messaging_proxy_weak_ptr_, error_message,
117 WTF::Passed(location->Clone()), exception_id)); 118 WTF::Passed(location->Clone()), exception_id));
118 } 119 }
119 120
120 void InProcessWorkerObjectProxy::DidCreateWorkerGlobalScope( 121 void InProcessWorkerObjectProxy::DidCreateWorkerGlobalScope(
121 WorkerOrWorkletGlobalScope* global_scope) { 122 WorkerOrWorkletGlobalScope* global_scope) {
122 DCHECK(!worker_global_scope_); 123 DCHECK(!worker_global_scope_);
123 worker_global_scope_ = ToWorkerGlobalScope(global_scope); 124 worker_global_scope_ = ToWorkerGlobalScope(global_scope);
124 timer_ = WTF::MakeUnique<TaskRunnerTimer<InProcessWorkerObjectProxy>>( 125 timer_ = WTF::MakeUnique<TaskRunnerTimer<InProcessWorkerObjectProxy>>(
125 Platform::Current()->CurrentThread()->GetWebTaskRunner(), this, 126 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, global_scope), this,
haraken 2017/04/17 14:49:52 Sorry for my previous comment but I begin to think
altimin 2017/04/18 00:46:40 Should we make a special GC task type? It seems th
nhiroki 2017/04/18 05:34:38 Yeah, that makes sense. Replaced.
haraken 2017/04/18 07:29:38 I'm slightly negative about increasing # of unspec
nhiroki 2017/04/19 06:35:59 Thank you for the comment. For the record I copied
126 &InProcessWorkerObjectProxy::CheckPendingActivity); 127 &InProcessWorkerObjectProxy::CheckPendingActivity);
127 } 128 }
128 129
129 void InProcessWorkerObjectProxy::DidEvaluateWorkerScript(bool) { 130 void InProcessWorkerObjectProxy::DidEvaluateWorkerScript(bool) {
130 StartPendingActivityTimer(); 131 StartPendingActivityTimer();
131 } 132 }
132 133
133 void InProcessWorkerObjectProxy::WillDestroyWorkerGlobalScope() { 134 void InProcessWorkerObjectProxy::WillDestroyWorkerGlobalScope() {
134 timer_.reset(); 135 timer_.reset();
135 worker_global_scope_ = nullptr; 136 worker_global_scope_ = nullptr;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // There is still a pending activity. Check it later. 179 // There is still a pending activity. Check it later.
179 StartPendingActivityTimer(); 180 StartPendingActivityTimer();
180 } 181 }
181 182
182 WeakPtr<ThreadedMessagingProxyBase> 183 WeakPtr<ThreadedMessagingProxyBase>
183 InProcessWorkerObjectProxy::MessagingProxyWeakPtr() { 184 InProcessWorkerObjectProxy::MessagingProxyWeakPtr() {
184 return messaging_proxy_weak_ptr_; 185 return messaging_proxy_weak_ptr_;
185 } 186 }
186 187
187 } // namespace blink 188 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698