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

Unified Diff: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.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/web/WebEmbeddedWorkerImpl.h
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h
index 71295710b7d0f3a234fa9feeabc0dba07f65975c..e407dd80db180cae4d7a44c9238b650002ec4a22 100644
--- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h
+++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h
@@ -122,7 +122,9 @@ class WebEmbeddedWorkerImpl final : public WebEmbeddedWorker,
// Kept around only while main script loading is ongoing.
RefPtr<WorkerScriptLoader> m_mainScriptLoader;
- Persistent<ParentFrameTaskRunners> m_mainThreadTaskRunners;
+ // Owned by the main thread, but will be accessed by the worker when
+ // posting tasks.
+ CrossThreadPersistent<ParentFrameTaskRunners> m_mainThreadTaskRunners;
std::unique_ptr<WorkerThread> m_workerThread;
RefPtr<WorkerLoaderProxy> m_loaderProxy;
@@ -134,7 +136,11 @@ class WebEmbeddedWorkerImpl final : public WebEmbeddedWorker,
// deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they
// are guaranteed to exist while this object is around.
WebView* m_webView;
- Persistent<WebLocalFrameImpl> m_mainFrame;
+
+ // Accessed cross-thread when worker thread posts tasks to the parent.
+ //
+ // TODO: avoid reaching into the local frame object when posting.
+ CrossThreadPersistent<WebLocalFrameImpl> m_mainFrame;
bool m_loadingShadowPage;
bool m_askedToTerminate;
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Persistent.h ('k') | third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698