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