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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 message.columnNumber, nullptr))); | 256 message.columnNumber, nullptr))); |
257 } | 257 } |
258 | 258 |
259 void WebEmbeddedWorkerImpl::postMessageToPageInspector(const String& message) { | 259 void WebEmbeddedWorkerImpl::postMessageToPageInspector(const String& message) { |
260 m_workerInspectorProxy->dispatchMessageFromWorker(message); | 260 m_workerInspectorProxy->dispatchMessageFromWorker(message); |
261 } | 261 } |
262 | 262 |
263 void WebEmbeddedWorkerImpl::postTaskToLoader( | 263 void WebEmbeddedWorkerImpl::postTaskToLoader( |
264 const WebTraceLocation& location, | 264 const WebTraceLocation& location, |
265 std::unique_ptr<ExecutionContextTask> task) { | 265 std::unique_ptr<ExecutionContextTask> task) { |
| 266 // This cross-thread operation is brittle wrt per-thread heaps, |
| 267 // posting a task to main-thread owned objects. |
266 m_mainThreadTaskRunners->get(TaskType::Networking) | 268 m_mainThreadTaskRunners->get(TaskType::Networking) |
267 ->postTask( | 269 ->postTask( |
268 BLINK_FROM_HERE, | 270 BLINK_FROM_HERE, |
269 crossThreadBind( | 271 crossThreadBind( |
270 &ExecutionContextTask::performTaskIfContextIsValid, | 272 &ExecutionContextTask::performTaskIfContextIsValid, |
271 WTF::passed(std::move(task)), | 273 WTF::passed(std::move(task)), |
272 wrapCrossThreadWeakPersistent(m_mainFrame->frame()->document()))); | 274 wrapCrossThreadWeakPersistent(m_mainFrame->frame()->document()))); |
273 } | 275 } |
274 | 276 |
275 void WebEmbeddedWorkerImpl::postTaskToWorkerGlobalScope( | 277 void WebEmbeddedWorkerImpl::postTaskToWorkerGlobalScope( |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 *this, *document, *m_workerContextClient); | 477 *this, *document, *m_workerContextClient); |
476 m_loaderProxy = WorkerLoaderProxy::create(this); | 478 m_loaderProxy = WorkerLoaderProxy::create(this); |
477 m_workerThread = ServiceWorkerThread::create( | 479 m_workerThread = ServiceWorkerThread::create( |
478 m_loaderProxy, *m_workerGlobalScopeProxy, m_mainThreadTaskRunners.get()); | 480 m_loaderProxy, *m_workerGlobalScopeProxy, m_mainThreadTaskRunners.get()); |
479 m_workerThread->start(std::move(startupData)); | 481 m_workerThread->start(std::move(startupData)); |
480 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), | 482 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), |
481 scriptURL); | 483 scriptURL); |
482 } | 484 } |
483 | 485 |
484 } // namespace blink | 486 } // namespace blink |
OLD | NEW |