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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/process_util.h" // GetSystemMemoryInfo | 8 #include "base/process_util.h" // GetSystemMemoryInfo |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 NotificationService::AllSources()); | 59 NotificationService::AllSources()); |
60 UpdateTextAndSetNextTimer(); | 60 UpdateTextAndSetNextTimer(); |
61 } | 61 } |
62 | 62 |
63 MemoryMenuButton::~MemoryMenuButton() { | 63 MemoryMenuButton::~MemoryMenuButton() { |
64 } | 64 } |
65 | 65 |
66 void MemoryMenuButton::UpdateTextAndSetNextTimer() { | 66 void MemoryMenuButton::UpdateTextAndSetNextTimer() { |
67 UpdateText(); | 67 UpdateText(); |
68 | 68 |
69 timer_.Start(base::TimeDelta::FromSeconds(kUpdateIntervalSeconds), this, | 69 timer_.Start(FROM_HERE, |
| 70 base::TimeDelta::FromSeconds(kUpdateIntervalSeconds), this, |
70 &MemoryMenuButton::UpdateTextAndSetNextTimer); | 71 &MemoryMenuButton::UpdateTextAndSetNextTimer); |
71 } | 72 } |
72 | 73 |
73 void MemoryMenuButton::UpdateText() { | 74 void MemoryMenuButton::UpdateText() { |
74 base::GetSystemMemoryInfo(meminfo_.get()); | 75 base::GetSystemMemoryInfo(meminfo_.get()); |
75 // "Anonymous" memory, meaning not mapped to a file (which has a name), | 76 // "Anonymous" memory, meaning not mapped to a file (which has a name), |
76 // represents memory that has been dynamically allocated to a process. | 77 // represents memory that has been dynamically allocated to a process. |
77 // It thus approximates heap memory usage across all processes. | 78 // It thus approximates heap memory usage across all processes. |
78 int anon_kb = meminfo_->active_anon + meminfo_->inactive_anon; | 79 int anon_kb = meminfo_->active_anon + meminfo_->inactive_anon; |
79 std::wstring label = base::StringPrintf(L"%d MB (%d)", | 80 std::wstring label = base::StringPrintf(L"%d MB (%d)", |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 262 } |
262 break; | 263 break; |
263 } | 264 } |
264 default: | 265 default: |
265 NOTREACHED() << L"Received unexpected notification"; | 266 NOTREACHED() << L"Received unexpected notification"; |
266 break; | 267 break; |
267 } | 268 } |
268 } | 269 } |
269 | 270 |
270 } // namespace chromeos | 271 } // namespace chromeos |
OLD | NEW |