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

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

Issue 2806623004: Worker: Introduce per-global-scope task scheduler (Closed)
Patch Set: rebase Created 3 years, 8 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 27 matching lines...) Expand all
38 #include "core/inspector/ConsoleMessage.h" 38 #include "core/inspector/ConsoleMessage.h"
39 #include "core/loader/FrameLoadRequest.h" 39 #include "core/loader/FrameLoadRequest.h"
40 #include "core/loader/ThreadableLoadingContext.h" 40 #include "core/loader/ThreadableLoadingContext.h"
41 #include "core/probe/CoreProbes.h" 41 #include "core/probe/CoreProbes.h"
42 #include "core/workers/ParentFrameTaskRunners.h" 42 #include "core/workers/ParentFrameTaskRunners.h"
43 #include "core/workers/WorkerClients.h" 43 #include "core/workers/WorkerClients.h"
44 #include "core/workers/WorkerGlobalScope.h" 44 #include "core/workers/WorkerGlobalScope.h"
45 #include "core/workers/WorkerInspectorProxy.h" 45 #include "core/workers/WorkerInspectorProxy.h"
46 #include "core/workers/WorkerLoaderProxy.h" 46 #include "core/workers/WorkerLoaderProxy.h"
47 #include "core/workers/WorkerScriptLoader.h" 47 #include "core/workers/WorkerScriptLoader.h"
48 #include "core/workers/WorkerTaskRunners.h"
48 #include "core/workers/WorkerThreadStartupData.h" 49 #include "core/workers/WorkerThreadStartupData.h"
49 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" 50 #include "modules/serviceworkers/ServiceWorkerContainerClient.h"
50 #include "modules/serviceworkers/ServiceWorkerThread.h" 51 #include "modules/serviceworkers/ServiceWorkerThread.h"
51 #include "platform/Histogram.h" 52 #include "platform/Histogram.h"
52 #include "platform/SharedBuffer.h" 53 #include "platform/SharedBuffer.h"
53 #include "platform/heap/Handle.h" 54 #include "platform/heap/Handle.h"
54 #include "platform/loader/fetch/SubstituteData.h" 55 #include "platform/loader/fetch/SubstituteData.h"
55 #include "platform/network/ContentSecurityPolicyParsers.h" 56 #include "platform/network/ContentSecurityPolicyParsers.h"
56 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" 57 #include "platform/network/ContentSecurityPolicyResponseHeaders.h"
57 #include "platform/network/NetworkUtils.h" 58 #include "platform/network/NetworkUtils.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 std::unique_ptr<WTF::CrossThreadClosure> task) { 268 std::unique_ptr<WTF::CrossThreadClosure> task) {
268 main_thread_task_runners_->Get(TaskType::kNetworking) 269 main_thread_task_runners_->Get(TaskType::kNetworking)
269 ->PostTask(BLINK_FROM_HERE, std::move(task)); 270 ->PostTask(BLINK_FROM_HERE, std::move(task));
270 } 271 }
271 272
272 void WebEmbeddedWorkerImpl::PostTaskToWorkerGlobalScope( 273 void WebEmbeddedWorkerImpl::PostTaskToWorkerGlobalScope(
273 const WebTraceLocation& location, 274 const WebTraceLocation& location,
274 std::unique_ptr<WTF::CrossThreadClosure> task) { 275 std::unique_ptr<WTF::CrossThreadClosure> task) {
275 if (asked_to_terminate_ || !worker_thread_) 276 if (asked_to_terminate_ || !worker_thread_)
276 return; 277 return;
277 worker_thread_->PostTask(location, std::move(task)); 278 worker_thread_->GetWorkerTaskRunners()
279 ->Get(TaskType::kNetworking)
280 ->PostTask(location, std::move(task));
278 } 281 }
279 282
280 ThreadableLoadingContext* WebEmbeddedWorkerImpl::GetThreadableLoadingContext() { 283 ThreadableLoadingContext* WebEmbeddedWorkerImpl::GetThreadableLoadingContext() {
281 if (!loading_context_) { 284 if (!loading_context_) {
282 loading_context_ = ThreadableLoadingContext::Create( 285 loading_context_ = ThreadableLoadingContext::Create(
283 *main_frame_->GetFrame()->GetDocument()); 286 *main_frame_->GetFrame()->GetDocument());
284 } 287 }
285 return loading_context_; 288 return loading_context_;
286 } 289 }
287 290
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 loader_proxy_ = WorkerLoaderProxy::Create(this); 479 loader_proxy_ = WorkerLoaderProxy::Create(this);
477 worker_thread_ = 480 worker_thread_ =
478 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); 481 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_);
479 worker_thread_->Start(std::move(startup_data), 482 worker_thread_->Start(std::move(startup_data),
480 main_thread_task_runners_.Get()); 483 main_thread_task_runners_.Get());
481 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), 484 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(),
482 script_url); 485 script_url);
483 } 486 }
484 487
485 } // namespace blink 488 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698