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 CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "content/public/browser/devtools_agent_host.h" | 14 #include "content/public/browser/devtools_agent_host.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
| 18 class BrowserContext; |
18 class DevToolsAgentHostImpl; | 19 class DevToolsAgentHostImpl; |
19 class ServiceWorkerDevToolsAgentHost; | 20 class ServiceWorkerDevToolsAgentHost; |
20 class ServiceWorkerContextCore; | 21 class ServiceWorkerContextCore; |
21 | 22 |
22 // Manages WorkerDevToolsAgentHost's for Service Workers. | 23 // Manages WorkerDevToolsAgentHost's for Service Workers. |
23 // This class lives on UI thread. | 24 // This class lives on UI thread. |
24 class CONTENT_EXPORT ServiceWorkerDevToolsManager { | 25 class CONTENT_EXPORT ServiceWorkerDevToolsManager { |
25 public: | 26 public: |
26 using WorkerId = std::pair<int, int>; | 27 using WorkerId = std::pair<int, int>; |
27 using AgentList = std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>; | 28 using AgentList = std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const GURL url_; | 65 const GURL url_; |
65 }; | 66 }; |
66 | 67 |
67 // Returns the ServiceWorkerDevToolsManager singleton. | 68 // Returns the ServiceWorkerDevToolsManager singleton. |
68 static ServiceWorkerDevToolsManager* GetInstance(); | 69 static ServiceWorkerDevToolsManager* GetInstance(); |
69 | 70 |
70 DevToolsAgentHostImpl* GetDevToolsAgentHostForWorker(int worker_process_id, | 71 DevToolsAgentHostImpl* GetDevToolsAgentHostForWorker(int worker_process_id, |
71 int worker_route_id); | 72 int worker_route_id); |
72 void AddAllAgentHosts( | 73 void AddAllAgentHosts( |
73 std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>* result); | 74 std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>* result); |
| 75 void AddAllAgentHostsForBrowserContext( |
| 76 BrowserContext* browser_context, |
| 77 std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>* result); |
74 | 78 |
75 // Returns true when the worker must be paused on start because a DevTool | 79 // Returns true when the worker must be paused on start because a DevTool |
76 // window for the same former ServiceWorkerIdentifier is still opened or | 80 // window for the same former ServiceWorkerIdentifier is still opened or |
77 // debug-on-start is enabled in chrome://serviceworker-internals. | 81 // debug-on-start is enabled in chrome://serviceworker-internals. |
78 bool WorkerCreated(int worker_process_id, | 82 bool WorkerCreated(int worker_process_id, |
79 int worker_route_id, | 83 int worker_route_id, |
80 const ServiceWorkerIdentifier& service_worker_id); | 84 const ServiceWorkerIdentifier& service_worker_id); |
81 void WorkerReadyForInspection(int worker_process_id, int worker_route_id); | 85 void WorkerReadyForInspection(int worker_process_id, int worker_route_id); |
82 void WorkerStopIgnored(int worker_process_id, int worker_route_id); | 86 void WorkerStopIgnored(int worker_process_id, int worker_route_id); |
83 void WorkerDestroyed(int worker_process_id, int worker_route_id); | 87 void WorkerDestroyed(int worker_process_id, int worker_route_id); |
(...skipping 25 matching lines...) Expand all Loading... |
109 ObserverList<Observer> observer_list_; | 113 ObserverList<Observer> observer_list_; |
110 AgentHostMap workers_; | 114 AgentHostMap workers_; |
111 bool debug_service_worker_on_start_; | 115 bool debug_service_worker_on_start_; |
112 | 116 |
113 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDevToolsManager); | 117 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDevToolsManager); |
114 }; | 118 }; |
115 | 119 |
116 } // namespace content | 120 } // namespace content |
117 | 121 |
118 #endif // CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_ | 122 #endif // CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_ |
OLD | NEW |