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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (simulated_reader_) | 158 if (simulated_reader_) |
159 return simulated_reader_.release(); | 159 return simulated_reader_.release(); |
160 return new AppCacheResponseReader(response_id, group_id, disk_cache()); | 160 return new AppCacheResponseReader(response_id, group_id, disk_cache()); |
161 } | 161 } |
162 | 162 |
163 AppCacheResponseWriter* MockAppCacheStorage::CreateResponseWriter( | 163 AppCacheResponseWriter* MockAppCacheStorage::CreateResponseWriter( |
164 const GURL& manifest_url, int64 group_id) { | 164 const GURL& manifest_url, int64 group_id) { |
165 return new AppCacheResponseWriter(NewResponseId(), group_id, disk_cache()); | 165 return new AppCacheResponseWriter(NewResponseId(), group_id, disk_cache()); |
166 } | 166 } |
167 | 167 |
| 168 AppCacheResponseMetadataWriter* |
| 169 MockAppCacheStorage::CreateResponseMetadataWriter(int64 group_id, |
| 170 int64 response_id) { |
| 171 return new AppCacheResponseMetadataWriter(response_id, group_id, |
| 172 disk_cache()); |
| 173 } |
| 174 |
168 void MockAppCacheStorage::DoomResponses( | 175 void MockAppCacheStorage::DoomResponses( |
169 const GURL& manifest_url, const std::vector<int64>& response_ids) { | 176 const GURL& manifest_url, const std::vector<int64>& response_ids) { |
170 DeleteResponses(manifest_url, response_ids); | 177 DeleteResponses(manifest_url, response_ids); |
171 } | 178 } |
172 | 179 |
173 void MockAppCacheStorage::DeleteResponses( | 180 void MockAppCacheStorage::DeleteResponses( |
174 const GURL& manifest_url, const std::vector<int64>& response_ids) { | 181 const GURL& manifest_url, const std::vector<int64>& response_ids) { |
175 // We don't bother with actually removing responses from the disk-cache, | 182 // We don't bother with actually removing responses from the disk-cache, |
176 // just keep track of which ids have been doomed or deleted | 183 // just keep track of which ids have been doomed or deleted |
177 std::vector<int64>::const_iterator it = response_ids.begin(); | 184 std::vector<int64>::const_iterator it = response_ids.begin(); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { | 542 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { |
536 if (!cache) | 543 if (!cache) |
537 return true; | 544 return true; |
538 | 545 |
539 // If the 'stored' ref is the only ref, real storage will have to load from | 546 // If the 'stored' ref is the only ref, real storage will have to load from |
540 // the database. | 547 // the database. |
541 return IsCacheStored(cache) && cache->HasOneRef(); | 548 return IsCacheStored(cache) && cache->HasOneRef(); |
542 } | 549 } |
543 | 550 |
544 } // namespace content | 551 } // namespace content |
OLD | NEW |