| 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 29 matching lines...) Expand all Loading... |
| 40 #include "wtf/OwnPtr.h" | 40 #include "wtf/OwnPtr.h" |
| 41 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class ContextLifecycleNotifier; | 45 class ContextLifecycleNotifier; |
| 46 class LocalDOMWindow; | 46 class LocalDOMWindow; |
| 47 class ErrorEvent; | 47 class ErrorEvent; |
| 48 class EventQueue; | 48 class EventQueue; |
| 49 class ScriptState; | 49 class ScriptState; |
| 50 class PublicURLManager; | |
| 51 class ScriptCallStack; | 50 class ScriptCallStack; |
| 52 | 51 |
| 53 class ExecutionContext | 52 class ExecutionContext |
| 54 : public LifecycleContext<ExecutionContext> | 53 : public LifecycleContext<ExecutionContext> |
| 55 , public Supplementable<ExecutionContext> { | 54 , public Supplementable<ExecutionContext> { |
| 56 public: | 55 public: |
| 57 // Delegating to ExecutionContextClient | 56 // Delegating to ExecutionContextClient |
| 58 bool isDocument() const { return m_client && m_client->isDocument(); } | 57 bool isDocument() const { return m_client && m_client->isDocument(); } |
| 59 const KURL& url() const; | 58 const KURL& url() const; |
| 60 KURL completeURL(const String& url) const; | 59 KURL completeURL(const String& url) const; |
| 61 LocalDOMWindow* executingWindow() const; | 60 LocalDOMWindow* executingWindow() const; |
| 62 double timerAlignmentInterval() const; | 61 double timerAlignmentInterval() const; |
| 63 | 62 |
| 64 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; | 63 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; |
| 65 | 64 |
| 66 KURL contextURL() const { return virtualURL(); } | 65 KURL contextURL() const { return virtualURL(); } |
| 67 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL
(url); } | 66 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL
(url); } |
| 68 | 67 |
| 69 bool shouldSanitizeScriptError(const String& sourceURL); | 68 bool shouldSanitizeScriptError(const String& sourceURL); |
| 70 void reportException(PassRefPtr<ErrorEvent>, int scriptId, PassRefPtr<Script
CallStack>); | 69 void reportException(PassRefPtr<ErrorEvent>, int scriptId, PassRefPtr<Script
CallStack>); |
| 71 | 70 |
| 72 void addConsoleMessage(PassRefPtr<ConsoleMessage>); | 71 void addConsoleMessage(PassRefPtr<ConsoleMessage>); |
| 73 | 72 |
| 74 PublicURLManager& publicURLManager(); | |
| 75 | |
| 76 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. | 73 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. |
| 77 bool hasPendingActivity(); | 74 bool hasPendingActivity(); |
| 78 | 75 |
| 79 void stopActiveDOMObjects(); | 76 void stopActiveDOMObjects(); |
| 80 unsigned activeDOMObjectCount(); | 77 unsigned activeDOMObjectCount(); |
| 81 | 78 |
| 82 bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSusp
ended; } | 79 bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSusp
ended; } |
| 83 bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStoppe
d; } | 80 bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStoppe
d; } |
| 84 bool isIteratingOverObservers() const; | 81 bool isIteratingOverObservers() const; |
| 85 | 82 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 typedef HashMap<int, OwnPtr<DOMTimer> > TimeoutMap; | 128 typedef HashMap<int, OwnPtr<DOMTimer> > TimeoutMap; |
| 132 TimeoutMap m_timeouts; | 129 TimeoutMap m_timeouts; |
| 133 | 130 |
| 134 bool m_inDispatchErrorEvent; | 131 bool m_inDispatchErrorEvent; |
| 135 class PendingException; | 132 class PendingException; |
| 136 OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions; | 133 OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions; |
| 137 | 134 |
| 138 bool m_activeDOMObjectsAreSuspended; | 135 bool m_activeDOMObjectsAreSuspended; |
| 139 bool m_activeDOMObjectsAreStopped; | 136 bool m_activeDOMObjectsAreStopped; |
| 140 | 137 |
| 141 OwnPtr<PublicURLManager> m_publicURLManager; | |
| 142 | |
| 143 // The location of this member is important; to make sure contextDestroyed()
notification on | 138 // The location of this member is important; to make sure contextDestroyed()
notification on |
| 144 // ExecutionContext's members (notably m_timeouts) is called before they are
destructed, | 139 // ExecutionContext's members (notably m_timeouts) is called before they are
destructed, |
| 145 // m_lifecycleNotifer should be placed *after* such members. | 140 // m_lifecycleNotifer should be placed *after* such members. |
| 146 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; | 141 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; |
| 147 }; | 142 }; |
| 148 | 143 |
| 149 } // namespace blink | 144 } // namespace blink |
| 150 | 145 |
| 151 #endif // ExecutionContext_h | 146 #endif // ExecutionContext_h |
| OLD | NEW |