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/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "content/public/browser/render_view_host_delegate.h" | 27 #include "content/public/browser/render_view_host_delegate.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "content/public/common/bindings_policy.h" | 29 #include "content/public/common/bindings_policy.h" |
30 #include "content/public/common/process_type.h" | 30 #include "content/public/common/process_type.h" |
31 #include "grit/chromium_strings.h" | 31 #include "grit/chromium_strings.h" |
32 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
33 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
34 | 34 |
35 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 35 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
36 #include "content/browser/renderer_host/render_sandbox_host_linux.h" | 36 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
37 #include "content/browser/zygote_host_linux.h" | 37 #include "content/public/browser/zygote_host_linux.h" |
38 #endif | 38 #endif |
39 | 39 |
40 using content::BrowserChildProcessHostIterator; | 40 using content::BrowserChildProcessHostIterator; |
41 using content::BrowserThread; | 41 using content::BrowserThread; |
42 using content::NavigationEntry; | 42 using content::NavigationEntry; |
43 using content::WebContents; | 43 using content::WebContents; |
44 | 44 |
45 // static | 45 // static |
46 std::string ProcessMemoryInformation::GetRendererTypeNameInEnglish( | 46 std::string ProcessMemoryInformation::GetRendererTypeNameInEnglish( |
47 RendererProcessType type) { | 47 RendererProcessType type) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // Now go do expensive memory lookups from the file thread. | 150 // Now go do expensive memory lookups from the file thread. |
151 BrowserThread::PostTask( | 151 BrowserThread::PostTask( |
152 BrowserThread::FILE, FROM_HERE, | 152 BrowserThread::FILE, FROM_HERE, |
153 base::Bind(&MemoryDetails::CollectProcessData, this, child_info)); | 153 base::Bind(&MemoryDetails::CollectProcessData, this, child_info)); |
154 } | 154 } |
155 | 155 |
156 void MemoryDetails::CollectChildInfoOnUIThread() { | 156 void MemoryDetails::CollectChildInfoOnUIThread() { |
157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
158 | 158 |
159 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 159 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
160 const pid_t zygote_pid = ZygoteHost::GetInstance()->pid(); | 160 const pid_t zygote_pid = content::ZygoteHost::GetInstance()->GetPid(); |
161 const pid_t sandbox_helper_pid = RenderSandboxHostLinux::GetInstance()->pid(); | 161 const pid_t sandbox_helper_pid = RenderSandboxHostLinux::GetInstance()->pid(); |
162 #endif | 162 #endif |
163 | 163 |
164 ProcessData* const chrome_browser = ChromeBrowser(); | 164 ProcessData* const chrome_browser = ChromeBrowser(); |
165 // Get more information about the process. | 165 // Get more information about the process. |
166 for (size_t index = 0; index < chrome_browser->processes.size(); | 166 for (size_t index = 0; index < chrome_browser->processes.size(); |
167 index++) { | 167 index++) { |
168 // Check if it's a renderer, if so get the list of page titles in it and | 168 // Check if it's a renderer, if so get the list of page titles in it and |
169 // check if it's a diagnostics-related process. We skip about:memory pages. | 169 // check if it's a diagnostics-related process. We skip about:memory pages. |
170 // Iterate the RenderProcessHosts to find the tab contents. | 170 // Iterate the RenderProcessHosts to find the tab contents. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount", | 426 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount", |
427 pepper_plugin_count); | 427 pepper_plugin_count); |
428 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); | 428 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); |
429 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); | 429 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
430 // TODO(viettrungluu): Do we want separate counts for the other | 430 // TODO(viettrungluu): Do we want separate counts for the other |
431 // (platform-specific) process types? | 431 // (platform-specific) process types? |
432 | 432 |
433 int total_sample = static_cast<int>(aggregate_memory / 1000); | 433 int total_sample = static_cast<int>(aggregate_memory / 1000); |
434 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); | 434 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
435 } | 435 } |
OLD | NEW |