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 "core/inspector/ConsoleMessage.h" | 9 #include "core/inspector/ConsoleMessage.h" |
10 #include "core/workers/WorkerThread.h" | 10 #include "core/workers/WorkerThread.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "platform/wtf/Forward.h" | 12 #include "platform/wtf/Forward.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class Document; | 16 class ExecutionContext; |
17 class KURL; | 17 class KURL; |
18 | 18 |
19 // A proxy for talking to the worker inspector on the worker thread. | 19 // A proxy for talking to the worker inspector on the worker thread. |
20 // All of these methods should be called on the main thread. | 20 // All of these methods should be called on the main thread. |
21 class CORE_EXPORT WorkerInspectorProxy final | 21 class CORE_EXPORT WorkerInspectorProxy final |
22 : public GarbageCollectedFinalized<WorkerInspectorProxy> { | 22 : public GarbageCollectedFinalized<WorkerInspectorProxy> { |
23 public: | 23 public: |
24 static WorkerInspectorProxy* Create(); | 24 static WorkerInspectorProxy* Create(); |
25 | 25 |
26 ~WorkerInspectorProxy(); | 26 ~WorkerInspectorProxy(); |
27 DECLARE_TRACE(); | 27 DECLARE_TRACE(); |
28 | 28 |
29 class CORE_EXPORT PageInspector { | 29 class CORE_EXPORT PageInspector { |
30 public: | 30 public: |
31 virtual ~PageInspector() {} | 31 virtual ~PageInspector() {} |
32 virtual void DispatchMessageFromWorker(WorkerInspectorProxy*, | 32 virtual void DispatchMessageFromWorker(WorkerInspectorProxy*, |
33 const String&) = 0; | 33 const String&) = 0; |
34 }; | 34 }; |
35 | 35 |
36 WorkerThreadStartMode WorkerStartMode(Document*); | 36 WorkerThreadStartMode WorkerStartMode(ExecutionContext*); |
37 void WorkerThreadCreated(Document*, WorkerThread*, const KURL&); | 37 void WorkerThreadCreated(ExecutionContext*, WorkerThread*, const KURL&); |
38 void WorkerThreadTerminated(); | 38 void WorkerThreadTerminated(); |
39 void DispatchMessageFromWorker(const String&); | 39 void DispatchMessageFromWorker(const String&); |
40 void AddConsoleMessageFromWorker(MessageLevel, | 40 void AddConsoleMessageFromWorker(MessageLevel, |
41 const String& message, | 41 const String& message, |
42 std::unique_ptr<SourceLocation>); | 42 std::unique_ptr<SourceLocation>); |
43 | 43 |
44 void ConnectToInspector(PageInspector*); | 44 void ConnectToInspector(PageInspector*); |
45 void DisconnectFromInspector(PageInspector*); | 45 void DisconnectFromInspector(PageInspector*); |
46 void SendMessageToInspector(const String&); | 46 void SendMessageToInspector(const String&); |
47 void WriteTimelineStartedEvent(const String& session_id); | 47 void WriteTimelineStartedEvent(const String& session_id); |
48 | 48 |
49 const String& Url() { return url_; } | 49 const String& Url() { return url_; } |
50 Document* GetDocument() { return document_; } | 50 ExecutionContext* GetExecutionContext() { return execution_context_; } |
51 const String& InspectorId(); | 51 const String& InspectorId(); |
52 | 52 |
53 using WorkerInspectorProxySet = | 53 using WorkerInspectorProxySet = |
54 PersistentHeapHashSet<WeakMember<WorkerInspectorProxy>>; | 54 PersistentHeapHashSet<WeakMember<WorkerInspectorProxy>>; |
55 static const WorkerInspectorProxySet& AllProxies(); | 55 static const WorkerInspectorProxySet& AllProxies(); |
56 | 56 |
57 private: | 57 private: |
58 WorkerInspectorProxy(); | 58 WorkerInspectorProxy(); |
59 | 59 |
60 WorkerThread* worker_thread_; | 60 WorkerThread* worker_thread_; |
61 Member<Document> document_; | 61 Member<ExecutionContext> execution_context_; |
62 PageInspector* page_inspector_; | 62 PageInspector* page_inspector_; |
63 String url_; | 63 String url_; |
64 String inspector_id_; | 64 String inspector_id_; |
65 }; | 65 }; |
66 | 66 |
67 } // namespace blink | 67 } // namespace blink |
68 | 68 |
69 #endif // WorkerInspectorProxy_h | 69 #endif // WorkerInspectorProxy_h |
OLD | NEW |