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

Side by Side Diff: third_party/WebKit/Source/core/workers/WorkletGlobalScope.h

Issue 2029163002: Worklets - Change inheritance heirarchy of WorkletGlobalScope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase. Created 4 years, 6 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 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 #ifndef WorkletGlobalScope_h 5 #ifndef WorkletGlobalScope_h
6 #define WorkletGlobalScope_h 6 #define WorkletGlobalScope_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/CoreExport.h"
9 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
10 #include "core/dom/ExecutionContextTask.h" 11 #include "core/dom/ExecutionContextTask.h"
11 #include "core/dom/SecurityContext.h" 12 #include "core/dom/SecurityContext.h"
12 #include "core/inspector/ConsoleMessage.h" 13 #include "core/inspector/ConsoleMessage.h"
13 #include "core/workers/MainThreadWorkletGlobalScope.h"
14 #include "core/workers/WorkerOrWorkletGlobalScope.h" 14 #include "core/workers/WorkerOrWorkletGlobalScope.h"
15 #include "modules/ModulesExport.h"
16 #include "platform/heap/Handle.h" 15 #include "platform/heap/Handle.h"
17 16
18 namespace blink { 17 namespace blink {
19 18
20 class EventQueue; 19 class EventQueue;
21 class LocalFrame;
22 class WorkerOrWorkletScriptController; 20 class WorkerOrWorkletScriptController;
23 21
24 class MODULES_EXPORT WorkletGlobalScope : public GarbageCollectedFinalized<Workl etGlobalScope>, public SecurityContext, public MainThreadWorkletGlobalScope, pub lic ScriptWrappable { 22 class CORE_EXPORT WorkletGlobalScope : public GarbageCollectedFinalized<WorkletG lobalScope>, public SecurityContext, public WorkerOrWorkletGlobalScope, public S criptWrappable {
25 DEFINE_WRAPPERTYPEINFO(); 23 DEFINE_WRAPPERTYPEINFO();
26 USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); 24 USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope);
27 public: 25 public:
28 ~WorkletGlobalScope() override; 26 ~WorkletGlobalScope() override;
29 virtual void dispose(); 27 virtual void dispose();
30 28
31 bool isWorkletGlobalScope() const final { return true; } 29 bool isWorkletGlobalScope() const final { return true; }
32 30
33 // WorkerOrWorkletGlobalScope 31 // WorkerOrWorkletGlobalScope
34 ScriptWrappable* getScriptWrappable() const final { return const_cast<Workle tGlobalScope*>(this); } 32 ScriptWrappable* getScriptWrappable() const final { return const_cast<Workle tGlobalScope*>(this); }
35 WorkerOrWorkletScriptController* scriptController() final { return m_scriptC ontroller.get(); } 33 WorkerOrWorkletScriptController* scriptController() final { return m_scriptC ontroller.get(); }
36 34
37 // ScriptWrappable 35 // ScriptWrappable
38 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte xt) final; 36 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte xt) final;
39 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn fo*, v8::Local<v8::Object> wrapper) final; 37 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn fo*, v8::Local<v8::Object> wrapper) final;
40 38
41 // ExecutionContext 39 // ExecutionContext
42 void disableEval(const String& errorMessage) final; 40 void disableEval(const String& errorMessage) final;
43 String userAgent() const final { return m_userAgent; } 41 String userAgent() const final { return m_userAgent; }
44 SecurityContext& securityContext() final { return *this; } 42 SecurityContext& securityContext() final { return *this; }
45 EventQueue* getEventQueue() const final { ASSERT_NOT_REACHED(); return nullp tr; } // WorkletGlobalScopes don't have an event queue. 43 EventQueue* getEventQueue() const final { NOTREACHED(); return nullptr; } // WorkletGlobalScopes don't have an event queue.
46 bool isSecureContext(String& errorMessage, const SecureContextCheck = Standa rdSecureContextCheck) const final; 44 bool isSecureContext(String& errorMessage, const SecureContextCheck = Standa rdSecureContextCheck) const final;
47 45
48 using SecurityContext::getSecurityOrigin; 46 using SecurityContext::getSecurityOrigin;
49 using SecurityContext::contentSecurityPolicy; 47 using SecurityContext::contentSecurityPolicy;
50 48
51 DOMTimerCoordinator* timers() final { ASSERT_NOT_REACHED(); return nullptr; } // WorkletGlobalScopes don't have timers. 49 DOMTimerCoordinator* timers() final { NOTREACHED(); return nullptr; } // Wor kletGlobalScopes don't have timers.
52 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask> ) override 50 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask> ) override
53 { 51 {
54 // TODO(ikilpatrick): implement. 52 // TODO(ikilpatrick): implement.
55 ASSERT_NOT_REACHED(); 53 NOTREACHED();
56 } 54 }
57 55
58 void reportBlockedScriptExecutionToInspector(const String& directiveText) fi nal; 56 void reportBlockedScriptExecutionToInspector(const String& directiveText) fi nal;
59 void addConsoleMessage(ConsoleMessage*) final;
60 void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLoca tion>) final; 57 void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLoca tion>) final;
61 58
62 DECLARE_VIRTUAL_TRACE(); 59 DECLARE_VIRTUAL_TRACE();
63 60
64 protected: 61 protected:
65 // The url, userAgent and securityOrigin arguments are inherited from the 62 // The url, userAgent and securityOrigin arguments are inherited from the
66 // parent ExecutionContext for Worklets. 63 // parent ExecutionContext for Worklets.
67 WorkletGlobalScope(LocalFrame*, const KURL&, const String& userAgent, PassRe fPtr<SecurityOrigin>, v8::Isolate*); 64 WorkletGlobalScope(const KURL&, const String& userAgent, PassRefPtr<Security Origin>, v8::Isolate*);
68 65
69 private: 66 private:
70 const KURL& virtualURL() const final { return m_url; } 67 const KURL& virtualURL() const final { return m_url; }
71 KURL virtualCompleteURL(const String&) const final; 68 KURL virtualCompleteURL(const String&) const final;
72 69
73 EventTarget* errorEventTarget() final { return nullptr; } 70 EventTarget* errorEventTarget() final { return nullptr; }
74 void didUpdateSecurityOrigin() final { } 71 void didUpdateSecurityOrigin() final { }
75 72
76 KURL m_url; 73 KURL m_url;
77 String m_userAgent; 74 String m_userAgent;
78 Member<WorkerOrWorkletScriptController> m_scriptController; 75 Member<WorkerOrWorkletScriptController> m_scriptController;
79 }; 76 };
80 77
81 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork letGlobalScope(), context.isWorkletGlobalScope()); 78 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork letGlobalScope(), context.isWorkletGlobalScope());
82 79
83 } // namespace blink 80 } // namespace blink
84 81
85 #endif // WorkletGlobalScope_h 82 #endif // WorkletGlobalScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698