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

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

Issue 413063004: Service Worker: in Unregister, wait until after the active worker no longer controls a document (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete/restore from storage Created 6 years, 4 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 | Annotate | Revision Log
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_STORAGE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // (the callback may be called prior to the method returning) or 80 // (the callback may be called prior to the method returning) or
81 // asynchronously. 81 // asynchronously.
82 void FindRegistrationForDocument(const GURL& document_url, 82 void FindRegistrationForDocument(const GURL& document_url,
83 const FindRegistrationCallback& callback); 83 const FindRegistrationCallback& callback);
84 void FindRegistrationForPattern(const GURL& scope, 84 void FindRegistrationForPattern(const GURL& scope,
85 const FindRegistrationCallback& callback); 85 const FindRegistrationCallback& callback);
86 void FindRegistrationForId(int64 registration_id, 86 void FindRegistrationForId(int64 registration_id,
87 const GURL& origin, 87 const GURL& origin,
88 const FindRegistrationCallback& callback); 88 const FindRegistrationCallback& callback);
89 89
90 scoped_refptr<ServiceWorkerRegistration> GetUninstallingRegistration(
91 const GURL& scope);
92
90 // Returns info about all stored and initially installing registrations. 93 // Returns info about all stored and initially installing registrations.
91 void GetAllRegistrations(const GetAllRegistrationInfosCallback& callback); 94 void GetAllRegistrations(const GetAllRegistrationInfosCallback& callback);
92 95
93 // Commits |registration| with the installed but not activated |version| 96 // Commits |registration| with the installed but not activated |version|
94 // to storage, overwritting any pre-existing registration data for the scope. 97 // to storage, overwritting any pre-existing registration data for the scope.
95 // A pre-existing version's script resources remain available if that version 98 // A pre-existing version's script resources remain available if that version
96 // is live. PurgeResources should be called when it's OK to delete them. 99 // is live. PurgeResources should be called when it's OK to delete them.
97 void StoreRegistration( 100 void StoreRegistration(
98 ServiceWorkerRegistration* registration, 101 ServiceWorkerRegistration* registration,
99 ServiceWorkerVersion* version, 102 ServiceWorkerVersion* version,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 int64 NewVersionId(); 139 int64 NewVersionId();
137 int64 NewResourceId(); 140 int64 NewResourceId();
138 141
139 // Intended for use only by ServiceWorkerRegisterJob. 142 // Intended for use only by ServiceWorkerRegisterJob.
140 void NotifyInstallingRegistration( 143 void NotifyInstallingRegistration(
141 ServiceWorkerRegistration* registration); 144 ServiceWorkerRegistration* registration);
142 void NotifyDoneInstallingRegistration( 145 void NotifyDoneInstallingRegistration(
143 ServiceWorkerRegistration* registration, 146 ServiceWorkerRegistration* registration,
144 ServiceWorkerVersion* version, 147 ServiceWorkerVersion* version,
145 ServiceWorkerStatusCode status); 148 ServiceWorkerStatusCode status);
149 // Intended for use only by ServiceWorkerRegistration.
150 void NotifyUninstallingRegistration(ServiceWorkerRegistration* registration);
151 void NotifyDoneUninstallingRegistration(
152 ServiceWorkerRegistration* registration);
146 153
147 void Disable(); 154 void Disable();
148 bool IsDisabled() const; 155 bool IsDisabled() const;
149 156
150 // |resources| must already be on the purgeable list. 157 // |resources| must already be on the purgeable list.
151 void PurgeResources(const ResourceList& resources); 158 void PurgeResources(const ResourceList& resources);
152 159
153 private: 160 private:
154 friend class ServiceWorkerResourceStorageTest; 161 friend class ServiceWorkerResourceStorageTest;
155 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest, 162 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 const FindInDBCallback& callback); 321 const FindInDBCallback& callback);
315 322
316 void ScheduleDeleteAndStartOver(); 323 void ScheduleDeleteAndStartOver();
317 void DidDeleteDatabase( 324 void DidDeleteDatabase(
318 const StatusCallback& callback, 325 const StatusCallback& callback,
319 ServiceWorkerDatabase::Status status); 326 ServiceWorkerDatabase::Status status);
320 void DidDeleteDiskCache( 327 void DidDeleteDiskCache(
321 const StatusCallback& callback, 328 const StatusCallback& callback,
322 bool result); 329 bool result);
323 330
324 // For finding registrations being installed. 331 // For finding registrations being installed or uninstalled.
325 RegistrationRefsById installing_registrations_; 332 RegistrationRefsById installing_registrations_;
333 RegistrationRefsById uninstalling_registrations_;
326 334
327 // Origins having registations. 335 // Origins having registations.
328 std::set<GURL> registered_origins_; 336 std::set<GURL> registered_origins_;
329 337
330 // Pending database tasks waiting for initialization. 338 // Pending database tasks waiting for initialization.
331 std::vector<base::Closure> pending_tasks_; 339 std::vector<base::Closure> pending_tasks_;
332 340
333 int64 next_registration_id_; 341 int64 next_registration_id_;
334 int64 next_version_id_; 342 int64 next_version_id_;
335 int64 next_resource_id_; 343 int64 next_resource_id_;
(...skipping 21 matching lines...) Expand all
357 bool has_checked_for_stale_resources_; 365 bool has_checked_for_stale_resources_;
358 366
359 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; 367 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_;
360 368
361 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); 369 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage);
362 }; 370 };
363 371
364 } // namespace content 372 } // namespace content
365 373
366 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ 374 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698