OLD | NEW |
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 // Note: this file is used by Aura on all linux platforms, even though it |
| 6 // is currently in a chromeos specific location. |
| 7 |
5 #include "chrome/browser/chromeos/status/memory_menu_button.h" | 8 #include "chrome/browser/chromeos/status/memory_menu_button.h" |
6 | 9 |
7 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
8 #include "base/file_util.h" | 11 #include "base/file_util.h" |
9 #include "base/process_util.h" // GetSystemMemoryInfo | 12 #include "base/process_util.h" // GetSystemMemoryInfo |
10 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
11 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
12 #include "chrome/browser/chromeos/view_ids.h" | 15 #include "chrome/browser/chromeos/view_ids.h" |
13 #include "chrome/browser/memory_purger.h" | 16 #include "chrome/browser/memory_purger.h" |
14 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
(...skipping 24 matching lines...) Expand all Loading... |
39 SHMEM_ITEM, | 42 SHMEM_ITEM, |
40 PURGE_MEMORY_ITEM, | 43 PURGE_MEMORY_ITEM, |
41 #if defined(USE_TCMALLOC) | 44 #if defined(USE_TCMALLOC) |
42 TOGGLE_PROFILING_ITEM, | 45 TOGGLE_PROFILING_ITEM, |
43 DUMP_PROFILING_ITEM, | 46 DUMP_PROFILING_ITEM, |
44 #endif | 47 #endif |
45 }; | 48 }; |
46 | 49 |
47 } // namespace | 50 } // namespace |
48 | 51 |
49 namespace chromeos { | |
50 | |
51 // Delay between updates, in seconds. | 52 // Delay between updates, in seconds. |
52 const int kUpdateIntervalSeconds = 5; | 53 const int kUpdateIntervalSeconds = 5; |
53 | 54 |
54 MemoryMenuButton::MemoryMenuButton(StatusAreaButton::Delegate* delegate) | 55 MemoryMenuButton::MemoryMenuButton(StatusAreaButton::Delegate* delegate) |
55 : StatusAreaButton(delegate, this), | 56 : StatusAreaButton(delegate, this), |
56 meminfo_(new base::SystemMemoryInfoKB()), | 57 meminfo_(new base::SystemMemoryInfoKB()), |
57 renderer_kills_(0) { | 58 renderer_kills_(0) { |
58 set_id(VIEW_ID_STATUS_BUTTON_MEMORY); | 59 set_id(VIEW_ID_STATUS_BUTTON_MEMORY); |
59 // Track renderer kills, as the kernel OOM killer will start to kill our | 60 // Track renderer kills, as the kernel OOM killer will start to kill our |
60 // renderers as we run out of memory. | 61 // renderers as we run out of memory. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // A kill is a very interesting event, so repaint immediately. | 271 // A kill is a very interesting event, so repaint immediately. |
271 UpdateText(); | 272 UpdateText(); |
272 } | 273 } |
273 break; | 274 break; |
274 } | 275 } |
275 default: | 276 default: |
276 NOTREACHED() << L"Received unexpected notification"; | 277 NOTREACHED() << L"Received unexpected notification"; |
277 break; | 278 break; |
278 } | 279 } |
279 } | 280 } |
280 | |
281 } // namespace chromeos | |
OLD | NEW |