| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 BrowserThread::PostTask( | 197 BrowserThread::PostTask( |
| 198 BrowserThread::FILE, FROM_HERE, | 198 BrowserThread::FILE, FROM_HERE, |
| 199 base::Bind(&MemoryDetails::CollectProcessData, this, child_info)); | 199 base::Bind(&MemoryDetails::CollectProcessData, this, child_info)); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void MemoryDetails::CollectChildInfoOnUIThread() { | 202 void MemoryDetails::CollectChildInfoOnUIThread() { |
| 203 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 203 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 204 | 204 |
| 205 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 205 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 206 const pid_t zygote_pid = content::ZygoteHost::GetInstance()->GetPid(); | 206 const pid_t zygote_pid = content::ZygoteHost::GetInstance()->GetPid(); |
| 207 const pid_t sandbox_helper_pid = |
| 208 content::ZygoteHost::GetInstance()->GetSandboxHelperPid(); |
| 207 #endif | 209 #endif |
| 208 | 210 |
| 209 ProcessData* const chrome_browser = ChromeBrowser(); | 211 ProcessData* const chrome_browser = ChromeBrowser(); |
| 210 // Get more information about the process. | 212 // Get more information about the process. |
| 211 for (size_t index = 0; index < chrome_browser->processes.size(); | 213 for (size_t index = 0; index < chrome_browser->processes.size(); |
| 212 index++) { | 214 index++) { |
| 213 // Check if it's a renderer, if so get the list of page titles in it and | 215 // Check if it's a renderer, if so get the list of page titles in it and |
| 214 // check if it's a diagnostics-related process. We skip about:memory pages. | 216 // check if it's a diagnostics-related process. We skip about:memory pages. |
| 215 // Iterate the RenderProcessHosts to find the tab contents. | 217 // Iterate the RenderProcessHosts to find the tab contents. |
| 216 ProcessMemoryInformation& process = | 218 ProcessMemoryInformation& process = |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 (pending_entry && | 332 (pending_entry && |
| 331 LowerCaseEqualsASCII(pending_entry->GetVirtualURL().spec(), | 333 LowerCaseEqualsASCII(pending_entry->GetVirtualURL().spec(), |
| 332 chrome::kChromeUIMemoryURL))) { | 334 chrome::kChromeUIMemoryURL))) { |
| 333 process.is_diagnostics = true; | 335 process.is_diagnostics = true; |
| 334 } | 336 } |
| 335 } | 337 } |
| 336 | 338 |
| 337 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 339 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 338 if (process.pid == zygote_pid) { | 340 if (process.pid == zygote_pid) { |
| 339 process.process_type = content::PROCESS_TYPE_ZYGOTE; | 341 process.process_type = content::PROCESS_TYPE_ZYGOTE; |
| 342 } else if (process.pid == sandbox_helper_pid) { |
| 343 process.process_type = content::PROCESS_TYPE_SANDBOX_HELPER; |
| 340 } | 344 } |
| 341 #endif | 345 #endif |
| 342 } | 346 } |
| 343 | 347 |
| 344 // Get rid of other Chrome processes that are from a different profile. | 348 // Get rid of other Chrome processes that are from a different profile. |
| 345 for (size_t index = 0; index < chrome_browser->processes.size(); | 349 for (size_t index = 0; index < chrome_browser->processes.size(); |
| 346 index++) { | 350 index++) { |
| 347 if (chrome_browser->processes[index].process_type == | 351 if (chrome_browser->processes[index].process_type == |
| 348 content::PROCESS_TYPE_UNKNOWN) { | 352 content::PROCESS_TYPE_UNKNOWN) { |
| 349 chrome_browser->processes.erase( | 353 chrome_browser->processes.erase( |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 578 |
| 575 if (swap_info_.orig_data_size > 0 && swap_info_.compr_data_size > 0) { | 579 if (swap_info_.orig_data_size > 0 && swap_info_.compr_data_size > 0) { |
| 576 UMA_HISTOGRAM_CUSTOM_COUNTS( | 580 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 577 "Memory.Swap.CompressionRatio", | 581 "Memory.Swap.CompressionRatio", |
| 578 swap_info_.orig_data_size / swap_info_.compr_data_size, | 582 swap_info_.orig_data_size / swap_info_.compr_data_size, |
| 579 1, 20, 20); | 583 1, 20, 20); |
| 580 } | 584 } |
| 581 } | 585 } |
| 582 | 586 |
| 583 #endif | 587 #endif |
| OLD | NEW |