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

Unified Diff: base/metrics/persistent_histogram_allocator.h

Issue 1891913002: Support saving browser metrics to disk and reading them during next run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed some build problems 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
Index: base/metrics/persistent_histogram_allocator.h
diff --git a/base/metrics/persistent_histogram_allocator.h b/base/metrics/persistent_histogram_allocator.h
index b2038c4314c704f572771648b76410fdcffd03b0..f5a4b48f51ca3ec7aff28767eb13b4cda875913c 100644
--- a/base/metrics/persistent_histogram_allocator.h
+++ b/base/metrics/persistent_histogram_allocator.h
@@ -241,6 +241,16 @@ class BASE_EXPORT GlobalHistogramAllocator
// in other ways.
static std::unique_ptr<GlobalHistogramAllocator> ReleaseForTesting();
+ // Stores a pathname to which the contents of this allocator should be saved
+ // in order to persist the data for a later use.
+ void SetPersistentLocation(FilePath location);
Ilya Sherman 2016/04/19 00:57:46 nit: Are FilePaths usually passed by copy or by co
bcwhite 2016/04/19 16:33:38 I've seen it both ways. If I make this a ref then
Ilya Sherman 2016/04/20 07:12:14 There was recently a thread on chromium-dev about
bcwhite 2016/04/20 16:47:45 Interesting. Better to pass-by-ref for maintainab
+
+ // Writes the internal data to a previously set location. This is generally
+ // called when a process is exiting from a section of code that may not know
+ // the filesystem. The data is written in an atomic manner. The return value
+ // indicates success.
+ bool WritePersistentLocation();
Ilya Sherman 2016/04/19 00:57:46 nit: Perhaps "WriteTo" rather than just "Write"?
bcwhite 2016/04/19 16:33:38 Done.
+
private:
friend class StatisticsRecorder;
@@ -259,6 +269,9 @@ class BASE_EXPORT GlobalHistogramAllocator
// iterator to continue the work.
Iterator import_iterator_;
+ // The location to which the data should be persisted.
+ FilePath persistent_location_;
Ilya Sherman 2016/04/19 00:57:46 nit: Can this be const?
bcwhite 2016/04/19 16:33:37 Const values have to be set in the constructor. T
+
DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator);
};

Powered by Google App Engine
This is Rietveld 408576698