diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-23 23:53:08 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-23 23:53:08 +0000 |
commit | 96af6d4d2ea59c487a866ba6fc844c801f4c80f9 (patch) | |
tree | 431c8caabdf7a314e0fb058c851e2e8280d21b1d /chrome/browser/oom_priority_manager.h | |
parent | 4a6ed0d466e886bb9cedf38aa5081342c1489679 (diff) | |
download | chromium_src-96af6d4d2ea59c487a866ba6fc844c801f4c80f9.zip chromium_src-96af6d4d2ea59c487a866ba6fc844c801f4c80f9.tar.gz chromium_src-96af6d4d2ea59c487a866ba6fc844c801f4c80f9.tar.bz2 |
Revert 67175 - This change implements OOM priority management for ChromeOS
(Build failure, probably debug/release warning difference.)
This adds periodic OOM score adjustment, based on the last access time of the tab, whether or not it is pinned, and (of course) how much memory it is using.
BUG=http://crosbug.com/8990
TEST=Ran some ui_tests, ran on device.
Review URL: http://codereview.chromium.org/4498001
TBR=gspencer@chromium.org
Review URL: http://codereview.chromium.org/5284003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/oom_priority_manager.h')
-rw-r--r-- | chrome/browser/oom_priority_manager.h | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/chrome/browser/oom_priority_manager.h b/chrome/browser/oom_priority_manager.h deleted file mode 100644 index 55ce733..0000000 --- a/chrome/browser/oom_priority_manager.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ -#define CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ - -#include <list> - -#include "base/timer.h" -#include "base/process.h" - -namespace browser { - -// The OomPriorityManager periodically checks (see -// ADJUSTMENT_INTERVAL_SECONDS in the source) the status of renderers -// and adjusts the out of memory (OOM) adjustment value (in -// /proc/<pid>/oom_adj) of the renderers so that they match the -// algorithm embedded here for priority in being killed upon OOM -// conditions. -// -// The algorithm used favors killing tabs that are not pinned, have -// been idle for longest, and take up the most memory, in that order -// of priority. We round the idle times to the nearest few minutes -// (see BUCKET_INTERVAL_MINUTES in the source) so that we can bucket -// them, as no two tabs will have exactly the same idle time. -class OomPriorityManager { - public: - OomPriorityManager(); - ~OomPriorityManager(); - - private: - struct RendererStats { - bool is_pinned; - base::TimeTicks last_selected; - size_t memory_used; - base::ProcessHandle renderer_handle; - }; - typedef std::list<RendererStats> StatsList; - - void StartTimer(); - void StopTimer(); - - // Posts DoAdjustOomPriorities task to the file thread. Called when - // the timer fires. - void AdjustOomPriorities(); - - // Called by AdjustOomPriorities. Runs on the file thread. - void DoAdjustOomPriorities(StatsList list); - - static bool CompareRendererStats(RendererStats first, RendererStats second); - - base::RepeatingTimer<OomPriorityManager> timer_; - - DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); -}; -} // namespace browser - -DISABLE_RUNNABLE_METHOD_REFCOUNT(browser::OomPriorityManager); - -#endif // CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ |