OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/workers/ThreadedWorklet.h" | 5 #include "core/workers/ThreadedWorklet.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptSourceCode.h" | 7 #include "bindings/core/v8/ScriptSourceCode.h" |
8 #include "bindings/core/v8/V8BindingForCore.h" | 8 #include "bindings/core/v8/V8BindingForCore.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 GetWorkletGlobalScopeProxy()->EvaluateScript(source_code); | 61 GetWorkletGlobalScopeProxy()->EvaluateScript(source_code); |
62 resolver->Resolve(); | 62 resolver->Resolve(); |
63 } | 63 } |
64 | 64 |
65 void ThreadedWorklet::ContextDestroyed(ExecutionContext* execution_context) { | 65 void ThreadedWorklet::ContextDestroyed(ExecutionContext* execution_context) { |
66 DCHECK(IsMainThread()); | 66 DCHECK(IsMainThread()); |
67 for (const auto& script_loader : loader_to_resolver_map_.Keys()) | 67 for (const auto& script_loader : loader_to_resolver_map_.Keys()) |
68 script_loader->Cancel(); | 68 script_loader->Cancel(); |
69 loader_to_resolver_map_.clear(); | 69 loader_to_resolver_map_.clear(); |
| 70 if (IsInitialized()) |
| 71 GetWorkletGlobalScopeProxy()->TerminateWorkletGlobalScope(); |
70 Worklet::ContextDestroyed(execution_context); | 72 Worklet::ContextDestroyed(execution_context); |
71 } | 73 } |
72 | 74 |
73 DEFINE_TRACE(ThreadedWorklet) { | 75 DEFINE_TRACE(ThreadedWorklet) { |
74 visitor->Trace(loader_to_resolver_map_); | 76 visitor->Trace(loader_to_resolver_map_); |
75 Worklet::Trace(visitor); | 77 Worklet::Trace(visitor); |
76 } | 78 } |
77 | 79 |
78 } // namespace blink | 80 } // namespace blink |
OLD | NEW |