Chromium Code Reviews| 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..1c8a58cf5ab33f6ed7a8c226f6ca3755dac92c90 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" |
|
emaxx
2017/05/05 10:44:25
nit: Not necessary anymore.
ljusten (tachyonic)
2017/05/05 12:58:36
Done.
|
| #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, |
| @@ -44,22 +41,35 @@ enum PolicyLoadStatus { |
| POLICY_LOAD_STATUS_SIZE |
| }; |
| -// A helper for generating policy load status UMA statistics that'll collect |
| -// histogram samples for a policy load operation and records histogram samples |
| -// for the status codes that were seen on destruction. |
| -class POLICY_EXPORT PolicyLoadStatusSample { |
| +// A helper for collecting statuses for a policy load operation. |
| +class POLICY_EXPORT PolicyLoadStatusSampler { |
| public: |
| - PolicyLoadStatusSample(); |
| - ~PolicyLoadStatusSample(); |
| + using StatusSet = std::bitset<POLICY_LOAD_STATUS_SIZE>; |
| + |
| + PolicyLoadStatusSampler(); |
| + virtual ~PolicyLoadStatusSampler(); |
| // Adds a status code. |
| void Add(PolicyLoadStatus status); |
| + // Returns a set with all statuses. |
| + const StatusSet& GetStatusSet() const { return status_bits_; } |
| + |
| private: |
| - std::bitset<POLICY_LOAD_STATUS_SIZE> status_bits_; |
| - base::HistogramBase* histogram_; |
| + StatusSet status_bits_; |
| + DISALLOW_COPY_AND_ASSIGN(PolicyLoadStatusSampler); |
| +}; |
| - DISALLOW_COPY_AND_ASSIGN(PolicyLoadStatusSample); |
| +// A helper for generating policy load status UMA statistics. On destruction, |
| +// records histogram samples for the collected status codes. |
| +class POLICY_EXPORT PolicyLoadStatusAutoSubmitter |
|
emaxx
2017/05/05 10:44:25
nit: Not insisting, but as you're already changing
ljusten (tachyonic)
2017/05/05 12:58:36
Done, but I dropped the 'Auto' - it's cleaner.
|
| + : public PolicyLoadStatusSampler { |
| + public: |
| + PolicyLoadStatusAutoSubmitter(); |
| + ~PolicyLoadStatusAutoSubmitter() override; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(PolicyLoadStatusAutoSubmitter); |
| }; |
| } // namespace policy |