Files
android/libwvdrmengine/cdm/metrics/src/counter_metric.cpp
Rahul Frias 0e28104cff Change from custom Lock to std::mutex.
[ Merge of http://go/wvgerrit/67884 ]

Now that we can use C++11, we should use the cross-platform std::mutex
type, not the custom pthread version.

Bug: 111850982
Test: WV unit/integration tests
Change-Id: If2fde2836826c5184609e6b1f3a6511206bd4594
2018-12-13 11:55:54 -08:00

26 lines
643 B
C++

// Copyright 2017 Google Inc. All Rights Reserved.
//
// This file contains implementations for the BaseCounterMetric, the base class
// for CounterMetric.
#include "counter_metric.h"
#include "metrics.pb.h"
namespace wvcdm {
namespace metrics {
void BaseCounterMetric::Increment(const std::string &counter_key,
int64_t value) {
std::unique_lock<std::mutex> lock(internal_lock_);
if (value_map_.find(counter_key) == value_map_.end()) {
value_map_[counter_key] = value;
} else {
value_map_[counter_key] = value_map_[counter_key] + value;
}
}
} // namespace metrics
} // namespace wvcdm