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

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 unnecessary comments 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 BLINK_FROM_HERE, 115 BLINK_FROM_HERE,
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);
125 // This timer task should be unthrottled in order to prevent GC timing from
126 // being delayed.
127 // TODO(nhiroki): Consider making a special task type for GC.
128 // (https://crbug.com/712504)
124 timer_ = WTF::MakeUnique<TaskRunnerTimer<InProcessWorkerObjectProxy>>( 129 timer_ = WTF::MakeUnique<TaskRunnerTimer<InProcessWorkerObjectProxy>>(
125 Platform::Current()->CurrentThread()->GetWebTaskRunner(), this, 130 TaskRunnerHelper::Get(TaskType::kUnthrottled, global_scope), this,
126 &InProcessWorkerObjectProxy::CheckPendingActivity); 131 &InProcessWorkerObjectProxy::CheckPendingActivity);
127 } 132 }
128 133
129 void InProcessWorkerObjectProxy::DidEvaluateWorkerScript(bool) { 134 void InProcessWorkerObjectProxy::DidEvaluateWorkerScript(bool) {
130 StartPendingActivityTimer(); 135 StartPendingActivityTimer();
131 } 136 }
132 137
133 void InProcessWorkerObjectProxy::WillDestroyWorkerGlobalScope() { 138 void InProcessWorkerObjectProxy::WillDestroyWorkerGlobalScope() {
134 timer_.reset(); 139 timer_.reset();
135 worker_global_scope_ = nullptr; 140 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. 183 // There is still a pending activity. Check it later.
179 StartPendingActivityTimer(); 184 StartPendingActivityTimer();
180 } 185 }
181 186
182 WeakPtr<ThreadedMessagingProxyBase> 187 WeakPtr<ThreadedMessagingProxyBase>
183 InProcessWorkerObjectProxy::MessagingProxyWeakPtr() { 188 InProcessWorkerObjectProxy::MessagingProxyWeakPtr() {
184 return messaging_proxy_weak_ptr_; 189 return messaging_proxy_weak_ptr_;
185 } 190 }
186 191
187 } // namespace blink 192 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698