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

Side by Side Diff: base/metrics/histogram_persistence.h

Issue 1689833002: Add ownership-transfer to histogram management calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 10 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
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/histogram_persistence.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ 5 #ifndef BASE_METRICS_HISTOGRAM_PERSISTENCE_H_
6 #define BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ 6 #define BASE_METRICS_HISTOGRAM_PERSISTENCE_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/feature_list.h" 9 #include "base/feature_list.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Recreate a Histogram from data held in persistent memory. Though this 42 // Recreate a Histogram from data held in persistent memory. Though this
43 // object will be local to the current process, the sample data will be 43 // object will be local to the current process, the sample data will be
44 // shared with all other threads referencing it. This method takes a |ref| 44 // shared with all other threads referencing it. This method takes a |ref|
45 // to the top- level histogram data and the |allocator| on which it is found. 45 // to the top- level histogram data and the |allocator| on which it is found.
46 // This method will return nullptr if any problem is detected with the data. 46 // This method will return nullptr if any problem is detected with the data.
47 // The |allocator| may or may not be the same as the PersistentMemoryAllocator 47 // The |allocator| may or may not be the same as the PersistentMemoryAllocator
48 // set for general use so that this method can be used to extract Histograms 48 // set for general use so that this method can be used to extract Histograms
49 // from persistent memory segments other than the default place that this 49 // from persistent memory segments other than the default place that this
50 // process is creating its own histograms. The caller must take ownership of 50 // process is creating its own histograms. The caller must take ownership of
51 // the returned object and destroy it when no longer needed. 51 // the returned object and destroy it when no longer needed.
52 BASE_EXPORT HistogramBase* GetPersistentHistogram( 52 BASE_EXPORT scoped_ptr<HistogramBase> GetPersistentHistogram(
53 PersistentMemoryAllocator* allocator, 53 PersistentMemoryAllocator* allocator,
54 int32_t ref); 54 int32_t ref);
55 55
56 // Get the next histogram in persistent data based on iterator. The caller 56 // Get the next histogram in persistent data based on iterator. The caller
57 // must take ownership of the returned object and destroy it when no longer 57 // must take ownership of the returned object and destroy it when no longer
58 // needed. 58 // needed.
59 BASE_EXPORT HistogramBase* GetNextPersistentHistogram( 59 BASE_EXPORT scoped_ptr<HistogramBase> GetNextPersistentHistogram(
60 PersistentMemoryAllocator* allocator, 60 PersistentMemoryAllocator* allocator,
61 PersistentMemoryAllocator::Iterator* iter); 61 PersistentMemoryAllocator::Iterator* iter);
62 62
63 // Finalize the creation of the histogram, making it available to other 63 // Finalize the creation of the histogram, making it available to other
64 // processes if it is the registered instance. 64 // processes if it is the registered instance.
65 void FinalizePersistentHistogram(PersistentMemoryAllocator::Reference ref, 65 void FinalizePersistentHistogram(PersistentMemoryAllocator::Reference ref,
66 bool register); 66 bool register);
67 67
68 // Allocate a new persistent histogram. This does *not* make the object 68 // Allocate a new persistent histogram. This does *not* make the object
69 // iterable in the allocator; call MakeIterable(ref) directly if that is 69 // iterable in the allocator; call MakeIterable(ref) directly if that is
70 // desired. 70 // desired.
71 BASE_EXPORT HistogramBase* AllocatePersistentHistogram( 71 BASE_EXPORT scoped_ptr<HistogramBase> AllocatePersistentHistogram(
72 PersistentMemoryAllocator* allocator, 72 PersistentMemoryAllocator* allocator,
73 HistogramType histogram_type, 73 HistogramType histogram_type,
74 const std::string& name, 74 const std::string& name,
75 int minimum, 75 int minimum,
76 int maximum, 76 int maximum,
77 const BucketRanges* bucket_ranges, 77 const BucketRanges* bucket_ranges,
78 int32_t flags, 78 int32_t flags,
79 PersistentMemoryAllocator::Reference* ref_ptr); 79 PersistentMemoryAllocator::Reference* ref_ptr);
80 80
81 // Import new histograms from attached PersistentMemoryAllocator. It's 81 // Import new histograms from attached PersistentMemoryAllocator. It's
82 // possible for other processes to create histograms in the attached memory 82 // possible for other processes to create histograms in the attached memory
83 // segment; this adds those to the internal list of known histograms to 83 // segment; this adds those to the internal list of known histograms to
84 // avoid creating duplicates that would have to merged during reporting. 84 // avoid creating duplicates that would have to merged during reporting.
85 // Every call to this method resumes from the last entry it saw so it costs 85 // Every call to this method resumes from the last entry it saw so it costs
86 // nothing if nothing new has been added. 86 // nothing if nothing new has been added.
87 void ImportPersistentHistograms(); 87 void ImportPersistentHistograms();
88 88
89 } // namespace base 89 } // namespace base
90 90
91 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ 91 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/histogram_persistence.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698