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

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

Issue 2546043002: Worker: Fix cross-thread violations on ObjectProxy (Closed)
Patch Set: Created 4 years 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/ThreadedWorkletObjectProxy.h
diff --git a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
index 71e434c714391e72c09bc1f3d33e031a5549a422..4c04c47f9f4515c36c1676144b3238e66ff7c13d 100644
--- a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
+++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
@@ -14,8 +14,8 @@ namespace blink {
class ThreadedWorkletMessagingProxy;
-// A proxy to talk to the parent worklet object. This object is created on the
-// main thread, passed on to the worklet thread, and used just to proxy
+// A proxy to talk to the parent worklet object. This object is created and
+// destroyed on the main thread, and used on the worklet thread for proxying
// messages to the ThreadedWorkletMessagingProxy on the main thread.
// ThreadedWorkletMessagingProxy always outlives this proxy.
class CORE_EXPORT ThreadedWorkletObjectProxy : public WorkerReportingProxy {
@@ -24,7 +24,8 @@ class CORE_EXPORT ThreadedWorkletObjectProxy : public WorkerReportingProxy {
public:
static std::unique_ptr<ThreadedWorkletObjectProxy> create(
- const WeakPtr<ThreadedWorkletMessagingProxy>&);
+ const WeakPtr<ThreadedWorkletMessagingProxy>&,
+ ParentFrameTaskRunners*);
~ThreadedWorkletObjectProxy() override;
void reportPendingActivity(bool hasPendingActivity);
@@ -47,13 +48,18 @@ class CORE_EXPORT ThreadedWorkletObjectProxy : public WorkerReportingProxy {
void didTerminateWorkerThread() override;
protected:
- ThreadedWorkletObjectProxy(const WeakPtr<ThreadedWorkletMessagingProxy>&);
+ ThreadedWorkletObjectProxy(const WeakPtr<ThreadedWorkletMessagingProxy>&,
+ ParentFrameTaskRunners*);
private:
// No guarantees about the lifetimes of tasks posted by this proxy wrt the
// ThreadedWorkletMessagingProxy so a weak pointer must be used when posting
// the tasks.
WeakPtr<ThreadedWorkletMessagingProxy> m_messagingProxyWeakPtr;
+
+ // Used to post a task to ThreadedWorkletMessagingProxy on the parent context
+ // thread.
+ CrossThreadPersistent<ParentFrameTaskRunners> m_parentFrameTaskRunners;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698