OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |