Ran clang-format on the metrics directory.

[ Merge of http://go/wvgerrit/137809 ]

Bug: 204946540
Test: Metric unit tests
Change-Id: Ibd68db73ea9ee64664d33c2cb8e8bb7c56674c27
This commit is contained in:
Alex Dale
2021-11-03 17:24:34 -07:00
parent 2046fc05fa
commit 21a021e800
16 changed files with 431 additions and 441 deletions

View File

@@ -19,7 +19,7 @@ namespace impl {
// Helper function for setting a value in the proto.
template <typename T>
void SetValue(drm_metrics::ValueMetric *value_proto, const T &value);
void SetValue(drm_metrics::ValueMetric* value_proto, const T& value);
} // namespace impl
@@ -46,7 +46,7 @@ class ValueMetric {
: error_code_(0), has_error_(false), has_value_(false) {}
// Record the value of the metric.
void Record(const T &value) {
void Record(const T& value) {
std::unique_lock<std::mutex> lock(internal_lock_);
value_ = value;
has_value_ = true;
@@ -65,7 +65,7 @@ class ValueMetric {
std::unique_lock<std::mutex> lock(internal_lock_);
return has_value_;
}
const T &GetValue() const {
const T& GetValue() const {
std::unique_lock<std::mutex> lock(internal_lock_);
return value_;
}
@@ -88,14 +88,14 @@ class ValueMetric {
// Returns a new ValueMetric proto containing the metric value or the
// error code. If neither the error or value are set, it returns nullptr.
drm_metrics::ValueMetric *ToProto() const {
drm_metrics::ValueMetric* ToProto() const {
std::unique_lock<std::mutex> lock(internal_lock_);
if (has_error_) {
drm_metrics::ValueMetric *value_proto = new drm_metrics::ValueMetric;
drm_metrics::ValueMetric* value_proto = new drm_metrics::ValueMetric;
value_proto->set_error_code(error_code_);
return value_proto;
} else if (has_value_) {
drm_metrics::ValueMetric *value_proto = new drm_metrics::ValueMetric;
drm_metrics::ValueMetric* value_proto = new drm_metrics::ValueMetric;
impl::SetValue(value_proto, value_);
return value_proto;
}