OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "modules/csspaint/PaintWorkletGlobalScope.h" | 5 #include "modules/csspaint/PaintWorkletGlobalScope.h" |
6 | 6 |
7 #include "bindings/core/v8/IDLTypes.h" | 7 #include "bindings/core/v8/IDLTypes.h" |
8 #include "bindings/core/v8/NativeValueTraitsImpl.h" | 8 #include "bindings/core/v8/NativeValueTraitsImpl.h" |
9 #include "bindings/core/v8/V8BindingMacros.h" | 9 #include "bindings/core/v8/V8BindingMacros.h" |
10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
11 #include "core/CSSPropertyNames.h" | 11 #include "core/CSSPropertyNames.h" |
12 #include "core/css/CSSSyntaxDescriptor.h" | 12 #include "core/css/CSSSyntaxDescriptor.h" |
13 #include "core/dom/ExceptionCode.h" | 13 #include "core/dom/ExceptionCode.h" |
14 #include "core/inspector/MainThreadDebugger.h" | 14 #include "core/inspector/MainThreadDebugger.h" |
15 #include "modules/csspaint/CSSPaintDefinition.h" | 15 #include "modules/csspaint/CSSPaintDefinition.h" |
16 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h" | 16 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h" |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 // static | 20 // static |
21 PaintWorkletGlobalScope* PaintWorkletGlobalScope::Create( | 21 PaintWorkletGlobalScope* PaintWorkletGlobalScope::Create( |
22 LocalFrame* frame, | 22 LocalFrame* frame, |
23 const KURL& url, | 23 const KURL& url, |
24 const String& user_agent, | 24 const String& user_agent, |
25 PassRefPtr<SecurityOrigin> security_origin, | 25 PassRefPtr<SecurityOrigin> security_origin, |
26 v8::Isolate* isolate, | 26 v8::Isolate* isolate) { |
27 WorkletObjectProxy* object_proxy) { | |
28 PaintWorkletGlobalScope* paint_worklet_global_scope = | 27 PaintWorkletGlobalScope* paint_worklet_global_scope = |
29 new PaintWorkletGlobalScope(frame, url, user_agent, | 28 new PaintWorkletGlobalScope(frame, url, user_agent, |
30 std::move(security_origin), isolate, | 29 std::move(security_origin), isolate); |
31 object_proxy); | |
32 paint_worklet_global_scope->ScriptController()->InitializeContextIfNeeded(); | 30 paint_worklet_global_scope->ScriptController()->InitializeContextIfNeeded(); |
33 MainThreadDebugger::Instance()->ContextCreated( | 31 MainThreadDebugger::Instance()->ContextCreated( |
34 paint_worklet_global_scope->ScriptController()->GetScriptState(), | 32 paint_worklet_global_scope->ScriptController()->GetScriptState(), |
35 paint_worklet_global_scope->GetFrame(), | 33 paint_worklet_global_scope->GetFrame(), |
36 paint_worklet_global_scope->GetSecurityOrigin()); | 34 paint_worklet_global_scope->GetSecurityOrigin()); |
37 return paint_worklet_global_scope; | 35 return paint_worklet_global_scope; |
38 } | 36 } |
39 | 37 |
40 PaintWorkletGlobalScope::PaintWorkletGlobalScope( | 38 PaintWorkletGlobalScope::PaintWorkletGlobalScope( |
41 LocalFrame* frame, | 39 LocalFrame* frame, |
42 const KURL& url, | 40 const KURL& url, |
43 const String& user_agent, | 41 const String& user_agent, |
44 PassRefPtr<SecurityOrigin> security_origin, | 42 PassRefPtr<SecurityOrigin> security_origin, |
45 v8::Isolate* isolate, | 43 v8::Isolate* isolate) |
46 WorkletObjectProxy* object_proxy) | |
47 : MainThreadWorkletGlobalScope(frame, | 44 : MainThreadWorkletGlobalScope(frame, |
48 url, | 45 url, |
49 user_agent, | 46 user_agent, |
50 std::move(security_origin), | 47 std::move(security_origin), |
51 isolate, | 48 isolate) {} |
52 object_proxy) {} | |
53 | 49 |
54 PaintWorkletGlobalScope::~PaintWorkletGlobalScope() {} | 50 PaintWorkletGlobalScope::~PaintWorkletGlobalScope() {} |
55 | 51 |
56 void PaintWorkletGlobalScope::Dispose() { | 52 void PaintWorkletGlobalScope::Dispose() { |
57 MainThreadDebugger::Instance()->ContextWillBeDestroyed( | 53 MainThreadDebugger::Instance()->ContextWillBeDestroyed( |
58 ScriptController()->GetScriptState()); | 54 ScriptController()->GetScriptState()); |
59 // Explicitly clear the paint defininitions to break a reference cycle | 55 // Explicitly clear the paint defininitions to break a reference cycle |
60 // between them and this global scope. | 56 // between them and this global scope. |
61 paint_definitions_.clear(); | 57 paint_definitions_.clear(); |
62 | 58 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 set->insert(generator); | 221 set->insert(generator); |
226 } | 222 } |
227 | 223 |
228 DEFINE_TRACE(PaintWorkletGlobalScope) { | 224 DEFINE_TRACE(PaintWorkletGlobalScope) { |
229 visitor->Trace(paint_definitions_); | 225 visitor->Trace(paint_definitions_); |
230 visitor->Trace(pending_generators_); | 226 visitor->Trace(pending_generators_); |
231 MainThreadWorkletGlobalScope::Trace(visitor); | 227 MainThreadWorkletGlobalScope::Trace(visitor); |
232 } | 228 } |
233 | 229 |
234 } // namespace blink | 230 } // namespace blink |
OLD | NEW |