Chromium Code Reviews| Index: content/browser/devtools/embedded_worker_devtools_manager.h |
| diff --git a/content/browser/devtools/embedded_worker_devtools_manager.h b/content/browser/devtools/embedded_worker_devtools_manager.h |
| index 8a07e5bc1326eb3303d263a4907ef2b27b915fcb..3ca8d6ebae793091ba3965b9f1f190058b324da4 100644 |
| --- a/content/browser/devtools/embedded_worker_devtools_manager.h |
| +++ b/content/browser/devtools/embedded_worker_devtools_manager.h |
| @@ -7,6 +7,7 @@ |
| #include "base/basictypes.h" |
| #include "base/containers/scoped_ptr_hash_map.h" |
| +#include "base/files/file_path.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/memory/scoped_vector.h" |
| #include "base/memory/singleton.h" |
| @@ -37,8 +38,12 @@ class CONTENT_EXPORT EmbeddedWorkerDevToolsManager { |
| bool SharedWorkerCreated(int worker_process_id, |
| int worker_route_id, |
| const SharedWorkerInstance& instance); |
| - void WorkerDestroyed(int worker_process_id, int worker_route_id); |
| + bool ServiceWorkerCreated(int worker_process_id, |
| + int worker_route_id, |
| + const base::FilePath& path, |
| + const GURL& scope); |
| void WorkerContextStarted(int worker_process_id, int worker_route_id); |
| + void WorkerDestroyed(int worker_process_id, int worker_route_id); |
| private: |
| friend struct DefaultSingletonTraits<EmbeddedWorkerDevToolsManager>; |
| @@ -55,19 +60,34 @@ class CONTENT_EXPORT EmbeddedWorkerDevToolsManager { |
| class WorkerInfo { |
| public: |
| - explicit WorkerInfo(const SharedWorkerInstance& instance) |
| - : instance_(instance), state_(WORKER_UNINSPECTED), agent_host_(NULL) {} |
| + explicit WorkerInfo(const SharedWorkerInstance& instance); |
| + WorkerInfo(const base::FilePath& service_worker_path, |
| + const GURL& service_worker_scope); |
| + ~WorkerInfo(); |
| - const SharedWorkerInstance& instance() const { return instance_; } |
| WorkerState state() { return state_; } |
| void set_state(WorkerState new_state) { state_ = new_state; } |
| EmbeddedWorkerDevToolsAgentHost* agent_host() { return agent_host_; } |
| void set_agent_host(EmbeddedWorkerDevToolsAgentHost* agent_host) { |
| agent_host_ = agent_host; |
| } |
| + bool Matches(const SharedWorkerInstance& other) { |
| + if (!shared_worker_instance_) |
| + return false; |
| + return shared_worker_instance_->Matches(other); |
| + } |
| + bool Matches(const base::FilePath& other_service_worker_path, |
|
yurys
2014/05/02 04:35:35
nit: move implementation of Matches methods to the
horo
2014/05/02 06:31:55
Done.
|
| + const GURL& other_service_worker_scope) { |
| + if (!service_worker_path_ || !service_worker_scope_) |
| + return false; |
| + return *service_worker_path_ == other_service_worker_path && |
| + *service_worker_scope_ == other_service_worker_scope; |
| + } |
| private: |
| - const SharedWorkerInstance instance_; |
| + scoped_ptr<SharedWorkerInstance> shared_worker_instance_; |
| + scoped_ptr<base::FilePath> service_worker_path_; |
| + scoped_ptr<GURL> service_worker_scope_; |
| WorkerState state_; |
| EmbeddedWorkerDevToolsAgentHost* agent_host_; |
| }; |
| @@ -81,6 +101,9 @@ class CONTENT_EXPORT EmbeddedWorkerDevToolsManager { |
| WorkerInfoMap::iterator FindExistingSharedWorkerInfo( |
| const SharedWorkerInstance& instance); |
| + WorkerInfoMap::iterator FindExistingServiceWorkerInfo( |
| + const base::FilePath& service_worker_path, |
| + const GURL& service_worker_scope); |
| // Resets to its initial state as if newly created. |
| void ResetForTesting(); |