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

Unified Diff: third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.h

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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.h
diff --git a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.h b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.h
index 09a841d57e6bf69c930f57b84822ea9812728017..308cf11abb1259292a1bf6e907f27ec589f7a952 100644
--- a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.h
+++ b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.h
@@ -8,13 +8,13 @@
#include "core/CoreExport.h"
#include "core/frame/UseCounter.h"
#include "core/inspector/ConsoleTypes.h"
+#include "core/workers/ParentFrameTaskRunners.h"
#include "core/workers/WorkerLoaderProxy.h"
#include "wtf/Forward.h"
namespace blink {
class ExecutionContext;
-class ParentFrameTaskRunners;
class SourceLocation;
class WorkerInspectorProxy;
class WorkerLoaderProxy;
@@ -44,10 +44,12 @@ class CORE_EXPORT ThreadedMessagingProxyBase
// 'virtual' for testing.
virtual void workerThreadTerminated();
+ // Accessed from both the parent thread and the worker.
ExecutionContext* getExecutionContext() const {
return m_executionContext.get();
}
+ // Accessed from both the parent thread and the worker.
ParentFrameTaskRunners* getParentFrameTaskRunners() {
return m_parentFrameTaskRunners.get();
}
@@ -68,7 +70,7 @@ class CORE_EXPORT ThreadedMessagingProxyBase
bool askedToTerminate() const { return m_askedToTerminate; }
PassRefPtr<WorkerLoaderProxy> loaderProxy() { return m_loaderProxy; }
- WorkerInspectorProxy* workerInspectorProxy() {
+ WorkerInspectorProxy* workerInspectorProxy() const {
return m_workerInspectorProxy.get();
}
@@ -90,9 +92,14 @@ class CORE_EXPORT ThreadedMessagingProxyBase
void parentObjectDestroyedInternal();
- Persistent<ExecutionContext> m_executionContext;
+ // Accessed cross-thread when worker thread posts tasks to the parent;
+ // it is not ideal to have ExecutionContext be cross-thread accessible.
+ //
+ // TODO: try to drop the need for the CrossThreadPersistent<>.
+ CrossThreadPersistent<ExecutionContext> m_executionContext;
Persistent<WorkerInspectorProxy> m_workerInspectorProxy;
- Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners;
+ // Accessed cross-thread when worker thread posts tasks to the parent.
+ CrossThreadPersistent<ParentFrameTaskRunners> m_parentFrameTaskRunners;
std::unique_ptr<WorkerThread> m_workerThread;

Powered by Google App Engine
This is Rietveld 408576698