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

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

Issue 2845533002: Worklet: Move Worklet::Initialize() into ThreadedWorklet for cleanup (Closed)
Patch Set: fix test failures Created 3 years, 7 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 // 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698