mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-14 06:10:40 +01:00

This is a reland of commit 84c48ae751
Original change's description:
> [Stats] Move metric names to Attribute, constructed via AttributeInit.
>
> As of this CL, Attribute no longer implements RTCStatsMemberInterface
> and a member no longer owns knowing its own name. The attribute knows
> the name because we pass it down at construction time.
>
> To achieve this, the WEBRTC_RTCSTATS_IMPL() macro is updated to take
> AttributeInits instead of raw member pointers, i.e. (name, ptr) pairs.
>
> By constructing RTCStatsMember<T> without a name parameter, it does the
> same thing as the absl::optional<T> constructor. So RTCStatsMember<T>'s
> days are numbered!
>
> Bug: webrtc:15164
> Change-Id: I560c0134bae1c2d7218426a1576425ecc1b677a7
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334203
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Evan Shrubsole <eshr@google.com>
> Cr-Commit-Position: refs/heads/main@{#41540}
Bug: webrtc:15164
Change-Id: I28f3d588004ff185e5820347ad9513f2f7a6cc66
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/335020
Auto-Submit: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41556}
43 lines
1.8 KiB
C++
43 lines
1.8 KiB
C++
/*
|
|
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "stats/test/rtc_test_stats.h"
|
|
|
|
#include "api/stats/attribute.h"
|
|
#include "rtc_base/checks.h"
|
|
|
|
namespace webrtc {
|
|
|
|
WEBRTC_RTCSTATS_IMPL(RTCTestStats,
|
|
RTCStats,
|
|
"test-stats",
|
|
AttributeInit("mBool", &m_bool),
|
|
AttributeInit("mInt32", &m_int32),
|
|
AttributeInit("mUint32", &m_uint32),
|
|
AttributeInit("mInt64", &m_int64),
|
|
AttributeInit("mUint64", &m_uint64),
|
|
AttributeInit("mDouble", &m_double),
|
|
AttributeInit("mString", &m_string),
|
|
AttributeInit("mSequenceBool", &m_sequence_bool),
|
|
AttributeInit("mSequenceInt32", &m_sequence_int32),
|
|
AttributeInit("mSequenceUint32", &m_sequence_uint32),
|
|
AttributeInit("mSequenceInt64", &m_sequence_int64),
|
|
AttributeInit("mSequenceUint64", &m_sequence_uint64),
|
|
AttributeInit("mSequenceDouble", &m_sequence_double),
|
|
AttributeInit("mSequenceString", &m_sequence_string),
|
|
AttributeInit("mMapStringUint64", &m_map_string_uint64),
|
|
AttributeInit("mMapStringDouble", &m_map_string_double))
|
|
|
|
RTCTestStats::RTCTestStats(const std::string& id, Timestamp timestamp)
|
|
: RTCStats(id, timestamp) {}
|
|
|
|
RTCTestStats::~RTCTestStats() {}
|
|
|
|
} // namespace webrtc
|