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

Side by Side Diff: chrome/browser/oom_priority_manager.h

Issue 7930022: chromeos: Set a least score to the currently focused tab so that it is not selected (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ 5 #ifndef CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_
6 #define CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ 6 #define CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 typedef std::vector<RendererStats> StatsList; 61 typedef std::vector<RendererStats> StatsList;
62 typedef base::hash_map<base::ProcessHandle, int> ProcessScoreMap; 62 typedef base::hash_map<base::ProcessHandle, int> ProcessScoreMap;
63 63
64 // Posts DoAdjustOomPriorities task to the file thread. Called when 64 // Posts DoAdjustOomPriorities task to the file thread. Called when
65 // the timer fires. 65 // the timer fires.
66 void AdjustOomPriorities(); 66 void AdjustOomPriorities();
67 67
68 // Called by AdjustOomPriorities. Runs on the file thread. 68 // Called by AdjustOomPriorities. Runs on the file thread.
69 void DoAdjustOomPriorities(); 69 void DoAdjustOomPriorities();
70 70
71 // Called when a tab comes into focus. Runs on the file thread.
72 // Sets the score of only the currently focused tab to the least value.
73 void AdjustTabScore(base::ProcessHandle pid);
74
71 static bool CompareRendererStats(RendererStats first, RendererStats second); 75 static bool CompareRendererStats(RendererStats first, RendererStats second);
72 76
73 virtual void Observe(int type, 77 virtual void Observe(int type,
74 const NotificationSource& source, 78 const NotificationSource& source,
75 const NotificationDetails& details); 79 const NotificationDetails& details);
76 80
77 base::RepeatingTimer<OomPriorityManager> timer_; 81 base::RepeatingTimer<OomPriorityManager> timer_;
78 // renderer_stats_ is used on both UI and file threads. 82 // renderer_stats_ is used on both UI and file threads.
79 base::Lock renderer_stats_lock_; 83 base::Lock renderer_stats_lock_;
80 StatsList renderer_stats_; 84 StatsList renderer_stats_;
85 // This lock is for pid_to_oom_score_ and last_set_score_.
James Cook 2011/09/19 17:08:55 Thanks for a separate comment!
86 base::Lock pid_to_oom_score_lock_;
81 // map maintaining the process - oom_score map. 87 // map maintaining the process - oom_score map.
82 base::Lock pid_to_oom_score_lock_;
83 ProcessScoreMap pid_to_oom_score_; 88 ProcessScoreMap pid_to_oom_score_;
84 NotificationRegistrar registrar_; 89 NotificationRegistrar registrar_;
90 int last_used_score_;
85 91
86 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); 92 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager);
87 }; 93 };
88 94
89 } // namespace browser 95 } // namespace browser
90 96
91 DISABLE_RUNNABLE_METHOD_REFCOUNT(browser::OomPriorityManager); 97 DISABLE_RUNNABLE_METHOD_REFCOUNT(browser::OomPriorityManager);
92 98
93 #endif // CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ 99 #endif // CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/oom_priority_manager.cc » ('j') | chrome/browser/oom_priority_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698