Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 #include "platform/Supplementable.h" | 36 #include "platform/Supplementable.h" |
| 37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 #include "platform/weborigin/KURL.h" | 38 #include "platform/weborigin/KURL.h" |
| 39 #include "platform/weborigin/ReferrerPolicy.h" | 39 #include "platform/weborigin/ReferrerPolicy.h" |
| 40 #include "public/platform/WebTraceLocation.h" | 40 #include "public/platform/WebTraceLocation.h" |
| 41 #include "wtf/Noncopyable.h" | 41 #include "wtf/Noncopyable.h" |
| 42 #include <memory> | 42 #include <memory> |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 class ActiveDOMObject; | 46 class SuspendableObject; |
| 47 class ConsoleMessage; | 47 class ConsoleMessage; |
| 48 class DOMTimerCoordinator; | 48 class DOMTimerCoordinator; |
| 49 class ErrorEvent; | 49 class ErrorEvent; |
| 50 class EventQueue; | 50 class EventQueue; |
| 51 class EventTarget; | 51 class EventTarget; |
| 52 class ExecutionContextTask; | 52 class ExecutionContextTask; |
| 53 class LocalDOMWindow; | 53 class LocalDOMWindow; |
| 54 class PublicURLManager; | 54 class PublicURLManager; |
| 55 class SecurityOrigin; | 55 class SecurityOrigin; |
| 56 enum class TaskType : unsigned; | 56 enum class TaskType : unsigned; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus); | 119 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus); |
| 120 void dispatchErrorEvent(ErrorEvent*, AccessControlStatus); | 120 void dispatchErrorEvent(ErrorEvent*, AccessControlStatus); |
| 121 | 121 |
| 122 virtual void addConsoleMessage(ConsoleMessage*) = 0; | 122 virtual void addConsoleMessage(ConsoleMessage*) = 0; |
| 123 virtual void exceptionThrown(ErrorEvent*) = 0; | 123 virtual void exceptionThrown(ErrorEvent*) = 0; |
| 124 | 124 |
| 125 PublicURLManager& publicURLManager(); | 125 PublicURLManager& publicURLManager(); |
| 126 | 126 |
| 127 virtual void removeURLFromMemoryCache(const KURL&); | 127 virtual void removeURLFromMemoryCache(const KURL&); |
| 128 | 128 |
| 129 void suspendActiveDOMObjects(); | 129 void suspendSuspendableObjects(); |
| 130 void resumeActiveDOMObjects(); | 130 void resumeSuspendableObjects(); |
| 131 void stopActiveDOMObjects(); | 131 void stopSuspendableObjects(); |
| 132 void notifyContextDestroyed() override; | 132 void notifyContextDestroyed() override; |
| 133 | 133 |
| 134 void suspendScheduledTasks(); | 134 void suspendScheduledTasks(); |
| 135 void resumeScheduledTasks(); | 135 void resumeScheduledTasks(); |
| 136 | 136 |
| 137 // TODO(haraken): Remove these methods by making the customers inherit from | 137 // TODO(haraken): Remove these methods by making the customers inherit from |
| 138 // ActiveDOMObject. ActiveDOMObject is a standard way to observe context | 138 // SuspendableObject. SuspendableObject is a standard way to observe context |
| 139 // suspension/resumption. | 139 // suspension/resumption. |
| 140 virtual bool tasksNeedSuspension() { return false; } | 140 virtual bool tasksNeedSuspension() { return false; } |
| 141 virtual void tasksWereSuspended() {} | 141 virtual void tasksWereSuspended() {} |
| 142 virtual void tasksWereResumed() {} | 142 virtual void tasksWereResumed() {} |
| 143 | 143 |
| 144 bool activeDOMObjectsAreSuspended() const { | 144 bool activeDOMObjectsAreSuspended() const { |
| 145 return m_activeDOMObjectsAreSuspended; | 145 return m_activeDOMObjectsAreSuspended; |
| 146 } | 146 } |
| 147 bool isContextDestroyed() const { return m_isContextDestroyed; } | 147 bool isContextDestroyed() const { return m_isContextDestroyed; } |
| 148 | 148 |
| 149 // Called after the construction of an ActiveDOMObject to synchronize suspend | 149 // Called after the construction of an SuspendableObject to synchronize |
| 150 // suspend | |
|
dcheng
2016/12/12 02:06:27
Nit: merge comments on line 150 and 151
| |
| 150 // state. | 151 // state. |
| 151 void suspendActiveDOMObjectIfNeeded(ActiveDOMObject*); | 152 void suspendSuspendableObjectIfNeeded(SuspendableObject*); |
| 152 | 153 |
| 153 // Gets the next id in a circular sequence from 1 to 2^31-1. | 154 // Gets the next id in a circular sequence from 1 to 2^31-1. |
| 154 int circularSequentialID(); | 155 int circularSequentialID(); |
| 155 | 156 |
| 156 virtual EventTarget* errorEventTarget() = 0; | 157 virtual EventTarget* errorEventTarget() = 0; |
| 157 virtual EventQueue* getEventQueue() const = 0; | 158 virtual EventQueue* getEventQueue() const = 0; |
| 158 | 159 |
| 159 // Methods related to window interaction. It should be used to manage window | 160 // Methods related to window interaction. It should be used to manage window |
| 160 // focusing and window creation permission for an ExecutionContext. | 161 // focusing and window creation permission for an ExecutionContext. |
| 161 void allowWindowInteraction(); | 162 void allowWindowInteraction(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to | 210 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to |
| 210 // increment and decrement the counter. | 211 // increment and decrement the counter. |
| 211 int m_windowInteractionTokens; | 212 int m_windowInteractionTokens; |
| 212 | 213 |
| 213 ReferrerPolicy m_referrerPolicy; | 214 ReferrerPolicy m_referrerPolicy; |
| 214 }; | 215 }; |
| 215 | 216 |
| 216 } // namespace blink | 217 } // namespace blink |
| 217 | 218 |
| 218 #endif // ExecutionContext_h | 219 #endif // ExecutionContext_h |
| OLD | NEW |