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

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

Issue 817653002: Split EmbeddedWorkerDevToolsManager into two for Shared- and ServiceWorker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + indent fixes Created 6 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/memory/singleton.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/browser/devtools/worker_devtools_manager.h"
14 #include "content/browser/shared_worker/shared_worker_instance.h"
15
16 namespace content {
17
18 class ServiceWorkerDevToolsAgentHost;
19 class ServiceWorkerContextCore;
20
21 // Manages WorkerDevToolsAgentHost's for Service Workers.
22 // This class lives on UI thread.
23 class CONTENT_EXPORT ServiceWorkerDevToolsManager
24 : public WorkerDevToolsManager {
25 public:
26 class ServiceWorkerIdentifier {
27 public:
28 ServiceWorkerIdentifier(
29 const ServiceWorkerContextCore* context,
30 base::WeakPtr<ServiceWorkerContextCore> context_weak,
31 int64 version_id,
32 const GURL& url);
33 ServiceWorkerIdentifier(const ServiceWorkerIdentifier& other);
34 ~ServiceWorkerIdentifier();
35
36 bool Matches(const ServiceWorkerIdentifier& other) const;
37
38 const ServiceWorkerContextCore* context() const { return context_; }
39 base::WeakPtr<ServiceWorkerContextCore> context_weak() const {
40 return context_weak_;
41 }
42 int64 version_id() const { return version_id_; }
43 GURL url() const { return url_; }
44
45 private:
46 const ServiceWorkerContextCore* const context_;
47 const base::WeakPtr<ServiceWorkerContextCore> context_weak_;
48 const int64 version_id_;
49 const GURL url_;
50 };
51
52 // Returns the ServiceWorkerDevToolsManager singleton.
53 static ServiceWorkerDevToolsManager* GetInstance();
54
55 // Returns true when the worker must be paused on start because a DevTool
56 // window for the same former ServiceWorkerIdentifier is still opened or
57 // debug-on-start is enabled in chrome://serviceworker-internals.
58 bool WorkerCreated(int worker_process_id,
59 int worker_route_id,
60 const ServiceWorkerIdentifier& service_worker_id);
61 void WorkerStopIgnored(int worker_process_id, int worker_route_id);
62
63 void set_debug_service_worker_on_start(bool debug_on_start) {
64 debug_service_worker_on_start_ = debug_on_start;
65 }
66 bool debug_service_worker_on_start() const {
67 return debug_service_worker_on_start_;
68 }
69
70 private:
71 friend struct DefaultSingletonTraits<ServiceWorkerDevToolsManager>;
72 friend class ServiceWorkerDevToolsAgentHost;
73
74 ServiceWorkerDevToolsManager();
75 ~ServiceWorkerDevToolsManager() override;
76
77 AgentHostMap::iterator FindExistingWorkerAgentHost(
78 const ServiceWorkerIdentifier& service_worker_id);
79
80 bool debug_service_worker_on_start_;
81
82 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDevToolsManager);
83 };
84
85 } // namespace content
86
87 #endif // CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698