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