Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Side by Side Diff: content/browser/loader/async_resource_handler.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/async_resource_handler.h" 5 #include "content/browser/loader/async_resource_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/debug/alias.h" 12 #include "base/debug/alias.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h"
14 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
15 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
16 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "content/browser/devtools/devtools_netlog_observer.h" 19 #include "content/browser/devtools/devtools_netlog_observer.h"
19 #include "content/browser/host_zoom_map_impl.h" 20 #include "content/browser/host_zoom_map_impl.h"
20 #include "content/browser/loader/resource_buffer.h" 21 #include "content/browser/loader/resource_buffer.h"
21 #include "content/browser/loader/resource_dispatcher_host_impl.h" 22 #include "content/browser/loader/resource_dispatcher_host_impl.h"
22 #include "content/browser/loader/resource_message_filter.h" 23 #include "content/browser/loader/resource_message_filter.h"
23 #include "content/browser/loader/resource_request_info_impl.h" 24 #include "content/browser/loader/resource_request_info_impl.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (waiting_for_upload_progress_ack_) 138 if (waiting_for_upload_progress_ack_)
138 return; // Send one progress event at a time. 139 return; // Send one progress event at a time.
139 140
140 net::UploadProgress progress = request()->GetUploadProgress(); 141 net::UploadProgress progress = request()->GetUploadProgress();
141 if (!progress.size()) 142 if (!progress.size())
142 return; // Nothing to upload. 143 return; // Nothing to upload.
143 144
144 if (progress.position() == last_upload_position_) 145 if (progress.position() == last_upload_position_)
145 return; // No progress made since last time. 146 return; // No progress made since last time.
146 147
147 const uint64 kHalfPercentIncrements = 200; 148 const uint64_t kHalfPercentIncrements = 200;
148 const TimeDelta kOneSecond = TimeDelta::FromMilliseconds(1000); 149 const TimeDelta kOneSecond = TimeDelta::FromMilliseconds(1000);
149 150
150 uint64 amt_since_last = progress.position() - last_upload_position_; 151 uint64_t amt_since_last = progress.position() - last_upload_position_;
151 TimeDelta time_since_last = TimeTicks::Now() - last_upload_ticks_; 152 TimeDelta time_since_last = TimeTicks::Now() - last_upload_ticks_;
152 153
153 bool is_finished = (progress.size() == progress.position()); 154 bool is_finished = (progress.size() == progress.position());
154 bool enough_new_progress = 155 bool enough_new_progress =
155 (amt_since_last > (progress.size() / kHalfPercentIncrements)); 156 (amt_since_last > (progress.size() / kHalfPercentIncrements));
156 bool too_much_time_passed = time_since_last > kOneSecond; 157 bool too_much_time_passed = time_since_last > kOneSecond;
157 158
158 if (is_finished || enough_new_progress || too_much_time_passed) { 159 if (is_finished || enough_new_progress || too_much_time_passed) {
159 ResourceMessageFilter* filter = GetFilter(); 160 ResourceMessageFilter* filter = GetFilter();
160 if (filter) { 161 if (filter) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 request()->LogUnblocked(); 438 request()->LogUnblocked();
438 controller()->Resume(); 439 controller()->Resume();
439 } 440 }
440 } 441 }
441 442
442 void AsyncResourceHandler::OnDefer() { 443 void AsyncResourceHandler::OnDefer() {
443 request()->LogBlockedBy("AsyncResourceHandler"); 444 request()->LogBlockedBy("AsyncResourceHandler");
444 } 445 }
445 446
446 } // namespace content 447 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/async_resource_handler.h ('k') | content/browser/loader/async_resource_handler_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698