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

Unified Diff: components/policy/core/common/policy_load_status.h

Issue 2860973002: Allow PolicyLoadStatusSample to override reporting method (Closed)
Patch Set: Change lambda bind to a more classical bind. Created 3 years, 7 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/policy/core/common/policy_load_status.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/policy_load_status.h
diff --git a/components/policy/core/common/policy_load_status.h b/components/policy/core/common/policy_load_status.h
index 6c9e907152f44a3a107cca7ab1bf99b3922c8961..82815376b498ee7886d9c02b3d8ba1449f817c2c 100644
--- a/components/policy/core/common/policy_load_status.h
+++ b/components/policy/core/common/policy_load_status.h
@@ -7,13 +7,10 @@
#include <bitset>
+#include "base/callback.h"
#include "base/macros.h"
#include "components/policy/policy_export.h"
-namespace base {
-class HistogramBase;
-}
-
namespace policy {
// UMA histogram enum for policy load status. Don't change existing constants,
@@ -49,7 +46,14 @@ enum PolicyLoadStatus {
// for the status codes that were seen on destruction.
class POLICY_EXPORT PolicyLoadStatusSample {
public:
- PolicyLoadStatusSample();
+ using ReportCallback = base::Callback<void(PolicyLoadStatus status)>;
+
+ // If |report_callback| is set, status is sent to this callback. Otherwise,
emaxx 2017/05/04 13:00:34 To me this looks like stretching a single class fo
ljusten (tachyonic) 2017/05/05 08:16:27 Thanks, I like that better.
+ // status is sent to a base::LinearHistogram with name |kHistogramName|. Set
+ // the callback in situations where base::LinearHistogram cannot be used, e.g.
+ // when called from Chromium OS code.
+ PolicyLoadStatusSample(
+ const ReportCallback& report_callback = ReportCallback());
~PolicyLoadStatusSample();
// Adds a status code.
@@ -57,7 +61,7 @@ class POLICY_EXPORT PolicyLoadStatusSample {
private:
std::bitset<POLICY_LOAD_STATUS_SIZE> status_bits_;
- base::HistogramBase* histogram_;
+ ReportCallback report_callback_;
DISALLOW_COPY_AND_ASSIGN(PolicyLoadStatusSample);
};
« no previous file with comments | « no previous file | components/policy/core/common/policy_load_status.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698