OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 WorkerInspectorProxy_h | 5 #ifndef WorkerInspectorProxy_h |
6 #define WorkerInspectorProxy_h | 6 #define WorkerInspectorProxy_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/heap/Handle.h" | |
9 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
10 #include "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class ExecutionContext; | 15 class ExecutionContext; |
15 class KURL; | 16 class KURL; |
16 class WebTraceLocation; | 17 class WebTraceLocation; |
17 class WorkerGlobalScopeProxy; | 18 class WorkerGlobalScopeProxy; |
18 class WorkerThread; | 19 class WorkerThread; |
19 | 20 |
20 // A proxy for talking to the worker inspector on the worker thread. | 21 // A proxy for talking to the worker inspector on the worker thread. |
21 // All of these methods should be called on the main thread. | 22 // All of these methods should be called on the main thread. |
22 class CORE_EXPORT WorkerInspectorProxy final { | 23 class CORE_EXPORT WorkerInspectorProxy final : public NoBaseWillBeGarbageCollect edFinalized<WorkerInspectorProxy> { |
23 public: | 24 public: |
24 static PassOwnPtr<WorkerInspectorProxy> create(); | 25 static PassOwnPtrWillBeRawPtr<WorkerInspectorProxy> create(); |
25 | 26 |
26 ~WorkerInspectorProxy(); | 27 ~WorkerInspectorProxy(); |
28 DECLARE_TRACE(); | |
27 | 29 |
28 class PageInspector { | 30 class PageInspector : public NoBaseWillBeGarbageCollectedFinalized<PageInspe ctor> { |
29 public: | 31 public: |
30 virtual ~PageInspector() { } | 32 virtual ~PageInspector() { } |
31 virtual void dispatchMessageFromWorker(const String&) = 0; | 33 virtual void dispatchMessageFromWorker(const String&) = 0; |
32 virtual void workerConsoleAgentEnabled(WorkerGlobalScopeProxy*) = 0; | 34 virtual void workerConsoleAgentEnabled(WorkerGlobalScopeProxy*) = 0; |
35 DEFINE_INLINE_VIRTUAL_TRACE() { } | |
33 }; | 36 }; |
34 | 37 |
35 void workerThreadCreated(ExecutionContext*, WorkerThread*, const KURL&); | 38 void workerThreadCreated(ExecutionContext*, WorkerThread*, const KURL&); |
36 void workerThreadTerminated(); | 39 void workerThreadTerminated(); |
37 | 40 |
38 void connectToInspector(PageInspector*); | 41 void connectToInspector(PageInspector*); |
39 void disconnectFromInspector(); | 42 void disconnectFromInspector(); |
40 void sendMessageToInspector(const String&); | 43 void sendMessageToInspector(const String&); |
41 void writeTimelineStartedEvent(const String& sessionId, const String& worker Id); | 44 void writeTimelineStartedEvent(const String& sessionId, const String& worker Id); |
42 | 45 |
43 PageInspector* pageInspector() const { return m_pageInspector; } | 46 PageInspector* pageInspector() const { return m_pageInspector; } |
44 | 47 |
45 void setWorkerGlobalScopeProxy(WorkerGlobalScopeProxy* proxy) { m_workerGlob alScopeProxy = proxy; } | 48 void setWorkerGlobalScopeProxy(WorkerGlobalScopeProxy* proxy) { m_workerGlob alScopeProxy = proxy; } |
46 WorkerGlobalScopeProxy* workerGlobalScopeProxy() const { return m_workerGlob alScopeProxy; } | 49 WorkerGlobalScopeProxy* workerGlobalScopeProxy() const { return m_workerGlob alScopeProxy; } |
47 | 50 |
48 private: | 51 private: |
49 WorkerInspectorProxy(); | 52 WorkerInspectorProxy(); |
50 | 53 |
51 void addDebuggerTaskForWorker(const WebTraceLocation&, PassOwnPtr<WebThread: :Task>); | 54 void addDebuggerTaskForWorker(const WebTraceLocation&, PassOwnPtr<WebThread: :Task>); |
52 | 55 |
53 WorkerThread* m_workerThread; | 56 WorkerThread* m_workerThread; |
haraken
2015/07/30 07:47:32
This raw pointer would be safe since the m_workerT
| |
54 ExecutionContext* m_executionContext; | 57 RawPtrWillBeMember<ExecutionContext> m_executionContext; |
55 WorkerInspectorProxy::PageInspector* m_pageInspector; | 58 RawPtrWillBeMember<WorkerInspectorProxy::PageInspector> m_pageInspector; |
56 WorkerGlobalScopeProxy* m_workerGlobalScopeProxy; | 59 WorkerGlobalScopeProxy* m_workerGlobalScopeProxy; |
haraken
2015/07/30 07:47:32
I guess this pointer has a risk of becoming a stal
keishi
2015/08/03 09:35:56
Done.
| |
57 }; | 60 }; |
58 | 61 |
59 } // namespace blink | 62 } // namespace blink |
60 | 63 |
61 #endif // WorkerInspectorProxy_h | 64 #endif // WorkerInspectorProxy_h |
OLD | NEW |