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

Side by Side Diff: content/browser/appcache/mock_appcache_storage.cc

Issue 932643002: Introduce AppCacheResponseMetadataWriter to support metadata caching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated michaeln's comment Created 5 years, 10 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
« no previous file with comments | « content/browser/appcache/mock_appcache_storage.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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
OLDNEW
« no previous file with comments | « content/browser/appcache/mock_appcache_storage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698