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

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

Issue 2566623002: Worker: Factor out common functions into ThreadedObjectProxyBase (Closed)
Patch Set: fix layout tests 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/ThreadedObjectProxyBase.h
diff --git a/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h b/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..9bc7176b2b519c762167f0d4a4fc20498b2267fd
--- /dev/null
+++ b/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h
@@ -0,0 +1,54 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ThreadedObjectProxyBase_h
+#define ThreadedObjectProxyBase_h
+
+#include "bindings/core/v8/SourceLocation.h"
+#include "core/CoreExport.h"
+#include "core/dom/MessagePort.h"
+#include "core/workers/WorkerReportingProxy.h"
+
+namespace blink {
+
+class ThreadedMessagingProxyBase;
+
+// A proxy to talk to the parent object. This object is created and destroyed on
+// the main thread, and used on the worker thread for proxying messages to the
+// ThreadedMessagingProxyBase on the main thread. ThreadedMessagingProxyBase
+// always outlives this proxy.
+class CORE_EXPORT ThreadedObjectProxyBase : public WorkerReportingProxy {
+ USING_FAST_MALLOC(ThreadedObjectProxyBase);
+ WTF_MAKE_NONCOPYABLE(ThreadedObjectProxyBase);
+
+ public:
+ ~ThreadedObjectProxyBase() override = default;
+
+ void reportPendingActivity(bool hasPendingActivity);
+
+ // WorkerReportingProxy overrides.
+ void countFeature(UseCounter::Feature) override{};
+ void countDeprecation(UseCounter::Feature) override{};
+ void reportConsoleMessage(MessageSource,
+ MessageLevel,
+ const String& message,
+ SourceLocation*) override;
+ void postMessageToPageInspector(const String&) override;
+ ParentFrameTaskRunners* getParentFrameTaskRunners() override;
+ void didCloseWorkerGlobalScope() override;
+ void didTerminateWorkerThread() override;
+
+ protected:
+ explicit ThreadedObjectProxyBase(ParentFrameTaskRunners*);
+ virtual WeakPtr<ThreadedMessagingProxyBase> messagingProxyWeakPtr() = 0;
+
+ private:
+ // Used to post a task to ThreadedMessagingProxyBase on the parent context
+ // thread.
+ CrossThreadPersistent<ParentFrameTaskRunners> m_parentFrameTaskRunners;
+};
+
+} // namespace blink
+
+#endif // ThreadedObjectProxyBase_h

Powered by Google App Engine
This is Rietveld 408576698