OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/file_version_info.h" | 13 #include "base/file_version_info.h" |
14 #include "base/mac_util.h" | 14 #include "base/mac/mac_util.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "chrome/browser/browser_child_process_host.h" | 19 #include "chrome/browser/browser_child_process_host.h" |
20 #include "chrome/browser/browser_thread.h" | 20 #include "chrome/browser/browser_thread.h" |
21 #include "chrome/browser/process_info_snapshot.h" | 21 #include "chrome/browser/process_info_snapshot.h" |
22 #include "chrome/browser/renderer_host/backing_store_manager.h" | 22 #include "chrome/browser/renderer_host/backing_store_manager.h" |
23 #include "chrome/browser/renderer_host/render_process_host.h" | 23 #include "chrome/browser/renderer_host/render_process_host.h" |
24 #include "chrome/browser/tab_contents/navigation_entry.h" | 24 #include "chrome/browser/tab_contents/navigation_entry.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 // Try to get version information. To do this, we need first to get the | 140 // Try to get version information. To do this, we need first to get the |
141 // executable's name (we can only believe |proc_info.command| if it looks | 141 // executable's name (we can only believe |proc_info.command| if it looks |
142 // like an absolute path). Then we need strip the executable's name back | 142 // like an absolute path). Then we need strip the executable's name back |
143 // to the bundle's name. And only then can we try to get the version. | 143 // to the bundle's name. And only then can we try to get the version. |
144 scoped_ptr<FileVersionInfo> version_info; | 144 scoped_ptr<FileVersionInfo> version_info; |
145 ProcessInfoSnapshot::ProcInfoEntry proc_info; | 145 ProcessInfoSnapshot::ProcInfoEntry proc_info; |
146 if (process_info.GetProcInfo(info.pid, &proc_info)) { | 146 if (process_info.GetProcInfo(info.pid, &proc_info)) { |
147 if (proc_info.command.length() > 1 && proc_info.command[0] == '/') { | 147 if (proc_info.command.length() > 1 && proc_info.command[0] == '/') { |
148 FilePath bundle_name = | 148 FilePath bundle_name = |
149 mac_util::GetAppBundlePath(FilePath(proc_info.command)); | 149 base::mac::GetAppBundlePath(FilePath(proc_info.command)); |
150 if (!bundle_name.empty()) { | 150 if (!bundle_name.empty()) { |
151 version_info.reset(FileVersionInfo::CreateFileVersionInfo( | 151 version_info.reset(FileVersionInfo::CreateFileVersionInfo( |
152 bundle_name)); | 152 bundle_name)); |
153 } | 153 } |
154 } | 154 } |
155 } | 155 } |
156 if (version_info.get()) { | 156 if (version_info.get()) { |
157 info.product_name = version_info->product_name(); | 157 info.product_name = version_info->product_name(); |
158 info.version = version_info->product_version(); | 158 info.version = version_info->product_version(); |
159 } else { | 159 } else { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 // Memory info. | 222 // Memory info. |
223 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); | 223 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); |
224 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); | 224 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); |
225 | 225 |
226 // Add the process info to our list. | 226 // Add the process info to our list. |
227 process_data_[CHROME_BROWSER].processes.push_back(info); | 227 process_data_[CHROME_BROWSER].processes.push_back(info); |
228 } | 228 } |
OLD | NEW |