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" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/file_version_info.h" | 12 #include "base/file_version_info.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/mac/foundation_util.h" | 14 #include "base/mac/foundation_util.h" |
15 #include "base/process/process_iterator.h" | 15 #include "base/process/process_iterator.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "chrome/browser/process_info_snapshot.h" | 19 #include "chrome/browser/process_info_snapshot.h" |
20 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
21 #include "chrome/common/chrome_version_info.h" | |
22 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
23 #include "chrome/grit/chromium_strings.h" | 22 #include "chrome/grit/chromium_strings.h" |
| 23 #include "components/version_info/version_info.h" |
24 #include "content/public/browser/browser_child_process_host.h" | 24 #include "content/public/browser/browser_child_process_host.h" |
25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/common/process_type.h" | 26 #include "content/public/common/process_type.h" |
27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
28 | 28 |
29 using content::BrowserThread; | 29 using content::BrowserThread; |
30 | 30 |
31 // TODO(viettrungluu): Many of the TODOs below are subsumed by a general need to | 31 // TODO(viettrungluu): Many of the TODOs below are subsumed by a general need to |
32 // refactor the about:memory code (not just on Mac, but probably on other | 32 // refactor the about:memory code (not just on Mac, but probably on other |
33 // platforms as well). I've filed crbug.com/25456. | 33 // platforms as well). I've filed crbug.com/25456. |
(...skipping 22 matching lines...) Expand all Loading... |
56 const std::vector<ProcessMemoryInformation>& child_info, | 56 const std::vector<ProcessMemoryInformation>& child_info, |
57 base::ProcessId pid, | 57 base::ProcessId pid, |
58 ProcessMemoryInformationList* processes) { | 58 ProcessMemoryInformationList* processes) { |
59 ProcessMemoryInformation info; | 59 ProcessMemoryInformation info; |
60 info.pid = pid; | 60 info.pid = pid; |
61 if (info.pid == base::GetCurrentProcId()) | 61 if (info.pid == base::GetCurrentProcId()) |
62 info.process_type = content::PROCESS_TYPE_BROWSER; | 62 info.process_type = content::PROCESS_TYPE_BROWSER; |
63 else | 63 else |
64 info.process_type = content::PROCESS_TYPE_UNKNOWN; | 64 info.process_type = content::PROCESS_TYPE_UNKNOWN; |
65 | 65 |
66 chrome::VersionInfo version_info; | 66 info.product_name = base::ASCIIToUTF16(version_info::GetProductName()); |
67 info.product_name = base::ASCIIToUTF16(version_info.Name()); | 67 info.version = base::ASCIIToUTF16(version_info::GetVersionNumber()); |
68 info.version = base::ASCIIToUTF16(version_info.Version()); | |
69 | 68 |
70 // Check if this is one of the child processes whose data was already | 69 // Check if this is one of the child processes whose data was already |
71 // collected and exists in |child_data|. | 70 // collected and exists in |child_data|. |
72 for (const ProcessMemoryInformation& child : child_info) { | 71 for (const ProcessMemoryInformation& child : child_info) { |
73 if (child.pid == info.pid) { | 72 if (child.pid == info.pid) { |
74 info.titles = child.titles; | 73 info.titles = child.titles; |
75 info.process_type = child.process_type; | 74 info.process_type = child.process_type; |
76 break; | 75 break; |
77 } | 76 } |
78 } | 77 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 248 |
250 // And collect data about the helpers. | 249 // And collect data about the helpers. |
251 for (const base::ProcessId& pid : helper_pids) | 250 for (const base::ProcessId& pid : helper_pids) |
252 CollectProcessDataForChromeProcess(child_info, pid, chrome_processes); | 251 CollectProcessDataForChromeProcess(child_info, pid, chrome_processes); |
253 | 252 |
254 // Finally return to the browser thread. | 253 // Finally return to the browser thread. |
255 BrowserThread::PostTask( | 254 BrowserThread::PostTask( |
256 BrowserThread::UI, FROM_HERE, | 255 BrowserThread::UI, FROM_HERE, |
257 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this)); | 256 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this)); |
258 } | 257 } |
OLD | NEW |