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 #include "chrome/browser/chromeos/status/memory_menu_button.h" | 5 #include "chrome/browser/chromeos/status/memory_menu_button.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/process_util.h" // GetSystemMemoryInfo | 9 #include "base/process_util.h" // GetSystemMemoryInfo |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
11 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
12 #include "chrome/browser/chromeos/view_ids.h" | |
13 #include "chrome/browser/memory_purger.h" | 12 #include "chrome/browser/memory_purger.h" |
| 13 #include "chrome/browser/ui/view_ids.h" |
14 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
15 #include "content/browser/renderer_host/render_process_host.h" | 15 #include "content/browser/renderer_host/render_process_host.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
20 #include "views/controls/menu/menu_runner.h" | 20 #include "views/controls/menu/menu_runner.h" |
21 #include "views/widget/widget.h" | 21 #include "views/widget/widget.h" |
22 | 22 |
23 #if defined(USE_TCMALLOC) | 23 #if defined(USE_TCMALLOC) |
(...skipping 15 matching lines...) Expand all Loading... |
39 SHMEM_ITEM, | 39 SHMEM_ITEM, |
40 PURGE_MEMORY_ITEM, | 40 PURGE_MEMORY_ITEM, |
41 #if defined(USE_TCMALLOC) | 41 #if defined(USE_TCMALLOC) |
42 TOGGLE_PROFILING_ITEM, | 42 TOGGLE_PROFILING_ITEM, |
43 DUMP_PROFILING_ITEM, | 43 DUMP_PROFILING_ITEM, |
44 #endif | 44 #endif |
45 }; | 45 }; |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 namespace chromeos { | |
50 | |
51 // Delay between updates, in seconds. | 49 // Delay between updates, in seconds. |
52 const int kUpdateIntervalSeconds = 5; | 50 const int kUpdateIntervalSeconds = 5; |
53 | 51 |
54 MemoryMenuButton::MemoryMenuButton(StatusAreaButton::Delegate* delegate) | 52 MemoryMenuButton::MemoryMenuButton(StatusAreaButton::Delegate* delegate) |
55 : StatusAreaButton(delegate, this), | 53 : StatusAreaButton(delegate, this), |
56 meminfo_(new base::SystemMemoryInfoKB()), | 54 meminfo_(new base::SystemMemoryInfoKB()), |
57 renderer_kills_(0) { | 55 renderer_kills_(0) { |
58 set_id(VIEW_ID_STATUS_BUTTON_MEMORY); | 56 set_id(VIEW_ID_STATUS_BUTTON_MEMORY); |
59 // Track renderer kills, as the kernel OOM killer will start to kill our | 57 // Track renderer kills, as the kernel OOM killer will start to kill our |
60 // renderers as we run out of memory. | 58 // 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. | 268 // A kill is a very interesting event, so repaint immediately. |
271 UpdateText(); | 269 UpdateText(); |
272 } | 270 } |
273 break; | 271 break; |
274 } | 272 } |
275 default: | 273 default: |
276 NOTREACHED() << L"Received unexpected notification"; | 274 NOTREACHED() << L"Received unexpected notification"; |
277 break; | 275 break; |
278 } | 276 } |
279 } | 277 } |
280 | |
281 } // namespace chromeos | |
OLD | NEW |