Source release 17.1.0

This commit is contained in:
John "Juce" Bruce
2022-07-07 17:14:31 -07:00
parent 8c17574083
commit 694cf6fb25
2233 changed files with 272026 additions and 223371 deletions

View File

@@ -1,23 +1,23 @@
// Copyright 2017 Google Inc. All Rights Reserved.
// Copyright 2017 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
//
// This file contains the declarations for the Metric class and related
// types.
#ifndef WVCDM_METRICS_COUNTER_METRIC_H_
#define WVCDM_METRICS_COUNTER_METRIC_H_
#include <cstdarg>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
#include "attribute_handler.h"
#include "field_tuples.h"
#include "wv_metrics.pb.h"
namespace wvcdm {
namespace metrics {
class CounterMetricTest;
// This base class provides the common defintion used by all templated
@@ -37,7 +37,7 @@ class BaseCounterMetric {
// Increment will look for an existing instance of the field names and
// add the new value to the existing value. If the instance does not exist,
// this method will create it.
void Increment(const std::string &counter_key, int64_t value);
void Increment(const std::string& counter_key, int64_t value);
private:
friend class CounterMetricTest;
@@ -99,14 +99,13 @@ class CounterMetric : public BaseCounterMetric {
void Increment(int64_t value, F1 field1 = util::Unused(),
F2 field2 = util::Unused(), F3 field3 = util::Unused(),
F4 field4 = util::Unused()) {
std::string key =
attribute_handler_.GetSerializedAttributes(field1, field2,
field3, field4);
std::string key = attribute_handler_.GetSerializedAttributes(
field1, field2, field3, field4);
BaseCounterMetric::Increment(key, value);
}
void ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>
*counters) const;
void ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>*
counters) const;
private:
friend class CounterMetricTest;
@@ -120,13 +119,12 @@ class CounterMetric : public BaseCounterMetric {
template <>
inline void CounterMetric<0, util::Unused, 0, util::Unused, 0, util::Unused, 0,
util::Unused>::
ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>
*counters) const {
ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>*
counters) const {
const std::map<std::string, int64_t>* values = GetValues();
for (std::map<std::string, int64_t>::const_iterator it = values->begin();
it != values->end(); it++) {
drm_metrics::CounterMetric *new_counter = counters->Add();
drm_metrics::CounterMetric* new_counter = counters->Add();
new_counter->set_count(it->second);
}
}
@@ -134,20 +132,18 @@ inline void CounterMetric<0, util::Unused, 0, util::Unused, 0, util::Unused, 0,
template <int I1, typename F1, int I2, typename F2, int I3, typename F3, int I4,
typename F4>
inline void CounterMetric<I1, F1, I2, F2, I3, F3, I4, F4>::ToProto(
::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>
*counters) const {
::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>* counters)
const {
const std::map<std::string, int64_t>* values = GetValues();
for (std::map<std::string, int64_t>::const_iterator it = values->begin();
it != values->end(); it++) {
drm_metrics::CounterMetric *new_counter = counters->Add();
drm_metrics::CounterMetric* new_counter = counters->Add();
if (!new_counter->mutable_attributes()->ParseFromString(it->first)) {
LOGE("Failed to parse the attributes from a string.");
}
new_counter->set_count(it->second);
}
}
} // namespace metrics
} // namespace wvcdm
#endif // WVCDM_METRICS_COUNTER_METRIC_H_