| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/subprocess_metrics_provider.h" | 5 #include "chrome/browser/metrics/subprocess_metrics_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/metrics/histogram_base.h" | 9 #include "base/metrics/histogram_base.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void SubprocessMetricsProvider::RenderProcessReady( | 153 void SubprocessMetricsProvider::RenderProcessReady( |
| 154 content::RenderProcessHost* host) { | 154 content::RenderProcessHost* host) { |
| 155 DCHECK(thread_checker_.CalledOnValidThread()); | 155 DCHECK(thread_checker_.CalledOnValidThread()); |
| 156 | 156 |
| 157 // If the render-process-host passed a persistent-memory-allocator to the | 157 // If the render-process-host passed a persistent-memory-allocator to the |
| 158 // renderer process, extract it and register it here. | 158 // renderer process, extract it and register it here. |
| 159 std::unique_ptr<base::SharedPersistentMemoryAllocator> allocator = | 159 std::unique_ptr<base::SharedPersistentMemoryAllocator> allocator = |
| 160 host->TakeMetricsAllocator(); | 160 host->TakeMetricsAllocator(); |
| 161 if (allocator) { | 161 if (allocator) { |
| 162 RegisterSubprocessAllocator( | 162 RegisterSubprocessAllocator( |
| 163 host->GetID(), | 163 host->GetID(), base::MakeUnique<base::PersistentHistogramAllocator>( |
| 164 WrapUnique(new base::PersistentHistogramAllocator( | 164 std::move(allocator))); |
| 165 std::move(allocator)))); | |
| 166 } | 165 } |
| 167 } | 166 } |
| 168 | 167 |
| 169 void SubprocessMetricsProvider::RenderProcessExited( | 168 void SubprocessMetricsProvider::RenderProcessExited( |
| 170 content::RenderProcessHost* host, | 169 content::RenderProcessHost* host, |
| 171 base::TerminationStatus status, | 170 base::TerminationStatus status, |
| 172 int exit_code) { | 171 int exit_code) { |
| 173 DCHECK(thread_checker_.CalledOnValidThread()); | 172 DCHECK(thread_checker_.CalledOnValidThread()); |
| 174 | 173 |
| 175 DeregisterSubprocessAllocator(host->GetID()); | 174 DeregisterSubprocessAllocator(host->GetID()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 198 return nullptr; | 197 return nullptr; |
| 199 | 198 |
| 200 std::unique_ptr<base::SharedPersistentMemoryAllocator> allocator = | 199 std::unique_ptr<base::SharedPersistentMemoryAllocator> allocator = |
| 201 host->TakeMetricsAllocator(); | 200 host->TakeMetricsAllocator(); |
| 202 if (!allocator) | 201 if (!allocator) |
| 203 return nullptr; | 202 return nullptr; |
| 204 | 203 |
| 205 return base::MakeUnique<base::PersistentHistogramAllocator>( | 204 return base::MakeUnique<base::PersistentHistogramAllocator>( |
| 206 std::move(allocator)); | 205 std::move(allocator)); |
| 207 } | 206 } |
| OLD | NEW |