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

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: rebase Created 8 years, 3 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 LoadState state = GetWriterLoadState(); 412 LoadState state = GetWriterLoadState();
414 if (state != LOAD_STATE_WAITING_FOR_CACHE) 413 if (state != LOAD_STATE_WAITING_FOR_CACHE)
415 return state; 414 return state;
416 415
417 if (cache_) 416 if (cache_)
418 return cache_->GetLoadStateForPendingTransaction(this); 417 return cache_->GetLoadStateForPendingTransaction(this);
419 418
420 return LOAD_STATE_IDLE; 419 return LOAD_STATE_IDLE;
421 } 420 }
422 421
423 uint64 HttpCache::Transaction::GetUploadProgress() const { 422 UploadProgress HttpCache::Transaction::GetUploadProgress() const {
424 if (network_trans_.get()) 423 if (network_trans_.get())
425 return network_trans_->GetUploadProgress(); 424 return network_trans_->GetUploadProgress();
426 return final_upload_progress_; 425 return final_upload_progress_;
darin (slow to review) 2012/08/29 22:05:35 nothing seems to ever assign a value to final_uplo
hashimoto 2012/08/29 22:27:08 HttpCache::Transaction::DoUpdateCachedResponseComp
427 } 426 }
428 427
429 //----------------------------------------------------------------------------- 428 //-----------------------------------------------------------------------------
430 429
431 void HttpCache::Transaction::DoCallback(int rv) { 430 void HttpCache::Transaction::DoCallback(int rv) {
432 DCHECK(rv != ERR_IO_PENDING); 431 DCHECK(rv != ERR_IO_PENDING);
433 DCHECK(!callback_.is_null()); 432 DCHECK(!callback_.is_null());
434 433
435 // Since Run may result in Read being called, clear callback_ up front. 434 // Since Run may result in Read being called, clear callback_ up front.
436 CompletionCallback c = callback_; 435 CompletionCallback c = callback_;
(...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 before_send_percent); 2372 before_send_percent);
2374 } 2373 }
2375 break; 2374 break;
2376 } 2375 }
2377 default: 2376 default:
2378 NOTREACHED(); 2377 NOTREACHED();
2379 } 2378 }
2380 } 2379 }
2381 2380
2382 } // namespace net 2381 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698