OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ThreadedObjectProxyBase_h |
| 6 #define ThreadedObjectProxyBase_h |
| 7 |
| 8 #include "bindings/core/v8/SourceLocation.h" |
| 9 #include "core/CoreExport.h" |
| 10 #include "core/dom/MessagePort.h" |
| 11 #include "core/workers/WorkerReportingProxy.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class ThreadedMessagingProxyBase; |
| 16 |
| 17 // A proxy to talk to the parent object. This object is created and destroyed on |
| 18 // the main thread, and used on the worker thread for proxying messages to the |
| 19 // ThreadedMessagingProxyBase on the main thread. ThreadedMessagingProxyBase |
| 20 // always outlives this proxy. |
| 21 class CORE_EXPORT ThreadedObjectProxyBase : public WorkerReportingProxy { |
| 22 USING_FAST_MALLOC(ThreadedObjectProxyBase); |
| 23 WTF_MAKE_NONCOPYABLE(ThreadedObjectProxyBase); |
| 24 |
| 25 public: |
| 26 ~ThreadedObjectProxyBase() override = default; |
| 27 |
| 28 void reportPendingActivity(bool hasPendingActivity); |
| 29 |
| 30 // WorkerReportingProxy overrides. |
| 31 void countFeature(UseCounter::Feature) override{}; |
| 32 void countDeprecation(UseCounter::Feature) override{}; |
| 33 void reportConsoleMessage(MessageSource, |
| 34 MessageLevel, |
| 35 const String& message, |
| 36 SourceLocation*) override; |
| 37 void postMessageToPageInspector(const String&) override; |
| 38 ParentFrameTaskRunners* getParentFrameTaskRunners() override; |
| 39 void didCloseWorkerGlobalScope() override; |
| 40 void didTerminateWorkerThread() override; |
| 41 |
| 42 protected: |
| 43 explicit ThreadedObjectProxyBase(ParentFrameTaskRunners*); |
| 44 virtual WeakPtr<ThreadedMessagingProxyBase> messagingProxyWeakPtr() = 0; |
| 45 |
| 46 private: |
| 47 // Used to post a task to ThreadedMessagingProxyBase on the parent context |
| 48 // thread. |
| 49 CrossThreadPersistent<ParentFrameTaskRunners> m_parentFrameTaskRunners; |
| 50 }; |
| 51 |
| 52 } // namespace blink |
| 53 |
| 54 #endif // ThreadedObjectProxyBase_h |
OLD | NEW |