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 // This file contains an implementation of the ResourceLoaderBridge class. | 5 // This file contains an implementation of the ResourceLoaderBridge class. |
6 // The class is implemented using net::URLRequest, meaning it is a "simple" | 6 // The class is implemented using net::URLRequest, meaning it is a "simple" |
7 // version that directly issues requests. The more complicated one used in the | 7 // version that directly issues requests. The more complicated one used in the |
8 // browser uses IPC. | 8 // browser uses IPC. |
9 // | 9 // |
10 // Because net::URLRequest only provides an asynchronous resource loading API, | 10 // Because net::URLRequest only provides an asynchronous resource loading API, |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 // If a redirect is received upload is cancelled in net::URLRequest, we | 609 // If a redirect is received upload is cancelled in net::URLRequest, we |
610 // should try to stop the |upload_progress_timer_| timer and return. | 610 // should try to stop the |upload_progress_timer_| timer and return. |
611 if (!request_->has_upload()) { | 611 if (!request_->has_upload()) { |
612 if (upload_progress_timer_.IsRunning()) | 612 if (upload_progress_timer_.IsRunning()) |
613 upload_progress_timer_.Stop(); | 613 upload_progress_timer_.Stop(); |
614 return; | 614 return; |
615 } | 615 } |
616 | 616 |
617 // GetContentLengthSync() may perform file IO, but it's ok here, as file | 617 // GetContentLengthSync() may perform file IO, but it's ok here, as file |
618 // IO is not prohibited in IOThread defined in the file. | 618 // IO is not prohibited in IOThread defined in the file. |
619 uint64 size = request_->get_upload()->GetContentLengthSync(); | 619 uint64 size = request_->get_upload_mutable()->GetContentLengthSync(); |
620 uint64 position = request_->GetUploadProgress(); | 620 uint64 position = request_->GetUploadProgress(); |
621 if (position == last_upload_position_) | 621 if (position == last_upload_position_) |
622 return; // no progress made since last time | 622 return; // no progress made since last time |
623 | 623 |
624 const uint64 kHalfPercentIncrements = 200; | 624 const uint64 kHalfPercentIncrements = 200; |
625 const base::TimeDelta kOneSecond = base::TimeDelta::FromMilliseconds(1000); | 625 const base::TimeDelta kOneSecond = base::TimeDelta::FromMilliseconds(1000); |
626 | 626 |
627 uint64 amt_since_last = position - last_upload_position_; | 627 uint64 amt_since_last = position - last_upload_position_; |
628 base::TimeDelta time_since_last = base::TimeTicks::Now() - | 628 base::TimeDelta time_since_last = base::TimeTicks::Now() - |
629 last_upload_ticks_; | 629 last_upload_ticks_; |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); | 1130 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); |
1131 g_file_over_http_params = new FileOverHTTPParams(file_path_template, | 1131 g_file_over_http_params = new FileOverHTTPParams(file_path_template, |
1132 http_prefix); | 1132 http_prefix); |
1133 } | 1133 } |
1134 | 1134 |
1135 // static | 1135 // static |
1136 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( | 1136 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
1137 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 1137 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
1138 return new ResourceLoaderBridgeImpl(request_info); | 1138 return new ResourceLoaderBridgeImpl(request_info); |
1139 } | 1139 } |
OLD | NEW |