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

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

Issue 2171973002: [WIP][worklets] ThreadedWorkletGlobalScope + AnimationWorkletGlobalScope 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/ThreadedWorkletObjectProxy.h
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
similarity index 55%
copy from third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
copy to third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
index d7213448bc955595bcb27967e6283ccf6fbcd12c..4e9472204e0190cbc8e5fb72434ab9c7bb9f45fa 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
+++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
@@ -28,13 +28,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef InProcessWorkerObjectProxy_h
-#define InProcessWorkerObjectProxy_h
+#ifndef ThreadedWorkletObjectProxy_h
+#define ThreadedWorkletObjectProxy_h
#include "core/CoreExport.h"
#include "core/dom/MessagePort.h"
#include "core/workers/WorkerReportingProxy.h"
-#include "platform/Timer.h"
#include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include <memory>
@@ -44,73 +43,47 @@ namespace blink {
class ConsoleMessage;
class ExecutionContext;
class ExecutionContextTask;
-class InProcessWorkerMessagingProxy;
-class ParentFrameTaskRunners;
-class WorkerGlobalScope;
+class ThreadedWorkletMessagingProxy;
class WorkerOrWorkletGlobalScope;
// A proxy to talk to the worker object. This object is created on the
// parent context thread (i.e. usually the main thread), passed on to
-// the worker thread, and used to proxy messages to the
-// InProcessWorkerMessagingProxy on the parent context thread.
-//
-// This also checks pending activities on WorkerGlobalScope and reports a result
-// to the message proxy when an exponential backoff timer is fired.
+// the worker thread, and used just to proxy messages to the
+// ThreadedWorkletMessagingProxy on the parent context thread.
//
// Used only by in-process workers (DedicatedWorker and CompositorWorker.)
-class CORE_EXPORT InProcessWorkerObjectProxy : public WorkerReportingProxy {
- USING_FAST_MALLOC(InProcessWorkerObjectProxy);
- WTF_MAKE_NONCOPYABLE(InProcessWorkerObjectProxy);
+class CORE_EXPORT ThreadedWorkletObjectProxy : public WorkerReportingProxy {
+ USING_FAST_MALLOC(ThreadedWorkletObjectProxy);
+ WTF_MAKE_NONCOPYABLE(ThreadedWorkletObjectProxy);
+
public:
- static std::unique_ptr<InProcessWorkerObjectProxy> create(InProcessWorkerMessagingProxy*);
- ~InProcessWorkerObjectProxy() override;
+ static std::unique_ptr<ThreadedWorkletObjectProxy> create(ThreadedWorkletMessagingProxy*);
+ ~ThreadedWorkletObjectProxy() override {}
- void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>);
void postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask>);
- void confirmMessageFromWorkerObject();
- void startPendingActivityTimer();
+ // void confirmMessageFromWorkerObject(bool hasPendingActivity);
+ void reportPendingActivity(bool hasPendingActivity);
// WorkerReportingProxy overrides.
- void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>, int exceptionId) override;
+ void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>, int exceptionId) override {}
void reportConsoleMessage(MessageSource, MessageLevel, const String& message, SourceLocation*) override;
void postMessageToPageInspector(const String&) override;
- void didEvaluateWorkerScript(bool success) override;
- void workerGlobalScopeStarted(WorkerOrWorkletGlobalScope*) override;
+ void didEvaluateWorkerScript(bool success) override {}
+ void workerGlobalScopeStarted(WorkerOrWorkletGlobalScope*) override {}
void workerGlobalScopeClosed() override;
void workerThreadTerminated() override;
- void willDestroyWorkerGlobalScope() override;
+ void willDestroyWorkerGlobalScope() override {}
protected:
- InProcessWorkerObjectProxy(InProcessWorkerMessagingProxy*);
- virtual ExecutionContext* getExecutionContext();
+ ThreadedWorkletObjectProxy(ThreadedWorkletMessagingProxy*);
private:
- friend class InProcessWorkerMessagingProxyForTest;
-
- void checkPendingActivity(TimerBase*);
-
- // Returns the parent frame's task runners.
- ParentFrameTaskRunners* getParentFrameTaskRunners();
+ ExecutionContext* getExecutionContext() const;
// This object always outlives this proxy.
- InProcessWorkerMessagingProxy* m_messagingProxy;
-
- // Used for checking pending activities on the worker global scope. This is
- // cancelled when the worker global scope is destroyed.
- std::unique_ptr<Timer<InProcessWorkerObjectProxy>> m_timer;
-
- // The next interval duration of the timer. This is initially set to
- // kDefaultIntervalInSec and exponentially increased up to
- // |m_maxIntervalInSec|.
- double m_nextIntervalInSec;
-
- // The max interval duration of the timer. This is usually kMaxIntervalInSec
- // but made as a member variable for testing.
- double m_maxIntervalInSec;
-
- Persistent<WorkerGlobalScope> m_workerGlobalScope;
+ ThreadedWorkletMessagingProxy* m_messagingProxy;
};
} // namespace blink
-#endif // InProcessWorkerObjectProxy_h
+#endif // ThreadedWorkletObjectProxy_h

Powered by Google App Engine
This is Rietveld 408576698