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

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

Issue 293483002: Store the service worker script and its imports on first load... really (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nix compile Created 6 years, 7 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_version.h" 8 #include "content/browser/service_worker/service_worker_version.h"
9 #include "content/common/service_worker/service_worker_types.h" 9 #include "content/common/service_worker/service_worker_types.h"
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 resource_ids_.erase(url); 43 resource_ids_.erase(url);
44 // TODO(michaeln): Doom the resource id. 44 // TODO(michaeln): Doom the resource id.
45 } 45 }
46 } 46 }
47 47
48 void ServiceWorkerScriptCacheMap::GetResources( 48 void ServiceWorkerScriptCacheMap::GetResources(
49 std::vector<ServiceWorkerDatabase::ResourceRecord>* resources) { 49 std::vector<ServiceWorkerDatabase::ResourceRecord>* resources) {
50 DCHECK(resources->empty()); 50 DCHECK(resources->empty());
51 for (ResourceIDMap::const_iterator it = resource_ids_.begin(); 51 for (ResourceIDMap::const_iterator it = resource_ids_.begin();
52 it != resource_ids_.end(); ++it) { 52 it != resource_ids_.end(); ++it) {
53 ServiceWorkerDatabase::ResourceRecord record = { it->second, it->first }; 53 resources->push_back(
54 resources->push_back(record); 54 ServiceWorkerDatabase::ResourceRecord(it->second, it->first));
55 } 55 }
56 } 56 }
57 57
58 void ServiceWorkerScriptCacheMap::SetResources( 58 void ServiceWorkerScriptCacheMap::SetResources(
59 const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources) { 59 const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources) {
60 DCHECK(resource_ids_.empty()); 60 DCHECK(resource_ids_.empty());
61 typedef std::vector<ServiceWorkerDatabase::ResourceRecord> RecordVector; 61 typedef std::vector<ServiceWorkerDatabase::ResourceRecord> RecordVector;
62 for (RecordVector::const_iterator it = resources.begin(); 62 for (RecordVector::const_iterator it = resources.begin();
63 it != resources.end(); ++it) { 63 it != resources.end(); ++it) {
64 resource_ids_[it->url] = it->resource_id; 64 resource_ids_[it->url] = it->resource_id;
65 } 65 }
66 } 66 }
67 67
68 } // namespace content 68 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_register_job.cc ('k') | content/browser/service_worker/service_worker_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698