Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / browser / devtools / embedded_worker_devtools_manager.h
index 34e2ebc..804ef41 100644 (file)
@@ -11,6 +11,7 @@
 #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"
@@ -18,6 +19,7 @@
 namespace content {
 
 class DevToolsAgentHost;
+class DevToolsAgentHostImpl;
 class EmbeddedWorkerDevToolsAgentHost;
 class ServiceWorkerContextCore;
 
@@ -31,24 +33,35 @@ class CONTENT_EXPORT EmbeddedWorkerDevToolsManager {
   class ServiceWorkerIdentifier {
    public:
     ServiceWorkerIdentifier(
-        const ServiceWorkerContextCore* const service_worker_context,
-        int64 service_worker_version_id);
-    explicit ServiceWorkerIdentifier(const ServiceWorkerIdentifier& other);
-    ~ServiceWorkerIdentifier() {}
+        const ServiceWorkerContextCore* context,
+        base::WeakPtr<ServiceWorkerContextCore> context_weak,
+        int64 version_id,
+        const GURL& url);
+    ServiceWorkerIdentifier(const ServiceWorkerIdentifier& other);
+    ~ServiceWorkerIdentifier();
 
     bool Matches(const ServiceWorkerIdentifier& other) const;
 
+    const ServiceWorkerContextCore* context() const;
+    base::WeakPtr<ServiceWorkerContextCore> context_weak() const;
+    int64 version_id() const;
+    GURL url() const;
+
    private:
-    const ServiceWorkerContextCore* const service_worker_context_;
-    const int64 service_worker_version_id_;
+    const ServiceWorkerContextCore* const context_;
+    const base::WeakPtr<ServiceWorkerContextCore> context_weak_;
+    const int64 version_id_;
+    const GURL url_;
   };
 
   // Returns the EmbeddedWorkerDevToolsManager singleton.
   static EmbeddedWorkerDevToolsManager* GetInstance();
 
-  DevToolsAgentHost* GetDevToolsAgentHostForWorker(int worker_process_id,
+  DevToolsAgentHostImpl* GetDevToolsAgentHostForWorker(int worker_process_id,
                                                    int worker_route_id);
 
+  std::vector<scoped_refptr<DevToolsAgentHost> > GetOrCreateAllAgentHosts();
+
   // 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,
@@ -60,6 +73,7 @@ class CONTENT_EXPORT EmbeddedWorkerDevToolsManager {
   bool ServiceWorkerCreated(int worker_process_id,
                             int worker_route_id,
                             const ServiceWorkerIdentifier& service_worker_id);
+  void WorkerReadyForInspection(int worker_process_id, int worker_route_id);
   void WorkerContextStarted(int worker_process_id, int worker_route_id);
   void WorkerDestroyed(int worker_process_id, int worker_route_id);