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

Side by Side Diff: net/url_request/url_fetcher_core.cc

Issue 10830182: net: Return size of upload as well as position from URLRequest::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
« no previous file with comments | « content/browser/renderer_host/resource_loader.cc ('k') | net/url_request/url_request.h » ('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 #include "net/url_request/url_fetcher_core.h" 5 #include "net/url_request/url_fetcher_core.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util_proxy.h" 8 #include "base/file_util_proxy.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 OnReadCompleted(request_.get(), bytes_read); 939 OnReadCompleted(request_.get(), bytes_read);
940 } 940 }
941 941
942 void URLFetcherCore::DisownFile() { 942 void URLFetcherCore::DisownFile() {
943 file_writer_->DisownFile(); 943 file_writer_->DisownFile();
944 } 944 }
945 945
946 void URLFetcherCore::InformDelegateUploadProgress() { 946 void URLFetcherCore::InformDelegateUploadProgress() {
947 DCHECK(network_task_runner_->BelongsToCurrentThread()); 947 DCHECK(network_task_runner_->BelongsToCurrentThread());
948 if (request_.get()) { 948 if (request_.get()) {
949 int64 current = request_->GetUploadProgress(); 949 int64 current = request_->GetUploadProgress().position;
950 if (current_upload_bytes_ != current) { 950 if (current_upload_bytes_ != current) {
951 current_upload_bytes_ = current; 951 current_upload_bytes_ = current;
952 int64 total = -1; 952 int64 total = -1;
953 if (!is_chunked_upload_) 953 if (!is_chunked_upload_)
954 total = static_cast<int64>(upload_content_.size()); 954 total = static_cast<int64>(upload_content_.size());
955 delegate_task_runner_->PostTask( 955 delegate_task_runner_->PostTask(
956 FROM_HERE, 956 FROM_HERE,
957 base::Bind( 957 base::Bind(
958 &URLFetcherCore::InformDelegateUploadProgressInDelegateThread, 958 &URLFetcherCore::InformDelegateUploadProgressInDelegateThread,
959 this, current, total)); 959 this, current, total));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } 998 }
999 999
1000 void URLFetcherCore::InformDelegateDownloadDataInDelegateThread( 1000 void URLFetcherCore::InformDelegateDownloadDataInDelegateThread(
1001 scoped_ptr<std::string> download_data) { 1001 scoped_ptr<std::string> download_data) {
1002 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); 1002 DCHECK(delegate_task_runner_->BelongsToCurrentThread());
1003 if (delegate_) 1003 if (delegate_)
1004 delegate_->OnURLFetchDownloadData(fetcher_, download_data.Pass()); 1004 delegate_->OnURLFetchDownloadData(fetcher_, download_data.Pass());
1005 } 1005 }
1006 1006
1007 } // namespace net 1007 } // namespace net
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_loader.cc ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698