Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_CHROMEOS_MEMORY_OOM_PRIORITY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_MEMORY_OOM_PRIORITY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_MEMORY_OOM_PRIORITY_MANAGER_H_ | 6 #define CHROME_BROWSER_MEMORY_OOM_PRIORITY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/memory_pressure_listener.h" | 14 #include "base/memory/memory_pressure_listener.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
| 21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 | 23 |
| 24 class GURL; | 24 class GURL; |
| 25 | 25 |
| 26 namespace chromeos { | 26 namespace memory { |
| 27 | 27 |
| 28 class LowMemoryObserver; | 28 class LowMemoryObserver; |
| 29 | 29 |
| 30 // The OomPriorityManager periodically checks (see | 30 // The OomPriorityManager periodically checks (see |
| 31 // ADJUSTMENT_INTERVAL_SECONDS in the source) the status of renderers | 31 // ADJUSTMENT_INTERVAL_SECONDS in the source) the status of renderers |
| 32 // and adjusts the out of memory (OOM) adjustment value (in | 32 // and adjusts the out of memory (OOM) adjustment value (in |
| 33 // /proc/<pid>/oom_score_adj) of the renderers so that they match the | 33 // /proc/<pid>/oom_score_adj) of the renderers so that they match the |
| 34 // algorithm embedded here for priority in being killed upon OOM | 34 // algorithm embedded here for priority in being killed upon OOM |
| 35 // conditions. | 35 // conditions. |
| 36 // | 36 // |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 void LogMemory(const std::string& title, const base::Closure& callback); | 68 void LogMemory(const std::string& title, const base::Closure& callback); |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, Comparator); | 71 FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, Comparator); |
| 72 FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, IsReloadableUI); | 72 FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, IsReloadableUI); |
| 73 FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, GetProcessHandles); | 73 FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, GetProcessHandles); |
| 74 | 74 |
| 75 struct TabStats { | 75 struct TabStats { |
| 76 TabStats(); | 76 TabStats(); |
| 77 ~TabStats(); | 77 ~TabStats(); |
| 78 bool is_app; // browser window is an app | 78 bool is_app; // browser window is an app |
|
sky
2015/06/18 19:56:56
nit: I wouldn't bother with trying to align like t
Georges Khalil
2015/06/18 20:27:47
I think that was git cl format doing its magic.
R
| |
| 79 bool is_reloadable_ui; // Reloadable web UI page, like NTP or Settings. | 79 bool is_reloadable_ui; // Reloadable web UI page, like NTP or Settings. |
| 80 bool is_playing_audio; | 80 bool is_playing_audio; |
| 81 bool is_pinned; | 81 bool is_pinned; |
| 82 bool is_selected; // selected in the currently active browser window | 82 bool is_selected; // selected in the currently active browser window |
| 83 bool is_discarded; | 83 bool is_discarded; |
| 84 base::TimeTicks last_active; | 84 base::TimeTicks last_active; |
| 85 base::ProcessHandle renderer_handle; | 85 base::ProcessHandle renderer_handle; |
| 86 int child_process_host_id; | 86 int child_process_host_id; |
| 87 base::string16 title; | 87 base::string16 title; |
| 88 int64 tab_contents_id; // unique ID per WebContents | 88 int64 tab_contents_id; // unique ID per WebContents |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 // Number of times we have discarded a tab, for statistics. | 185 // Number of times we have discarded a tab, for statistics. |
| 186 int discard_count_; | 186 int discard_count_; |
| 187 | 187 |
| 188 // Whether a tab discard event has occurred during the last time interval, | 188 // Whether a tab discard event has occurred during the last time interval, |
| 189 // used for statistics normalized by usage. | 189 // used for statistics normalized by usage. |
| 190 bool recent_tab_discard_; | 190 bool recent_tab_discard_; |
| 191 | 191 |
| 192 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); | 192 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 } // namespace chromeos | 195 } // namespace memory |
| 196 | 196 |
| 197 #endif // CHROME_BROWSER_CHROMEOS_MEMORY_OOM_PRIORITY_MANAGER_H_ | 197 #endif // CHROME_BROWSER_MEMORY_OOM_PRIORITY_MANAGER_H_ |
| OLD | NEW |