OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 NullExecutionContext_h | 5 #ifndef NullExecutionContext_h |
6 #define NullExecutionContext_h | 6 #define NullExecutionContext_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptCallStack.h" | 8 #include "bindings/core/v8/ScriptCallStack.h" |
9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
10 #include "core/dom/SecurityContext.h" | 10 #include "core/dom/SecurityContext.h" |
11 #include "core/events/EventQueue.h" | 11 #include "core/events/EventQueue.h" |
12 #include "core/inspector/ConsoleMessage.h" | 12 #include "core/inspector/ConsoleMessage.h" |
13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
14 #include "platform/weborigin/KURL.h" | 14 #include "platform/weborigin/KURL.h" |
15 #include "wtf/RefCounted.h" | 15 #include "wtf/RefCounted.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 class NullExecutionContext final : public RefCountedWillBeGarbageCollectedFinali
zed<NullExecutionContext>, public SecurityContext, public ExecutionContext { | 19 class NullExecutionContext final : public GarbageCollectedFinalized<NullExecutio
nContext>, public SecurityContext, public ExecutionContext { |
20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext); | 20 USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext); |
21 public: | 21 public: |
22 NullExecutionContext(); | 22 NullExecutionContext(); |
23 | 23 |
24 void disableEval(const String&) override { } | 24 void disableEval(const String&) override { } |
25 String userAgent() const override { return String(); } | 25 String userAgent() const override { return String(); } |
26 | 26 |
27 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) ove
rride; | 27 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) ove
rride; |
28 | 28 |
29 EventTarget* errorEventTarget() override { return nullptr; } | 29 EventTarget* errorEventTarget() override { return nullptr; } |
30 EventQueue* getEventQueue() const override { return m_queue.get(); } | 30 EventQueue* getEventQueue() const override { return m_queue.get(); } |
31 | 31 |
32 bool tasksNeedSuspension() override { return m_tasksNeedSuspension; } | 32 bool tasksNeedSuspension() override { return m_tasksNeedSuspension; } |
33 void setTasksNeedSuspension(bool flag) { m_tasksNeedSuspension = flag; } | 33 void setTasksNeedSuspension(bool flag) { m_tasksNeedSuspension = flag; } |
34 | 34 |
35 void reportBlockedScriptExecutionToInspector(const String& directiveText) ov
erride { } | 35 void reportBlockedScriptExecutionToInspector(const String& directiveText) ov
erride { } |
36 void didUpdateSecurityOrigin() override { } | 36 void didUpdateSecurityOrigin() override { } |
37 SecurityContext& securityContext() override { return *this; } | 37 SecurityContext& securityContext() override { return *this; } |
38 DOMTimerCoordinator* timers() override { return nullptr; } | 38 DOMTimerCoordinator* timers() override { return nullptr; } |
39 | 39 |
40 void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) override { } | 40 void addConsoleMessage(RawPtr<ConsoleMessage>) override { } |
41 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>)
override { } | 41 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>)
override { } |
42 | 42 |
43 void setIsSecureContext(bool); | 43 void setIsSecureContext(bool); |
44 bool isSecureContext(String& errorMessage, const SecureContextCheck = Standa
rdSecureContextCheck) const override; | 44 bool isSecureContext(String& errorMessage, const SecureContextCheck = Standa
rdSecureContextCheck) const override; |
45 | 45 |
46 DEFINE_INLINE_TRACE() | 46 DEFINE_INLINE_TRACE() |
47 { | 47 { |
48 visitor->trace(m_queue); | 48 visitor->trace(m_queue); |
49 SecurityContext::trace(visitor); | 49 SecurityContext::trace(visitor); |
50 ExecutionContext::trace(visitor); | 50 ExecutionContext::trace(visitor); |
51 } | 51 } |
52 | 52 |
53 #if !ENABLE(OILPAN) | 53 #if !ENABLE(OILPAN) |
54 using RefCounted<NullExecutionContext>::ref; | 54 using RefCounted<NullExecutionContext>::ref; |
55 using RefCounted<NullExecutionContext>::deref; | 55 using RefCounted<NullExecutionContext>::deref; |
56 | 56 |
57 void refExecutionContext() override { ref(); } | 57 void refExecutionContext() override { ref(); } |
58 void derefExecutionContext() override { deref(); } | 58 void derefExecutionContext() override { deref(); } |
59 #endif | 59 #endif |
60 | 60 |
61 protected: | 61 protected: |
62 const KURL& virtualURL() const override { return m_dummyURL; } | 62 const KURL& virtualURL() const override { return m_dummyURL; } |
63 KURL virtualCompleteURL(const String&) const override { return m_dummyURL; } | 63 KURL virtualCompleteURL(const String&) const override { return m_dummyURL; } |
64 | 64 |
65 private: | 65 private: |
66 bool m_tasksNeedSuspension; | 66 bool m_tasksNeedSuspension; |
67 bool m_isSecureContext; | 67 bool m_isSecureContext; |
68 OwnPtrWillBeMember<EventQueue> m_queue; | 68 Member<EventQueue> m_queue; |
69 | 69 |
70 KURL m_dummyURL; | 70 KURL m_dummyURL; |
71 }; | 71 }; |
72 | 72 |
73 } // namespace blink | 73 } // namespace blink |
74 | 74 |
75 #endif // NullExecutionContext_h | 75 #endif // NullExecutionContext_h |
OLD | NEW |