Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: chrome/browser/metrics/subprocess_metrics_provider.cc

Issue 2334613003: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Changes from review by sky Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698