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 #include "chrome/browser/memory_details.h" | 5 #include "chrome/browser/memory_details.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // TODO(viettrungluu): possibly add more? | 41 // TODO(viettrungluu): possibly add more? |
42 CHROME_BROWSER = 0, | 42 CHROME_BROWSER = 0, |
43 SAFARI_BROWSER, | 43 SAFARI_BROWSER, |
44 FIREFOX_BROWSER, | 44 FIREFOX_BROWSER, |
45 CAMINO_BROWSER, | 45 CAMINO_BROWSER, |
46 OPERA_BROWSER, | 46 OPERA_BROWSER, |
47 OMNIWEB_BROWSER, | 47 OMNIWEB_BROWSER, |
48 MAX_BROWSERS | 48 MAX_BROWSERS |
49 } BrowserProcess; | 49 } BrowserProcess; |
50 | 50 |
51 | 51 MemoryDetails::MemoryDetails() { |
52 MemoryDetails::MemoryDetails() | |
53 : user_metrics_mode_(UPDATE_USER_METRICS), | |
54 memory_growth_tracker_(NULL) { | |
55 const base::FilePath browser_process_path = | 52 const base::FilePath browser_process_path = |
56 base::GetProcessExecutablePath(base::GetCurrentProcessHandle()); | 53 base::GetProcessExecutablePath(base::GetCurrentProcessHandle()); |
57 const std::string browser_process_name = | 54 const std::string browser_process_name = |
58 browser_process_path.BaseName().value(); | 55 browser_process_path.BaseName().value(); |
59 const std::string google_browser_name = | 56 const std::string google_browser_name = |
60 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); | 57 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); |
61 | 58 |
62 // (Human and process) names of browsers; should match the ordering for | 59 // (Human and process) names of browsers; should match the ordering for |
63 // |BrowserProcess| (i.e., |BrowserType|). | 60 // |BrowserProcess| (i.e., |BrowserType|). |
64 // TODO(viettrungluu): The current setup means that we can't detect both | 61 // TODO(viettrungluu): The current setup means that we can't detect both |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 if (info.working_set.priv == 0) { | 232 if (info.working_set.priv == 0) { |
236 scoped_ptr<base::ProcessMetrics> metrics; | 233 scoped_ptr<base::ProcessMetrics> metrics; |
237 metrics.reset(base::ProcessMetrics::CreateProcessMetrics( | 234 metrics.reset(base::ProcessMetrics::CreateProcessMetrics( |
238 pid, content::BrowserChildProcessHost::GetPortProvider())); | 235 pid, content::BrowserChildProcessHost::GetPortProvider())); |
239 metrics->GetWorkingSetKBytes(&info.working_set); | 236 metrics->GetWorkingSetKBytes(&info.working_set); |
240 } | 237 } |
241 | 238 |
242 // Add the process info to our list. | 239 // Add the process info to our list. |
243 process_data_[CHROME_BROWSER].processes.push_back(info); | 240 process_data_[CHROME_BROWSER].processes.push_back(info); |
244 } | 241 } |
OLD | NEW |