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/ExecutionContext.h" | |
10 #include "core/dom/ExecutionContextTask.h" | |
11 #include "core/dom/SecurityContext.h" | |
12 #include "core/inspector/ConsoleMessage.h" | |
13 #include "core/inspector/ScriptCallStack.h" | |
14 #include "platform/heap/Handle.h" | |
15 | |
16 namespace blink { | |
17 | |
18 class EventQueue; | |
19 class GlobalScopeScriptController; | |
20 class WorkletScriptController; | |
21 | |
22 class WorkletGlobalScope : public RefCountedWillBeNoBase<WorkletGlobalScope>, pu blic SecurityContext, public ExecutionContext, 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/24 04:45:51
Can we add a comment to note all parameters are of
ikilpatrick
2015/12/27 20:22:39
Done.
| |
32 ~WorkletGlobalScope() override; | |
33 | |
34 bool isWorkletGlobalScope() const final { return true; } | |
35 | |
36 GlobalScopeScriptController* script(); | |
37 v8::Isolate* isolate() const { return m_isolate; } | |
38 | |
39 // ScriptWrappable | |
40 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte xt) final; | |
41 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn fo*, v8::Local<v8::Object> wrapper) final; | |
42 | |
43 // ExecutionContext | |
44 void disableEval(const String& errorMessage) final; | |
45 String userAgent() const final { return m_userAgent; } | |
46 SecurityContext& securityContext() final { return *this; } | |
47 EventQueue* eventQueue() const final { ASSERT_NOT_REACHED(); return nullptr; } // WorkletGlobalScopes don't have an event queue. | |
48 bool isSecureContext(String& errorMessage, const SecureContextCheck = Standa rdSecureContextCheck) const final; | |
49 | |
50 using SecurityContext::securityOrigin; | |
51 using SecurityContext::contentSecurityPolicy; | |
52 | |
53 DOMTimerCoordinator* timers() final { ASSERT_NOT_REACHED(); return nullptr; } // WorkletGlobalScopes don't have timers. | |
54 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) ove rride { } | |
55 | |
56 // TODO(ikilpatrick): implement when we implement devtools support. | |
57 void reportBlockedScriptExecutionToInspector(const String& directiveText) fi nal { } | |
58 void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) final { } | |
59 void logExceptionToConsole(const String& errorMessage, int scriptId, const S tring& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<Scrip tCallStack>) final { } | |
60 | |
61 DECLARE_VIRTUAL_TRACE(); | |
62 | |
63 private: | |
64 #if !ENABLE(OILPAN) | |
65 void refExecutionContext() final { ref(); } | |
66 void derefExecutionContext() final { deref(); } | |
67 #endif | |
68 | |
69 WorkletGlobalScope(const KURL&, const String& userAgent, v8::Isolate*); | |
70 | |
71 const KURL& virtualURL() const final { return m_url; } | |
72 KURL virtualCompleteURL(const String&) const final; | |
73 | |
74 EventTarget* errorEventTarget() final { return nullptr; } | |
75 void didUpdateSecurityOrigin() final { } | |
76 | |
77 KURL m_url; | |
78 String m_userAgent; | |
79 v8::Isolate* m_isolate; | |
80 OwnPtrWillBeMember<WorkletScriptController> m_script; | |
81 }; | |
82 | |
83 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork letGlobalScope(), context.isWorkletGlobalScope()); | |
84 | |
85 } // namespace blink | |
86 | |
87 #endif // WorkletGlobalScope_h | |
OLD | NEW |