OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // Not suppported in SharedWorker. | 217 // Not suppported in SharedWorker. |
218 } | 218 } |
219 | 219 |
220 void WebSharedWorkerImpl::reportConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMes
sage>) | 220 void WebSharedWorkerImpl::reportConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMes
sage>) |
221 { | 221 { |
222 // Not supported in SharedWorker. | 222 // Not supported in SharedWorker. |
223 } | 223 } |
224 | 224 |
225 void WebSharedWorkerImpl::postMessageToPageInspector(const String& message) | 225 void WebSharedWorkerImpl::postMessageToPageInspector(const String& message) |
226 { | 226 { |
227 m_mainFrame->frame()->document()->postInspectorTask(FROM_HERE, createCrossTh
readTask(&WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread, this, mes
sage)); | 227 m_mainFrame->frame()->document()->postInspectorTask(BLINK_FROM_HERE, createC
rossThreadTask(&WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread, thi
s, message)); |
228 } | 228 } |
229 | 229 |
230 void WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread(const String& m
essage) | 230 void WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread(const String& m
essage) |
231 { | 231 { |
232 WorkerInspectorProxy::PageInspector* pageInspector = m_workerInspectorProxy-
>pageInspector(); | 232 WorkerInspectorProxy::PageInspector* pageInspector = m_workerInspectorProxy-
>pageInspector(); |
233 if (!pageInspector) | 233 if (!pageInspector) |
234 return; | 234 return; |
235 pageInspector->dispatchMessageFromWorker(message); | 235 pageInspector->dispatchMessageFromWorker(message); |
236 | 236 |
237 } | 237 } |
238 | 238 |
239 void WebSharedWorkerImpl::workerGlobalScopeClosed() | 239 void WebSharedWorkerImpl::workerGlobalScopeClosed() |
240 { | 240 { |
241 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, threadS
afeBind(&WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread, AllowCrossThr
eadAccess(this))); | 241 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HERE, t
hreadSafeBind(&WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread, AllowCr
ossThreadAccess(this))); |
242 } | 242 } |
243 | 243 |
244 void WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread() | 244 void WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread() |
245 { | 245 { |
246 m_client->workerContextClosed(); | 246 m_client->workerContextClosed(); |
247 | 247 |
248 terminateWorkerThread(); | 248 terminateWorkerThread(); |
249 } | 249 } |
250 | 250 |
251 void WebSharedWorkerImpl::workerGlobalScopeStarted(WorkerGlobalScope*) | 251 void WebSharedWorkerImpl::workerGlobalScopeStarted(WorkerGlobalScope*) |
252 { | 252 { |
253 } | 253 } |
254 | 254 |
255 void WebSharedWorkerImpl::workerThreadTerminated() | 255 void WebSharedWorkerImpl::workerThreadTerminated() |
256 { | 256 { |
257 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, threadS
afeBind(&WebSharedWorkerImpl::workerThreadTerminatedOnMainThread, AllowCrossThre
adAccess(this))); | 257 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HERE, t
hreadSafeBind(&WebSharedWorkerImpl::workerThreadTerminatedOnMainThread, AllowCro
ssThreadAccess(this))); |
258 } | 258 } |
259 | 259 |
260 void WebSharedWorkerImpl::workerThreadTerminatedOnMainThread() | 260 void WebSharedWorkerImpl::workerThreadTerminatedOnMainThread() |
261 { | 261 { |
262 m_client->workerContextDestroyed(); | 262 m_client->workerContextDestroyed(); |
263 // The lifetime of this proxy is controlled by the worker context. | 263 // The lifetime of this proxy is controlled by the worker context. |
264 delete this; | 264 delete this; |
265 } | 265 } |
266 | 266 |
267 // WorkerLoaderProxyProvider ---------------------------------------------------
-------- | 267 // WorkerLoaderProxyProvider ---------------------------------------------------
-------- |
268 | 268 |
269 void WebSharedWorkerImpl::postTaskToLoader(PassOwnPtr<ExecutionContextTask> task
) | 269 void WebSharedWorkerImpl::postTaskToLoader(PassOwnPtr<ExecutionContextTask> task
) |
270 { | 270 { |
271 m_mainFrame->frame()->document()->postTask(FROM_HERE, task); | 271 m_mainFrame->frame()->document()->postTask(BLINK_FROM_HERE, task); |
272 } | 272 } |
273 | 273 |
274 bool WebSharedWorkerImpl::postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContex
tTask> task) | 274 bool WebSharedWorkerImpl::postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContex
tTask> task) |
275 { | 275 { |
276 m_workerThread->postTask(FROM_HERE, task); | 276 m_workerThread->postTask(BLINK_FROM_HERE, task); |
277 return true; | 277 return true; |
278 } | 278 } |
279 | 279 |
280 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel) | 280 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel) |
281 { | 281 { |
282 workerThread()->postTask( | 282 workerThread()->postTask( |
283 FROM_HERE, createCrossThreadTask(&connectTask, adoptPtr(webChannel))); | 283 BLINK_FROM_HERE, createCrossThreadTask(&connectTask, adoptPtr(webChannel
))); |
284 } | 284 } |
285 | 285 |
286 void WebSharedWorkerImpl::connectTask(PassOwnPtr<WebMessagePortChannel> channel,
ExecutionContext* context) | 286 void WebSharedWorkerImpl::connectTask(PassOwnPtr<WebMessagePortChannel> channel,
ExecutionContext* context) |
287 { | 287 { |
288 // Wrap the passed-in channel in a MessagePort, and send it off via a connec
t event. | 288 // Wrap the passed-in channel in a MessagePort, and send it off via a connec
t event. |
289 MessagePort* port = MessagePort::create(*context); | 289 MessagePort* port = MessagePort::create(*context); |
290 port->entangle(channel); | 290 port->entangle(channel); |
291 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); | 291 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); |
292 ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScop
e()); | 292 ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScop
e()); |
293 workerGlobalScope->dispatchEvent(createConnectEvent(port)); | 293 workerGlobalScope->dispatchEvent(createConnectEvent(port)); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 if (devtoolsAgent) | 394 if (devtoolsAgent) |
395 devtoolsAgent->dispatchOnInspectorBackend(message); | 395 devtoolsAgent->dispatchOnInspectorBackend(message); |
396 } | 396 } |
397 | 397 |
398 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 398 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
399 { | 399 { |
400 return new WebSharedWorkerImpl(client); | 400 return new WebSharedWorkerImpl(client); |
401 } | 401 } |
402 | 402 |
403 } // namespace blink | 403 } // namespace blink |
OLD | NEW |