OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2012 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "core/dom/ContextLifecycleObserver.h" | 33 #include "core/dom/ContextLifecycleObserver.h" |
34 #include "core/dom/SecurityContext.h" | 34 #include "core/dom/SecurityContext.h" |
35 #include "core/dom/SuspendableTask.h" | 35 #include "core/dom/SuspendableTask.h" |
36 #include "core/fetch/AccessControlStatus.h" | 36 #include "core/fetch/AccessControlStatus.h" |
37 #include "platform/Supplementable.h" | 37 #include "platform/Supplementable.h" |
38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
39 #include "platform/weborigin/KURL.h" | 39 #include "platform/weborigin/KURL.h" |
40 #include "platform/weborigin/ReferrerPolicy.h" | 40 #include "platform/weborigin/ReferrerPolicy.h" |
41 #include "wtf/Deque.h" | 41 #include "wtf/Deque.h" |
42 #include "wtf/Noncopyable.h" | 42 #include "wtf/Noncopyable.h" |
43 #include "wtf/OwnPtr.h" | 43 #include <memory> |
44 #include "wtf/PassOwnPtr.h" | |
45 | 44 |
46 namespace blink { | 45 namespace blink { |
47 | 46 |
48 class ActiveDOMObject; | 47 class ActiveDOMObject; |
49 class ConsoleMessage; | 48 class ConsoleMessage; |
50 class DOMTimerCoordinator; | 49 class DOMTimerCoordinator; |
51 class ErrorEvent; | 50 class ErrorEvent; |
52 class EventQueue; | 51 class EventQueue; |
53 class EventTarget; | 52 class EventTarget; |
54 class ExecutionContextTask; | 53 class ExecutionContextTask; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; | 100 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; |
102 | 101 |
103 virtual SecurityContext& securityContext() = 0; | 102 virtual SecurityContext& securityContext() = 0; |
104 KURL contextURL() const { return virtualURL(); } | 103 KURL contextURL() const { return virtualURL(); } |
105 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL
(url); } | 104 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL
(url); } |
106 | 105 |
107 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus)
; | 106 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus)
; |
108 void reportException(ErrorEvent*, AccessControlStatus); | 107 void reportException(ErrorEvent*, AccessControlStatus); |
109 | 108 |
110 virtual void addConsoleMessage(ConsoleMessage*) = 0; | 109 virtual void addConsoleMessage(ConsoleMessage*) = 0; |
111 virtual void logExceptionToConsole(const String& errorMessage, PassOwnPtr<So
urceLocation>) = 0; | 110 virtual void logExceptionToConsole(const String& errorMessage, std::unique_p
tr<SourceLocation>) = 0; |
112 | 111 |
113 PublicURLManager& publicURLManager(); | 112 PublicURLManager& publicURLManager(); |
114 | 113 |
115 virtual void removeURLFromMemoryCache(const KURL&); | 114 virtual void removeURLFromMemoryCache(const KURL&); |
116 | 115 |
117 void suspendActiveDOMObjects(); | 116 void suspendActiveDOMObjects(); |
118 void resumeActiveDOMObjects(); | 117 void resumeActiveDOMObjects(); |
119 void stopActiveDOMObjects(); | 118 void stopActiveDOMObjects(); |
120 void postSuspendableTask(PassOwnPtr<SuspendableTask>); | 119 void postSuspendableTask(std::unique_ptr<SuspendableTask>); |
121 void notifyContextDestroyed() override; | 120 void notifyContextDestroyed() override; |
122 | 121 |
123 virtual void suspendScheduledTasks(); | 122 virtual void suspendScheduledTasks(); |
124 virtual void resumeScheduledTasks(); | 123 virtual void resumeScheduledTasks(); |
125 virtual bool tasksNeedSuspension() { return false; } | 124 virtual bool tasksNeedSuspension() { return false; } |
126 virtual void tasksWereSuspended() { } | 125 virtual void tasksWereSuspended() { } |
127 virtual void tasksWereResumed() { } | 126 virtual void tasksWereResumed() { } |
128 | 127 |
129 bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSusp
ended; } | 128 bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSusp
ended; } |
130 bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStoppe
d; } | 129 bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStoppe
d; } |
(...skipping 30 matching lines...) Expand all Loading... |
161 virtual KURL virtualCompleteURL(const String&) const = 0; | 160 virtual KURL virtualCompleteURL(const String&) const = 0; |
162 | 161 |
163 private: | 162 private: |
164 bool dispatchErrorEvent(ErrorEvent*, AccessControlStatus); | 163 bool dispatchErrorEvent(ErrorEvent*, AccessControlStatus); |
165 void runSuspendableTasks(); | 164 void runSuspendableTasks(); |
166 | 165 |
167 unsigned m_circularSequentialID; | 166 unsigned m_circularSequentialID; |
168 | 167 |
169 bool m_inDispatchErrorEvent; | 168 bool m_inDispatchErrorEvent; |
170 class PendingException; | 169 class PendingException; |
171 OwnPtr<Vector<OwnPtr<PendingException>>> m_pendingExceptions; | 170 std::unique_ptr<Vector<std::unique_ptr<PendingException>>> m_pendingExceptio
ns; |
172 | 171 |
173 bool m_activeDOMObjectsAreSuspended; | 172 bool m_activeDOMObjectsAreSuspended; |
174 bool m_activeDOMObjectsAreStopped; | 173 bool m_activeDOMObjectsAreStopped; |
175 | 174 |
176 Member<PublicURLManager> m_publicURLManager; | 175 Member<PublicURLManager> m_publicURLManager; |
177 | 176 |
178 // Counter that keeps track of how many window interaction calls are allowed | 177 // Counter that keeps track of how many window interaction calls are allowed |
179 // for this ExecutionContext. Callers are expected to call | 178 // for this ExecutionContext. Callers are expected to call |
180 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to | 179 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to |
181 // increment and decrement the counter. | 180 // increment and decrement the counter. |
182 int m_windowInteractionTokens; | 181 int m_windowInteractionTokens; |
183 | 182 |
184 Deque<OwnPtr<SuspendableTask>> m_suspendedTasks; | 183 Deque<std::unique_ptr<SuspendableTask>> m_suspendedTasks; |
185 bool m_isRunSuspendableTasksScheduled; | 184 bool m_isRunSuspendableTasksScheduled; |
186 | 185 |
187 ReferrerPolicy m_referrerPolicy; | 186 ReferrerPolicy m_referrerPolicy; |
188 }; | 187 }; |
189 | 188 |
190 } // namespace blink | 189 } // namespace blink |
191 | 190 |
192 #endif // ExecutionContext_h | 191 #endif // ExecutionContext_h |
OLD | NEW |