| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "content/browser/shared_worker/shared_worker_instance.h" | 14 #include "content/browser/shared_worker/shared_worker_instance.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 DevToolsAgentHostImpl; |
| 20 class ServiceWorkerContextCore; | 20 class ServiceWorkerContextCore; |
| 21 | 21 |
| 22 // EmbeddedWorkerDevToolsManager is used instead of WorkerDevToolsManager when | 22 // EmbeddedWorkerDevToolsManager is used instead of WorkerDevToolsManager when |
| 23 // "enable-embedded-shared-worker" flag is set. | 23 // "enable-embedded-shared-worker" flag is set. |
| 24 // This class lives on UI thread. | 24 // This class lives on UI thread. |
| 25 class CONTENT_EXPORT EmbeddedWorkerDevToolsManager { | 25 class CONTENT_EXPORT EmbeddedWorkerDevToolsManager { |
| 26 public: | 26 public: |
| 27 typedef std::pair<int, int> WorkerId; | 27 typedef std::pair<int, int> WorkerId; |
| 28 class EmbeddedWorkerDevToolsAgentHost; | 28 class EmbeddedWorkerDevToolsAgentHost; |
| 29 | 29 |
| 30 class ServiceWorkerIdentifier { | 30 class ServiceWorkerIdentifier { |
| 31 public: | 31 public: |
| 32 ServiceWorkerIdentifier( | 32 ServiceWorkerIdentifier( |
| 33 const ServiceWorkerContextCore* const service_worker_context, | 33 const ServiceWorkerContextCore* const service_worker_context, |
| 34 int64 service_worker_version_id); | 34 int64 service_worker_version_id); |
| 35 explicit ServiceWorkerIdentifier(const ServiceWorkerIdentifier& other); | 35 explicit ServiceWorkerIdentifier(const ServiceWorkerIdentifier& other); |
| 36 ~ServiceWorkerIdentifier() {} | 36 ~ServiceWorkerIdentifier() {} |
| 37 | 37 |
| 38 bool Matches(const ServiceWorkerIdentifier& other) const; | 38 bool Matches(const ServiceWorkerIdentifier& other) const; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 const ServiceWorkerContextCore* const service_worker_context_; | 41 const ServiceWorkerContextCore* const service_worker_context_; |
| 42 const int64 service_worker_version_id_; | 42 const int64 service_worker_version_id_; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // Returns the EmbeddedWorkerDevToolsManager singleton. | 45 // Returns the EmbeddedWorkerDevToolsManager singleton. |
| 46 static EmbeddedWorkerDevToolsManager* GetInstance(); | 46 static EmbeddedWorkerDevToolsManager* GetInstance(); |
| 47 | 47 |
| 48 DevToolsAgentHost* GetDevToolsAgentHostForWorker(int worker_process_id, | 48 DevToolsAgentHostImpl* GetDevToolsAgentHostForWorker(int worker_process_id, |
| 49 int worker_route_id); | 49 int worker_route_id); |
| 50 DevToolsAgentHost* GetDevToolsAgentHostForServiceWorker( | 50 DevToolsAgentHostImpl* GetDevToolsAgentHostForServiceWorker( |
| 51 const ServiceWorkerIdentifier& service_worker_id); | 51 const ServiceWorkerIdentifier& service_worker_id); |
| 52 | 52 |
| 53 // Returns true when the worker must be paused on start because a DevTool | 53 // Returns true when the worker must be paused on start because a DevTool |
| 54 // window for the same former SharedWorkerInstance is still opened. | 54 // window for the same former SharedWorkerInstance is still opened. |
| 55 bool SharedWorkerCreated(int worker_process_id, | 55 bool SharedWorkerCreated(int worker_process_id, |
| 56 int worker_route_id, | 56 int worker_route_id, |
| 57 const SharedWorkerInstance& instance); | 57 const SharedWorkerInstance& instance); |
| 58 // Returns true when the worker must be paused on start because a DevTool | 58 // Returns true when the worker must be paused on start because a DevTool |
| 59 // window for the same former ServiceWorkerIdentifier is still opened or | 59 // window for the same former ServiceWorkerIdentifier is still opened or |
| 60 // debug-on-start is enabled in chrome://serviceworker-internals. | 60 // debug-on-start is enabled in chrome://serviceworker-internals. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 WorkerInfoMap workers_; | 129 WorkerInfoMap workers_; |
| 130 | 130 |
| 131 bool debug_service_worker_on_start_; | 131 bool debug_service_worker_on_start_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDevToolsManager); | 133 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDevToolsManager); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace content | 136 } // namespace content |
| 137 | 137 |
| 138 #endif // CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_ | 138 #endif // CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_ |
| OLD | NEW |