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

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

Issue 2702243003: Disallow cross-thread Persistent<> read access. (Closed)
Patch Set: rebased upto r451733 Created 3 years, 10 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h ('k') | third_party/WebKit/Source/web/WebSharedWorkerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698