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

Side by Side Diff: chrome/browser/renderer_host/web_cache_manager.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
« no previous file with comments | « chrome/browser/prerender/prerender_manager.cc ('k') | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // Compute the unreserved space available. 225 // Compute the unreserved space available.
226 size_t total_extra = global_size_limit_ - (active_size + inactive_size); 226 size_t total_extra = global_size_limit_ - (active_size + inactive_size);
227 227
228 // The plan for the extra space is to divide it evenly amoung the active 228 // The plan for the extra space is to divide it evenly amoung the active
229 // renderers. 229 // renderers.
230 size_t shares = active_renderers_.size(); 230 size_t shares = active_renderers_.size();
231 231
232 // The inactive renderers get one share of the extra memory to be divided 232 // The inactive renderers get one share of the extra memory to be divided
233 // among themselves. 233 // among themselves.
234 size_t inactive_extra = 0; 234 size_t inactive_extra = 0;
235 if (inactive_renderers_.size() > 0) { 235 if (!inactive_renderers_.empty()) {
236 ++shares; 236 ++shares;
237 inactive_extra = total_extra / shares; 237 inactive_extra = total_extra / shares;
238 } 238 }
239 239
240 // The remaining memory is allocated to the active renderers. 240 // The remaining memory is allocated to the active renderers.
241 size_t active_extra = total_extra - inactive_extra; 241 size_t active_extra = total_extra - inactive_extra;
242 242
243 // Actually compute the allocations for each renderer. 243 // Actually compute the allocations for each renderer.
244 AddToStrategy(active_renderers_, active_tactic, active_extra, strategy); 244 AddToStrategy(active_renderers_, active_tactic, active_extra, strategy);
245 AddToStrategy(inactive_renderers_, inactive_tactic, inactive_extra, strategy); 245 AddToStrategy(inactive_renderers_, inactive_tactic, inactive_extra, strategy);
(...skipping 155 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
« no previous file with comments | « chrome/browser/prerender/prerender_manager.cc ('k') | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698