OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_MANAGER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_MANAGER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "content/browser/worker_host/worker_process_host.h" | 14 #include "content/browser/worker_host/worker_process_host.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class DevToolsAgentHost; | 19 class DevToolsAgentHost; |
20 | 20 |
21 // All methods are supposed to be called on the IO thread. | 21 // All methods are supposed to be called on the IO thread. |
| 22 // This class is not used when "enable-embedded-shared-worker" flag is set. |
22 class WorkerDevToolsManager { | 23 class WorkerDevToolsManager { |
23 public: | 24 public: |
24 typedef std::pair<int, int> WorkerId; | 25 typedef std::pair<int, int> WorkerId; |
25 class WorkerDevToolsAgentHost; | 26 class WorkerDevToolsAgentHost; |
26 | 27 |
27 // Returns the WorkerDevToolsManager singleton. | 28 // Returns the WorkerDevToolsManager singleton. |
28 static WorkerDevToolsManager* GetInstance(); | 29 static WorkerDevToolsManager* GetInstance(); |
29 | 30 |
30 // Called on the UI thread. | 31 // Called on the UI thread. |
31 static DevToolsAgentHost* GetDevToolsAgentHostForWorker( | 32 static DevToolsAgentHost* GetDevToolsAgentHostForWorker( |
32 int worker_process_id, | 33 int worker_process_id, |
33 int worker_route_id); | 34 int worker_route_id); |
34 | 35 |
35 void ForwardToDevToolsClient(int worker_process_id, | 36 void ForwardToDevToolsClient(int worker_process_id, |
36 int worker_route_id, | 37 int worker_route_id, |
37 const std::string& message); | 38 const std::string& message); |
38 void SaveAgentRuntimeState(int worker_process_id, | 39 void SaveAgentRuntimeState(int worker_process_id, |
39 int worker_route_id, | 40 int worker_route_id, |
40 const std::string& state); | 41 const std::string& state); |
41 | 42 |
42 // Called on the IO thread. | 43 // Called on the IO thread. |
43 // Returns true when the worker must be paused on start. | 44 // Returns true when the worker must be paused on start. |
44 bool WorkerCreated( | 45 bool WorkerCreated(WorkerProcessHost* process, |
45 WorkerProcessHost* process, | 46 const WorkerProcessHost::WorkerInstance& instance); |
46 const WorkerProcessHost::WorkerInstance& instance); | |
47 void WorkerDestroyed(WorkerProcessHost* process, int worker_route_id); | 47 void WorkerDestroyed(WorkerProcessHost* process, int worker_route_id); |
48 void WorkerContextStarted(WorkerProcessHost* process, int worker_route_id); | 48 void WorkerContextStarted(WorkerProcessHost* process, int worker_route_id); |
49 | 49 |
50 private: | 50 private: |
51 friend struct DefaultSingletonTraits<WorkerDevToolsManager>; | 51 friend struct DefaultSingletonTraits<WorkerDevToolsManager>; |
52 class DetachedClientHosts; | 52 class DetachedClientHosts; |
53 struct InspectedWorker; | 53 struct InspectedWorker; |
54 typedef std::list<InspectedWorker> InspectedWorkersList; | 54 typedef std::list<InspectedWorker> InspectedWorkersList; |
55 | 55 |
56 WorkerDevToolsManager(); | 56 WorkerDevToolsManager(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // worker. | 101 // worker. |
102 // - Existing DevTools client was reattached to the new worker. | 102 // - Existing DevTools client was reattached to the new worker. |
103 PausedWorkers paused_workers_; | 103 PausedWorkers paused_workers_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsManager); | 105 DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsManager); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace content | 108 } // namespace content |
109 | 109 |
110 #endif // CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_MANAGER_H_ | 110 #endif // CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_MANAGER_H_ |
OLD | NEW |