Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp

Issue 2518073002: Worker: Use per-frame task runners from a worker thread (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 void WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread( 248 void WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread(
249 const String& message) { 249 const String& message) {
250 m_workerInspectorProxy->dispatchMessageFromWorker(message); 250 m_workerInspectorProxy->dispatchMessageFromWorker(message);
251 } 251 }
252 252
253 ParentFrameTaskRunners* WebSharedWorkerImpl::getParentFrameTaskRunners() { 253 ParentFrameTaskRunners* WebSharedWorkerImpl::getParentFrameTaskRunners() {
254 return m_parentFrameTaskRunners.get(); 254 return m_parentFrameTaskRunners.get();
255 } 255 }
256 256
257 void WebSharedWorkerImpl::didCloseWorkerGlobalScope() { 257 void WebSharedWorkerImpl::didCloseWorkerGlobalScope() {
258 // TODO(nhiroki): Replace this with getParentFrameTaskRunners(). 258 getParentFrameTaskRunners()
259 // (https://crbug.com/667310) 259 ->get(TaskType::Internal)
260 Platform::current()->mainThread()->getWebTaskRunner()->postTask( 260 ->postTask(
261 BLINK_FROM_HERE, 261 BLINK_FROM_HERE,
262 crossThreadBind( 262 crossThreadBind(
263 &WebSharedWorkerImpl::didCloseWorkerGlobalScopeOnMainThread, 263 &WebSharedWorkerImpl::didCloseWorkerGlobalScopeOnMainThread,
264 crossThreadUnretained(this))); 264 crossThreadUnretained(this)));
265 } 265 }
266 266
267 void WebSharedWorkerImpl::didCloseWorkerGlobalScopeOnMainThread() { 267 void WebSharedWorkerImpl::didCloseWorkerGlobalScopeOnMainThread() {
268 m_client->workerContextClosed(); 268 m_client->workerContextClosed();
269 269
270 terminateWorkerThread(); 270 terminateWorkerThread();
271 } 271 }
272 272
273 void WebSharedWorkerImpl::didTerminateWorkerThread() { 273 void WebSharedWorkerImpl::didTerminateWorkerThread() {
274 // TODO(nhiroki): Replace this with getParentFrameTaskRunners(). 274 getParentFrameTaskRunners()
275 // (https://crbug.com/667310) 275 ->get(TaskType::Internal)
276 Platform::current()->mainThread()->getWebTaskRunner()->postTask( 276 ->postTask(BLINK_FROM_HERE,
277 BLINK_FROM_HERE, 277 crossThreadBind(
278 crossThreadBind( 278 &WebSharedWorkerImpl::didTerminateWorkerThreadOnMainThread,
279 &WebSharedWorkerImpl::didTerminateWorkerThreadOnMainThread, 279 crossThreadUnretained(this)));
280 crossThreadUnretained(this)));
281 } 280 }
282 281
283 void WebSharedWorkerImpl::didTerminateWorkerThreadOnMainThread() { 282 void WebSharedWorkerImpl::didTerminateWorkerThreadOnMainThread() {
284 m_client->workerContextDestroyed(); 283 m_client->workerContextDestroyed();
285 // The lifetime of this proxy is controlled by the worker context. 284 // The lifetime of this proxy is controlled by the worker context.
286 delete this; 285 delete this;
287 } 286 }
288 287
289 // WorkerLoaderProxyProvider ------------------------------------------------- 288 // WorkerLoaderProxyProvider -------------------------------------------------
290 289
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 if (devtoolsAgent) 444 if (devtoolsAgent)
446 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, 445 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method,
447 message); 446 message);
448 } 447 }
449 448
450 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) { 449 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) {
451 return new WebSharedWorkerImpl(client); 450 return new WebSharedWorkerImpl(client);
452 } 451 }
453 452
454 } // namespace blink 453 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698