OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WorkletGlobalScope_h | |
6 #define WorkletGlobalScope_h | |
7 | |
8 #include "bindings/core/v8/ScriptWrappable.h" | |
9 #include "core/dom/ExecutionContextTask.h" | |
10 #include "core/inspector/ConsoleMessage.h" | |
11 #include "core/inspector/ScriptCallStack.h" | |
12 #include "core/workers/AbstractGlobalScope.h" | |
13 #include "platform/heap/Handle.h" | |
14 | |
15 namespace blink { | |
16 | |
17 class ExecutionContext; | |
18 class EventQueue; | |
19 class GlobalScopeScriptController; | |
20 class WorkletScriptController; | |
21 | |
22 class WorkletGlobalScope : public RefCountedWillBeNoBase<WorkletGlobalScope>, pu blic AbstractGlobalScope, public ScriptWrappable { | |
23 DEFINE_WRAPPERTYPEINFO(); | |
24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); | |
25 public: | |
26 #if !ENABLE(OILPAN) | |
27 using RefCounted<WorkletGlobalScope>::ref; | |
28 using RefCounted<WorkletGlobalScope>::deref; | |
29 #endif | |
30 | |
31 static PassRefPtrWillBeRawPtr<WorkletGlobalScope> create(const KURL&, const String& userAgent, v8::Isolate*); | |
kinuko
2015/12/22 08:39:03
Are we giving the parent context's url, userAgent
ikilpatrick
2015/12/22 23:40:23
Yes the parents url & userAgent, and the appropria
| |
32 ~WorkletGlobalScope() override; | |
33 | |
34 bool isWorkletGlobalScope() const final { return true; } | |
35 | |
36 // AbstractGlobalScope | |
37 ExecutionContext* executionContext() const final { return const_cast<Worklet GlobalScope*>(this); } | |
38 GlobalScopeScriptController* script() final; | |
39 v8::Isolate* isolate() const final { return m_isolate; } | |
40 void didStopRunLoop() final { } | |
41 | |
42 // ScriptWrappable | |
43 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte xt) final; | |
44 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn fo*, v8::Local<v8::Object> wrapper) final; | |
45 | |
46 // ExecutionContext | |
47 SecurityContext& securityContext() final { return *this; } | |
48 EventQueue* eventQueue() const final { ASSERT_NOT_REACHED(); return nullptr; } // WorkletGlobalScopes don't have an event queue. | |
49 | |
50 DOMTimerCoordinator* timers() final { ASSERT_NOT_REACHED(); return nullptr; } // WorkletGlobalScopes don't have timers. | |
51 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) ove rride { } | |
52 | |
53 // TODO(ikilpatrick): implement when we implement devtools support. | |
54 void reportBlockedScriptExecutionToInspector(const String& directiveText) fi nal { } | |
55 void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) final { } | |
56 void logExceptionToConsole(const String& errorMessage, int scriptId, const S tring& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<Scrip tCallStack>) final { } | |
57 | |
58 DECLARE_VIRTUAL_TRACE(); | |
59 | |
60 private: | |
61 #if !ENABLE(OILPAN) | |
62 void refExecutionContext() final { ref(); } | |
63 void derefExecutionContext() final { deref(); } | |
64 #endif | |
65 | |
66 WorkletGlobalScope(const KURL&, const String& userAgent, v8::Isolate*); | |
67 | |
68 EventTarget* errorEventTarget() final { return nullptr; } | |
69 | |
70 v8::Isolate* m_isolate; | |
71 OwnPtrWillBeMember<WorkletScriptController> m_script; | |
72 }; | |
73 | |
74 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork letGlobalScope(), context.isWorkletGlobalScope()); | |
75 | |
76 } // namespace blink | |
77 | |
78 #endif // WorkletGlobalScope_h | |
OLD | NEW |