OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WebRTCStats_h | |
6 #define WebRTCStats_h | |
7 | |
8 #include "WebCommon.h" | |
9 #include "WebString.h" | |
10 | |
11 #include <memory> | |
12 #include <string> | |
13 #include <vector> | |
14 | |
15 namespace blink { | |
16 | |
17 class WebRTCStatsMember; | |
18 | |
19 enum WebRTCStatsMemberType { | |
20 WebRTCStatsMemberTypeInt32, // int32_t | |
21 WebRTCStatsMemberTypeUint32, // uint32_t | |
22 WebRTCStatsMemberTypeInt64, // int64_t | |
23 WebRTCStatsMemberTypeUint64, // uint64_t | |
24 WebRTCStatsMemberTypeDouble, // double | |
25 WebRTCStatsMemberTypeStaticString, // const char* | |
26 WebRTCStatsMemberTypeString, // std::string | |
27 | |
28 WebRTCStatsMemberTypeSequenceInt32, // std::vector<int32_t> | |
29 WebRTCStatsMemberTypeSequenceUint32, // std::vector<uint32_t> | |
30 WebRTCStatsMemberTypeSequenceInt64, // std::vector<int64_t> | |
31 WebRTCStatsMemberTypeSequenceUint64, // std::vector<uint64_t> | |
32 WebRTCStatsMemberTypeSequenceDouble, // std::vector<double> | |
33 WebRTCStatsMemberTypeSequenceStaticString, // std::vector<const char*> | |
34 WebRTCStatsMemberTypeSequenceString, // std::vector<std::string> | |
35 }; | |
36 | |
37 class WebRTCStats { | |
38 public: | |
39 virtual ~WebRTCStats() {} | |
40 | |
41 virtual WebString id() const = 0; | |
42 virtual WebString type() const = 0; | |
43 virtual double timestamp() const = 0; | |
44 | |
45 virtual size_t membersCount() const = 0; | |
46 // The member is only valid as long as this |WebRTCStats| object is alive, n ever use a | |
47 // |WebRTCStatsMember| created by a |WebRTCStats| object that has been destr oyed. | |
esprehn
2016/09/08 09:19:47
This sounds pretty suspect, do you want a RefPtr i
hbos_chromium
2016/09/08 12:17:09
I'm able to avoid this problem by letting the impl
esprehn
2016/09/08 22:41:39
That's what WebPrivatePtr does, if your type is Re
hbos_chromium
2016/09/09 06:35:33
Good to know!
| |
48 virtual std::unique_ptr<WebRTCStatsMember> getMember(size_t) const = 0; | |
49 }; | |
50 | |
51 class WebRTCStatsMember { | |
52 public: | |
53 virtual WebString name() const = 0; | |
54 virtual WebRTCStatsMemberType type() const = 0; | |
55 | |
56 // Value getters. No conversion is performed; the function must match the me mber's |type|. | |
57 virtual int32_t valueInt32() const = 0; | |
58 virtual uint32_t valueUint32() const = 0; | |
59 virtual int64_t valueInt64() const = 0; | |
60 virtual uint64_t valueUint64() const = 0; | |
61 virtual double valueDouble() const = 0; | |
62 virtual const char* valueStaticString() const = 0; | |
63 virtual const std::string& valueString() const = 0; | |
64 virtual const std::vector<int32_t>& valueSequenceInt32() const = 0; | |
65 virtual const std::vector<uint32_t>& valueSequenceUint32() const = 0; | |
esprehn
2016/09/08 09:19:47
Blink doesn't use std::vector, this would need to
hbos_chromium
2016/09/08 12:17:09
Done. Also changed const char* and std::string to
| |
66 virtual const std::vector<int64_t>& valueSequenceInt64() const = 0; | |
67 virtual const std::vector<uint64_t>& valueSequenceUint64() const = 0; | |
68 virtual const std::vector<double>& valueSequenceDouble() const = 0; | |
69 virtual const std::vector<const char*>& valueSequenceStaticString() const = 0; | |
70 virtual const std::vector<std::string>& valueSequenceString() const = 0; | |
71 }; | |
72 | |
73 } // namespace blink | |
74 | |
75 #endif // WebRTCStats_h | |
OLD | NEW |