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

Unified Diff: components/cronet/histogram_manager.h

Issue 1882563004: [Cronet] Make HistogramManager public APIs thread-safe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make lock specific to GetDeltas() 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 | « no previous file | components/cronet/histogram_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/histogram_manager.h
diff --git a/components/cronet/histogram_manager.h b/components/cronet/histogram_manager.h
index e4305e7c0e16540ee2103e31ff0c70ff915187ca..4c34ceb826e74a1556a3417c8bf7551a75966979 100644
--- a/components/cronet/histogram_manager.h
+++ b/components/cronet/histogram_manager.h
@@ -15,13 +15,14 @@
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram_flattener.h"
#include "base/metrics/histogram_snapshot_manager.h"
+#include "base/synchronization/lock.h"
#include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
namespace cronet {
// A HistogramManager instance is created by the app. It is the central
// controller for the acquisition of log data, and recording deltas for
-// transmission to an external server.
+// transmission to an external server. Public APIs are all thread-safe.
class HistogramManager : public base::HistogramFlattener {
public:
HistogramManager();
@@ -52,6 +53,10 @@ class HistogramManager : public base::HistogramFlattener {
// Stores the protocol buffer representation for this log.
metrics::ChromeUserMetricsExtension uma_proto_;
+ // Should be acquired whenever GetDeltas() is executing to maintain
+ // thread-safety.
+ base::Lock get_deltas_lock_;
+
DISALLOW_COPY_AND_ASSIGN(HistogramManager);
};
« no previous file with comments | « no previous file | components/cronet/histogram_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698