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

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

Issue 360123002: ServiceWorker: some more groundwork in support of the update process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 #include "content/browser/service_worker/service_worker_storage.h" 5 #include "content/browser/service_worker/service_worker_storage.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 scoped_refptr<ServiceWorkerVersion> version = 739 scoped_refptr<ServiceWorkerVersion> version =
740 context_->GetLiveVersion(data.version_id); 740 context_->GetLiveVersion(data.version_id);
741 if (!version) { 741 if (!version) {
742 version = new ServiceWorkerVersion(registration, data.version_id, context_); 742 version = new ServiceWorkerVersion(registration, data.version_id, context_);
743 version->SetStatus(data.is_active ? 743 version->SetStatus(data.is_active ?
744 ServiceWorkerVersion::ACTIVE : ServiceWorkerVersion::INSTALLED); 744 ServiceWorkerVersion::ACTIVE : ServiceWorkerVersion::INSTALLED);
745 version->script_cache_map()->SetResources(resources); 745 version->script_cache_map()->SetResources(resources);
746 } 746 }
747 747
748 if (version->status() == ServiceWorkerVersion::ACTIVE) 748 if (version->status() == ServiceWorkerVersion::ACTIVE)
749 registration->set_active_version(version); 749 registration->SetActiveVersion(version);
750 else if (version->status() == ServiceWorkerVersion::INSTALLED) 750 else if (version->status() == ServiceWorkerVersion::INSTALLED)
751 registration->set_waiting_version(version); 751 registration->SetWaitingVersion(version);
752 else 752 else
753 NOTREACHED(); 753 NOTREACHED();
754 // TODO(michaeln): Hmmm, what if DeleteReg was invoked after 754 // TODO(michaeln): Hmmm, what if DeleteReg was invoked after
755 // the Find result we're returning here? NOTREACHED condition? 755 // the Find result we're returning here? NOTREACHED condition?
756 return registration; 756 return registration;
757 } 757 }
758 758
759 ServiceWorkerRegistration* 759 ServiceWorkerRegistration*
760 ServiceWorkerStorage::FindInstallingRegistrationForDocument( 760 ServiceWorkerStorage::FindInstallingRegistrationForDocument(
761 const GURL& document_url) { 761 const GURL& document_url) {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 // Give up the corruption recovery until the browser restarts. 1130 // Give up the corruption recovery until the browser restarts.
1131 LOG(ERROR) << "Failed to delete the diskcache."; 1131 LOG(ERROR) << "Failed to delete the diskcache.";
1132 callback.Run(SERVICE_WORKER_ERROR_FAILED); 1132 callback.Run(SERVICE_WORKER_ERROR_FAILED);
1133 return; 1133 return;
1134 } 1134 }
1135 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; 1135 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully.";
1136 callback.Run(SERVICE_WORKER_OK); 1136 callback.Run(SERVICE_WORKER_OK);
1137 } 1137 }
1138 1138
1139 } // namespace content 1139 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698