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 #include "chrome/browser/memory_details.h" | 5 #include "chrome/browser/memory_details.h" |
| 6 | 6 |
| 7 #include <psapi.h> | 7 #include <psapi.h> |
| 8 #include <TlHelp32.h> | 8 #include <TlHelp32.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/win/scoped_handle.h" | 16 #include "base/win/scoped_handle.h" |
| 17 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
| 18 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
| 19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "chrome/grit/chromium_strings.h" | 20 #include "chrome/grit/chromium_strings.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/common/process_type.h" | 22 #include "content/public/common/process_type.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 | 24 |
| 25 using content::BrowserThread; | 25 using content::BrowserThread; |
| 26 | 26 |
| 27 // Known browsers which we collect details for. | 27 // Known browsers which we collect details for. |
| 28 enum { | 28 enum BrowserProcess { |
| 29 CHROME_BROWSER = 0, | 29 CHROME_BROWSER = 0, |
| 30 CHROME_NACL_PROCESS, | 30 CHROME_NACL_PROCESS, |
| 31 IE_BROWSER, | 31 IE_BROWSER, |
| 32 FIREFOX_BROWSER, | 32 FIREFOX_BROWSER, |
| 33 OPERA_BROWSER, | 33 OPERA_BROWSER, |
| 34 SAFARI_BROWSER, | 34 SAFARI_BROWSER, |
| 35 IE_64BIT_BROWSER, | 35 IE_64BIT_BROWSER, |
| 36 KONQUEROR_BROWSER, | 36 KONQUEROR_BROWSER, |
| 37 MAX_BROWSERS | 37 MAX_BROWSERS |
| 38 } BrowserProcess; | 38 }; |
|
cpu_(ooo_6.6-7.5)
2015/07/07 17:39:24
woa!
Matt Giuca
2015/07/08 02:51:28
I know, this was a highlight :)
| |
| 39 | 39 |
| 40 MemoryDetails::MemoryDetails() { | 40 MemoryDetails::MemoryDetails() { |
| 41 base::FilePath browser_process_path; | 41 base::FilePath browser_process_path; |
| 42 PathService::Get(base::FILE_EXE, &browser_process_path); | 42 PathService::Get(base::FILE_EXE, &browser_process_path); |
| 43 const base::string16 browser_process_name = | 43 const base::string16 browser_process_name = |
| 44 browser_process_path.BaseName().value(); | 44 browser_process_path.BaseName().value(); |
| 45 const base::string16 google_browser_name = | 45 const base::string16 google_browser_name = |
| 46 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 46 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
| 47 | 47 |
| 48 struct { | 48 struct { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 } | 161 } |
| 162 break; | 162 break; |
| 163 } | 163 } |
| 164 } while (::Process32Next(snapshot.Get(), &process_entry)); | 164 } while (::Process32Next(snapshot.Get(), &process_entry)); |
| 165 | 165 |
| 166 // Finally return to the browser thread. | 166 // Finally return to the browser thread. |
| 167 BrowserThread::PostTask( | 167 BrowserThread::PostTask( |
| 168 BrowserThread::UI, FROM_HERE, | 168 BrowserThread::UI, FROM_HERE, |
| 169 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this)); | 169 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this)); |
| 170 } | 170 } |
| OLD | NEW |