OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <psapi.h> | 6 #include <psapi.h> |
7 | 7 |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "chrome/app/chrome_version_info.h" |
11 #include "chrome/browser/child_process_host.h" | 12 #include "chrome/browser/child_process_host.h" |
12 #include "chrome/browser/chrome_thread.h" | 13 #include "chrome/browser/chrome_thread.h" |
13 #include "chrome/browser/renderer_host/backing_store_manager.h" | 14 #include "chrome/browser/renderer_host/backing_store_manager.h" |
14 #include "chrome/browser/renderer_host/render_process_host.h" | 15 #include "chrome/browser/renderer_host/render_process_host.h" |
15 #include "chrome/browser/tab_contents/navigation_entry.h" | 16 #include "chrome/browser/tab_contents/navigation_entry.h" |
16 #include "chrome/browser/tab_contents/tab_contents.h" | 17 #include "chrome/browser/tab_contents/tab_contents.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
19 | 20 |
20 // Known browsers which we collect details for. | 21 // Known browsers which we collect details for. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 115 |
115 scoped_ptr<base::ProcessMetrics> metrics; | 116 scoped_ptr<base::ProcessMetrics> metrics; |
116 metrics.reset(base::ProcessMetrics::CreateProcessMetrics(handle)); | 117 metrics.reset(base::ProcessMetrics::CreateProcessMetrics(handle)); |
117 metrics->GetCommittedKBytes(&info.committed); | 118 metrics->GetCommittedKBytes(&info.committed); |
118 metrics->GetWorkingSetKBytes(&info.working_set); | 119 metrics->GetWorkingSetKBytes(&info.working_set); |
119 | 120 |
120 // Get Version Information. | 121 // Get Version Information. |
121 TCHAR name[MAX_PATH]; | 122 TCHAR name[MAX_PATH]; |
122 if (index2 == CHROME_BROWSER || index2 == CHROME_NACL_PROCESS) { | 123 if (index2 == CHROME_BROWSER || index2 == CHROME_NACL_PROCESS) { |
123 scoped_ptr<FileVersionInfo> version_info( | 124 scoped_ptr<FileVersionInfo> version_info( |
124 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); | 125 chrome_app::GetChromeVersionInfo()); |
125 if (version_info != NULL) | 126 if (version_info != NULL) |
126 info.version = version_info->file_version(); | 127 info.version = version_info->file_version(); |
127 // Check if this is one of the child processes whose data we collected | 128 // Check if this is one of the child processes whose data we collected |
128 // on the IO thread, and if so copy over that data. | 129 // on the IO thread, and if so copy over that data. |
129 for (size_t child = 0; child < child_info.size(); child++) { | 130 for (size_t child = 0; child < child_info.size(); child++) { |
130 if (child_info[child].pid != info.pid) | 131 if (child_info[child].pid != info.pid) |
131 continue; | 132 continue; |
132 info.titles = child_info[child].titles; | 133 info.titles = child_info[child].titles; |
133 info.type = child_info[child].type; | 134 info.type = child_info[child].type; |
134 break; | 135 break; |
(...skipping 17 matching lines...) Expand all Loading... |
152 } | 153 } |
153 break; | 154 break; |
154 } | 155 } |
155 } while (::Process32Next(snapshot, &process_entry)); | 156 } while (::Process32Next(snapshot, &process_entry)); |
156 | 157 |
157 // Finally return to the browser thread. | 158 // Finally return to the browser thread. |
158 ChromeThread::PostTask( | 159 ChromeThread::PostTask( |
159 ChromeThread::UI, FROM_HERE, | 160 ChromeThread::UI, FROM_HERE, |
160 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnUIThread)); | 161 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnUIThread)); |
161 } | 162 } |
OLD | NEW |