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

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

Issue 10834178: net: Return size of upload as well as position from HttpTransaction::GetUploadProgress() (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 #include "net/http/http_cache_transaction.h" 5 #include "net/http/http_cache_transaction.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 invalid_range_(false), 128 invalid_range_(false),
129 truncated_(false), 129 truncated_(false),
130 is_sparse_(false), 130 is_sparse_(false),
131 range_requested_(false), 131 range_requested_(false),
132 handling_206_(false), 132 handling_206_(false),
133 cache_pending_(false), 133 cache_pending_(false),
134 done_reading_(false), 134 done_reading_(false),
135 read_offset_(0), 135 read_offset_(0),
136 effective_load_flags_(0), 136 effective_load_flags_(0),
137 write_len_(0), 137 write_len_(0),
138 final_upload_progress_(0),
139 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 138 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
140 ALLOW_THIS_IN_INITIALIZER_LIST(io_callback_( 139 ALLOW_THIS_IN_INITIALIZER_LIST(io_callback_(
141 base::Bind(&Transaction::OnIOComplete, 140 base::Bind(&Transaction::OnIOComplete,
142 weak_factory_.GetWeakPtr()))), 141 weak_factory_.GetWeakPtr()))),
143 transaction_pattern_(PATTERN_UNDEFINED), 142 transaction_pattern_(PATTERN_UNDEFINED),
144 bytes_read_from_cache_(0), 143 bytes_read_from_cache_(0),
145 bytes_read_from_network_(0), 144 bytes_read_from_network_(0),
146 transaction_delegate_(transaction_delegate) { 145 transaction_delegate_(transaction_delegate) {
147 COMPILE_ASSERT(HttpCache::Transaction::kNumValidationHeaders == 146 COMPILE_ASSERT(HttpCache::Transaction::kNumValidationHeaders ==
148 arraysize(kValidationHeaders), 147 arraysize(kValidationHeaders),
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 LoadState state = GetWriterLoadState(); 410 LoadState state = GetWriterLoadState();
412 if (state != LOAD_STATE_WAITING_FOR_CACHE) 411 if (state != LOAD_STATE_WAITING_FOR_CACHE)
413 return state; 412 return state;
414 413
415 if (cache_) 414 if (cache_)
416 return cache_->GetLoadStateForPendingTransaction(this); 415 return cache_->GetLoadStateForPendingTransaction(this);
417 416
418 return LOAD_STATE_IDLE; 417 return LOAD_STATE_IDLE;
419 } 418 }
420 419
421 uint64 HttpCache::Transaction::GetUploadProgress() const { 420 UploadProgress HttpCache::Transaction::GetUploadProgress() const {
422 if (network_trans_.get()) 421 if (network_trans_.get())
423 return network_trans_->GetUploadProgress(); 422 return network_trans_->GetUploadProgress();
424 return final_upload_progress_; 423 return final_upload_progress_;
425 } 424 }
426 425
427 //----------------------------------------------------------------------------- 426 //-----------------------------------------------------------------------------
428 427
429 void HttpCache::Transaction::DoCallback(int rv) { 428 void HttpCache::Transaction::DoCallback(int rv) {
430 DCHECK(rv != ERR_IO_PENDING); 429 DCHECK(rv != ERR_IO_PENDING);
431 DCHECK(!callback_.is_null()); 430 DCHECK(!callback_.is_null());
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 before_send_percent); 2348 before_send_percent);
2350 } 2349 }
2351 break; 2350 break;
2352 } 2351 }
2353 default: 2352 default:
2354 NOTREACHED(); 2353 NOTREACHED();
2355 } 2354 }
2356 } 2355 }
2357 2356
2358 } // namespace net 2357 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698