OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_version_info.h" | 7 #include "base/file_version_info.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // | 63 // |
64 // The ChildProcessInfo::Iterator can only be accessed from the IO thread. | 64 // The ChildProcessInfo::Iterator can only be accessed from the IO thread. |
65 // | 65 // |
66 // The RenderProcessHostIterator can only be accessed from the UI thread. | 66 // The RenderProcessHostIterator can only be accessed from the UI thread. |
67 // | 67 // |
68 // This operation can take 30-100ms to complete. We never want to have | 68 // This operation can take 30-100ms to complete. We never want to have |
69 // one task run for that long on the UI or IO threads. So, we run the | 69 // one task run for that long on the UI or IO threads. So, we run the |
70 // expensive parts of this operation over on the file thread. | 70 // expensive parts of this operation over on the file thread. |
71 // | 71 // |
72 void MemoryDetails::StartFetch() { | 72 void MemoryDetails::StartFetch() { |
| 73 // This might get called from the UI or FILE threads, but should not be |
| 74 // getting called from the IO thread. |
73 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); | 75 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); |
74 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::FILE)); | |
75 | 76 |
76 // In order to process this request, we need to use the plugin information. | 77 // In order to process this request, we need to use the plugin information. |
77 // However, plugin process information is only available from the IO thread. | 78 // However, plugin process information is only available from the IO thread. |
78 BrowserThread::PostTask( | 79 BrowserThread::PostTask( |
79 BrowserThread::IO, FROM_HERE, | 80 BrowserThread::IO, FROM_HERE, |
80 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnIOThread)); | 81 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnIOThread)); |
81 } | 82 } |
82 | 83 |
83 MemoryDetails::~MemoryDetails() {} | 84 MemoryDetails::~MemoryDetails() {} |
84 | 85 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount", | 359 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount", |
359 pepper_plugin_count); | 360 pepper_plugin_count); |
360 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); | 361 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); |
361 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); | 362 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
362 // TODO(viettrungluu): Do we want separate counts for the other | 363 // TODO(viettrungluu): Do we want separate counts for the other |
363 // (platform-specific) process types? | 364 // (platform-specific) process types? |
364 | 365 |
365 int total_sample = static_cast<int>(aggregate_memory / 1000); | 366 int total_sample = static_cast<int>(aggregate_memory / 1000); |
366 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); | 367 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
367 } | 368 } |
OLD | NEW |