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

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

Issue 182993003: Add the ability for DevTools to wrap network transactions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 | « chrome/test/base/testing_profile.cc ('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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const base::FilePath path_; 117 const base::FilePath path_;
118 int max_bytes_; 118 int max_bytes_;
119 scoped_refptr<base::MessageLoopProxy> thread_; 119 scoped_refptr<base::MessageLoopProxy> thread_;
120 }; 120 };
121 121
122 // The disk cache is initialized lazily (by CreateTransaction) in this case. 122 // The disk cache is initialized lazily (by CreateTransaction) in this case.
123 // The HttpCache takes ownership of the |backend_factory|. 123 // The HttpCache takes ownership of the |backend_factory|.
124 HttpCache(const net::HttpNetworkSession::Params& params, 124 HttpCache(const net::HttpNetworkSession::Params& params,
125 BackendFactory* backend_factory); 125 BackendFactory* backend_factory);
126 126
127 // The disk cache is initialized lazily (by CreateTransaction) in this case. 127 // The disk cache is initialized lazily (by CreateTransaction) in this case.
128 // Provide an existing HttpNetworkSession, the cache can construct a 128 // Provide an existing HttpNetworkSession, the cache can construct a
129 // network layer with a shared HttpNetworkSession in order for multiple 129 // network layer with a shared HttpNetworkSession in order for multiple
130 // network layers to share information (e.g. authentication data). The 130 // network layers to share information (e.g. authentication data). The
131 // HttpCache takes ownership of the |backend_factory|. 131 // HttpCache takes ownership of the |backend_factory|.
132 HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory); 132 HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory);
133 133
134 // Initialize the cache from its component parts, which is useful for 134 // Initialize the cache from its component parts. The lifetime of the
135 // testing. The lifetime of the network_layer and backend_factory are managed 135 // |network_layer| and |backend_factory| are managed by the HttpCache and
136 // by the HttpCache and will be destroyed using |delete| when the HttpCache is 136 // will be destroyed using |delete| when the HttpCache is destroyed.
137 // destroyed.
138 HttpCache(HttpTransactionFactory* network_layer, 137 HttpCache(HttpTransactionFactory* network_layer,
139 NetLog* net_log, 138 NetLog* net_log,
140 BackendFactory* backend_factory); 139 BackendFactory* backend_factory);
141 140
142 virtual ~HttpCache(); 141 virtual ~HttpCache();
143 142
144 HttpTransactionFactory* network_layer() { return network_layer_.get(); } 143 HttpTransactionFactory* network_layer() { return network_layer_.get(); }
145 144
146 // Retrieves the cache backend for this HttpCache instance. If the backend 145 // Retrieves the cache backend for this HttpCache instance. If the backend
147 // is not initialized yet, this method will initialize it. The return value is 146 // is not initialized yet, this method will initialize it. The return value is
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 void RemovePendingTransaction(Transaction* trans); 347 void RemovePendingTransaction(Transaction* trans);
349 348
350 // Removes the transaction |trans|, from the pending list of |entry|. 349 // Removes the transaction |trans|, from the pending list of |entry|.
351 bool RemovePendingTransactionFromEntry(ActiveEntry* entry, 350 bool RemovePendingTransactionFromEntry(ActiveEntry* entry,
352 Transaction* trans); 351 Transaction* trans);
353 352
354 // Removes the transaction |trans|, from the pending list of |pending_op|. 353 // Removes the transaction |trans|, from the pending list of |pending_op|.
355 bool RemovePendingTransactionFromPendingOp(PendingOp* pending_op, 354 bool RemovePendingTransactionFromPendingOp(PendingOp* pending_op,
356 Transaction* trans); 355 Transaction* trans);
357 356
357 // Instantiates and sets QUIC server info factory.
358 void SetupQuicServerInfoFactory(HttpNetworkSession* session);
359
358 // Resumes processing the pending list of |entry|. 360 // Resumes processing the pending list of |entry|.
359 void ProcessPendingQueue(ActiveEntry* entry); 361 void ProcessPendingQueue(ActiveEntry* entry);
360 362
361 // Events (called via PostTask) --------------------------------------------- 363 // Events (called via PostTask) ---------------------------------------------
362 364
363 void OnProcessPendingQueue(ActiveEntry* entry); 365 void OnProcessPendingQueue(ActiveEntry* entry);
364 366
365 // Callbacks ---------------------------------------------------------------- 367 // Callbacks ----------------------------------------------------------------
366 368
367 // Processes BackendCallback notifications. 369 // Processes BackendCallback notifications.
(...skipping 15 matching lines...) Expand all
383 // Variables ---------------------------------------------------------------- 385 // Variables ----------------------------------------------------------------
384 386
385 NetLog* net_log_; 387 NetLog* net_log_;
386 388
387 // Used when lazily constructing the disk_cache_. 389 // Used when lazily constructing the disk_cache_.
388 scoped_ptr<BackendFactory> backend_factory_; 390 scoped_ptr<BackendFactory> backend_factory_;
389 bool building_backend_; 391 bool building_backend_;
390 392
391 Mode mode_; 393 Mode mode_;
392 394
393 const scoped_ptr<QuicServerInfoFactoryAdaptor> quic_server_info_factory_; 395 scoped_ptr<QuicServerInfoFactoryAdaptor> quic_server_info_factory_;
394 396
395 scoped_ptr<HttpTransactionFactory> network_layer_; 397 scoped_ptr<HttpTransactionFactory> network_layer_;
396 398
397 scoped_ptr<disk_cache::Backend> disk_cache_; 399 scoped_ptr<disk_cache::Backend> disk_cache_;
398 400
399 // The set of active entries indexed by cache key. 401 // The set of active entries indexed by cache key.
400 ActiveEntriesMap active_entries_; 402 ActiveEntriesMap active_entries_;
401 403
402 // The set of doomed entries. 404 // The set of doomed entries.
403 ActiveEntriesSet doomed_entries_; 405 ActiveEntriesSet doomed_entries_;
404 406
405 // The set of entries "under construction". 407 // The set of entries "under construction".
406 PendingOpsMap pending_ops_; 408 PendingOpsMap pending_ops_;
407 409
408 scoped_ptr<PlaybackCacheMap> playback_cache_map_; 410 scoped_ptr<PlaybackCacheMap> playback_cache_map_;
409 411
410 base::WeakPtrFactory<HttpCache> weak_factory_; 412 base::WeakPtrFactory<HttpCache> weak_factory_;
411 413
412 DISALLOW_COPY_AND_ASSIGN(HttpCache); 414 DISALLOW_COPY_AND_ASSIGN(HttpCache);
413 }; 415 };
414 416
415 } // namespace net 417 } // namespace net
416 418
417 #endif // NET_HTTP_HTTP_CACHE_H_ 419 #endif // NET_HTTP_HTTP_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698