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

Side by Side Diff: chrome/browser/renderer_host/web_cache_manager.cc

Issue 6602049: Pure pedantry: Replace all ".size() == 0" with ".empty()". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/web_cache_manager.h" 5 #include "chrome/browser/renderer_host/web_cache_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 250
251 void WebCacheManager::AddToStrategy(const std::set<int>& renderers, 251 void WebCacheManager::AddToStrategy(const std::set<int>& renderers,
252 AllocationTactic tactic, 252 AllocationTactic tactic,
253 size_t extra_bytes_to_allocate, 253 size_t extra_bytes_to_allocate,
254 AllocationStrategy* strategy) { 254 AllocationStrategy* strategy) {
255 DCHECK(strategy); 255 DCHECK(strategy);
256 256
257 // Nothing to do if there are no renderers. It is common for there to be no 257 // Nothing to do if there are no renderers. It is common for there to be no
258 // inactive renderers if there is a single active tab. 258 // inactive renderers if there is a single active tab.
259 if (renderers.size() == 0) 259 if (renderers.empty())
260 return; 260 return;
261 261
262 // Divide the extra memory evenly among the renderers. 262 // Divide the extra memory evenly among the renderers.
263 size_t extra_each = extra_bytes_to_allocate / renderers.size(); 263 size_t extra_each = extra_bytes_to_allocate / renderers.size();
264 264
265 std::set<int>::const_iterator iter = renderers.begin(); 265 std::set<int>::const_iterator iter = renderers.begin();
266 while (iter != renderers.end()) { 266 while (iter != renderers.end()) {
267 size_t cache_size = extra_each; 267 size_t cache_size = extra_each;
268 268
269 // Add in the space required to implement |tactic|. 269 // Add in the space required to implement |tactic|.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 if (idle >= TimeDelta::FromMinutes(kRendererInactiveThresholdMinutes)) { 401 if (idle >= TimeDelta::FromMinutes(kRendererInactiveThresholdMinutes)) {
402 // Moved to inactive status. This invalidates our iterator. 402 // Moved to inactive status. This invalidates our iterator.
403 inactive_renderers_.insert(*iter); 403 inactive_renderers_.insert(*iter);
404 active_renderers_.erase(*iter); 404 active_renderers_.erase(*iter);
405 iter = active_renderers_.begin(); 405 iter = active_renderers_.begin();
406 continue; 406 continue;
407 } 407 }
408 ++iter; 408 ++iter;
409 } 409 }
410 } 410 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698