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

Side by Side Diff: chrome/browser/chromeos/memory/oom_priority_manager.cc

Issue 1124163003: Rename OS-specific MemoryPressureMonitor implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error on ChromeOS. Created 5 years, 7 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 "chrome/browser/chromeos/memory/oom_priority_manager.h" 5 #include "chrome/browser/chromeos/memory/oom_priority_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 if (!low_memory_observer_) { 505 if (!low_memory_observer_) {
506 // Coming here we know that a renderer was just killed and memory should 506 // Coming here we know that a renderer was just killed and memory should
507 // come back into the pool. However - the memory pressure observer did 507 // come back into the pool. However - the memory pressure observer did
508 // not yet update its status and therefore we ask it to redo the 508 // not yet update its status and therefore we ask it to redo the
509 // measurement, calling us again if we have to release more. 509 // measurement, calling us again if we have to release more.
510 // Note: We do not only accelerate the discarding speed by doing another 510 // Note: We do not only accelerate the discarding speed by doing another
511 // check in short succession - we also accelerate it because the timer 511 // check in short succession - we also accelerate it because the timer
512 // driven MemoryPressureMonitor will continue to produce timed events 512 // driven MemoryPressureMonitor will continue to produce timed events
513 // on top. So the longer the cleanup phase takes, the more tabs will 513 // on top. So the longer the cleanup phase takes, the more tabs will
514 // get discarded in parallel. 514 // get discarded in parallel.
515 base::MemoryPressureMonitorChromeOS* monitor = 515 base::chromeos::MemoryPressureMonitor* monitor =
516 static_cast<base::MemoryPressureMonitorChromeOS*>( 516 base::chromeos::MemoryPressureMonitor::Get();
517 base::MemoryPressureMonitor::Get());
518 if (monitor) 517 if (monitor)
519 monitor->ScheduleEarlyCheck(); 518 monitor->ScheduleEarlyCheck();
520 } 519 }
521 break; 520 break;
522 } 521 }
523 case content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED: { 522 case content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED: {
524 bool visible = *content::Details<bool>(details).ptr(); 523 bool visible = *content::Details<bool>(details).ptr();
525 if (visible) { 524 if (visible) {
526 content::RenderProcessHost* render_host = 525 content::RenderProcessHost* render_host =
527 content::Source<content::RenderWidgetHost>(source).ptr()-> 526 content::Source<content::RenderWidgetHost>(source).ptr()->
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 // For the moment we only do something when we reach a critical state. 699 // For the moment we only do something when we reach a critical state.
701 if (memory_pressure_level == 700 if (memory_pressure_level ==
702 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) { 701 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) {
703 LogMemoryAndDiscardTab(); 702 LogMemoryAndDiscardTab();
704 } 703 }
705 // TODO(skuhne): If more memory pressure levels are introduced, we might 704 // TODO(skuhne): If more memory pressure levels are introduced, we might
706 // consider to call PurgeBrowserMemory() before CRITICAL is reached. 705 // consider to call PurgeBrowserMemory() before CRITICAL is reached.
707 } 706 }
708 707
709 } // namespace chromeos 708 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698