| 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 3b15c8f209967344375d3a70ca3325de225fb4e2..48608635a8c7926c63abfa1b84ff84c39a08b729 100644
|
| --- a/content/browser/devtools/embedded_worker_devtools_manager.h
|
| +++ b/content/browser/devtools/embedded_worker_devtools_manager.h
|
| @@ -5,18 +5,21 @@
|
| #ifndef CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_
|
| #define CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_
|
|
|
| +#include <map>
|
| +
|
| #include "base/basictypes.h"
|
| #include "base/containers/scoped_ptr_hash_map.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/memory/scoped_vector.h"
|
| #include "base/memory/singleton.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "base/strings/string16.h"
|
| #include "content/browser/shared_worker/shared_worker_instance.h"
|
| #include "content/common/content_export.h"
|
| +#include "content/public/browser/devtools_agent_host.h"
|
|
|
| namespace content {
|
|
|
| -class DevToolsAgentHost;
|
| class ServiceWorkerContextCore;
|
|
|
| // EmbeddedWorkerDevToolsManager is used instead of WorkerDevToolsManager when
|
| @@ -25,20 +28,22 @@ class ServiceWorkerContextCore;
|
| class CONTENT_EXPORT EmbeddedWorkerDevToolsManager {
|
| public:
|
| typedef std::pair<int, int> WorkerId;
|
| - class EmbeddedWorkerDevToolsAgentHost;
|
|
|
| class ServiceWorkerIdentifier {
|
| public:
|
| ServiceWorkerIdentifier(
|
| - const ServiceWorkerContextCore* const service_worker_context,
|
| + const ServiceWorkerContextCore* service_worker_context,
|
| + base::WeakPtr<ServiceWorkerContextCore> service_worker_context_weak,
|
| int64 service_worker_version_id);
|
| - explicit ServiceWorkerIdentifier(const ServiceWorkerIdentifier& other);
|
| - ~ServiceWorkerIdentifier() {}
|
| + ServiceWorkerIdentifier(const ServiceWorkerIdentifier& other);
|
| + ~ServiceWorkerIdentifier();
|
|
|
| bool Matches(const ServiceWorkerIdentifier& other) const;
|
|
|
| private:
|
| + friend class EmbeddedWorkerDevToolsManager;
|
| const ServiceWorkerContextCore* const service_worker_context_;
|
| + const base::WeakPtr<ServiceWorkerContextCore> service_worker_context_weak_;
|
| const int64 service_worker_version_id_;
|
| };
|
|
|
| @@ -50,6 +55,8 @@ class CONTENT_EXPORT EmbeddedWorkerDevToolsManager {
|
| DevToolsAgentHost* GetDevToolsAgentHostForServiceWorker(
|
| const ServiceWorkerIdentifier& service_worker_id);
|
|
|
| + void GetOrCreateAllHosts(const DevToolsAgentHost::ListCallback& callback);
|
| +
|
| // Returns true when the worker must be paused on start because a DevTool
|
| // window for the same former SharedWorkerInstance is still opened.
|
| bool SharedWorkerCreated(int worker_process_id,
|
| @@ -85,6 +92,8 @@ class CONTENT_EXPORT EmbeddedWorkerDevToolsManager {
|
| WORKER_PAUSED_FOR_REATTACH,
|
| };
|
|
|
| + class EmbeddedWorkerDevToolsAgentHost;
|
| +
|
| class WorkerInfo {
|
| public:
|
| // Creates WorkerInfo for SharedWorker.
|
| @@ -101,6 +110,9 @@ class CONTENT_EXPORT EmbeddedWorkerDevToolsManager {
|
| }
|
| bool Matches(const SharedWorkerInstance& other);
|
| bool Matches(const ServiceWorkerIdentifier& other);
|
| + ServiceWorkerIdentifier* service_worker_id() {
|
| + return service_worker_id_.get();
|
| + }
|
|
|
| private:
|
| scoped_ptr<SharedWorkerInstance> shared_worker_instance_;
|
| @@ -123,6 +135,15 @@ class CONTENT_EXPORT EmbeddedWorkerDevToolsManager {
|
|
|
| void MoveToPausedState(const WorkerId& id, const WorkerInfoMap::iterator& it);
|
|
|
| + DevToolsAgentHost* GetOrCreateAgentHost(int worker_process_id,
|
| + int worker_route_id,
|
| + const GURL& url);
|
| + static void GetServiceWorkerUrlsOnIO(
|
| + const std::map<WorkerId, ServiceWorkerIdentifier>& ids,
|
| + const DevToolsAgentHost::ListCallback& callback);
|
| + static void CreateAgentHosts(const std::map<WorkerId, GURL> url_map,
|
| + const DevToolsAgentHost::ListCallback& callback);
|
| +
|
| // Resets to its initial state as if newly created.
|
| void ResetForTesting();
|
|
|
|
|