| 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 "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
| 9 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 11 #include "chrome/browser/chrome_thread.h" |
| 11 #include "chrome/browser/renderer_host/render_process_host.h" | 12 #include "chrome/browser/renderer_host/render_process_host.h" |
| 12 #include "chrome/browser/tab_contents/web_contents.h" | 13 #include "chrome/browser/tab_contents/web_contents.h" |
| 13 #include "chrome/common/child_process_host.h" | 14 #include "chrome/common/child_process_host.h" |
| 14 | 15 |
| 15 class RenderViewHostDelegate; | 16 class RenderViewHostDelegate; |
| 16 | 17 |
| 17 // Template of static data we use for finding browser process information. | 18 // Template of static data we use for finding browser process information. |
| 18 // These entries must match the ordering for MemoryDetails::BrowserProcess. | 19 // These entries must match the ordering for MemoryDetails::BrowserProcess. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 DCHECK(widget); | 206 DCHECK(widget); |
| 206 if (!widget || !widget->IsRenderView()) | 207 if (!widget || !widget->IsRenderView()) |
| 207 continue; | 208 continue; |
| 208 | 209 |
| 209 RenderViewHost* host = static_cast<RenderViewHost*>(widget); | 210 RenderViewHost* host = static_cast<RenderViewHost*>(widget); |
| 210 TabContents* contents = NULL; | 211 TabContents* contents = NULL; |
| 211 if (host->delegate()) | 212 if (host->delegate()) |
| 212 contents = host->delegate()->GetAsWebContents(); | 213 contents = host->delegate()->GetAsWebContents(); |
| 213 if (!contents) | 214 if (!contents) |
| 214 continue; | 215 continue; |
| 215 std::wstring title = contents->GetTitle(); | 216 std::wstring title = UTF16ToWideHack(contents->GetTitle()); |
| 216 if (!title.length()) | 217 if (!title.length()) |
| 217 title = L"Untitled"; | 218 title = L"Untitled"; |
| 218 process.titles.push_back(title); | 219 process.titles.push_back(title); |
| 219 if (contents->type() == TAB_CONTENTS_ABOUT_UI) | 220 if (contents->type() == TAB_CONTENTS_ABOUT_UI) |
| 220 process.is_diagnostics = true; | 221 process.is_diagnostics = true; |
| 221 } | 222 } |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 | 225 |
| 225 // Get rid of other Chrome processes that are from a different profile. | 226 // Get rid of other Chrome processes that are from a different profile. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } | 269 } |
| 269 | 270 |
| 270 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", | 271 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", |
| 271 static_cast<int>(browser.processes.size())); | 272 static_cast<int>(browser.processes.size())); |
| 272 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); | 273 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); |
| 273 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); | 274 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
| 274 | 275 |
| 275 int total_sample = static_cast<int>(aggregate_memory / 1000); | 276 int total_sample = static_cast<int>(aggregate_memory / 1000); |
| 276 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); | 277 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
| 277 } | 278 } |
| OLD | NEW |