OLD | NEW |
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 Loading... |
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" | |
40 #include "core/events/MessageEvent.h" | 39 #include "core/events/MessageEvent.h" |
41 #include "core/inspector/ConsoleMessage.h" | 40 #include "core/inspector/ConsoleMessage.h" |
42 #include "core/workers/InProcessWorkerMessagingProxy.h" | 41 #include "core/workers/InProcessWorkerMessagingProxy.h" |
43 #include "core/workers/ParentFrameTaskRunners.h" | 42 #include "core/workers/ParentFrameTaskRunners.h" |
44 #include "core/workers/WorkerGlobalScope.h" | 43 #include "core/workers/WorkerGlobalScope.h" |
45 #include "core/workers/WorkerThread.h" | 44 #include "core/workers/WorkerThread.h" |
46 #include "platform/CrossThreadFunctional.h" | 45 #include "platform/CrossThreadFunctional.h" |
47 #include "platform/WebTaskRunner.h" | 46 #include "platform/WebTaskRunner.h" |
48 #include "platform/wtf/Functional.h" | 47 #include "platform/wtf/Functional.h" |
49 #include "platform/wtf/PtrUtil.h" | 48 #include "platform/wtf/PtrUtil.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 BLINK_FROM_HERE, | 114 BLINK_FROM_HERE, |
116 CrossThreadBind(&InProcessWorkerMessagingProxy::DispatchErrorEvent, | 115 CrossThreadBind(&InProcessWorkerMessagingProxy::DispatchErrorEvent, |
117 messaging_proxy_weak_ptr_, error_message, | 116 messaging_proxy_weak_ptr_, error_message, |
118 WTF::Passed(location->Clone()), exception_id)); | 117 WTF::Passed(location->Clone()), exception_id)); |
119 } | 118 } |
120 | 119 |
121 void InProcessWorkerObjectProxy::DidCreateWorkerGlobalScope( | 120 void InProcessWorkerObjectProxy::DidCreateWorkerGlobalScope( |
122 WorkerOrWorkletGlobalScope* global_scope) { | 121 WorkerOrWorkletGlobalScope* global_scope) { |
123 DCHECK(!worker_global_scope_); | 122 DCHECK(!worker_global_scope_); |
124 worker_global_scope_ = ToWorkerGlobalScope(global_scope); | 123 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) | |
129 timer_ = WTF::MakeUnique<TaskRunnerTimer<InProcessWorkerObjectProxy>>( | 124 timer_ = WTF::MakeUnique<TaskRunnerTimer<InProcessWorkerObjectProxy>>( |
130 TaskRunnerHelper::Get(TaskType::kUnthrottled, global_scope), this, | 125 Platform::Current()->CurrentThread()->GetWebTaskRunner(), this, |
131 &InProcessWorkerObjectProxy::CheckPendingActivity); | 126 &InProcessWorkerObjectProxy::CheckPendingActivity); |
132 } | 127 } |
133 | 128 |
134 void InProcessWorkerObjectProxy::DidEvaluateWorkerScript(bool) { | 129 void InProcessWorkerObjectProxy::DidEvaluateWorkerScript(bool) { |
135 StartPendingActivityTimer(); | 130 StartPendingActivityTimer(); |
136 } | 131 } |
137 | 132 |
138 void InProcessWorkerObjectProxy::WillDestroyWorkerGlobalScope() { | 133 void InProcessWorkerObjectProxy::WillDestroyWorkerGlobalScope() { |
139 timer_.reset(); | 134 timer_.reset(); |
140 worker_global_scope_ = nullptr; | 135 worker_global_scope_ = nullptr; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // There is still a pending activity. Check it later. | 178 // There is still a pending activity. Check it later. |
184 StartPendingActivityTimer(); | 179 StartPendingActivityTimer(); |
185 } | 180 } |
186 | 181 |
187 WeakPtr<ThreadedMessagingProxyBase> | 182 WeakPtr<ThreadedMessagingProxyBase> |
188 InProcessWorkerObjectProxy::MessagingProxyWeakPtr() { | 183 InProcessWorkerObjectProxy::MessagingProxyWeakPtr() { |
189 return messaging_proxy_weak_ptr_; | 184 return messaging_proxy_weak_ptr_; |
190 } | 185 } |
191 | 186 |
192 } // namespace blink | 187 } // namespace blink |
OLD | NEW |