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/appcache/mock_appcache_storage.h" | 5 #include "content/browser/appcache/mock_appcache_storage.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 | 159 |
160 void MockAppCacheStorage::StoreEvictionTimes(AppCacheGroup* group) { | 160 void MockAppCacheStorage::StoreEvictionTimes(AppCacheGroup* group) { |
161 stored_eviction_times_[group->group_id()] = | 161 stored_eviction_times_[group->group_id()] = |
162 std::make_pair(group->last_full_update_check_time(), | 162 std::make_pair(group->last_full_update_check_time(), |
163 group->first_evictable_error_time()); | 163 group->first_evictable_error_time()); |
164 } | 164 } |
165 | 165 |
166 AppCacheResponseReader* MockAppCacheStorage::CreateResponseReader( | 166 AppCacheResponseReader* MockAppCacheStorage::CreateResponseReader( |
167 const GURL& manifest_url, | 167 const GURL& manifest_url, |
168 int64_t group_id, | |
169 int64_t response_id) { | 168 int64_t response_id) { |
170 if (simulated_reader_) | 169 if (simulated_reader_) |
171 return simulated_reader_.release(); | 170 return simulated_reader_.release(); |
172 return new AppCacheResponseReader(response_id, group_id, | 171 return new AppCacheResponseReader(response_id, disk_cache()->GetWeakPtr()); |
173 disk_cache()->GetWeakPtr()); | |
174 } | 172 } |
175 | 173 |
176 AppCacheResponseWriter* MockAppCacheStorage::CreateResponseWriter( | 174 AppCacheResponseWriter* MockAppCacheStorage::CreateResponseWriter( |
177 const GURL& manifest_url, | 175 const GURL& manifest_url) { |
178 int64_t group_id) { | 176 return new AppCacheResponseWriter(NewResponseId(), |
179 return new AppCacheResponseWriter(NewResponseId(), group_id, | |
180 disk_cache()->GetWeakPtr()); | 177 disk_cache()->GetWeakPtr()); |
181 } | 178 } |
182 | 179 |
183 AppCacheResponseMetadataWriter* | 180 AppCacheResponseMetadataWriter* |
184 MockAppCacheStorage::CreateResponseMetadataWriter(int64_t group_id, | 181 MockAppCacheStorage::CreateResponseMetadataWriter(int64_t response_id) { |
185 int64_t response_id) { | 182 return new AppCacheResponseMetadataWriter(response_id, |
186 return new AppCacheResponseMetadataWriter(response_id, group_id, | |
187 disk_cache()->GetWeakPtr()); | 183 disk_cache()->GetWeakPtr()); |
188 } | 184 } |
189 | 185 |
190 void MockAppCacheStorage::DoomResponses( | 186 void MockAppCacheStorage::DoomResponses( |
191 const GURL& manifest_url, | 187 const GURL& manifest_url, |
192 const std::vector<int64_t>& response_ids) { | 188 const std::vector<int64_t>& response_ids) { |
193 DeleteResponses(manifest_url, response_ids); | 189 DeleteResponses(manifest_url, response_ids); |
194 } | 190 } |
195 | 191 |
196 void MockAppCacheStorage::DeleteResponses( | 192 void MockAppCacheStorage::DeleteResponses( |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { | 555 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { |
560 if (!cache) | 556 if (!cache) |
561 return true; | 557 return true; |
562 | 558 |
563 // If the 'stored' ref is the only ref, real storage will have to load from | 559 // If the 'stored' ref is the only ref, real storage will have to load from |
564 // the database. | 560 // the database. |
565 return IsCacheStored(cache) && cache->HasOneRef(); | 561 return IsCacheStored(cache) && cache->HasOneRef(); |
566 } | 562 } |
567 | 563 |
568 } // namespace content | 564 } // namespace content |
OLD | NEW |