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

Side by Side Diff: chrome/browser/cache_manager_host.cc

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/cache_manager_host.h" 5 #include "chrome/browser/cache_manager_host.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/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // Next, we try to keep the live objects in the active renders (with some 332 // Next, we try to keep the live objects in the active renders (with some
333 // room for new objects) and give whatever is left to the inactive 333 // room for new objects) and give whatever is left to the inactive
334 // renderers. 334 // renderers.
335 AttemptTactic(KEEP_LIVE_WITH_HEADROOM, active, 335 AttemptTactic(KEEP_LIVE_WITH_HEADROOM, active,
336 DIVIDE_EVENLY, inactive, &strategy) || 336 DIVIDE_EVENLY, inactive, &strategy) ||
337 // If we've gotten this far, then we are very tight on memory. Let's try 337 // If we've gotten this far, then we are very tight on memory. Let's try
338 // to at least keep around the live objects for the active renderers. 338 // to at least keep around the live objects for the active renderers.
339 AttemptTactic(KEEP_LIVE, active, DIVIDE_EVENLY, inactive, &strategy) || 339 AttemptTactic(KEEP_LIVE, active, DIVIDE_EVENLY, inactive, &strategy) ||
340 // We're basically out of memory. The best we can do is just divide up 340 // We're basically out of memory. The best we can do is just divide up
341 // what we have and soldier on. 341 // what we have and soldier on.
342 AttemptTactic(DIVIDE_EVENLY, active, DIVIDE_EVENLY, inactive, &strategy)) { 342 AttemptTactic(DIVIDE_EVENLY, active, DIVIDE_EVENLY, inactive,
343 &strategy)) {
343 // Having found a workable strategy, we enact it. 344 // Having found a workable strategy, we enact it.
344 EnactStrategy(strategy); 345 EnactStrategy(strategy);
345 } else { 346 } else {
346 // DIVIDE_EVENLY / DIVIDE_EVENLY should always succeed. 347 // DIVIDE_EVENLY / DIVIDE_EVENLY should always succeed.
347 NOTREACHED() << "Unable to find a cache allocation"; 348 NOTREACHED() << "Unable to find a cache allocation";
348 } 349 }
349 } 350 }
350 351
351 void CacheManagerHost::ReviseAllocationStrategyLater() { 352 void CacheManagerHost::ReviseAllocationStrategyLater() {
352 // Ask to be called back in a few milliseconds to actually recompute our 353 // Ask to be called back in a few milliseconds to actually recompute our
(...skipping 13 matching lines...) Expand all
366 if (idle >= TimeDelta::FromMinutes(kRendererInactiveThresholdMinutes)) { 367 if (idle >= TimeDelta::FromMinutes(kRendererInactiveThresholdMinutes)) {
367 // Moved to inactive status. This invalidates our iterator. 368 // Moved to inactive status. This invalidates our iterator.
368 inactive_renderers_.insert(*iter); 369 inactive_renderers_.insert(*iter);
369 active_renderers_.erase(*iter); 370 active_renderers_.erase(*iter);
370 iter = active_renderers_.begin(); 371 iter = active_renderers_.begin();
371 continue; 372 continue;
372 } 373 }
373 ++iter; 374 ++iter;
374 } 375 }
375 } 376 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.cc ('k') | chrome/browser/cache_manager_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698