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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 class ActiveDOMObject; | 48 class ActiveDOMObject; |
| 49 class ConsoleMessage; | 49 class ConsoleMessage; |
| 50 class DOMTimerCoordinator; | 50 class DOMTimerCoordinator; |
| 51 class ErrorEvent; | 51 class ErrorEvent; |
| 52 class EventQueue; | 52 class EventQueue; |
| 53 class EventTarget; | 53 class EventTarget; |
| 54 class ExecutionContextTask; | 54 class ExecutionContextTask; |
| 55 class LocalDOMWindow; | 55 class LocalDOMWindow; |
| 56 class OriginTrials; | |
| 57 class OriginTrialContext; | |
| 56 class PublicURLManager; | 58 class PublicURLManager; |
| 57 class SecurityOrigin; | 59 class SecurityOrigin; |
| 58 class ScriptCallStack; | 60 class ScriptCallStack; |
| 59 | 61 |
| 60 class CORE_EXPORT ExecutionContext | 62 class CORE_EXPORT ExecutionContext |
| 61 : public ContextLifecycleNotifier, public WillBeHeapSupplementable<Execution Context> { | 63 : public ContextLifecycleNotifier, public WillBeHeapSupplementable<Execution Context> { |
| 62 WTF_MAKE_NONCOPYABLE(ExecutionContext); | 64 WTF_MAKE_NONCOPYABLE(ExecutionContext); |
| 63 public: | 65 public: |
| 64 DECLARE_VIRTUAL_TRACE(); | 66 DECLARE_VIRTUAL_TRACE(); |
| 65 | 67 |
| 66 // Used to specify whether |isSecureContext| should walk the | 68 // Used to specify whether |isSecureContext| should walk the |
| 67 // ancestor tree to decide whether to restrict usage of a powerful | 69 // ancestor tree to decide whether to restrict usage of a powerful |
| 68 // feature. | 70 // feature. |
| 69 enum SecureContextCheck { | 71 enum SecureContextCheck { |
| 70 StandardSecureContextCheck, | 72 StandardSecureContextCheck, |
| 71 WebCryptoSecureContextCheck | 73 WebCryptoSecureContextCheck |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 virtual bool isDocument() const { return false; } | 76 virtual bool isDocument() const { return false; } |
| 75 virtual bool isWorkerGlobalScope() const { return false; } | 77 virtual bool isWorkerGlobalScope() const { return false; } |
| 76 virtual bool isWorkletGlobalScope() const { return false; } | 78 virtual bool isWorkletGlobalScope() const { return false; } |
| 77 virtual bool isDedicatedWorkerGlobalScope() const { return false; } | 79 virtual bool isDedicatedWorkerGlobalScope() const { return false; } |
| 78 virtual bool isSharedWorkerGlobalScope() const { return false; } | 80 virtual bool isSharedWorkerGlobalScope() const { return false; } |
| 79 virtual bool isServiceWorkerGlobalScope() const { return false; } | 81 virtual bool isServiceWorkerGlobalScope() const { return false; } |
| 80 virtual bool isCompositorWorkerGlobalScope() const { return false; } | 82 virtual bool isCompositorWorkerGlobalScope() const { return false; } |
| 81 virtual bool isJSExecutionForbidden() const { return false; } | 83 virtual bool isJSExecutionForbidden() const { return false; } |
| 82 | 84 |
| 83 virtual bool isContextThread() const { return true; } | 85 virtual bool isContextThread() const { return true; } |
| 84 | 86 |
| 87 OriginTrials* originTrials(); | |
| 85 SecurityOrigin* securityOrigin(); | 88 SecurityOrigin* securityOrigin(); |
| 86 ContentSecurityPolicy* contentSecurityPolicy(); | 89 ContentSecurityPolicy* contentSecurityPolicy(); |
| 87 const KURL& url() const; | 90 const KURL& url() const; |
| 88 KURL completeURL(const String& url) const; | 91 KURL completeURL(const String& url) const; |
| 89 virtual void disableEval(const String& errorMessage) = 0; | 92 virtual void disableEval(const String& errorMessage) = 0; |
| 90 virtual LocalDOMWindow* executingWindow() { return 0; } | 93 virtual LocalDOMWindow* executingWindow() { return 0; } |
| 91 virtual String userAgent() const = 0; | 94 virtual String userAgent() const = 0; |
| 92 virtual void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTa sk>) = 0; // Executes the task on context's thread asynchronously. | 95 virtual void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTa sk>) = 0; // Executes the task on context's thread asynchronously. |
| 93 | 96 |
| 94 // Gets the DOMTimerCoordinator which maintains the "active timer | 97 // Gets the DOMTimerCoordinator which maintains the "active timer |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 ExecutionContext(); | 166 ExecutionContext(); |
| 164 virtual ~ExecutionContext(); | 167 virtual ~ExecutionContext(); |
| 165 | 168 |
| 166 virtual const KURL& virtualURL() const = 0; | 169 virtual const KURL& virtualURL() const = 0; |
| 167 virtual KURL virtualCompleteURL(const String&) const = 0; | 170 virtual KURL virtualCompleteURL(const String&) const = 0; |
| 168 | 171 |
| 169 private: | 172 private: |
| 170 bool dispatchErrorEvent(PassRefPtrWillBeRawPtr<ErrorEvent>, AccessControlSta tus); | 173 bool dispatchErrorEvent(PassRefPtrWillBeRawPtr<ErrorEvent>, AccessControlSta tus); |
| 171 void runSuspendableTasks(); | 174 void runSuspendableTasks(); |
| 172 | 175 |
| 176 // Override to enable experimental features through origin trials | |
| 177 virtual OriginTrialContext* originTrialContext() { return nullptr; } | |
| 178 | |
| 173 #if !ENABLE(OILPAN) | 179 #if !ENABLE(OILPAN) |
| 174 virtual void refExecutionContext() = 0; | 180 virtual void refExecutionContext() = 0; |
| 175 virtual void derefExecutionContext() = 0; | 181 virtual void derefExecutionContext() = 0; |
| 176 #endif | 182 #endif |
| 177 // LifecycleContext implementation. | 183 // LifecycleContext implementation. |
| 178 | 184 |
| 179 unsigned m_circularSequentialID; | 185 unsigned m_circularSequentialID; |
| 180 | 186 |
| 181 bool m_inDispatchErrorEvent; | 187 bool m_inDispatchErrorEvent; |
| 182 class PendingException; | 188 class PendingException; |
| 183 OwnPtr<Vector<OwnPtr<PendingException>>> m_pendingExceptions; | 189 OwnPtr<Vector<OwnPtr<PendingException>>> m_pendingExceptions; |
| 184 | 190 |
| 185 bool m_activeDOMObjectsAreSuspended; | 191 bool m_activeDOMObjectsAreSuspended; |
| 186 bool m_activeDOMObjectsAreStopped; | 192 bool m_activeDOMObjectsAreStopped; |
| 187 | 193 |
| 188 OwnPtrWillBeMember<PublicURLManager> m_publicURLManager; | 194 OwnPtrWillBeMember<PublicURLManager> m_publicURLManager; |
| 189 | 195 |
| 190 // Counter that keeps track of how many window interaction calls are allowed | 196 // Counter that keeps track of how many window interaction calls are allowed |
| 191 // for this ExecutionContext. Callers are expected to call | 197 // for this ExecutionContext. Callers are expected to call |
| 192 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to | 198 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to |
| 193 // increment and decrement the counter. | 199 // increment and decrement the counter. |
| 194 int m_windowInteractionTokens; | 200 int m_windowInteractionTokens; |
| 195 | 201 |
| 196 Deque<OwnPtr<SuspendableTask>> m_suspendedTasks; | 202 Deque<OwnPtr<SuspendableTask>> m_suspendedTasks; |
| 197 bool m_isRunSuspendableTasksScheduled; | 203 bool m_isRunSuspendableTasksScheduled; |
| 198 | 204 |
| 199 ReferrerPolicy m_referrerPolicy; | 205 ReferrerPolicy m_referrerPolicy; |
| 206 | |
| 207 // Experimental framework policy and cache | |
| 208 OwnPtr<OriginTrials> m_originTrials; | |
|
jbroman
2016/03/01 23:29:21
One thought here: consider using a supplement (Wil
iclelland
2016/03/03 21:47:01
That's a really good idea. Thanks, done.
| |
| 200 }; | 209 }; |
| 201 | 210 |
| 202 } // namespace blink | 211 } // namespace blink |
| 203 | 212 |
| 204 #endif // ExecutionContext_h | 213 #endif // ExecutionContext_h |
| OLD | NEW |