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

Side by Side Diff: content/browser/service_worker/embedded_worker_instance.h

Issue 252633003: Introduce worker_devtools_agent_route_id for EmbeddedWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 6 years, 7 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/service_worker/embedded_worker_instance.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Add or remove |process_id| to the internal process set where this 87 // Add or remove |process_id| to the internal process set where this
88 // worker can be started. 88 // worker can be started.
89 void AddProcessReference(int process_id); 89 void AddProcessReference(int process_id);
90 void ReleaseProcessReference(int process_id); 90 void ReleaseProcessReference(int process_id);
91 bool HasProcessToRun() const { return !process_refs_.empty(); } 91 bool HasProcessToRun() const { return !process_refs_.empty(); }
92 92
93 int embedded_worker_id() const { return embedded_worker_id_; } 93 int embedded_worker_id() const { return embedded_worker_id_; }
94 Status status() const { return status_; } 94 Status status() const { return status_; }
95 int process_id() const { return process_id_; } 95 int process_id() const { return process_id_; }
96 int thread_id() const { return thread_id_; } 96 int thread_id() const { return thread_id_; }
97 int worker_devtools_agent_route_id() const {
98 return worker_devtools_agent_route_id_;
99 }
97 100
98 void AddListener(Listener* listener); 101 void AddListener(Listener* listener);
99 void RemoveListener(Listener* listener); 102 void RemoveListener(Listener* listener);
100 103
101 private: 104 private:
102 typedef ObserverList<Listener> ListenerList; 105 typedef ObserverList<Listener> ListenerList;
103 106
104 friend class EmbeddedWorkerRegistry; 107 friend class EmbeddedWorkerRegistry;
105 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop); 108 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop);
106 109
107 typedef std::map<int, int> ProcessRefMap; 110 typedef std::map<int, int> ProcessRefMap;
108 111
109 // Constructor is called via EmbeddedWorkerRegistry::CreateWorker(). 112 // Constructor is called via EmbeddedWorkerRegistry::CreateWorker().
110 // This instance holds a ref of |registry|. 113 // This instance holds a ref of |registry|.
111 EmbeddedWorkerInstance(EmbeddedWorkerRegistry* registry, 114 EmbeddedWorkerInstance(EmbeddedWorkerRegistry* registry,
112 int embedded_worker_id); 115 int embedded_worker_id);
113 116
114 // Called back from EmbeddedWorkerRegistry after Start() passes control to the 117 // Called back from EmbeddedWorkerRegistry after Start() passes control to the
115 // UI thread to acquire a reference to the process. 118 // UI thread to acquire a reference to the process.
116 void RecordProcessId(int process_id, ServiceWorkerStatusCode status); 119 void RecordProcessId(int process_id,
120 ServiceWorkerStatusCode status,
121 int worker_devtools_agent_route_id);
117 122
118 // Called back from Registry when the worker instance has ack'ed that 123 // Called back from Registry when the worker instance has ack'ed that
119 // its WorkerGlobalScope is actually started on |thread_id| in the 124 // its WorkerGlobalScope is actually started on |thread_id| in the
120 // child process. 125 // child process.
121 // This will change the internal status from STARTING to RUNNING. 126 // This will change the internal status from STARTING to RUNNING.
122 void OnStarted(int thread_id); 127 void OnStarted(int thread_id);
123 128
124 // Called back from Registry when the worker instance has ack'ed that 129 // Called back from Registry when the worker instance has ack'ed that
125 // its WorkerGlobalScope is actually stopped in the child process. 130 // its WorkerGlobalScope is actually stopped in the child process.
126 // This will change the internal status from STARTING or RUNNING to 131 // This will change the internal status from STARTING or RUNNING to
(...skipping 23 matching lines...) Expand all
150 std::vector<int> SortProcesses( 155 std::vector<int> SortProcesses(
151 const std::vector<int>& possible_process_ids) const; 156 const std::vector<int>& possible_process_ids) const;
152 157
153 scoped_refptr<EmbeddedWorkerRegistry> registry_; 158 scoped_refptr<EmbeddedWorkerRegistry> registry_;
154 const int embedded_worker_id_; 159 const int embedded_worker_id_;
155 Status status_; 160 Status status_;
156 161
157 // Current running information. -1 indicates the worker is not running. 162 // Current running information. -1 indicates the worker is not running.
158 int process_id_; 163 int process_id_;
159 int thread_id_; 164 int thread_id_;
165 int worker_devtools_agent_route_id_;
160 166
161 ProcessRefMap process_refs_; 167 ProcessRefMap process_refs_;
162 ListenerList listener_list_; 168 ListenerList listener_list_;
163 169
164 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); 170 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance);
165 }; 171 };
166 172
167 } // namespace content 173 } // namespace content
168 174
169 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ 175 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698