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

Side by Side Diff: net/http/mock_http_cache.h

Issue 345643003: Http cache: Implement a timeout for the cache lock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add constant Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/mock_http_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This is a mock of the http cache and related testing classes. To be fair, it 5 // This is a mock of the http cache and related testing classes. To be fair, it
6 // is not really a mock http cache given that it uses the real implementation of 6 // is not really a mock http cache given that it uses the real implementation of
7 // the http cache, but it has fake implementations of all required components, 7 // the http cache, but it has fake implementations of all required components,
8 // so it is useful for unit tests at the http layer. 8 // so it is useful for unit tests at the http layer.
9 9
10 #ifndef NET_HTTP_MOCK_HTTP_CACHE_H_ 10 #ifndef NET_HTTP_MOCK_HTTP_CACHE_H_
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 net::HttpCache* http_cache() { return &http_cache_; } 170 net::HttpCache* http_cache() { return &http_cache_; }
171 171
172 MockNetworkLayer* network_layer() { 172 MockNetworkLayer* network_layer() {
173 return static_cast<MockNetworkLayer*>(http_cache_.network_layer()); 173 return static_cast<MockNetworkLayer*>(http_cache_.network_layer());
174 } 174 }
175 MockDiskCache* disk_cache(); 175 MockDiskCache* disk_cache();
176 176
177 // Wrapper around http_cache()->CreateTransaction(net::DEFAULT_PRIORITY...) 177 // Wrapper around http_cache()->CreateTransaction(net::DEFAULT_PRIORITY...)
178 int CreateTransaction(scoped_ptr<net::HttpTransaction>* trans); 178 int CreateTransaction(scoped_ptr<net::HttpTransaction>* trans);
179 179
180 // Wrapper to bypass the cache lock for new transactions.
181 void BypassCacheLock();
182
180 // Helper function for reading response info from the disk cache. 183 // Helper function for reading response info from the disk cache.
181 static bool ReadResponseInfo(disk_cache::Entry* disk_entry, 184 static bool ReadResponseInfo(disk_cache::Entry* disk_entry,
182 net::HttpResponseInfo* response_info, 185 net::HttpResponseInfo* response_info,
183 bool* response_truncated); 186 bool* response_truncated);
184 187
185 // Helper function for writing response info into the disk cache. 188 // Helper function for writing response info into the disk cache.
186 static bool WriteResponseInfo(disk_cache::Entry* disk_entry, 189 static bool WriteResponseInfo(disk_cache::Entry* disk_entry,
187 const net::HttpResponseInfo* response_info, 190 const net::HttpResponseInfo* response_info,
188 bool skip_transient_headers, 191 bool skip_transient_headers,
189 bool response_truncated); 192 bool response_truncated);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 private: 244 private:
242 int Result() { return fail_ ? net::ERR_FAILED : net::OK; } 245 int Result() { return fail_ ? net::ERR_FAILED : net::OK; }
243 246
244 scoped_ptr<disk_cache::Backend>* backend_; 247 scoped_ptr<disk_cache::Backend>* backend_;
245 net::CompletionCallback callback_; 248 net::CompletionCallback callback_;
246 bool block_; 249 bool block_;
247 bool fail_; 250 bool fail_;
248 }; 251 };
249 252
250 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ 253 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_
OLDNEW
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/mock_http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698