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

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

Issue 2124693002: Worker: Fix broken GC logic on Dedicated Worker while DOMTimer is set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/InProcessWorkerObjectProxy.h
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
index 84705fe742dce77e1449b17726e602e3163bad4f..34042c793451bfe2d34d1f6234cf561c9de5924b 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
@@ -35,6 +35,7 @@
#include "core/dom/MessagePort.h"
#include "core/workers/WorkerReportingProxy.h"
#include "platform/heap/Handle.h"
+#include "wtf/MakeCancellable.h"
#include "wtf/PassRefPtr.h"
#include <memory>
@@ -57,12 +58,12 @@ class CORE_EXPORT InProcessWorkerObjectProxy : public WorkerReportingProxy {
WTF_MAKE_NONCOPYABLE(InProcessWorkerObjectProxy);
public:
static std::unique_ptr<InProcessWorkerObjectProxy> create(InProcessWorkerMessagingProxy*);
- ~InProcessWorkerObjectProxy() override { }
+ ~InProcessWorkerObjectProxy() override;
void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>);
void postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask>);
- void confirmMessageFromWorkerObject(bool hasPendingActivity);
- void reportPendingActivity(bool hasPendingActivity);
+ void confirmMessageFromWorkerObject();
+ void reportPendingActivity(WorkerGlobalScope*);
// WorkerReportingProxy overrides.
void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>, int exceptionId) override;
@@ -72,15 +73,27 @@ public:
void workerGlobalScopeStarted(WorkerOrWorkletGlobalScope*) override { }
void workerGlobalScopeClosed() override;
void workerThreadTerminated() override;
- void willDestroyWorkerGlobalScope() override { }
+ void willDestroyWorkerGlobalScope() override;
protected:
InProcessWorkerObjectProxy(InProcessWorkerMessagingProxy*);
virtual ExecutionContext* getExecutionContext();
private:
+ friend class InProcessWorkerMessagingProxyForTest;
+
// This object always outlives this proxy.
InProcessWorkerMessagingProxy* m_messagingProxy;
+
+ // Used for scheduling a task to check pending activities on the worker
+ // global scope. The task is scheduled as a delayed task with
+ // |m_currentDelayToCheckPendingActivityInMs| delay. The delay is
+ // exponetially increased up to |m_maxDelayToCheckPendingActivityInMs|
+ // until all pending activities are done. The task is cancelled when the
+ // worker global scoped is destroyed.
+ WTF::ScopedFunctionCanceller m_taskCanceller;
+ long long m_currentDelayToCheckPendingActivityInMs;
+ long long m_maxDelayToCheckPendingActivityInMs;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698