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

Side by Side Diff: net/url_request/url_request_throttler_entry.cc

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_request_throttler_entry.h" 5 #include "net/url_request/url_request_throttler_entry.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 bool URLRequestThrottlerEntry::IsEntryOutdated() const { 68 bool URLRequestThrottlerEntry::IsEntryOutdated() const {
69 CHECK(this); // to help track crbug.com/71721 69 CHECK(this); // to help track crbug.com/71721
70 if (entry_lifetime_ms_ == -1) 70 if (entry_lifetime_ms_ == -1)
71 return false; 71 return false;
72 72
73 base::TimeTicks now = GetTimeNow(); 73 base::TimeTicks now = GetTimeNow();
74 74
75 // If there are send events in the sliding window period, we still need this 75 // If there are send events in the sliding window period, we still need this
76 // entry. 76 // entry.
77 if (send_log_.size() > 0 && 77 if (!send_log_.empty() &&
78 send_log_.back() + sliding_window_period_ > now) { 78 send_log_.back() + sliding_window_period_ > now) {
79 return false; 79 return false;
80 } 80 }
81 81
82 int64 unused_since_ms = 82 int64 unused_since_ms =
83 (now - exponential_backoff_release_time_).InMilliseconds(); 83 (now - exponential_backoff_release_time_).InMilliseconds();
84 84
85 // Release time is further than now, we are managing it. 85 // Release time is further than now, we are managing it.
86 if (unused_since_ms < 0) 86 if (unused_since_ms < 0)
87 return false; 87 return false;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 if (maximum_backoff_ms_ < value_ms || value_ms < 0) 239 if (maximum_backoff_ms_ < value_ms || value_ms < 0)
240 return; 240 return;
241 241
242 exponential_backoff_release_time_ = std::max( 242 exponential_backoff_release_time_ = std::max(
243 (GetTimeNow() + base::TimeDelta::FromMilliseconds(value_ms)), 243 (GetTimeNow() + base::TimeDelta::FromMilliseconds(value_ms)),
244 exponential_backoff_release_time_); 244 exponential_backoff_release_time_);
245 } 245 }
246 246
247 } // namespace net 247 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_tracker.cc ('k') | net/websockets/websocket_handshake_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698