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

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

Issue 10736066: Adding histograms showing fraction of page load times (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
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 HttpCache::Transaction, a private class of HttpCache so 5 // This file declares HttpCache::Transaction, a private class of HttpCache so
6 // it should only be included by http_cache.cc 6 // it should only be included by http_cache.cc
7 7
8 #ifndef NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 8 #ifndef NET_HTTP_HTTP_CACHE_TRANSACTION_H_
9 #define NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 9 #define NET_HTTP_HTTP_CACHE_TRANSACTION_H_
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
15 #include "net/base/net_log.h" 15 #include "net/base/net_log.h"
16 #include "net/http/http_cache.h" 16 #include "net/http/http_cache.h"
17 #include "net/http/http_response_info.h" 17 #include "net/http/http_response_info.h"
18 #include "net/http/http_request_headers.h" 18 #include "net/http/http_request_headers.h"
19 #include "net/http/http_transaction.h" 19 #include "net/http/http_transaction.h"
20 20
21 namespace net { 21 namespace net {
22 22
23 class PartialData; 23 class PartialData;
24 struct HttpRequestInfo; 24 struct HttpRequestInfo;
25 class HttpTransactionDelegate;
25 26
26 // This is the transaction that is returned by the HttpCache transaction 27 // This is the transaction that is returned by the HttpCache transaction
27 // factory. 28 // factory.
28 class HttpCache::Transaction : public HttpTransaction { 29 class HttpCache::Transaction : public HttpTransaction {
29 public: 30 public:
30 // The transaction has the following modes, which apply to how it may access 31 // The transaction has the following modes, which apply to how it may access
31 // its cache entry. 32 // its cache entry.
32 // 33 //
33 // o If the mode of the transaction is NONE, then it is in "pass through" 34 // o If the mode of the transaction is NONE, then it is in "pass through"
34 // mode and all methods just forward to the inner network transaction. 35 // mode and all methods just forward to the inner network transaction.
(...skipping 14 matching lines...) Expand all
49 enum Mode { 50 enum Mode {
50 NONE = 0, 51 NONE = 0,
51 READ_META = 1 << 0, 52 READ_META = 1 << 0,
52 READ_DATA = 1 << 1, 53 READ_DATA = 1 << 1,
53 READ = READ_META | READ_DATA, 54 READ = READ_META | READ_DATA,
54 WRITE = 1 << 2, 55 WRITE = 1 << 2,
55 READ_WRITE = READ | WRITE, 56 READ_WRITE = READ | WRITE,
56 UPDATE = READ_META | WRITE, // READ_WRITE & ~READ_DATA 57 UPDATE = READ_META | WRITE, // READ_WRITE & ~READ_DATA
57 }; 58 };
58 59
59 explicit Transaction(HttpCache* cache); 60 Transaction(HttpCache* cache, HttpTransactionDelegate* delegate);
60 virtual ~Transaction(); 61 virtual ~Transaction();
61 62
62 Mode mode() const { return mode_; } 63 Mode mode() const { return mode_; }
63 64
64 const std::string& key() const { return cache_key_; } 65 const std::string& key() const { return cache_key_; }
65 66
66 // Writes |buf_len| bytes of meta-data from the provided buffer |buf|. to the 67 // Writes |buf_len| bytes of meta-data from the provided buffer |buf|. to the
67 // HTTP cache entry that backs this transaction (if any). 68 // HTTP cache entry that backs this transaction (if any).
68 // Returns the number of bytes actually written, or a net error code. If the 69 // Returns the number of bytes actually written, or a net error code. If the
69 // operation cannot complete immediately, returns ERR_IO_PENDING, grabs a 70 // operation cannot complete immediately, returns ERR_IO_PENDING, grabs a
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 int DoPartialCacheReadCompleted(int result); 328 int DoPartialCacheReadCompleted(int result);
328 329
329 // Returns true if we should bother attempting to resume this request if it 330 // Returns true if we should bother attempting to resume this request if it
330 // is aborted while in progress. If |has_data| is true, the size of the stored 331 // is aborted while in progress. If |has_data| is true, the size of the stored
331 // data is considered for the result. 332 // data is considered for the result.
332 bool CanResume(bool has_data); 333 bool CanResume(bool has_data);
333 334
334 // Called to signal completion of asynchronous IO. 335 // Called to signal completion of asynchronous IO.
335 void OnIOComplete(int result); 336 void OnIOComplete(int result);
336 337
338 void ReportCacheActionStart();
339 void ReportCacheActionFinish();
340
337 State next_state_; 341 State next_state_;
338 const HttpRequestInfo* request_; 342 const HttpRequestInfo* request_;
339 BoundNetLog net_log_; 343 BoundNetLog net_log_;
340 scoped_ptr<HttpRequestInfo> custom_request_; 344 scoped_ptr<HttpRequestInfo> custom_request_;
341 HttpRequestHeaders request_headers_copy_; 345 HttpRequestHeaders request_headers_copy_;
342 // If extra_headers specified a "if-modified-since" or "if-none-match", 346 // If extra_headers specified a "if-modified-since" or "if-none-match",
343 // |external_validation_| contains the value of those headers. 347 // |external_validation_| contains the value of those headers.
344 ValidationHeaders external_validation_; 348 ValidationHeaders external_validation_;
345 base::WeakPtr<HttpCache> cache_; 349 base::WeakPtr<HttpCache> cache_;
346 HttpCache::ActiveEntry* entry_; 350 HttpCache::ActiveEntry* entry_;
(...skipping 17 matching lines...) Expand all
364 bool done_reading_; 368 bool done_reading_;
365 scoped_refptr<IOBuffer> read_buf_; 369 scoped_refptr<IOBuffer> read_buf_;
366 int io_buf_len_; 370 int io_buf_len_;
367 int read_offset_; 371 int read_offset_;
368 int effective_load_flags_; 372 int effective_load_flags_;
369 int write_len_; 373 int write_len_;
370 scoped_ptr<PartialData> partial_; // We are dealing with range requests. 374 scoped_ptr<PartialData> partial_; // We are dealing with range requests.
371 uint64 final_upload_progress_; 375 uint64 final_upload_progress_;
372 base::WeakPtrFactory<Transaction> weak_factory_; 376 base::WeakPtrFactory<Transaction> weak_factory_;
373 CompletionCallback io_callback_; 377 CompletionCallback io_callback_;
378 HttpTransactionDelegate* delegate_;
mmenke 2012/07/27 19:03:54 Suggest you call this transaction_delegate_, to ma
tburkard 2012/07/27 23:25:44 Done.
374 }; 379 };
375 380
376 } // namespace net 381 } // namespace net
377 382
378 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 383 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698