Lines 69-75
using namespace WebCore;
Link Here
|
69 |
|
69 |
|
70 |
namespace WebKit { |
70 |
namespace WebKit { |
71 |
|
71 |
|
72 |
// Chromium-specific wrapper over WorkerMessagingProxy. |
72 |
// Chromium-specific decorator of WorkerMessagingProxy. |
73 |
// Delegates implementation of Worker{Loader,Context,Object}Proxy to WorkerMessagingProxy. |
73 |
// Delegates implementation of Worker{Loader,Context,Object}Proxy to WorkerMessagingProxy. |
74 |
|
74 |
|
75 |
// static |
75 |
// static |
Lines 79-205
WorkerContextProxy* WebWorkerClientImpl::createWorkerContextProxy(Worker* worker
Link Here
|
79 |
Document* document = static_cast<Document*>(worker->scriptExecutionContext()); |
79 |
Document* document = static_cast<Document*>(worker->scriptExecutionContext()); |
80 |
WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); |
80 |
WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); |
81 |
WebWorkerClientImpl* proxy = new WebWorkerClientImpl(worker, webFrame); |
81 |
WebWorkerClientImpl* proxy = new WebWorkerClientImpl(worker, webFrame); |
82 |
return proxy; |
82 |
return proxy; |
83 |
} |
83 |
} |
84 |
ASSERT_NOT_REACHED(); |
84 |
ASSERT_NOT_REACHED(); |
85 |
return 0; |
85 |
return 0; |
86 |
} |
86 |
} |
87 |
|
87 |
|
88 |
void WebWorkerClientImpl::startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) |
|
|
89 |
{ |
90 |
ASSERT(m_scriptExecutionContext->isDocument()); |
91 |
Document* document = static_cast<Document*>(m_scriptExecutionContext.get()); |
92 |
GroupSettings* settings = 0; |
93 |
if (document->page()) |
94 |
settings = document->page()->group().groupSettings(); |
95 |
RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, settings, sourceCode, *this, *this, startMode, |
96 |
document->contentSecurityPolicy()->deprecatedHeader(), |
97 |
document->contentSecurityPolicy()->deprecatedHeaderType(), |
98 |
document->topDocument()->securityOrigin()); |
99 |
m_proxy->workerThreadCreated(thread); |
100 |
thread->start(); |
101 |
InspectorInstrumentation::didStartWorkerContext(m_scriptExecutionContext.get(), m_proxy, scriptURL); |
102 |
} |
103 |
|
104 |
void WebWorkerClientImpl::terminateWorkerContext() |
88 |
void WebWorkerClientImpl::terminateWorkerContext() |
105 |
{ |
89 |
{ |
106 |
m_webFrame = 0; |
90 |
m_webFrame = 0; |
107 |
m_proxy->terminateWorkerContext(); |
91 |
WebCore::WorkerMessagingProxy::terminateWorkerContext(); |
108 |
} |
|
|
109 |
|
110 |
void WebWorkerClientImpl::postMessageToWorkerContext( |
111 |
PassRefPtr<SerializedScriptValue> value, |
112 |
PassOwnPtr<MessagePortChannelArray> ports) |
113 |
{ |
114 |
m_proxy->postMessageToWorkerContext(value, ports); |
115 |
} |
116 |
|
117 |
bool WebWorkerClientImpl::hasPendingActivity() const |
118 |
{ |
119 |
return m_proxy->hasPendingActivity(); |
120 |
} |
121 |
|
122 |
void WebWorkerClientImpl::workerObjectDestroyed() |
123 |
{ |
124 |
m_proxy->workerObjectDestroyed(); |
125 |
} |
126 |
|
127 |
#if ENABLE(INSPECTOR) |
128 |
void WebWorkerClientImpl::connectToInspector(PageInspector* inspector) |
129 |
{ |
130 |
m_proxy->connectToInspector(inspector); |
131 |
} |
132 |
|
133 |
void WebWorkerClientImpl::disconnectFromInspector() |
134 |
{ |
135 |
m_proxy->disconnectFromInspector(); |
136 |
} |
137 |
|
138 |
void WebWorkerClientImpl::sendMessageToInspector(const String& message) |
139 |
{ |
140 |
m_proxy->sendMessageToInspector(message); |
141 |
} |
142 |
|
143 |
void WebWorkerClientImpl::postMessageToPageInspector(const String& message) |
144 |
{ |
145 |
m_proxy->postMessageToPageInspector(message); |
146 |
} |
147 |
|
148 |
void WebWorkerClientImpl::updateInspectorStateCookie(const String& cookie) |
149 |
{ |
150 |
m_proxy->updateInspectorStateCookie(cookie); |
151 |
} |
152 |
#endif // ENABLE(INSPECTOR) |
153 |
|
154 |
|
155 |
void WebWorkerClientImpl::postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Task> task) |
156 |
{ |
157 |
m_proxy->postTaskToLoader(task); |
158 |
} |
92 |
} |
159 |
|
93 |
|
160 |
bool WebWorkerClientImpl::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode) |
94 |
WebWorkerBase* WebWorkerClientImpl::toWebWorkerBase() |
161 |
{ |
95 |
{ |
162 |
return m_proxy->postTaskForModeToWorkerContext(task, mode); |
96 |
return this; |
163 |
} |
97 |
} |
164 |
|
98 |
|
165 |
void WebWorkerClientImpl::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> value, PassOwnPtr<MessagePortChannelArray> ports) |
99 |
WebView* WebWorkerClientImpl::view() const |
166 |
{ |
100 |
{ |
167 |
m_proxy->postMessageToWorkerObject(value, ports); |
101 |
if (askedToTerminate()) |
168 |
} |
102 |
return 0; |
169 |
|
103 |
return m_webFrame->view(); |
170 |
void WebWorkerClientImpl::confirmMessageFromWorkerObject(bool hasPendingActivity) |
|
|
171 |
{ |
172 |
m_proxy->confirmMessageFromWorkerObject(hasPendingActivity); |
173 |
} |
174 |
|
175 |
void WebWorkerClientImpl::reportPendingActivity(bool hasPendingActivity) |
176 |
{ |
177 |
m_proxy->reportPendingActivity(hasPendingActivity); |
178 |
} |
179 |
|
180 |
void WebWorkerClientImpl::workerContextClosed() |
181 |
{ |
182 |
m_proxy->workerContextClosed(); |
183 |
} |
184 |
|
185 |
void WebWorkerClientImpl::postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) |
186 |
{ |
187 |
m_proxy->postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL); |
188 |
} |
189 |
|
190 |
void WebWorkerClientImpl::postConsoleMessageToWorkerObject(MessageSource source, MessageLevel level, const String& message, int lineNumber, const String& sourceURL) |
191 |
{ |
192 |
m_proxy->postConsoleMessageToWorkerObject(source, level, message, lineNumber, sourceURL); |
193 |
} |
104 |
} |
194 |
|
105 |
|
195 |
void WebWorkerClientImpl::workerContextDestroyed() |
106 |
bool WebWorkerClientImpl::allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) |
196 |
{ |
107 |
{ |
197 |
m_proxy->workerContextDestroyed(); |
108 |
if (askedToTerminate()) |
|
|
109 |
return false; |
110 |
WebKit::WebViewImpl* webView = m_webFrame->viewImpl(); |
111 |
if (!webView) |
112 |
return false; |
113 |
return !webView->permissionClient() || webView->permissionClient()->allowDatabase(m_webFrame, name, displayName, estimatedSize); |
198 |
} |
114 |
} |
199 |
|
115 |
|
200 |
bool WebWorkerClientImpl::allowFileSystem() |
116 |
bool WebWorkerClientImpl::allowFileSystem() |
201 |
{ |
117 |
{ |
202 |
if (m_proxy->askedToTerminate()) |
118 |
if (askedToTerminate()) |
203 |
return false; |
119 |
return false; |
204 |
WebKit::WebViewImpl* webView = m_webFrame->viewImpl(); |
120 |
WebKit::WebViewImpl* webView = m_webFrame->viewImpl(); |
205 |
if (!webView) |
121 |
if (!webView) |
Lines 207-253
bool WebWorkerClientImpl::allowFileSystem()
Link Here
|
207 |
return !webView->permissionClient() || webView->permissionClient()->allowFileSystem(m_webFrame); |
123 |
return !webView->permissionClient() || webView->permissionClient()->allowFileSystem(m_webFrame); |
208 |
} |
124 |
} |
209 |
|
125 |
|
210 |
void WebWorkerClientImpl::openFileSystem(WebFileSystem::Type type, long long size, bool create, |
126 |
void WebWorkerClientImpl::openFileSystem(WebFileSystem::Type type, long long size, bool create, |
211 |
WebFileSystemCallbacks* callbacks) |
127 |
WebFileSystemCallbacks* callbacks) |
212 |
{ |
128 |
{ |
213 |
if (m_proxy->askedToTerminate()) { |
129 |
if (askedToTerminate()) { |
214 |
callbacks->didFail(WebFileErrorAbort); |
130 |
callbacks->didFail(WebFileErrorAbort); |
215 |
return; |
131 |
return; |
216 |
} |
132 |
} |
217 |
m_webFrame->client()->openFileSystem(m_webFrame, type, size, create, callbacks); |
133 |
m_webFrame->client()->openFileSystem(m_webFrame, type, size, create, callbacks); |
218 |
} |
134 |
} |
219 |
|
135 |
|
220 |
bool WebWorkerClientImpl::allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) |
|
|
221 |
{ |
222 |
if (m_proxy->askedToTerminate()) |
223 |
return false; |
224 |
WebKit::WebViewImpl* webView = m_webFrame->viewImpl(); |
225 |
if (!webView) |
226 |
return false; |
227 |
return !webView->permissionClient() || webView->permissionClient()->allowDatabase(m_webFrame, name, displayName, estimatedSize); |
228 |
} |
229 |
|
230 |
bool WebWorkerClientImpl::allowIndexedDB(const WebString& name) |
136 |
bool WebWorkerClientImpl::allowIndexedDB(const WebString& name) |
231 |
{ |
137 |
{ |
232 |
if (m_proxy->askedToTerminate()) |
138 |
if (askedToTerminate()) |
233 |
return false; |
139 |
return false; |
234 |
WebKit::WebViewImpl* webView = m_webFrame->viewImpl(); |
140 |
WebKit::WebViewImpl* webView = m_webFrame->viewImpl(); |
235 |
if (!webView) |
141 |
if (!webView) |
236 |
return false; |
142 |
return false; |
237 |
return !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(m_webFrame, name, WebSecurityOrigin()); |
143 |
return !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(m_webFrame, name, WebSecurityOrigin()); |
238 |
} |
144 |
} |
239 |
|
|
|
240 |
WebView* WebWorkerClientImpl::view() const |
241 |
{ |
242 |
if (m_proxy->askedToTerminate()) |
243 |
return 0; |
244 |
return m_webFrame->view(); |
245 |
} |
246 |
|
145 |
|
247 |
WebWorkerClientImpl::WebWorkerClientImpl(Worker* worker, WebFrameImpl* webFrame) |
146 |
WebWorkerClientImpl::WebWorkerClientImpl(Worker* worker, WebFrameImpl* webFrame) |
248 |
: m_proxy(new WorkerMessagingProxy(worker)) |
147 |
: WebCore::WorkerMessagingProxy(worker) |
249 |
, m_scriptExecutionContext(worker->scriptExecutionContext()) |
148 |
, m_webFrame(webFrame) |
250 |
, m_webFrame(webFrame) |
|
|
251 |
{ |
149 |
{ |
252 |
} |
150 |
} |
253 |
|
151 |
|