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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 OnReadCompleted(request_.get(), bytes_read); | 937 OnReadCompleted(request_.get(), bytes_read); |
938 } | 938 } |
939 | 939 |
940 void URLFetcherCore::DisownFile() { | 940 void URLFetcherCore::DisownFile() { |
941 file_writer_->DisownFile(); | 941 file_writer_->DisownFile(); |
942 } | 942 } |
943 | 943 |
944 void URLFetcherCore::InformDelegateUploadProgress() { | 944 void URLFetcherCore::InformDelegateUploadProgress() { |
945 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 945 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
946 if (request_.get()) { | 946 if (request_.get()) { |
947 int64 current = request_->GetUploadProgress(); | 947 int64 current = request_->GetUploadProgress().position(); |
948 if (current_upload_bytes_ != current) { | 948 if (current_upload_bytes_ != current) { |
949 current_upload_bytes_ = current; | 949 current_upload_bytes_ = current; |
950 int64 total = -1; | 950 int64 total = -1; |
951 if (!is_chunked_upload_) | 951 if (!is_chunked_upload_) |
952 total = static_cast<int64>(upload_content_.size()); | 952 total = static_cast<int64>(upload_content_.size()); |
953 delegate_task_runner_->PostTask( | 953 delegate_task_runner_->PostTask( |
954 FROM_HERE, | 954 FROM_HERE, |
955 base::Bind( | 955 base::Bind( |
956 &URLFetcherCore::InformDelegateUploadProgressInDelegateThread, | 956 &URLFetcherCore::InformDelegateUploadProgressInDelegateThread, |
957 this, current, total)); | 957 this, current, total)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 } | 996 } |
997 | 997 |
998 void URLFetcherCore::InformDelegateDownloadDataInDelegateThread( | 998 void URLFetcherCore::InformDelegateDownloadDataInDelegateThread( |
999 scoped_ptr<std::string> download_data) { | 999 scoped_ptr<std::string> download_data) { |
1000 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); | 1000 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); |
1001 if (delegate_) | 1001 if (delegate_) |
1002 delegate_->OnURLFetchDownloadData(fetcher_, download_data.Pass()); | 1002 delegate_->OnURLFetchDownloadData(fetcher_, download_data.Pass()); |
1003 } | 1003 } |
1004 | 1004 |
1005 } // namespace net | 1005 } // namespace net |
OLD | NEW |