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

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

Issue 214383005: Browser side of ServiceWorker requestSyncEvents() function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up the testing code Created 6 years, 8 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 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_SERVICE_WORKER_VERSION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // 156 //
157 // This must be called when the status() is ACTIVE. 157 // This must be called when the status() is ACTIVE.
158 void DispatchSyncEvent(const StatusCallback& callback); 158 void DispatchSyncEvent(const StatusCallback& callback);
159 159
160 // These are expected to be called when a renderer process host for the 160 // These are expected to be called when a renderer process host for the
161 // same-origin as for this ServiceWorkerVersion is created. The added 161 // same-origin as for this ServiceWorkerVersion is created. The added
162 // processes are used to run an in-renderer embedded worker. 162 // processes are used to run an in-renderer embedded worker.
163 void AddProcessToWorker(int process_id); 163 void AddProcessToWorker(int process_id);
164 void RemoveProcessToWorker(int process_id); 164 void RemoveProcessToWorker(int process_id);
165 165
166 // Allows registering for sync events.
167 void RequestSyncEvents(bool requested);
michaeln 2014/04/05 01:54:47 maybe a getter too
168
166 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } 169 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); }
167 170
168 // EmbeddedWorkerInstance::Observer overrides: 171 // EmbeddedWorkerInstance::Observer overrides:
169 virtual void OnStarted() OVERRIDE; 172 virtual void OnStarted() OVERRIDE;
170 virtual void OnStopped() OVERRIDE; 173 virtual void OnStopped() OVERRIDE;
171 virtual void OnMessageReceived(int request_id, 174 virtual void OnMessageReceived(int request_id,
172 const IPC::Message& message) OVERRIDE; 175 const IPC::Message& message) OVERRIDE;
173 176
174 private: 177 private:
175 typedef ServiceWorkerVersion self; 178 typedef ServiceWorkerVersion self;
176 friend class base::RefCounted<ServiceWorkerVersion>; 179 friend class base::RefCounted<ServiceWorkerVersion>;
177 180
178 virtual ~ServiceWorkerVersion(); 181 virtual ~ServiceWorkerVersion();
179 182
180 const int64 version_id_; 183 const int64 version_id_;
181 184
182 Status status_; 185 Status status_;
183 186
184 bool is_shutdown_; 187 bool is_shutdown_;
188 // TODO(jkarlin): requested_sync_events_ needs to persist across Chrome
189 // restarts once SWs start to have such persistence.
190 bool requested_sync_events_;
185 scoped_refptr<ServiceWorkerRegistration> registration_; 191 scoped_refptr<ServiceWorkerRegistration> registration_;
186 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; 192 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_;
187 193
188 // Pending callbacks. 194 // Pending callbacks.
189 std::vector<StatusCallback> start_callbacks_; 195 std::vector<StatusCallback> start_callbacks_;
190 std::vector<StatusCallback> stop_callbacks_; 196 std::vector<StatusCallback> stop_callbacks_;
191 197
192 std::vector<base::Closure> status_change_callbacks_; 198 std::vector<base::Closure> status_change_callbacks_;
193 199
194 IDMap<MessageCallback, IDMapOwnPointer> message_callbacks_; 200 IDMap<MessageCallback, IDMapOwnPointer> message_callbacks_;
195 201
196 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; 202 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
197 203
198 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); 204 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
199 }; 205 };
200 206
201 } // namespace content 207 } // namespace content
202 208
203 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 209 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_browsertest.cc ('k') | content/browser/service_worker/service_worker_version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698