| 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_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_EMBEDDED_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/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.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/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "content/browser/shared_worker/shared_worker_instance.h" | 16 #include "content/browser/shared_worker/shared_worker_instance.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 class DevToolsAgentHost; |
| 21 class DevToolsAgentHostImpl; | 22 class DevToolsAgentHostImpl; |
| 22 class EmbeddedWorkerDevToolsAgentHost; | 23 class EmbeddedWorkerDevToolsAgentHost; |
| 23 class ServiceWorkerContextCore; | 24 class ServiceWorkerContextCore; |
| 24 | 25 |
| 25 // EmbeddedWorkerDevToolsManager is used instead of WorkerDevToolsManager when | 26 // EmbeddedWorkerDevToolsManager is used instead of WorkerDevToolsManager when |
| 26 // "enable-embedded-shared-worker" flag is set. | 27 // "enable-embedded-shared-worker" flag is set. |
| 27 // This class lives on UI thread. | 28 // This class lives on UI thread. |
| 28 class CONTENT_EXPORT EmbeddedWorkerDevToolsManager { | 29 class CONTENT_EXPORT EmbeddedWorkerDevToolsManager { |
| 29 public: | 30 public: |
| 30 typedef std::pair<int, int> WorkerId; | 31 typedef std::pair<int, int> WorkerId; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 52 const int64 version_id_; | 53 const int64 version_id_; |
| 53 const GURL url_; | 54 const GURL url_; |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 // Returns the EmbeddedWorkerDevToolsManager singleton. | 57 // Returns the EmbeddedWorkerDevToolsManager singleton. |
| 57 static EmbeddedWorkerDevToolsManager* GetInstance(); | 58 static EmbeddedWorkerDevToolsManager* GetInstance(); |
| 58 | 59 |
| 59 DevToolsAgentHostImpl* GetDevToolsAgentHostForWorker(int worker_process_id, | 60 DevToolsAgentHostImpl* GetDevToolsAgentHostForWorker(int worker_process_id, |
| 60 int worker_route_id); | 61 int worker_route_id); |
| 61 | 62 |
| 63 std::vector<scoped_refptr<DevToolsAgentHost> > GetOrCreateAllAgentHosts(); |
| 64 |
| 62 // Returns true when the worker must be paused on start because a DevTool | 65 // Returns true when the worker must be paused on start because a DevTool |
| 63 // window for the same former SharedWorkerInstance is still opened. | 66 // window for the same former SharedWorkerInstance is still opened. |
| 64 bool SharedWorkerCreated(int worker_process_id, | 67 bool SharedWorkerCreated(int worker_process_id, |
| 65 int worker_route_id, | 68 int worker_route_id, |
| 66 const SharedWorkerInstance& instance); | 69 const SharedWorkerInstance& instance); |
| 67 // Returns true when the worker must be paused on start because a DevTool | 70 // Returns true when the worker must be paused on start because a DevTool |
| 68 // window for the same former ServiceWorkerIdentifier is still opened or | 71 // window for the same former ServiceWorkerIdentifier is still opened or |
| 69 // debug-on-start is enabled in chrome://serviceworker-internals. | 72 // debug-on-start is enabled in chrome://serviceworker-internals. |
| 70 bool ServiceWorkerCreated(int worker_process_id, | 73 bool ServiceWorkerCreated(int worker_process_id, |
| 71 int worker_route_id, | 74 int worker_route_id, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 AgentHostMap workers_; | 111 AgentHostMap workers_; |
| 109 | 112 |
| 110 bool debug_service_worker_on_start_; | 113 bool debug_service_worker_on_start_; |
| 111 | 114 |
| 112 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDevToolsManager); | 115 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDevToolsManager); |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 } // namespace content | 118 } // namespace content |
| 116 | 119 |
| 117 #endif // CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_ | 120 #endif // CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_ |
| OLD | NEW |