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 28 matching lines...) Expand all Loading... |
39 #include "core/loader/ThreadableLoadingContext.h" | 39 #include "core/loader/ThreadableLoadingContext.h" |
40 #include "core/probe/CoreProbes.h" | 40 #include "core/probe/CoreProbes.h" |
41 #include "core/workers/ParentFrameTaskRunners.h" | 41 #include "core/workers/ParentFrameTaskRunners.h" |
42 #include "core/workers/SharedWorkerGlobalScope.h" | 42 #include "core/workers/SharedWorkerGlobalScope.h" |
43 #include "core/workers/SharedWorkerThread.h" | 43 #include "core/workers/SharedWorkerThread.h" |
44 #include "core/workers/WorkerClients.h" | 44 #include "core/workers/WorkerClients.h" |
45 #include "core/workers/WorkerGlobalScope.h" | 45 #include "core/workers/WorkerGlobalScope.h" |
46 #include "core/workers/WorkerInspectorProxy.h" | 46 #include "core/workers/WorkerInspectorProxy.h" |
47 #include "core/workers/WorkerLoaderProxy.h" | 47 #include "core/workers/WorkerLoaderProxy.h" |
48 #include "core/workers/WorkerScriptLoader.h" | 48 #include "core/workers/WorkerScriptLoader.h" |
| 49 #include "core/workers/WorkerTaskRunners.h" |
49 #include "core/workers/WorkerThreadStartupData.h" | 50 #include "core/workers/WorkerThreadStartupData.h" |
50 #include "platform/CrossThreadFunctional.h" | 51 #include "platform/CrossThreadFunctional.h" |
51 #include "platform/heap/Handle.h" | 52 #include "platform/heap/Handle.h" |
52 #include "platform/heap/Persistent.h" | 53 #include "platform/heap/Persistent.h" |
53 #include "platform/loader/fetch/ResourceResponse.h" | 54 #include "platform/loader/fetch/ResourceResponse.h" |
54 #include "platform/network/ContentSecurityPolicyParsers.h" | 55 #include "platform/network/ContentSecurityPolicyParsers.h" |
55 #include "platform/weborigin/KURL.h" | 56 #include "platform/weborigin/KURL.h" |
56 #include "platform/weborigin/SecurityOrigin.h" | 57 #include "platform/weborigin/SecurityOrigin.h" |
57 #include "platform/wtf/Functional.h" | 58 #include "platform/wtf/Functional.h" |
58 #include "platform/wtf/PtrUtil.h" | 59 #include "platform/wtf/PtrUtil.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 std::unique_ptr<WTF::CrossThreadClosure> task) { | 248 std::unique_ptr<WTF::CrossThreadClosure> task) { |
248 DCHECK(worker_thread_->IsCurrentThread()); | 249 DCHECK(worker_thread_->IsCurrentThread()); |
249 parent_frame_task_runners_->Get(TaskType::kNetworking) | 250 parent_frame_task_runners_->Get(TaskType::kNetworking) |
250 ->PostTask(FROM_HERE, std::move(task)); | 251 ->PostTask(FROM_HERE, std::move(task)); |
251 } | 252 } |
252 | 253 |
253 void WebSharedWorkerImpl::PostTaskToWorkerGlobalScope( | 254 void WebSharedWorkerImpl::PostTaskToWorkerGlobalScope( |
254 const WebTraceLocation& location, | 255 const WebTraceLocation& location, |
255 std::unique_ptr<WTF::CrossThreadClosure> task) { | 256 std::unique_ptr<WTF::CrossThreadClosure> task) { |
256 DCHECK(IsMainThread()); | 257 DCHECK(IsMainThread()); |
257 worker_thread_->PostTask(location, std::move(task)); | 258 GetWorkerThread() |
| 259 ->GetWorkerTaskRunners() |
| 260 ->Get(TaskType::kNetworking) |
| 261 ->PostTask(location, std::move(task)); |
258 } | 262 } |
259 | 263 |
260 ThreadableLoadingContext* WebSharedWorkerImpl::GetThreadableLoadingContext() { | 264 ThreadableLoadingContext* WebSharedWorkerImpl::GetThreadableLoadingContext() { |
261 if (!loading_context_) { | 265 if (!loading_context_) { |
262 loading_context_ = | 266 loading_context_ = |
263 ThreadableLoadingContext::Create(*ToDocument(loading_document_.Get())); | 267 ThreadableLoadingContext::Create(*ToDocument(loading_document_.Get())); |
264 } | 268 } |
265 return loading_context_; | 269 return loading_context_; |
266 } | 270 } |
267 | 271 |
268 void WebSharedWorkerImpl::Connect( | 272 void WebSharedWorkerImpl::Connect( |
269 std::unique_ptr<WebMessagePortChannel> web_channel) { | 273 std::unique_ptr<WebMessagePortChannel> web_channel) { |
270 DCHECK(IsMainThread()); | 274 DCHECK(IsMainThread()); |
271 GetWorkerThread()->PostTask( | 275 GetWorkerThread() |
272 BLINK_FROM_HERE, | 276 ->GetWorkerTaskRunners() |
273 CrossThreadBind(&WebSharedWorkerImpl::ConnectTaskOnWorkerThread, | 277 ->Get(TaskType::kDOMManipulation) |
274 WTF::CrossThreadUnretained(this), | 278 ->PostTask( |
275 WTF::Passed(std::move(web_channel)))); | 279 BLINK_FROM_HERE, |
| 280 CrossThreadBind(&WebSharedWorkerImpl::ConnectTaskOnWorkerThread, |
| 281 WTF::CrossThreadUnretained(this), |
| 282 WTF::Passed(std::move(web_channel)))); |
276 } | 283 } |
277 | 284 |
278 void WebSharedWorkerImpl::ConnectTaskOnWorkerThread( | 285 void WebSharedWorkerImpl::ConnectTaskOnWorkerThread( |
279 std::unique_ptr<WebMessagePortChannel> channel) { | 286 std::unique_ptr<WebMessagePortChannel> channel) { |
280 // Wrap the passed-in channel in a MessagePort, and send it off via a connect | 287 // Wrap the passed-in channel in a MessagePort, and send it off via a connect |
281 // event. | 288 // event. |
282 DCHECK(worker_thread_->IsCurrentThread()); | 289 DCHECK(worker_thread_->IsCurrentThread()); |
283 WorkerGlobalScope* worker_global_scope = | 290 WorkerGlobalScope* worker_global_scope = |
284 ToWorkerGlobalScope(worker_thread_->GlobalScope()); | 291 ToWorkerGlobalScope(worker_thread_->GlobalScope()); |
285 MessagePort* port = MessagePort::Create(*worker_global_scope); | 292 MessagePort* port = MessagePort::Create(*worker_global_scope); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 if (devtools_agent) | 428 if (devtools_agent) |
422 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, | 429 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, |
423 message); | 430 message); |
424 } | 431 } |
425 | 432 |
426 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { | 433 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { |
427 return new WebSharedWorkerImpl(client); | 434 return new WebSharedWorkerImpl(client); |
428 } | 435 } |
429 | 436 |
430 } // namespace blink | 437 } // namespace blink |
OLD | NEW |