Index: third_party/WebKit/public/platform/WebRTCStats.h |
diff --git a/third_party/WebKit/public/platform/WebRTCStats.h b/third_party/WebKit/public/platform/WebRTCStats.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e3b59aa4e97b8c1689c5a5826878fe0a975c1f14 |
--- /dev/null |
+++ b/third_party/WebKit/public/platform/WebRTCStats.h |
@@ -0,0 +1,75 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef WebRTCStats_h |
+#define WebRTCStats_h |
+ |
+#include "WebCommon.h" |
+#include "WebString.h" |
+ |
+#include <memory> |
+#include <string> |
+#include <vector> |
+ |
+namespace blink { |
+ |
+class WebRTCStatsMember; |
+ |
+enum WebRTCStatsMemberType { |
+ WebRTCStatsMemberTypeInt32, // int32_t |
+ WebRTCStatsMemberTypeUint32, // uint32_t |
+ WebRTCStatsMemberTypeInt64, // int64_t |
+ WebRTCStatsMemberTypeUint64, // uint64_t |
+ WebRTCStatsMemberTypeDouble, // double |
+ WebRTCStatsMemberTypeStaticString, // const char* |
+ WebRTCStatsMemberTypeString, // std::string |
+ |
+ WebRTCStatsMemberTypeSequenceInt32, // std::vector<int32_t> |
+ WebRTCStatsMemberTypeSequenceUint32, // std::vector<uint32_t> |
+ WebRTCStatsMemberTypeSequenceInt64, // std::vector<int64_t> |
+ WebRTCStatsMemberTypeSequenceUint64, // std::vector<uint64_t> |
+ WebRTCStatsMemberTypeSequenceDouble, // std::vector<double> |
+ WebRTCStatsMemberTypeSequenceStaticString, // std::vector<const char*> |
+ WebRTCStatsMemberTypeSequenceString, // std::vector<std::string> |
+}; |
+ |
+class WebRTCStats { |
+public: |
+ virtual ~WebRTCStats() {} |
+ |
+ virtual WebString id() const = 0; |
+ virtual WebString type() const = 0; |
+ virtual double timestamp() const = 0; |
+ |
+ virtual size_t membersCount() const = 0; |
+ // The member is only valid as long as this |WebRTCStats| object is alive, never use a |
+ // |WebRTCStatsMember| created by a |WebRTCStats| object that has been destroyed. |
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!
|
+ virtual std::unique_ptr<WebRTCStatsMember> getMember(size_t) const = 0; |
+}; |
+ |
+class WebRTCStatsMember { |
+public: |
+ virtual WebString name() const = 0; |
+ virtual WebRTCStatsMemberType type() const = 0; |
+ |
+ // Value getters. No conversion is performed; the function must match the member's |type|. |
+ virtual int32_t valueInt32() const = 0; |
+ virtual uint32_t valueUint32() const = 0; |
+ virtual int64_t valueInt64() const = 0; |
+ virtual uint64_t valueUint64() const = 0; |
+ virtual double valueDouble() const = 0; |
+ virtual const char* valueStaticString() const = 0; |
+ virtual const std::string& valueString() const = 0; |
+ virtual const std::vector<int32_t>& valueSequenceInt32() const = 0; |
+ 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
|
+ virtual const std::vector<int64_t>& valueSequenceInt64() const = 0; |
+ virtual const std::vector<uint64_t>& valueSequenceUint64() const = 0; |
+ virtual const std::vector<double>& valueSequenceDouble() const = 0; |
+ virtual const std::vector<const char*>& valueSequenceStaticString() const = 0; |
+ virtual const std::vector<std::string>& valueSequenceString() const = 0; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // WebRTCStats_h |