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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 class DOMURL; | 51 class DOMURL; |
52 class ExceptionState; | 52 class ExceptionState; |
53 class ScheduledAction; | 53 class ScheduledAction; |
54 class WorkerClients; | 54 class WorkerClients; |
55 class WorkerConsole; | 55 class WorkerConsole; |
56 class WorkerInspectorController; | 56 class WorkerInspectorController; |
57 class WorkerLocation; | 57 class WorkerLocation; |
58 class WorkerNavigator; | 58 class WorkerNavigator; |
59 class WorkerThread; | 59 class WorkerThread; |
60 | 60 |
61 class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public Scrip
tWrappable, public ExecutionContext, public WorkerSupplementable, public EventTa
rgetWithInlineData { | 61 class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public Scrip
tWrappable, public ExecutionContext, public ExecutionContextClient, public Worke
rSupplementable, public EventTargetWithInlineData { |
62 public: | 62 public: |
63 virtual ~WorkerGlobalScope(); | 63 virtual ~WorkerGlobalScope(); |
64 | 64 |
65 virtual bool isWorkerGlobalScope() const OVERRIDE { return true; } | 65 virtual bool isWorkerGlobalScope() const OVERRIDE { return true; } |
66 | 66 |
67 virtual ExecutionContext* executionContext() const OVERRIDE; | 67 virtual ExecutionContext* executionContext() const OVERRIDE; |
68 | 68 |
69 virtual bool isSharedWorkerGlobalScope() const { return false; } | 69 virtual bool isSharedWorkerGlobalScope() const { return false; } |
70 virtual bool isDedicatedWorkerGlobalScope() const { return false; } | 70 virtual bool isDedicatedWorkerGlobalScope() const { return false; } |
71 | 71 |
72 const KURL& url() const { return m_url; } | 72 const KURL& url() const { return m_url; } |
73 KURL completeURL(const String&) const; | 73 KURL completeURL(const String&) const; |
74 | 74 |
75 virtual String userAgent(const KURL&) const; | 75 virtual String userAgent(const KURL&) const; |
76 | |
77 virtual void disableEval(const String& errorMessage) OVERRIDE; | 76 virtual void disableEval(const String& errorMessage) OVERRIDE; |
78 | 77 |
79 WorkerScriptController* script() { return m_script.get(); } | 78 WorkerScriptController* script() { return m_script.get(); } |
80 void clearScript() { m_script.clear(); } | 79 void clearScript() { m_script.clear(); } |
81 void clearInspector(); | 80 void clearInspector(); |
82 | 81 |
83 WorkerThread* thread() const { return m_thread; } | 82 WorkerThread* thread() const { return m_thread; } |
84 | 83 |
85 virtual void postTask(PassOwnPtr<ExecutionContextTask>) OVERRIDE; // Exe
cutes the task on context's thread asynchronously. | 84 virtual void postTask(PassOwnPtr<ExecutionContextTask>) OVERRIDE; // Exe
cutes the task on context's thread asynchronously. |
86 | 85 |
87 // WorkerGlobalScope | 86 // WorkerGlobalScope |
88 WorkerGlobalScope* self() { return this; } | 87 WorkerGlobalScope* self() { return this; } |
89 WorkerConsole* console(); | 88 WorkerConsole* console(); |
90 WorkerLocation* location() const; | 89 WorkerLocation* location() const; |
91 void close(); | 90 void close(); |
92 | 91 |
93 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 92 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
94 | 93 |
95 // WorkerUtils | 94 // WorkerUtils |
96 virtual void importScripts(const Vector<String>& urls, ExceptionState&); | 95 virtual void importScripts(const Vector<String>& urls, ExceptionState&); |
97 WorkerNavigator* navigator() const; | 96 WorkerNavigator* navigator() const; |
98 | 97 |
99 // ExecutionContext | 98 // ExecutionContextClient |
100 virtual WorkerEventQueue* eventQueue() const OVERRIDE; | 99 virtual WorkerEventQueue* eventQueue() const OVERRIDE; |
101 | 100 |
102 virtual bool isContextThread() const OVERRIDE; | 101 virtual bool isContextThread() const OVERRIDE; |
103 virtual bool isJSExecutionForbidden() const OVERRIDE; | 102 virtual bool isJSExecutionForbidden() const OVERRIDE; |
104 | 103 |
| 104 virtual double timerAlignmentInterval() const OVERRIDE; |
| 105 |
105 WorkerInspectorController* workerInspectorController() { return m_worker
InspectorController.get(); } | 106 WorkerInspectorController* workerInspectorController() { return m_worker
InspectorController.get(); } |
106 // These methods are used for GC marking. See JSWorkerGlobalScope::visit
ChildrenVirtual(SlotVisitor&) in | 107 // These methods are used for GC marking. See JSWorkerGlobalScope::visit
ChildrenVirtual(SlotVisitor&) in |
107 // JSWorkerGlobalScopeCustom.cpp. | 108 // JSWorkerGlobalScopeCustom.cpp. |
108 WorkerConsole* optionalConsole() const { return m_console.get(); } | 109 WorkerConsole* optionalConsole() const { return m_console.get(); } |
109 WorkerNavigator* optionalNavigator() const { return m_navigator.get(); } | 110 WorkerNavigator* optionalNavigator() const { return m_navigator.get(); } |
110 WorkerLocation* optionalLocation() const { return m_location.get(); } | 111 WorkerLocation* optionalLocation() const { return m_location.get(); } |
111 | 112 |
112 using RefCounted<WorkerGlobalScope>::ref; | 113 using RefCounted<WorkerGlobalScope>::ref; |
113 using RefCounted<WorkerGlobalScope>::deref; | 114 using RefCounted<WorkerGlobalScope>::deref; |
114 | 115 |
(...skipping 24 matching lines...) Expand all Loading... |
139 protected: | 140 protected: |
140 WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, d
ouble timeOrigin, PassOwnPtr<WorkerClients>); | 141 WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, d
ouble timeOrigin, PassOwnPtr<WorkerClients>); |
141 void applyContentSecurityPolicyFromString(const String& contentSecurityP
olicy, ContentSecurityPolicy::HeaderType); | 142 void applyContentSecurityPolicyFromString(const String& contentSecurityP
olicy, ContentSecurityPolicy::HeaderType); |
142 | 143 |
143 virtual void logExceptionToConsole(const String& errorMessage, const Str
ing& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) O
VERRIDE; | 144 virtual void logExceptionToConsole(const String& errorMessage, const Str
ing& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) O
VERRIDE; |
144 void addMessageToWorkerConsole(MessageSource, MessageLevel, const String
& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallSt
ack>, ScriptState*); | 145 void addMessageToWorkerConsole(MessageSource, MessageLevel, const String
& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallSt
ack>, ScriptState*); |
145 | 146 |
146 private: | 147 private: |
147 virtual void refExecutionContext() OVERRIDE { ref(); } | 148 virtual void refExecutionContext() OVERRIDE { ref(); } |
148 virtual void derefExecutionContext() OVERRIDE { deref(); } | 149 virtual void derefExecutionContext() OVERRIDE { deref(); } |
| 150 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE
; |
149 | 151 |
150 virtual void refEventTarget() OVERRIDE { ref(); } | 152 virtual void refEventTarget() OVERRIDE { ref(); } |
151 virtual void derefEventTarget() OVERRIDE { deref(); } | 153 virtual void derefEventTarget() OVERRIDE { deref(); } |
152 | 154 |
153 virtual const KURL& virtualURL() const OVERRIDE; | 155 virtual const KURL& virtualURL() const OVERRIDE; |
154 virtual KURL virtualCompleteURL(const String&) const; | 156 virtual KURL virtualCompleteURL(const String&) const; |
155 | 157 |
156 virtual void addMessage(MessageSource, MessageLevel, const String& messa
ge, const String& sourceURL, unsigned lineNumber, ScriptState* = 0) OVERRIDE; | 158 virtual void addMessage(MessageSource, MessageLevel, const String& messa
ge, const String& sourceURL, unsigned lineNumber, ScriptState* = 0) OVERRIDE; |
157 | 159 |
158 virtual EventTarget* errorEventTarget() OVERRIDE; | 160 virtual EventTarget* errorEventTarget() OVERRIDE; |
(...skipping 23 matching lines...) Expand all Loading... |
182 | 184 |
183 inline WorkerGlobalScope* toWorkerGlobalScope(ExecutionContext* context) | 185 inline WorkerGlobalScope* toWorkerGlobalScope(ExecutionContext* context) |
184 { | 186 { |
185 ASSERT_WITH_SECURITY_IMPLICATION(!context || context->isWorkerGlobalScope())
; | 187 ASSERT_WITH_SECURITY_IMPLICATION(!context || context->isWorkerGlobalScope())
; |
186 return static_cast<WorkerGlobalScope*>(context); | 188 return static_cast<WorkerGlobalScope*>(context); |
187 } | 189 } |
188 | 190 |
189 } // namespace WebCore | 191 } // namespace WebCore |
190 | 192 |
191 #endif // WorkerGlobalScope_h | 193 #endif // WorkerGlobalScope_h |
OLD | NEW |