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

Side by Side Diff: net/http/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/base/net_error_list.h ('k') | net/http/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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 file declares a HttpTransactionFactory implementation that can be 5 // This file declares a HttpTransactionFactory implementation that can be
6 // layered on top of another HttpTransactionFactory to add HTTP caching. The 6 // layered on top of another HttpTransactionFactory to add HTTP caching. The
7 // caching logic follows RFC 2616 (any exceptions are called out in the code). 7 // caching logic follows RFC 2616 (any exceptions are called out in the code).
8 // 8 //
9 // The HttpCache takes a disk_cache::Backend as a parameter, and uses that for 9 // The HttpCache takes a disk_cache::Backend as a parameter, and uses that for
10 // the cache storage. 10 // the cache storage.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Close all idle connections. Will close all sockets not in active use. 180 // Close all idle connections. Will close all sockets not in active use.
181 void CloseIdleConnections(); 181 void CloseIdleConnections();
182 182
183 // Called whenever an external cache in the system reuses the resource 183 // Called whenever an external cache in the system reuses the resource
184 // referred to by |url| and |http_method|. 184 // referred to by |url| and |http_method|.
185 void OnExternalCacheHit(const GURL& url, const std::string& http_method); 185 void OnExternalCacheHit(const GURL& url, const std::string& http_method);
186 186
187 // Initializes the Infinite Cache, if selected by the field trial. 187 // Initializes the Infinite Cache, if selected by the field trial.
188 void InitializeInfiniteCache(const base::FilePath& path); 188 void InitializeInfiniteCache(const base::FilePath& path);
189 189
190 // Causes all transactions created after this point to effectively bypass
191 // the cache lock whenever there is lock contention.
192 void BypassLockForTest() {
193 bypass_lock_for_test_ = true;
194 }
195
190 // HttpTransactionFactory implementation: 196 // HttpTransactionFactory implementation:
191 virtual int CreateTransaction(RequestPriority priority, 197 virtual int CreateTransaction(RequestPriority priority,
192 scoped_ptr<HttpTransaction>* trans) OVERRIDE; 198 scoped_ptr<HttpTransaction>* trans) OVERRIDE;
193 virtual HttpCache* GetCache() OVERRIDE; 199 virtual HttpCache* GetCache() OVERRIDE;
194 virtual HttpNetworkSession* GetSession() OVERRIDE; 200 virtual HttpNetworkSession* GetSession() OVERRIDE;
195 201
196 base::WeakPtr<HttpCache> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } 202 base::WeakPtr<HttpCache> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
197 203
198 // Resets the network layer to allow for tests that probe 204 // Resets the network layer to allow for tests that probe
199 // network changes (e.g. host unreachable). The old network layer is 205 // network changes (e.g. host unreachable). The old network layer is
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // Processes the backend creation notification. 388 // Processes the backend creation notification.
383 void OnBackendCreated(int result, PendingOp* pending_op); 389 void OnBackendCreated(int result, PendingOp* pending_op);
384 390
385 // Variables ---------------------------------------------------------------- 391 // Variables ----------------------------------------------------------------
386 392
387 NetLog* net_log_; 393 NetLog* net_log_;
388 394
389 // Used when lazily constructing the disk_cache_. 395 // Used when lazily constructing the disk_cache_.
390 scoped_ptr<BackendFactory> backend_factory_; 396 scoped_ptr<BackendFactory> backend_factory_;
391 bool building_backend_; 397 bool building_backend_;
398 bool bypass_lock_for_test_;
392 399
393 Mode mode_; 400 Mode mode_;
394 401
395 scoped_ptr<QuicServerInfoFactoryAdaptor> quic_server_info_factory_; 402 scoped_ptr<QuicServerInfoFactoryAdaptor> quic_server_info_factory_;
396 403
397 scoped_ptr<HttpTransactionFactory> network_layer_; 404 scoped_ptr<HttpTransactionFactory> network_layer_;
398 405
399 scoped_ptr<disk_cache::Backend> disk_cache_; 406 scoped_ptr<disk_cache::Backend> disk_cache_;
400 407
401 // The set of active entries indexed by cache key. 408 // The set of active entries indexed by cache key.
402 ActiveEntriesMap active_entries_; 409 ActiveEntriesMap active_entries_;
403 410
404 // The set of doomed entries. 411 // The set of doomed entries.
405 ActiveEntriesSet doomed_entries_; 412 ActiveEntriesSet doomed_entries_;
406 413
407 // The set of entries "under construction". 414 // The set of entries "under construction".
408 PendingOpsMap pending_ops_; 415 PendingOpsMap pending_ops_;
409 416
410 scoped_ptr<PlaybackCacheMap> playback_cache_map_; 417 scoped_ptr<PlaybackCacheMap> playback_cache_map_;
411 418
412 base::WeakPtrFactory<HttpCache> weak_factory_; 419 base::WeakPtrFactory<HttpCache> weak_factory_;
413 420
414 DISALLOW_COPY_AND_ASSIGN(HttpCache); 421 DISALLOW_COPY_AND_ASSIGN(HttpCache);
415 }; 422 };
416 423
417 } // namespace net 424 } // namespace net
418 425
419 #endif // NET_HTTP_HTTP_CACHE_H_ 426 #endif // NET_HTTP_HTTP_CACHE_H_
OLDNEW
« no previous file with comments | « net/base/net_error_list.h ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698