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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 class SecurityOrigin; | 61 class SecurityOrigin; |
62 class ScriptCallStack; | 62 class ScriptCallStack; |
63 | 63 |
64 class ExecutionContext | 64 class ExecutionContext |
65 : public WillBeGarbageCollectedMixin | 65 : public WillBeGarbageCollectedMixin |
66 , public LifecycleContext<ExecutionContext> | 66 , public LifecycleContext<ExecutionContext> |
67 , public Supplementable<ExecutionContext> { | 67 , public Supplementable<ExecutionContext> { |
68 public: | 68 public: |
69 ExecutionContext(); | 69 ExecutionContext(); |
70 virtual ~ExecutionContext(); | 70 virtual ~ExecutionContext(); |
| 71 virtual void trace(Visitor*); |
71 | 72 |
72 // Delegating to ExecutionContextClient | 73 // Delegating to ExecutionContextClient |
73 bool isDocument() const { return m_client && m_client->isDocument(); } | 74 bool isDocument() const { return m_client && m_client->isDocument(); } |
74 bool isWorkerGlobalScope() const { return m_client && m_client->isWorkerGlob
alScope(); } | 75 bool isWorkerGlobalScope() const { return m_client && m_client->isWorkerGlob
alScope(); } |
75 bool isJSExecutionForbidden() { return m_client && m_client->isJSExecutionFo
rbidden(); } | 76 bool isJSExecutionForbidden() { return m_client && m_client->isJSExecutionFo
rbidden(); } |
76 SecurityOrigin* securityOrigin() const; | 77 SecurityOrigin* securityOrigin() const; |
77 ContentSecurityPolicy* contentSecurityPolicy() const; | 78 ContentSecurityPolicy* contentSecurityPolicy() const; |
78 const KURL& url() const; | 79 const KURL& url() const; |
79 KURL completeURL(const String& url) const; | 80 KURL completeURL(const String& url) const; |
80 void disableEval(const String& errorMessage); | 81 void disableEval(const String& errorMessage); |
81 DOMWindow* executingWindow() const; | 82 DOMWindow* executingWindow() const; |
82 String userAgent(const KURL&) const; | 83 String userAgent(const KURL&) const; |
83 void postTask(PassOwnPtr<ExecutionContextTask>); | 84 void postTask(PassOwnPtr<ExecutionContextTask>); |
84 void postTask(const Closure&); | 85 void postTask(const Closure&); |
85 double timerAlignmentInterval() const; | 86 double timerAlignmentInterval() const; |
86 | 87 |
87 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus)
; | 88 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus)
; |
88 void reportException(PassRefPtrWillBeRawPtr<ErrorEvent>, PassRefPtr<ScriptCa
llStack>, AccessControlStatus); | 89 void reportException(PassRefPtrWillBeRawPtr<ErrorEvent>, PassRefPtrWillBeRaw
Ptr<ScriptCallStack>, AccessControlStatus); |
89 | 90 |
90 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL, unsigned lineNumber); | 91 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL, unsigned lineNumber); |
91 void addConsoleMessage(MessageSource, MessageLevel, const String& message, S
criptState* = 0); | 92 void addConsoleMessage(MessageSource, MessageLevel, const String& message, S
criptState* = 0); |
92 | 93 |
93 PublicURLManager& publicURLManager(); | 94 PublicURLManager& publicURLManager(); |
94 | 95 |
95 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. | 96 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. |
96 bool hasPendingActivity(); | 97 bool hasPendingActivity(); |
97 | 98 |
98 void suspendActiveDOMObjects(); | 99 void suspendActiveDOMObjects(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 151 |
151 ExecutionContextClient* m_client; | 152 ExecutionContextClient* m_client; |
152 SandboxFlags m_sandboxFlags; | 153 SandboxFlags m_sandboxFlags; |
153 | 154 |
154 int m_circularSequentialID; | 155 int m_circularSequentialID; |
155 typedef HashMap<int, OwnPtr<DOMTimer> > TimeoutMap; | 156 typedef HashMap<int, OwnPtr<DOMTimer> > TimeoutMap; |
156 TimeoutMap m_timeouts; | 157 TimeoutMap m_timeouts; |
157 | 158 |
158 bool m_inDispatchErrorEvent; | 159 bool m_inDispatchErrorEvent; |
159 class PendingException; | 160 class PendingException; |
160 OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions; | 161 OwnPtrWillBeMember<WillBeHeapVector<OwnPtrWillBeMember<PendingException> > >
m_pendingExceptions; |
161 | 162 |
162 bool m_activeDOMObjectsAreSuspended; | 163 bool m_activeDOMObjectsAreSuspended; |
163 bool m_activeDOMObjectsAreStopped; | 164 bool m_activeDOMObjectsAreStopped; |
164 | 165 |
165 OwnPtr<PublicURLManager> m_publicURLManager; | 166 OwnPtr<PublicURLManager> m_publicURLManager; |
166 | 167 |
167 // The location of this member is important; to make sure contextDestroyed()
notification on | 168 // The location of this member is important; to make sure contextDestroyed()
notification on |
168 // ExecutionContext's members (notably m_timeouts) is called before they are
destructed, | 169 // ExecutionContext's members (notably m_timeouts) is called before they are
destructed, |
169 // m_lifecycleNotifer should be placed *after* such members. | 170 // m_lifecycleNotifer should be placed *after* such members. |
170 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; | 171 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; |
171 }; | 172 }; |
172 | 173 |
173 } // namespace WebCore | 174 } // namespace WebCore |
174 | 175 |
175 #endif // ExecutionContext_h | 176 #endif // ExecutionContext_h |
OLD | NEW |