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

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

Issue 796393005: Cleanup: Remove if (!CurrentlyOn()) PostTask() pattern in EmbeddedWorkerInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Sends |message| to the embedded worker running in the child process. 94 // Sends |message| to the embedded worker running in the child process.
95 // It is invalid to call this while the worker is not in RUNNING status. 95 // It is invalid to call this while the worker is not in RUNNING status.
96 ServiceWorkerStatusCode SendMessage(const IPC::Message& message); 96 ServiceWorkerStatusCode SendMessage(const IPC::Message& message);
97 97
98 void ResumeAfterDownload(); 98 void ResumeAfterDownload();
99 99
100 int embedded_worker_id() const { return embedded_worker_id_; } 100 int embedded_worker_id() const { return embedded_worker_id_; }
101 Status status() const { return status_; } 101 Status status() const { return status_; }
102 int process_id() const { return process_id_; } 102 int process_id() const { return process_id_; }
103 int thread_id() const { return thread_id_; } 103 int thread_id() const { return thread_id_; }
104 int worker_devtools_agent_route_id() const { 104 int worker_devtools_agent_route_id() const;
105 return worker_devtools_agent_route_id_;
106 }
107 MessagePortMessageFilter* message_port_message_filter() const; 105 MessagePortMessageFilter* message_port_message_filter() const;
108 106
109 void AddListener(Listener* listener); 107 void AddListener(Listener* listener);
110 void RemoveListener(Listener* listener); 108 void RemoveListener(Listener* listener);
111 109
112 void set_devtools_attached(bool attached) { devtools_attached_ = attached; } 110 void set_devtools_attached(bool attached) { devtools_attached_ = attached; }
113 111
114 private: 112 private:
115 typedef ObserverList<Listener> ListenerList; 113 typedef ObserverList<Listener> ListenerList;
116 114 class DevToolsProxy;
117 friend class EmbeddedWorkerRegistry; 115 friend class EmbeddedWorkerRegistry;
118 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop); 116 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop);
119 117
120 // Constructor is called via EmbeddedWorkerRegistry::CreateWorker(). 118 // Constructor is called via EmbeddedWorkerRegistry::CreateWorker().
121 // This instance holds a ref of |registry|. 119 // This instance holds a ref of |registry|.
122 EmbeddedWorkerInstance(base::WeakPtr<ServiceWorkerContextCore> context, 120 EmbeddedWorkerInstance(base::WeakPtr<ServiceWorkerContextCore> context,
123 int embedded_worker_id); 121 int embedded_worker_id);
124 122
125 // Called back from ServiceWorkerProcessManager after Start() passes control 123 // Called back from ServiceWorkerProcessManager after Start() passes control
126 // to the UI thread to acquire a reference to the process. 124 // to the UI thread to acquire a reference to the process.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 const GURL& source_url); 188 const GURL& source_url);
191 189
192 base::WeakPtr<ServiceWorkerContextCore> context_; 190 base::WeakPtr<ServiceWorkerContextCore> context_;
193 scoped_refptr<EmbeddedWorkerRegistry> registry_; 191 scoped_refptr<EmbeddedWorkerRegistry> registry_;
194 const int embedded_worker_id_; 192 const int embedded_worker_id_;
195 Status status_; 193 Status status_;
196 194
197 // Current running information. -1 indicates the worker is not running. 195 // Current running information. -1 indicates the worker is not running.
198 int process_id_; 196 int process_id_;
199 int thread_id_; 197 int thread_id_;
200 int worker_devtools_agent_route_id_;
201 198
202 // Whether devtools is attached or not. 199 // Whether devtools is attached or not.
203 bool devtools_attached_; 200 bool devtools_attached_;
204 201
205 StatusCallback start_callback_; 202 StatusCallback start_callback_;
206
207 ListenerList listener_list_; 203 ListenerList listener_list_;
204 scoped_ptr<DevToolsProxy> devtools_proxy_;
208 205
209 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; 206 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_;
210 207
211 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); 208 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance);
212 }; 209 };
213 210
214 } // namespace content 211 } // namespace content
215 212
216 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ 213 #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