| 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" |
| 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 Loading... |
| 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, |
| 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 Loading... |
| 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 |
| OLD | NEW |