Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: content/browser/devtools/embedded_worker_devtools_manager.h

Issue 470923004: DevTools: DevToolsAgentHost::Close/GetURL for service workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed crash Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "content/browser/shared_worker/shared_worker_instance.h" 16 #include "content/browser/shared_worker/shared_worker_instance.h"
16 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
17 18
18 namespace content { 19 namespace content {
19 20
20 class DevToolsAgentHost; 21 class DevToolsAgentHost;
21 class EmbeddedWorkerDevToolsAgentHost; 22 class EmbeddedWorkerDevToolsAgentHost;
22 class ServiceWorkerContextCore; 23 class ServiceWorkerContextCore;
23 24
24 // EmbeddedWorkerDevToolsManager is used instead of WorkerDevToolsManager when 25 // EmbeddedWorkerDevToolsManager is used instead of WorkerDevToolsManager when
25 // "enable-embedded-shared-worker" flag is set. 26 // "enable-embedded-shared-worker" flag is set.
26 // This class lives on UI thread. 27 // This class lives on UI thread.
27 class CONTENT_EXPORT EmbeddedWorkerDevToolsManager { 28 class CONTENT_EXPORT EmbeddedWorkerDevToolsManager {
28 public: 29 public:
29 typedef std::pair<int, int> WorkerId; 30 typedef std::pair<int, int> WorkerId;
30 31
31 class ServiceWorkerIdentifier { 32 class ServiceWorkerIdentifier {
32 public: 33 public:
33 ServiceWorkerIdentifier( 34 ServiceWorkerIdentifier(
34 const ServiceWorkerContextCore* const service_worker_context, 35 const ServiceWorkerContextCore* context,
35 int64 service_worker_version_id); 36 base::WeakPtr<ServiceWorkerContextCore> context_weak,
36 explicit ServiceWorkerIdentifier(const ServiceWorkerIdentifier& other); 37 int64 version_id,
37 ~ServiceWorkerIdentifier() {} 38 const GURL& url);
39 ServiceWorkerIdentifier(const ServiceWorkerIdentifier& other);
40 ~ServiceWorkerIdentifier();
38 41
39 bool Matches(const ServiceWorkerIdentifier& other) const; 42 bool Matches(const ServiceWorkerIdentifier& other) const;
40 43
44 const ServiceWorkerContextCore* context() const;
45 base::WeakPtr<ServiceWorkerContextCore> context_weak() const;
46 int64 version_id() const;
47 GURL url() const;
48
41 private: 49 private:
42 const ServiceWorkerContextCore* const service_worker_context_; 50 const ServiceWorkerContextCore* const context_;
43 const int64 service_worker_version_id_; 51 const base::WeakPtr<ServiceWorkerContextCore> context_weak_;
52 const int64 version_id_;
53 const GURL url_;
44 }; 54 };
45 55
46 // Returns the EmbeddedWorkerDevToolsManager singleton. 56 // Returns the EmbeddedWorkerDevToolsManager singleton.
47 static EmbeddedWorkerDevToolsManager* GetInstance(); 57 static EmbeddedWorkerDevToolsManager* GetInstance();
48 58
49 DevToolsAgentHost* GetDevToolsAgentHostForWorker(int worker_process_id, 59 DevToolsAgentHost* GetDevToolsAgentHostForWorker(int worker_process_id,
50 int worker_route_id); 60 int worker_route_id);
51 61
52 // Returns true when the worker must be paused on start because a DevTool 62 // Returns true when the worker must be paused on start because a DevTool
53 // window for the same former SharedWorkerInstance is still opened. 63 // window for the same former SharedWorkerInstance is still opened.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 AgentHostMap workers_; 107 AgentHostMap workers_;
98 108
99 bool debug_service_worker_on_start_; 109 bool debug_service_worker_on_start_;
100 110
101 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDevToolsManager); 111 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDevToolsManager);
102 }; 112 };
103 113
104 } // namespace content 114 } // namespace content
105 115
106 #endif // CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_ 116 #endif // CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698