| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |