| 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 "content/browser/loader/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 uint64 amt_since_last = progress.position() - last_upload_position_; | 152 uint64 amt_since_last = progress.position() - last_upload_position_; |
| 153 TimeDelta time_since_last = TimeTicks::Now() - last_upload_ticks_; | 153 TimeDelta time_since_last = TimeTicks::Now() - last_upload_ticks_; |
| 154 | 154 |
| 155 bool is_finished = (progress.size() == progress.position()); | 155 bool is_finished = (progress.size() == progress.position()); |
| 156 bool enough_new_progress = | 156 bool enough_new_progress = |
| 157 (amt_since_last > (progress.size() / kHalfPercentIncrements)); | 157 (amt_since_last > (progress.size() / kHalfPercentIncrements)); |
| 158 bool too_much_time_passed = time_since_last > kOneSecond; | 158 bool too_much_time_passed = time_since_last > kOneSecond; |
| 159 | 159 |
| 160 if (is_finished || enough_new_progress || too_much_time_passed) { | 160 if (is_finished || enough_new_progress || too_much_time_passed) { |
| 161 if (request_->load_flags() & net::LOAD_ENABLE_UPLOAD_PROGRESS) { | 161 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 162 if (info->is_upload_progress_enabled()) { |
| 162 handler_->OnUploadProgress(progress.position(), progress.size()); | 163 handler_->OnUploadProgress(progress.position(), progress.size()); |
| 163 waiting_for_upload_progress_ack_ = true; | 164 waiting_for_upload_progress_ack_ = true; |
| 164 } | 165 } |
| 165 last_upload_ticks_ = TimeTicks::Now(); | 166 last_upload_ticks_ = TimeTicks::Now(); |
| 166 last_upload_position_ = progress.position(); | 167 last_upload_position_ = progress.position(); |
| 167 } | 168 } |
| 168 } | 169 } |
| 169 | 170 |
| 170 void ResourceLoader::MarkAsTransferring() { | 171 void ResourceLoader::MarkAsTransferring() { |
| 171 CHECK(IsResourceTypeFrame(GetRequestInfo()->GetResourceType())) | 172 CHECK(IsResourceTypeFrame(GetRequestInfo()->GetResourceType())) |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); | 705 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); |
| 705 } | 706 } |
| 706 } | 707 } |
| 707 | 708 |
| 708 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { | 709 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { |
| 709 ssl_client_auth_handler_.reset(); | 710 ssl_client_auth_handler_.reset(); |
| 710 request_->ContinueWithCertificate(cert); | 711 request_->ContinueWithCertificate(cert); |
| 711 } | 712 } |
| 712 | 713 |
| 713 } // namespace content | 714 } // namespace content |
| OLD | NEW |