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

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

Issue 2555673002: Worker: Refine pending activity management on InProcessWorkerMessagingProxy (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/InProcessWorkerMessagingProxy.h
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h
index 9720acc27b139d52d24eac5f9b63c74cfc6cd8c9..8fa70eccb37b6ab013e885bcef0675ac046e4fcf 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h
@@ -45,9 +45,6 @@ class InProcessWorkerObjectProxy;
class SerializedScriptValue;
class WorkerClients;
-// TODO(nhiroki): "MessagingProxy" is not well-defined term among worker
-// components. Probably we should rename this to something more suitable.
-// (http://crbug.com/603785)
class CORE_EXPORT InProcessWorkerMessagingProxy
: public ThreadedMessagingProxyBase {
WTF_MAKE_NONCOPYABLE(InProcessWorkerMessagingProxy);
@@ -77,6 +74,9 @@ class CORE_EXPORT InProcessWorkerMessagingProxy
// 'virtual' for testing.
virtual void confirmMessageFromWorkerObject();
+
+ // Called from InProcessWorkerObjectProxy when all pending activities on the
+ // worker context are finished. See InProcessWorkerObjectProxy.h for details.
virtual void pendingActivityFinished();
protected:
@@ -101,9 +101,13 @@ class CORE_EXPORT InProcessWorkerMessagingProxy
Vector<std::unique_ptr<ExecutionContextTask>> m_queuedEarlyTasks;
// Unconfirmed messages from the parent context thread to the worker thread.
- unsigned m_unconfirmedMessageCount;
+ // When this is greater than 0, |m_workerGlobalScopeHasPendingActivity| should
+ // be true.
+ unsigned m_unconfirmedMessageCount = 0;
- bool m_workerGlobalScopeMayHavePendingActivity;
+ // Indicates whether there are pending activities (e.g, MessageEvent,
+ // setTimeout) on the worker context.
+ bool m_workerGlobalScopeHasPendingActivity = false;
WeakPtrFactory<InProcessWorkerMessagingProxy> m_weakPtrFactory;
};

Powered by Google App Engine
This is Rietveld 408576698