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

Unified Diff: base/metrics/persistent_histogram_allocator.h

Issue 2308763002: Integrate Crashpad UMA (Closed)
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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 ee1fba5f624221cc510474f75be3a6dd360cfd9b..1ced35f3392c78fc82632dd5872cbb30e844daa2 100644
--- a/base/metrics/persistent_histogram_allocator.h
+++ b/base/metrics/persistent_histogram_allocator.h
@@ -394,11 +394,40 @@ class BASE_EXPORT GlobalHistogramAllocator
// Create a global allocator by memory-mapping a |file|. If the file does
// not exist, it will be created with the specified |size|. If the file does
// exist, the allocator will use and add to its contents, ignoring the passed
- // size in favor of the existing size.
- static void CreateWithFile(const FilePath& file_path,
+ // size in favor of the existing size. Returns whether the global allocator
+ // was set.
+ static bool CreateWithFile(const FilePath& file_path,
size_t size,
uint64_t id,
StringPiece name);
+
+ // Creates a new file at |active_path|. If it already exists, it will first be
+ // moved to |base_path|. In all cases, any old file at |base_path| will be
+ // removed. The file will be created using the given size, id, and name.
+ // Returns whether the global allocator was set.
+ static bool CreateWithActiveFile(const FilePath& base_path,
+ const FilePath& active_path,
+ size_t size,
+ uint64_t id,
+ StringPiece name);
+
+ // Uses ConstructBaseActivePairFilePaths() to build a pair of file names which
+ // are then used for CreateWithActiveFile(). |name| is used for both the
+ // internal name for the allocator and also for the name of the file inside
+ // |dir|.
+ static bool CreateWithActiveFileInDir(const FilePath& dir,
+ size_t size,
+ uint64_t id,
+ StringPiece name);
+
+ // Constructs a pair of names in |dir| based on name that can be used for a
+ // base + active persistent memory mapped location for CreateWithActiveFile().
+ // |name| will be used as the basename of the file inside |dir|.
+ // |out_base_path| or |out_active_path| may be null if not needed.
+ static void ConstructFilePaths(const FilePath& dir,
+ StringPiece name,
+ FilePath* out_base_path,
+ FilePath* out_active_path);
#endif
// Create a global allocator using a block of shared |memory| of the
@@ -449,6 +478,10 @@ class BASE_EXPORT GlobalHistogramAllocator
// indicates success.
bool WriteToPersistentLocation();
+ // If there is a global metrics file being updated on disk, mark it to be
+ // deleted when the process exits.
+ void DeletePersistentLocation();
+
private:
friend class StatisticsRecorder;
« no previous file with comments | « no previous file | base/metrics/persistent_histogram_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698