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/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 // Always make this method look async. | 149 // Always make this method look async. |
150 ScheduleTask( | 150 ScheduleTask( |
151 base::Bind(&MockAppCacheStorage::ProcessMakeGroupObsolete, | 151 base::Bind(&MockAppCacheStorage::ProcessMakeGroupObsolete, |
152 weak_factory_.GetWeakPtr(), | 152 weak_factory_.GetWeakPtr(), |
153 make_scoped_refptr(group), | 153 make_scoped_refptr(group), |
154 make_scoped_refptr(GetOrCreateDelegateReference(delegate)), | 154 make_scoped_refptr(GetOrCreateDelegateReference(delegate)), |
155 response_code)); | 155 response_code)); |
156 } | 156 } |
157 | 157 |
| 158 void MockAppCacheStorage::StoreEvictionTimes(AppCacheGroup* group) { |
| 159 stored_eviction_times_[group->group_id()] = |
| 160 std::make_pair(group->last_full_update_check_time(), |
| 161 group->first_evictable_error_time()); |
| 162 } |
| 163 |
158 AppCacheResponseReader* MockAppCacheStorage::CreateResponseReader( | 164 AppCacheResponseReader* MockAppCacheStorage::CreateResponseReader( |
159 const GURL& manifest_url, int64 group_id, int64 response_id) { | 165 const GURL& manifest_url, int64 group_id, int64 response_id) { |
160 if (simulated_reader_) | 166 if (simulated_reader_) |
161 return simulated_reader_.release(); | 167 return simulated_reader_.release(); |
162 return new AppCacheResponseReader(response_id, group_id, disk_cache()); | 168 return new AppCacheResponseReader(response_id, group_id, disk_cache()); |
163 } | 169 } |
164 | 170 |
165 AppCacheResponseWriter* MockAppCacheStorage::CreateResponseWriter( | 171 AppCacheResponseWriter* MockAppCacheStorage::CreateResponseWriter( |
166 const GURL& manifest_url, int64 group_id) { | 172 const GURL& manifest_url, int64 group_id) { |
167 return new AppCacheResponseWriter(NewResponseId(), group_id, disk_cache()); | 173 return new AppCacheResponseWriter(NewResponseId(), group_id, disk_cache()); |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { | 549 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { |
544 if (!cache) | 550 if (!cache) |
545 return true; | 551 return true; |
546 | 552 |
547 // If the 'stored' ref is the only ref, real storage will have to load from | 553 // If the 'stored' ref is the only ref, real storage will have to load from |
548 // the database. | 554 // the database. |
549 return IsCacheStored(cache) && cache->HasOneRef(); | 555 return IsCacheStored(cache) && cache->HasOneRef(); |
550 } | 556 } |
551 | 557 |
552 } // namespace content | 558 } // namespace content |
OLD | NEW |