| 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 <memory> | 43 #include "wtf/OwnPtr.h" |
| 44 #include "wtf/PassOwnPtr.h" |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| 46 | 47 |
| 47 class ActiveDOMObject; | 48 class ActiveDOMObject; |
| 48 class ConsoleMessage; | 49 class ConsoleMessage; |
| 49 class DOMTimerCoordinator; | 50 class DOMTimerCoordinator; |
| 50 class ErrorEvent; | 51 class ErrorEvent; |
| 51 class EventQueue; | 52 class EventQueue; |
| 52 class EventTarget; | 53 class EventTarget; |
| 53 class ExecutionContextTask; | 54 class ExecutionContextTask; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; | 101 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; |
| 101 | 102 |
| 102 virtual SecurityContext& securityContext() = 0; | 103 virtual SecurityContext& securityContext() = 0; |
| 103 KURL contextURL() const { return virtualURL(); } | 104 KURL contextURL() const { return virtualURL(); } |
| 104 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL
(url); } | 105 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL
(url); } |
| 105 | 106 |
| 106 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus)
; | 107 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus)
; |
| 107 void reportException(ErrorEvent*, AccessControlStatus); | 108 void reportException(ErrorEvent*, AccessControlStatus); |
| 108 | 109 |
| 109 virtual void addConsoleMessage(ConsoleMessage*) = 0; | 110 virtual void addConsoleMessage(ConsoleMessage*) = 0; |
| 110 virtual void logExceptionToConsole(const String& errorMessage, std::unique_p
tr<SourceLocation>) = 0; | 111 virtual void logExceptionToConsole(const String& errorMessage, PassOwnPtr<So
urceLocation>) = 0; |
| 111 | 112 |
| 112 PublicURLManager& publicURLManager(); | 113 PublicURLManager& publicURLManager(); |
| 113 | 114 |
| 114 virtual void removeURLFromMemoryCache(const KURL&); | 115 virtual void removeURLFromMemoryCache(const KURL&); |
| 115 | 116 |
| 116 void suspendActiveDOMObjects(); | 117 void suspendActiveDOMObjects(); |
| 117 void resumeActiveDOMObjects(); | 118 void resumeActiveDOMObjects(); |
| 118 void stopActiveDOMObjects(); | 119 void stopActiveDOMObjects(); |
| 119 void postSuspendableTask(std::unique_ptr<SuspendableTask>); | 120 void postSuspendableTask(PassOwnPtr<SuspendableTask>); |
| 120 void notifyContextDestroyed() override; | 121 void notifyContextDestroyed() override; |
| 121 | 122 |
| 122 virtual void suspendScheduledTasks(); | 123 virtual void suspendScheduledTasks(); |
| 123 virtual void resumeScheduledTasks(); | 124 virtual void resumeScheduledTasks(); |
| 124 virtual bool tasksNeedSuspension() { return false; } | 125 virtual bool tasksNeedSuspension() { return false; } |
| 125 virtual void tasksWereSuspended() { } | 126 virtual void tasksWereSuspended() { } |
| 126 virtual void tasksWereResumed() { } | 127 virtual void tasksWereResumed() { } |
| 127 | 128 |
| 128 bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSusp
ended; } | 129 bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSusp
ended; } |
| 129 bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStoppe
d; } | 130 bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStoppe
d; } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 160 virtual KURL virtualCompleteURL(const String&) const = 0; | 161 virtual KURL virtualCompleteURL(const String&) const = 0; |
| 161 | 162 |
| 162 private: | 163 private: |
| 163 bool dispatchErrorEvent(ErrorEvent*, AccessControlStatus); | 164 bool dispatchErrorEvent(ErrorEvent*, AccessControlStatus); |
| 164 void runSuspendableTasks(); | 165 void runSuspendableTasks(); |
| 165 | 166 |
| 166 unsigned m_circularSequentialID; | 167 unsigned m_circularSequentialID; |
| 167 | 168 |
| 168 bool m_inDispatchErrorEvent; | 169 bool m_inDispatchErrorEvent; |
| 169 class PendingException; | 170 class PendingException; |
| 170 std::unique_ptr<Vector<std::unique_ptr<PendingException>>> m_pendingExceptio
ns; | 171 OwnPtr<Vector<OwnPtr<PendingException>>> m_pendingExceptions; |
| 171 | 172 |
| 172 bool m_activeDOMObjectsAreSuspended; | 173 bool m_activeDOMObjectsAreSuspended; |
| 173 bool m_activeDOMObjectsAreStopped; | 174 bool m_activeDOMObjectsAreStopped; |
| 174 | 175 |
| 175 Member<PublicURLManager> m_publicURLManager; | 176 Member<PublicURLManager> m_publicURLManager; |
| 176 | 177 |
| 177 // Counter that keeps track of how many window interaction calls are allowed | 178 // Counter that keeps track of how many window interaction calls are allowed |
| 178 // for this ExecutionContext. Callers are expected to call | 179 // for this ExecutionContext. Callers are expected to call |
| 179 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to | 180 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to |
| 180 // increment and decrement the counter. | 181 // increment and decrement the counter. |
| 181 int m_windowInteractionTokens; | 182 int m_windowInteractionTokens; |
| 182 | 183 |
| 183 Deque<std::unique_ptr<SuspendableTask>> m_suspendedTasks; | 184 Deque<OwnPtr<SuspendableTask>> m_suspendedTasks; |
| 184 bool m_isRunSuspendableTasksScheduled; | 185 bool m_isRunSuspendableTasksScheduled; |
| 185 | 186 |
| 186 ReferrerPolicy m_referrerPolicy; | 187 ReferrerPolicy m_referrerPolicy; |
| 187 }; | 188 }; |
| 188 | 189 |
| 189 } // namespace blink | 190 } // namespace blink |
| 190 | 191 |
| 191 #endif // ExecutionContext_h | 192 #endif // ExecutionContext_h |
| OLD | NEW |