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

Side by Side Diff: content/browser/service_worker/service_worker_database.cc

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: more cleanup 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/browser/service_worker/service_worker_database.h" 5 #include "content/browser/service_worker/service_worker_database.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 506
507 // Duplicated resource id or url should not exist. 507 // Duplicated resource id or url should not exist.
508 DCHECK(pushed_resources.insert(itr->resource_id).second); 508 DCHECK(pushed_resources.insert(itr->resource_id).second);
509 DCHECK(pushed_urls.insert(itr->url).second); 509 DCHECK(pushed_urls.insert(itr->url).second);
510 510
511 PutResourceRecordToBatch(*itr, registration.version_id, &batch); 511 PutResourceRecordToBatch(*itr, registration.version_id, &batch);
512 512
513 // Delete a resource from the uncommitted list. 513 // Delete a resource from the uncommitted list.
514 batch.Delete(CreateResourceIdKey( 514 batch.Delete(CreateResourceIdKey(
515 kUncommittedResIdKeyPrefix, itr->resource_id)); 515 kUncommittedResIdKeyPrefix, itr->resource_id));
516 // Delete from the purgeable list in case this version was once deleted.
517 batch.Delete(
518 CreateResourceIdKey(kPurgeableResIdKeyPrefix, itr->resource_id));
516 } 519 }
517 520
518 // Retrieve a previous version to sweep purgeable resources. 521 // Retrieve a previous version to sweep purgeable resources.
519 RegistrationData old_registration; 522 RegistrationData old_registration;
520 status = ReadRegistrationData(registration.registration_id, 523 status = ReadRegistrationData(registration.registration_id,
521 registration.scope.GetOrigin(), 524 registration.scope.GetOrigin(),
522 &old_registration); 525 &old_registration);
523 if (status != STATUS_OK && status != STATUS_ERROR_NOT_FOUND) 526 if (status != STATUS_OK && status != STATUS_ERROR_NOT_FOUND)
524 return status; 527 return status;
525 if (status == STATUS_OK) { 528 if (status == STATUS_OK) {
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1113
1111 void ServiceWorkerDatabase::HandleWriteResult( 1114 void ServiceWorkerDatabase::HandleWriteResult(
1112 const tracked_objects::Location& from_here, 1115 const tracked_objects::Location& from_here,
1113 Status status) { 1116 Status status) {
1114 if (status != STATUS_OK) 1117 if (status != STATUS_OK)
1115 Disable(from_here, status); 1118 Disable(from_here, status);
1116 ServiceWorkerMetrics::CountWriteDatabaseResult(status); 1119 ServiceWorkerMetrics::CountWriteDatabaseResult(status);
1117 } 1120 }
1118 1121
1119 } // namespace content 1122 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698