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

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

Issue 374873002: Service Worker: Delay stale resource cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing 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 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_script_cache_map.h" 5 #include "content/browser/service_worker/service_worker_script_cache_map.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/service_worker/service_worker_context_core.h" 8 #include "content/browser/service_worker/service_worker_context_core.h"
9 #include "content/browser/service_worker/service_worker_storage.h" 9 #include "content/browser/service_worker/service_worker_storage.h"
10 #include "content/browser/service_worker/service_worker_version.h" 10 #include "content/browser/service_worker/service_worker_version.h"
(...skipping 18 matching lines...) Expand all
29 return kInvalidServiceWorkerResponseId; 29 return kInvalidServiceWorkerResponseId;
30 return found->second; 30 return found->second;
31 } 31 }
32 32
33 void ServiceWorkerScriptCacheMap::NotifyStartedCaching( 33 void ServiceWorkerScriptCacheMap::NotifyStartedCaching(
34 const GURL& url, int64 resource_id) { 34 const GURL& url, int64 resource_id) {
35 DCHECK_EQ(kInvalidServiceWorkerResponseId, Lookup(url)); 35 DCHECK_EQ(kInvalidServiceWorkerResponseId, Lookup(url));
36 DCHECK(owner_->status() == ServiceWorkerVersion::NEW || 36 DCHECK(owner_->status() == ServiceWorkerVersion::NEW ||
37 owner_->status() == ServiceWorkerVersion::INSTALLING); 37 owner_->status() == ServiceWorkerVersion::INSTALLING);
38 resource_ids_[url] = resource_id; 38 resource_ids_[url] = resource_id;
39 context_->storage()->StoreUncommittedReponseId(resource_id); 39 context_->storage()->StoreUncommittedResponseId(resource_id);
40 } 40 }
41 41
42 void ServiceWorkerScriptCacheMap::NotifyFinishedCaching( 42 void ServiceWorkerScriptCacheMap::NotifyFinishedCaching(
43 const GURL& url, bool success) { 43 const GURL& url, bool success) {
44 DCHECK_NE(kInvalidServiceWorkerResponseId, Lookup(url)); 44 DCHECK_NE(kInvalidServiceWorkerResponseId, Lookup(url));
45 DCHECK(owner_->status() == ServiceWorkerVersion::NEW || 45 DCHECK(owner_->status() == ServiceWorkerVersion::NEW ||
46 owner_->status() == ServiceWorkerVersion::INSTALLING); 46 owner_->status() == ServiceWorkerVersion::INSTALLING);
47 if (!success) { 47 if (!success) {
48 context_->storage()->DoomUncommittedResponse(Lookup(url)); 48 context_->storage()->DoomUncommittedResponse(Lookup(url));
49 has_error_ = true; 49 has_error_ = true;
(...skipping 15 matching lines...) Expand all
65 const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources) { 65 const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources) {
66 DCHECK(resource_ids_.empty()); 66 DCHECK(resource_ids_.empty());
67 typedef std::vector<ServiceWorkerDatabase::ResourceRecord> RecordVector; 67 typedef std::vector<ServiceWorkerDatabase::ResourceRecord> RecordVector;
68 for (RecordVector::const_iterator it = resources.begin(); 68 for (RecordVector::const_iterator it = resources.begin();
69 it != resources.end(); ++it) { 69 it != resources.end(); ++it) {
70 resource_ids_[it->url] = it->resource_id; 70 resource_ids_[it->url] = it->resource_id;
71 } 71 }
72 } 72 }
73 73
74 } // namespace content 74 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698