| OLD | NEW |
| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 255 } |
| 256 | 256 |
| 257 void WebEmbeddedWorkerImpl::postTaskToLoader(const WebTraceLocation& location, s
td::unique_ptr<ExecutionContextTask> task) | 257 void WebEmbeddedWorkerImpl::postTaskToLoader(const WebTraceLocation& location, s
td::unique_ptr<ExecutionContextTask> task) |
| 258 { | 258 { |
| 259 // TODO(hiroshige,yuryu): Make this not use ExecutionContextTask and | 259 // TODO(hiroshige,yuryu): Make this not use ExecutionContextTask and |
| 260 // consider using m_mainThreadTaskRunners->get(TaskType::Networking) | 260 // consider using m_mainThreadTaskRunners->get(TaskType::Networking) |
| 261 // instead. | 261 // instead. |
| 262 m_mainFrame->frame()->document()->postTask(location, std::move(task)); | 262 m_mainFrame->frame()->document()->postTask(location, std::move(task)); |
| 263 } | 263 } |
| 264 | 264 |
| 265 bool WebEmbeddedWorkerImpl::postTaskToWorkerGlobalScope(const WebTraceLocation&
location, std::unique_ptr<ExecutionContextTask> task) | 265 void WebEmbeddedWorkerImpl::postTaskToWorkerGlobalScope(const WebTraceLocation&
location, std::unique_ptr<ExecutionContextTask> task) |
| 266 { | 266 { |
| 267 if (m_askedToTerminate || !m_workerThread) | 267 if (m_askedToTerminate || !m_workerThread) |
| 268 return false; | 268 return; |
| 269 | |
| 270 m_workerThread->postTask(location, std::move(task)); | 269 m_workerThread->postTask(location, std::move(task)); |
| 271 return !m_workerThread->terminated(); | |
| 272 } | 270 } |
| 273 | 271 |
| 274 void WebEmbeddedWorkerImpl::prepareShadowPageForLoader() | 272 void WebEmbeddedWorkerImpl::prepareShadowPageForLoader() |
| 275 { | 273 { |
| 276 // Create 'shadow page', which is never displayed and is used mainly to | 274 // Create 'shadow page', which is never displayed and is used mainly to |
| 277 // provide a context for loading on the main thread. | 275 // provide a context for loading on the main thread. |
| 278 // | 276 // |
| 279 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader. | 277 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader. |
| 280 // This code, and probably most of the code in this class should be shared | 278 // This code, and probably most of the code in this class should be shared |
| 281 // with SharedWorker. | 279 // with SharedWorker. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 m_mainThreadTaskRunners = ParentFrameTaskRunners::create(nullptr); | 445 m_mainThreadTaskRunners = ParentFrameTaskRunners::create(nullptr); |
| 448 | 446 |
| 449 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 447 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
| 450 m_loaderProxy = WorkerLoaderProxy::create(this); | 448 m_loaderProxy = WorkerLoaderProxy::create(this); |
| 451 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); | 449 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); |
| 452 m_workerThread->start(std::move(startupData)); | 450 m_workerThread->start(std::move(startupData)); |
| 453 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 451 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
| 454 } | 452 } |
| 455 | 453 |
| 456 } // namespace blink | 454 } // namespace blink |
| OLD | NEW |