| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/metrics/metrics_memory_details.h" | 5 #include "chrome/browser/metrics/metrics_memory_details.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "components/nacl/common/nacl_process_type.h" | 17 #include "components/nacl/common/nacl_process_type.h" |
| 18 #include "content/public/browser/render_process_host.h" | 18 #include "content/public/browser/render_process_host.h" |
| 19 #include "content/public/common/content_constants.h" | 19 #include "content/public/common/content_constants.h" |
| 20 #include "content/public/common/process_type.h" | 20 #include "content/public/common/process_type.h" |
| 21 #include "ppapi/features/features.h" |
| 21 | 22 |
| 22 MemoryGrowthTracker::MemoryGrowthTracker() { | 23 MemoryGrowthTracker::MemoryGrowthTracker() { |
| 23 } | 24 } |
| 24 | 25 |
| 25 MemoryGrowthTracker::~MemoryGrowthTracker() { | 26 MemoryGrowthTracker::~MemoryGrowthTracker() { |
| 26 } | 27 } |
| 27 | 28 |
| 28 bool MemoryGrowthTracker::UpdateSample(base::ProcessId pid, | 29 bool MemoryGrowthTracker::UpdateSample(base::ProcessId pid, |
| 29 int sample, | 30 int sample, |
| 30 int* diff) { | 31 int* diff) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 other_count++; | 136 other_count++; |
| 136 continue; | 137 continue; |
| 137 case content::PROCESS_TYPE_SANDBOX_HELPER: | 138 case content::PROCESS_TYPE_SANDBOX_HELPER: |
| 138 UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample); | 139 UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample); |
| 139 other_count++; | 140 other_count++; |
| 140 continue; | 141 continue; |
| 141 case content::PROCESS_TYPE_GPU: | 142 case content::PROCESS_TYPE_GPU: |
| 142 UMA_HISTOGRAM_MEMORY_KB("Memory.Gpu", sample); | 143 UMA_HISTOGRAM_MEMORY_KB("Memory.Gpu", sample); |
| 143 other_count++; | 144 other_count++; |
| 144 continue; | 145 continue; |
| 145 #if defined(ENABLE_PLUGINS) | 146 #if BUILDFLAG(ENABLE_PLUGINS) |
| 146 case content::PROCESS_TYPE_PPAPI_PLUGIN: { | 147 case content::PROCESS_TYPE_PPAPI_PLUGIN: { |
| 147 const std::vector<base::string16>& titles = | 148 const std::vector<base::string16>& titles = |
| 148 browser.processes[index].titles; | 149 browser.processes[index].titles; |
| 149 if (titles.size() == 1 && | 150 if (titles.size() == 1 && |
| 150 titles[0] == base::ASCIIToUTF16(content::kFlashPluginName)) { | 151 titles[0] == base::ASCIIToUTF16(content::kFlashPluginName)) { |
| 151 UMA_HISTOGRAM_MEMORY_KB("Memory.PepperFlashPlugin", sample); | 152 UMA_HISTOGRAM_MEMORY_KB("Memory.PepperFlashPlugin", sample); |
| 152 } | 153 } |
| 153 UMA_HISTOGRAM_MEMORY_KB("Memory.PepperPlugin", sample); | 154 UMA_HISTOGRAM_MEMORY_KB("Memory.PepperPlugin", sample); |
| 154 pepper_plugin_count++; | 155 pepper_plugin_count++; |
| 155 continue; | 156 continue; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 memory_growth_tracker_->UpdateSample(process_entry.pid, sample, | 317 memory_growth_tracker_->UpdateSample(process_entry.pid, sample, |
| 317 &diff) && | 318 &diff) && |
| 318 generate_histograms_) { | 319 generate_histograms_) { |
| 319 if (diff < 0) | 320 if (diff < 0) |
| 320 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererShrinkIn30Min", -diff); | 321 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererShrinkIn30Min", -diff); |
| 321 else | 322 else |
| 322 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererGrowthIn30Min", diff); | 323 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererGrowthIn30Min", diff); |
| 323 } | 324 } |
| 324 } | 325 } |
| 325 } | 326 } |
| OLD | NEW |