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

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

Issue 299693002: Add option to open the DevTools window for ServiceWorker on start in serviceworker-internals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 6 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
« no previous file with comments | « no previous file | content/browser/devtools/embedded_worker_devtools_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/containers/scoped_ptr_hash_map.h" 9 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 }; 43 };
44 44
45 // Returns the EmbeddedWorkerDevToolsManager singleton. 45 // Returns the EmbeddedWorkerDevToolsManager singleton.
46 static EmbeddedWorkerDevToolsManager* GetInstance(); 46 static EmbeddedWorkerDevToolsManager* GetInstance();
47 47
48 DevToolsAgentHost* GetDevToolsAgentHostForWorker(int worker_process_id, 48 DevToolsAgentHost* GetDevToolsAgentHostForWorker(int worker_process_id,
49 int worker_route_id); 49 int worker_route_id);
50 DevToolsAgentHost* GetDevToolsAgentHostForServiceWorker( 50 DevToolsAgentHost* GetDevToolsAgentHostForServiceWorker(
51 const ServiceWorkerIdentifier& service_worker_id); 51 const ServiceWorkerIdentifier& service_worker_id);
52 52
53 // Returns true when the worker must be paused on start. 53 // Returns true when the worker must be paused on start because a DevTool
54 // window for the same former SharedWorkerInstance is still opened.
54 bool SharedWorkerCreated(int worker_process_id, 55 bool SharedWorkerCreated(int worker_process_id,
55 int worker_route_id, 56 int worker_route_id,
56 const SharedWorkerInstance& instance); 57 const SharedWorkerInstance& instance);
57 // Returns true when the worker must be paused on start. 58 // Returns true when the worker must be paused on start because a DevTool
59 // window for the same former ServiceWorkerIdentifier is still opened or
60 // debug-on-start is enabled in chrome://serviceworker-internals.
58 bool ServiceWorkerCreated(int worker_process_id, 61 bool ServiceWorkerCreated(int worker_process_id,
59 int worker_route_id, 62 int worker_route_id,
60 const ServiceWorkerIdentifier& service_worker_id); 63 const ServiceWorkerIdentifier& service_worker_id);
61 void WorkerContextStarted(int worker_process_id, int worker_route_id); 64 void WorkerContextStarted(int worker_process_id, int worker_route_id);
62 void WorkerDestroyed(int worker_process_id, int worker_route_id); 65 void WorkerDestroyed(int worker_process_id, int worker_route_id);
63 66
67 void set_debug_service_worker_on_start(bool debug_on_start) {
68 debug_service_worker_on_start_ = debug_on_start;
69 }
70 bool debug_service_worker_on_start() const {
71 return debug_service_worker_on_start_;
72 }
73
64 private: 74 private:
65 friend struct DefaultSingletonTraits<EmbeddedWorkerDevToolsManager>; 75 friend struct DefaultSingletonTraits<EmbeddedWorkerDevToolsManager>;
66 friend class EmbeddedWorkerDevToolsManagerTest; 76 friend class EmbeddedWorkerDevToolsManagerTest;
67 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerDevToolsManagerTest, BasicTest); 77 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerDevToolsManagerTest, BasicTest);
68 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerDevToolsManagerTest, AttachTest); 78 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerDevToolsManagerTest, AttachTest);
69 79
70 enum WorkerState { 80 enum WorkerState {
71 WORKER_UNINSPECTED, 81 WORKER_UNINSPECTED,
72 WORKER_INSPECTED, 82 WORKER_INSPECTED,
73 WORKER_TERMINATED, 83 WORKER_TERMINATED,
74 WORKER_PAUSED, 84 WORKER_PAUSED_FOR_DEBUG_ON_START,
85 WORKER_PAUSED_FOR_REATTACH,
75 }; 86 };
76 87
77 class WorkerInfo { 88 class WorkerInfo {
78 public: 89 public:
79 // Creates WorkerInfo for SharedWorker. 90 // Creates WorkerInfo for SharedWorker.
80 explicit WorkerInfo(const SharedWorkerInstance& instance); 91 explicit WorkerInfo(const SharedWorkerInstance& instance);
81 // Creates WorkerInfo for ServiceWorker. 92 // Creates WorkerInfo for ServiceWorker.
82 explicit WorkerInfo(const ServiceWorkerIdentifier& service_worker_id); 93 explicit WorkerInfo(const ServiceWorkerIdentifier& service_worker_id);
83 ~WorkerInfo(); 94 ~WorkerInfo();
84 95
(...skipping 25 matching lines...) Expand all
110 WorkerInfoMap::iterator FindExistingServiceWorkerInfo( 121 WorkerInfoMap::iterator FindExistingServiceWorkerInfo(
111 const ServiceWorkerIdentifier& service_worker_id); 122 const ServiceWorkerIdentifier& service_worker_id);
112 123
113 void MoveToPausedState(const WorkerId& id, const WorkerInfoMap::iterator& it); 124 void MoveToPausedState(const WorkerId& id, const WorkerInfoMap::iterator& it);
114 125
115 // Resets to its initial state as if newly created. 126 // Resets to its initial state as if newly created.
116 void ResetForTesting(); 127 void ResetForTesting();
117 128
118 WorkerInfoMap workers_; 129 WorkerInfoMap workers_;
119 130
131 bool debug_service_worker_on_start_;
132
120 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDevToolsManager); 133 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDevToolsManager);
121 }; 134 };
122 135
123 } // namespace content 136 } // namespace content
124 137
125 #endif // CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_ 138 #endif // CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/devtools/embedded_worker_devtools_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698