| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "content/public/browser/devtools_agent_host.h" | 16 #include "content/public/browser/devtools_agent_host.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class BrowserContext; | 20 class BrowserContext; |
| 21 class DevToolsAgentHostImpl; | |
| 22 class ServiceWorkerDevToolsAgentHost; | 21 class ServiceWorkerDevToolsAgentHost; |
| 23 class ServiceWorkerContextCore; | 22 class ServiceWorkerContextCore; |
| 24 | 23 |
| 25 // Manages WorkerDevToolsAgentHost's for Service Workers. | 24 // Manages WorkerDevToolsAgentHost's for Service Workers. |
| 26 // This class lives on UI thread. | 25 // This class lives on UI thread. |
| 27 class CONTENT_EXPORT ServiceWorkerDevToolsManager { | 26 class CONTENT_EXPORT ServiceWorkerDevToolsManager { |
| 28 public: | 27 public: |
| 29 using WorkerId = std::pair<int, int>; | 28 using WorkerId = std::pair<int, int>; |
| 30 using AgentList = std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>; | 29 using AgentList = std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>; |
| 31 | 30 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const ServiceWorkerContextCore* const context_; | 66 const ServiceWorkerContextCore* const context_; |
| 68 const base::WeakPtr<ServiceWorkerContextCore> context_weak_; | 67 const base::WeakPtr<ServiceWorkerContextCore> context_weak_; |
| 69 const int64_t version_id_; | 68 const int64_t version_id_; |
| 70 const GURL url_; | 69 const GURL url_; |
| 71 const GURL scope_; | 70 const GURL scope_; |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 // Returns the ServiceWorkerDevToolsManager singleton. | 73 // Returns the ServiceWorkerDevToolsManager singleton. |
| 75 static ServiceWorkerDevToolsManager* GetInstance(); | 74 static ServiceWorkerDevToolsManager* GetInstance(); |
| 76 | 75 |
| 77 DevToolsAgentHostImpl* GetDevToolsAgentHostForWorker(int worker_process_id, | 76 ServiceWorkerDevToolsAgentHost* GetDevToolsAgentHostForWorker( |
| 78 int worker_route_id); | 77 int worker_process_id, |
| 78 int worker_route_id); |
| 79 void AddAllAgentHosts( | 79 void AddAllAgentHosts( |
| 80 std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>* result); | 80 std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>* result); |
| 81 void AddAllAgentHostsForBrowserContext( | 81 void AddAllAgentHostsForBrowserContext( |
| 82 BrowserContext* browser_context, | 82 BrowserContext* browser_context, |
| 83 std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>* result); | 83 std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>* result); |
| 84 | 84 |
| 85 // Returns true when the worker must be paused on start because a DevTool | 85 // Returns true when the worker must be paused on start because a DevTool |
| 86 // window for the same former ServiceWorkerIdentifier is still opened or | 86 // window for the same former ServiceWorkerIdentifier is still opened or |
| 87 // debug-on-start is enabled in chrome://serviceworker-internals. | 87 // debug-on-start is enabled in chrome://serviceworker-internals. |
| 88 bool WorkerCreated(int worker_process_id, | 88 bool WorkerCreated(int worker_process_id, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 base::ObserverList<Observer> observer_list_; | 121 base::ObserverList<Observer> observer_list_; |
| 122 AgentHostMap workers_; | 122 AgentHostMap workers_; |
| 123 bool debug_service_worker_on_start_; | 123 bool debug_service_worker_on_start_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDevToolsManager); | 125 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDevToolsManager); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 } // namespace content | 128 } // namespace content |
| 129 | 129 |
| 130 #endif // CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_ | 130 #endif // CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_ |
| OLD | NEW |