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