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

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

Issue 771103002: Implement ServiceWorkerClient attributes [2/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed 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
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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 ServiceWorkerScriptCacheMap* script_cache_map() { return &script_cache_map_; } 242 ServiceWorkerScriptCacheMap* script_cache_map() { return &script_cache_map_; }
243 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } 243 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); }
244 244
245 // Dooms this version to have REDUNDANT status and its resources deleted. If 245 // Dooms this version to have REDUNDANT status and its resources deleted. If
246 // the version is controlling a page, these changes will happen when the 246 // the version is controlling a page, these changes will happen when the
247 // version no longer controls any pages. 247 // version no longer controls any pages.
248 void Doom(); 248 void Doom();
249 bool is_doomed() const { return is_doomed_; } 249 bool is_doomed() const { return is_doomed_; }
250 250
251 private: 251 private:
252 class GetClientInfoCallback;
253
252 friend class base::RefCounted<ServiceWorkerVersion>; 254 friend class base::RefCounted<ServiceWorkerVersion>;
253 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, 255 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest,
254 ActivateWaitingVersion); 256 ActivateWaitingVersion);
255 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); 257 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker);
256 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); 258 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability);
257 typedef ServiceWorkerVersion self; 259 typedef ServiceWorkerVersion self;
258 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; 260 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap;
259 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; 261 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap;
260 262
261 ~ServiceWorkerVersion() override; 263 ~ServiceWorkerVersion() override;
(...skipping 18 matching lines...) Expand all
280 const StatusCallback& callback); 282 const StatusCallback& callback);
281 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback); 283 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback);
282 284
283 void DispatchMessageEventInternal( 285 void DispatchMessageEventInternal(
284 const base::string16& message, 286 const base::string16& message,
285 const std::vector<int>& sent_message_port_ids, 287 const std::vector<int>& sent_message_port_ids,
286 const StatusCallback& callback); 288 const StatusCallback& callback);
287 289
288 // Message handlers. 290 // Message handlers.
289 void OnGetClientDocuments(int request_id); 291 void OnGetClientDocuments(int request_id);
292 void OnGetClientInfoSuccess(int request_id,
293 const ServiceWorkerClientInfo& info);
294 void OnGetClientInfoError(int request_id);
290 void OnActivateEventFinished(int request_id, 295 void OnActivateEventFinished(int request_id,
291 blink::WebServiceWorkerEventResult result); 296 blink::WebServiceWorkerEventResult result);
292 void OnInstallEventFinished(int request_id, 297 void OnInstallEventFinished(int request_id,
293 blink::WebServiceWorkerEventResult result); 298 blink::WebServiceWorkerEventResult result);
294 void OnFetchEventFinished(int request_id, 299 void OnFetchEventFinished(int request_id,
295 ServiceWorkerFetchEventResult result, 300 ServiceWorkerFetchEventResult result,
296 const ServiceWorkerResponse& response); 301 const ServiceWorkerResponse& response);
297 void OnSyncEventFinished(int request_id); 302 void OnSyncEventFinished(int request_id);
298 void OnNotificationClickEventFinished(int request_id); 303 void OnNotificationClickEventFinished(int request_id);
299 void OnPushEventFinished(int request_id, 304 void OnPushEventFinished(int request_id,
(...skipping 20 matching lines...) Expand all
320 std::vector<base::Closure> status_change_callbacks_; 325 std::vector<base::Closure> status_change_callbacks_;
321 326
322 // Message callbacks. 327 // Message callbacks.
323 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_; 328 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_;
324 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_; 329 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_;
325 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_; 330 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_;
326 IDMap<StatusCallback, IDMapOwnPointer> sync_callbacks_; 331 IDMap<StatusCallback, IDMapOwnPointer> sync_callbacks_;
327 IDMap<StatusCallback, IDMapOwnPointer> notification_click_callbacks_; 332 IDMap<StatusCallback, IDMapOwnPointer> notification_click_callbacks_;
328 IDMap<StatusCallback, IDMapOwnPointer> push_callbacks_; 333 IDMap<StatusCallback, IDMapOwnPointer> push_callbacks_;
329 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; 334 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_;
335 IDMap<GetClientInfoCallback> get_client_info_callbacks_;
330 336
331 ControlleeMap controllee_map_; 337 ControlleeMap controllee_map_;
332 ControlleeByIDMap controllee_by_id_; 338 ControlleeByIDMap controllee_by_id_;
333 base::WeakPtr<ServiceWorkerContextCore> context_; 339 base::WeakPtr<ServiceWorkerContextCore> context_;
334 ObserverList<Listener> listeners_; 340 ObserverList<Listener> listeners_;
335 ServiceWorkerScriptCacheMap script_cache_map_; 341 ServiceWorkerScriptCacheMap script_cache_map_;
336 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; 342 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_;
337 base::OneShotTimer<ServiceWorkerVersion> update_timer_; 343 base::OneShotTimer<ServiceWorkerVersion> update_timer_;
338 bool is_doomed_; 344 bool is_doomed_;
339 345
340 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; 346 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
341 347
342 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); 348 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
343 }; 349 };
344 350
345 } // namespace content 351 } // namespace content
346 352
347 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 353 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698