| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 namespace blink { | 52 namespace blink { |
| 53 | 53 |
| 54 class ConsoleMessage; | 54 class ConsoleMessage; |
| 55 class ConsoleMessageStorage; | 55 class ConsoleMessageStorage; |
| 56 class ExceptionState; | 56 class ExceptionState; |
| 57 class WorkerClients; | 57 class WorkerClients; |
| 58 class WorkerConsole; | 58 class WorkerConsole; |
| 59 class WorkerInspectorController; | 59 class WorkerInspectorController; |
| 60 class WorkerLocation; | 60 class WorkerLocation; |
| 61 class WorkerNavigator; | 61 class WorkerNavigator; |
| 62 class WorkerThread; | 62 class WorkerScript; |
| 63 | 63 |
| 64 class CORE_EXPORT WorkerGlobalScope : public EventTargetWithInlineData, public R
efCountedWillBeNoBase<WorkerGlobalScope>, public SecurityContext, public Executi
onContext, public WillBeHeapSupplementable<WorkerGlobalScope>, public DOMWindowB
ase64 { | 64 class CORE_EXPORT WorkerGlobalScope : public EventTargetWithInlineData, public R
efCountedWillBeNoBase<WorkerGlobalScope>, public SecurityContext, public Executi
onContext, public WillBeHeapSupplementable<WorkerGlobalScope>, public DOMWindowB
ase64 { |
| 65 DEFINE_WRAPPERTYPEINFO(); | 65 DEFINE_WRAPPERTYPEINFO(); |
| 66 REFCOUNTED_EVENT_TARGET(WorkerGlobalScope); | 66 REFCOUNTED_EVENT_TARGET(WorkerGlobalScope); |
| 67 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WorkerGlobalScope); | 67 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WorkerGlobalScope); |
| 68 public: | 68 public: |
| 69 virtual ~WorkerGlobalScope(); | 69 virtual ~WorkerGlobalScope(); |
| 70 | 70 |
| 71 bool isWorkerGlobalScope() const override final { return true; } | 71 bool isWorkerGlobalScope() const override final { return true; } |
| 72 | 72 |
| 73 ExecutionContext* executionContext() const override final; | 73 ExecutionContext* executionContext() const override final; |
| 74 | 74 |
| 75 virtual void countFeature(UseCounter::Feature) const; | 75 virtual void countFeature(UseCounter::Feature) const; |
| 76 virtual void countDeprecation(UseCounter::Feature) const; | 76 virtual void countDeprecation(UseCounter::Feature) const; |
| 77 | 77 |
| 78 const KURL& url() const { return m_url; } | 78 const KURL& url() const { return m_url; } |
| 79 KURL completeURL(const String&) const; | 79 KURL completeURL(const String&) const; |
| 80 | 80 |
| 81 String userAgent(const KURL&) const override final; | 81 String userAgent(const KURL&) const override final; |
| 82 void disableEval(const String& errorMessage) override final; | 82 void disableEval(const String& errorMessage) override final; |
| 83 | 83 |
| 84 WorkerScriptController* script() { return m_script.get(); } | 84 WorkerScriptController* scriptController() { return m_scriptController.get()
; } |
| 85 | 85 |
| 86 virtual void didEvaluateWorkerScript(); | 86 virtual void didEvaluateWorkerScript(); |
| 87 void dispose(); | 87 void dispose(); |
| 88 | 88 |
| 89 WorkerThread* thread() const { return m_thread; } | 89 WorkerScript* script() const { return m_script; } |
| 90 | 90 |
| 91 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) ove
rride final; // Executes the task on context's thread asynchronously. | 91 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) ove
rride final; // Executes the task on context's thread asynchronously. |
| 92 | 92 |
| 93 // WorkerGlobalScope | 93 // WorkerGlobalScope |
| 94 WorkerGlobalScope* self() { return this; } | 94 WorkerGlobalScope* self() { return this; } |
| 95 WorkerConsole* console(); | 95 WorkerConsole* console(); |
| 96 WorkerLocation* location() const; | 96 WorkerLocation* location() const; |
| 97 void close(); | 97 void close(); |
| 98 | 98 |
| 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 void exceptionHandled(int exceptionId, bool isHandled); | 136 void exceptionHandled(int exceptionId, bool isHandled); |
| 137 | 137 |
| 138 virtual void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) { } | 138 virtual void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) { } |
| 139 | 139 |
| 140 bool isPrivilegedContext(String& errorMessage, const PrivilegeContextCheck =
StandardPrivilegeCheck) override; | 140 bool isPrivilegedContext(String& errorMessage, const PrivilegeContextCheck =
StandardPrivilegeCheck) override; |
| 141 | 141 |
| 142 DECLARE_VIRTUAL_TRACE(); | 142 DECLARE_VIRTUAL_TRACE(); |
| 143 | 143 |
| 144 protected: | 144 protected: |
| 145 WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, doubl
e timeOrigin, const SecurityOrigin*, PassOwnPtrWillBeRawPtr<WorkerClients>); | 145 WorkerGlobalScope(const KURL&, const String& userAgent, WorkerScript*, doubl
e timeOrigin, const SecurityOrigin*, PassOwnPtrWillBeRawPtr<WorkerClients>); |
| 146 void applyContentSecurityPolicyFromString(const String& contentSecurityPolic
y, ContentSecurityPolicyHeaderType); | 146 void applyContentSecurityPolicyFromString(const String& contentSecurityPolic
y, ContentSecurityPolicyHeaderType); |
| 147 | 147 |
| 148 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<Scrip
tCallStack>) override; | 148 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<Scrip
tCallStack>) override; |
| 149 void addMessageToWorkerConsole(PassRefPtrWillBeRawPtr<ConsoleMessage>); | 149 void addMessageToWorkerConsole(PassRefPtrWillBeRawPtr<ConsoleMessage>); |
| 150 void setV8CacheOptions(V8CacheOptions v8CacheOptions) { m_v8CacheOptions = v
8CacheOptions; } | 150 void setV8CacheOptions(V8CacheOptions v8CacheOptions) { m_v8CacheOptions = v
8CacheOptions; } |
| 151 | 151 |
| 152 void removeURLFromMemoryCache(const KURL&) override; | 152 void removeURLFromMemoryCache(const KURL&) override; |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 #if !ENABLE(OILPAN) | 155 #if !ENABLE(OILPAN) |
| 156 void refExecutionContext() override final { ref(); } | 156 void refExecutionContext() override final { ref(); } |
| 157 void derefExecutionContext() override final { deref(); } | 157 void derefExecutionContext() override final { deref(); } |
| 158 #endif | 158 #endif |
| 159 | 159 |
| 160 const KURL& virtualURL() const override final; | 160 const KURL& virtualURL() const override final; |
| 161 KURL virtualCompleteURL(const String&) const override final; | 161 KURL virtualCompleteURL(const String&) const override final; |
| 162 | 162 |
| 163 void reportBlockedScriptExecutionToInspector(const String& directiveText) ov
erride final; | 163 void reportBlockedScriptExecutionToInspector(const String& directiveText) ov
erride final; |
| 164 | 164 |
| 165 EventTarget* errorEventTarget() override final; | 165 EventTarget* errorEventTarget() override final; |
| 166 void didUpdateSecurityOrigin() override final { } | 166 void didUpdateSecurityOrigin() override final { } |
| 167 | 167 |
| 168 void clearScript() { m_script.clear(); } | |
| 169 void clearInspector(); | 168 void clearInspector(); |
| 170 | 169 |
| 171 static void removeURLFromMemoryCacheInternal(const KURL&); | 170 static void removeURLFromMemoryCacheInternal(const KURL&); |
| 172 | 171 |
| 173 KURL m_url; | 172 KURL m_url; |
| 174 String m_userAgent; | 173 String m_userAgent; |
| 175 V8CacheOptions m_v8CacheOptions; | 174 V8CacheOptions m_v8CacheOptions; |
| 176 | 175 |
| 177 mutable PersistentWillBeMember<WorkerConsole> m_console; | 176 mutable PersistentWillBeMember<WorkerConsole> m_console; |
| 178 mutable PersistentWillBeMember<WorkerLocation> m_location; | 177 mutable PersistentWillBeMember<WorkerLocation> m_location; |
| 179 mutable PersistentWillBeMember<WorkerNavigator> m_navigator; | 178 mutable PersistentWillBeMember<WorkerNavigator> m_navigator; |
| 180 | 179 |
| 181 mutable UseCounter::CountBits m_deprecationWarningBits; | 180 mutable UseCounter::CountBits m_deprecationWarningBits; |
| 182 | 181 |
| 183 OwnPtr<WorkerScriptController> m_script; | 182 OwnPtr<WorkerScriptController> m_scriptController; |
| 184 WorkerThread* m_thread; | 183 WorkerScript* m_script; |
| 185 | 184 |
| 186 RefPtrWillBeMember<WorkerInspectorController> m_workerInspectorController; | 185 RefPtrWillBeMember<WorkerInspectorController> m_workerInspectorController; |
| 187 bool m_closing; | 186 bool m_closing; |
| 188 | 187 |
| 189 OwnPtrWillBeMember<WorkerEventQueue> m_eventQueue; | 188 OwnPtrWillBeMember<WorkerEventQueue> m_eventQueue; |
| 190 | 189 |
| 191 OwnPtrWillBeMember<WorkerClients> m_workerClients; | 190 OwnPtrWillBeMember<WorkerClients> m_workerClients; |
| 192 | 191 |
| 193 DOMTimerCoordinator m_timers; | 192 DOMTimerCoordinator m_timers; |
| 194 | 193 |
| 195 double m_timeOrigin; | 194 double m_timeOrigin; |
| 196 | 195 |
| 197 OwnPtrWillBeMember<ConsoleMessageStorage> m_messageStorage; | 196 OwnPtrWillBeMember<ConsoleMessageStorage> m_messageStorage; |
| 198 | 197 |
| 199 unsigned long m_workerExceptionUniqueIdentifier; | 198 unsigned long m_workerExceptionUniqueIdentifier; |
| 200 WillBeHeapHashMap<unsigned long, RefPtrWillBeMember<ConsoleMessage>> m_pendi
ngMessages; | 199 WillBeHeapHashMap<unsigned long, RefPtrWillBeMember<ConsoleMessage>> m_pendi
ngMessages; |
| 201 }; | 200 }; |
| 202 | 201 |
| 203 DEFINE_TYPE_CASTS(WorkerGlobalScope, ExecutionContext, context, context->isWorke
rGlobalScope(), context.isWorkerGlobalScope()); | 202 DEFINE_TYPE_CASTS(WorkerGlobalScope, ExecutionContext, context, context->isWorke
rGlobalScope(), context.isWorkerGlobalScope()); |
| 204 | 203 |
| 205 } // namespace blink | 204 } // namespace blink |
| 206 | 205 |
| 207 #endif // WorkerGlobalScope_h | 206 #endif // WorkerGlobalScope_h |
| OLD | NEW |