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

Unified Diff: base/metrics/persistent_histogram_allocator.h

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | base/metrics/persistent_histogram_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/persistent_histogram_allocator.h
diff --git a/base/metrics/persistent_histogram_allocator.h b/base/metrics/persistent_histogram_allocator.h
index cc8d0233d3d337456651fe9ae9cdadca82d22f0f..cbbeed9bd5486f9cd1fc38303d8b815a4005f215 100644
--- a/base/metrics/persistent_histogram_allocator.h
+++ b/base/metrics/persistent_histogram_allocator.h
@@ -5,10 +5,11 @@
#ifndef BASE_METRICS_HISTOGRAM_PERSISTENCE_H_
#define BASE_METRICS_HISTOGRAM_PERSISTENCE_H_
+#include <memory>
+
#include "base/atomicops.h"
#include "base/base_export.h"
#include "base/feature_list.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/metrics/histogram_base.h"
#include "base/metrics/persistent_memory_allocator.h"
@@ -38,7 +39,8 @@ class BASE_EXPORT PersistentHistogramAllocator {
// A PersistentHistogramAllocator is constructed from a PersistentMemory-
// Allocator object of which it takes ownership.
- PersistentHistogramAllocator(scoped_ptr<PersistentMemoryAllocator> memory);
+ PersistentHistogramAllocator(
+ std::unique_ptr<PersistentMemoryAllocator> memory);
~PersistentHistogramAllocator();
// Direct access to underlying memory allocator. If the segment is shared
@@ -61,10 +63,10 @@ class BASE_EXPORT PersistentHistogramAllocator {
// shared with all other threads referencing it. This method takes a |ref|
// to where the top-level histogram data may be found in this allocator.
// This method will return null if any problem is detected with the data.
- scoped_ptr<HistogramBase> GetHistogram(Reference ref);
+ std::unique_ptr<HistogramBase> GetHistogram(Reference ref);
// Get the next histogram in persistent data based on iterator.
- scoped_ptr<HistogramBase> GetNextHistogram(Iterator* iter) {
+ std::unique_ptr<HistogramBase> GetNextHistogram(Iterator* iter) {
return GetNextHistogramWithIgnore(iter, 0);
}
@@ -73,7 +75,7 @@ class BASE_EXPORT PersistentHistogramAllocator {
// Allocate a new persistent histogram. The returned histogram will not
// be able to be located by other allocators until it is "finalized".
- scoped_ptr<HistogramBase> AllocateHistogram(
+ std::unique_ptr<HistogramBase> AllocateHistogram(
HistogramType histogram_type,
const std::string& name,
int minimum,
@@ -106,14 +108,14 @@ class BASE_EXPORT PersistentHistogramAllocator {
// possible during startup to capture as many histograms as possible and
// while operating single-threaded so there are no race-conditions.
static void SetGlobalAllocator(
- scoped_ptr<PersistentHistogramAllocator> allocator);
+ std::unique_ptr<PersistentHistogramAllocator> allocator);
static PersistentHistogramAllocator* GetGlobalAllocator();
// This access to the persistent allocator is only for testing; it extracts
// the current allocator completely. This allows easy creation of histograms
// within persistent memory segments which can then be extracted and used
// in other ways.
- static scoped_ptr<PersistentHistogramAllocator>
+ static std::unique_ptr<PersistentHistogramAllocator>
ReleaseGlobalAllocatorForTesting();
// These helper methods perform SetGlobalAllocator() calls with allocators
@@ -186,19 +188,18 @@ class BASE_EXPORT PersistentHistogramAllocator {
// Get the next histogram in persistent data based on iterator while
// ignoring a particular reference if it is found.
- scoped_ptr<HistogramBase> GetNextHistogramWithIgnore(
- Iterator* iter,
- Reference ignore);
+ std::unique_ptr<HistogramBase> GetNextHistogramWithIgnore(Iterator* iter,
+ Reference ignore);
// Create a histogram based on saved (persistent) information about it.
- scoped_ptr<HistogramBase> CreateHistogram(
+ std::unique_ptr<HistogramBase> CreateHistogram(
PersistentHistogramData* histogram_data_ptr);
// Record the result of a histogram creation.
static void RecordCreateHistogramResult(CreateHistogramResultType result);
// The memory allocator that provides the actual histogram storage.
- scoped_ptr<PersistentMemoryAllocator> memory_allocator_;
+ std::unique_ptr<PersistentMemoryAllocator> memory_allocator_;
// A reference to the last-created histogram in the allocator, used to avoid
// trying to import what was just created.
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | base/metrics/persistent_histogram_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698