OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 // This file contains structures used for retrieving statistics from an ongoing | 11 // This file contains structures used for retrieving statistics from an ongoing |
12 // libjingle session. | 12 // libjingle session. |
13 | 13 |
14 #ifndef WEBRTC_API_STATSTYPES_H_ | 14 #ifndef WEBRTC_API_STATSTYPES_H_ |
15 #define WEBRTC_API_STATSTYPES_H_ | 15 #define WEBRTC_API_STATSTYPES_H_ |
16 | 16 |
17 #include <algorithm> | 17 #include <algorithm> |
18 #include <list> | 18 #include <list> |
19 #include <map> | 19 #include <map> |
20 #include <string> | 20 #include <string> |
21 | 21 |
22 #include "webrtc/base/basictypes.h" | 22 #include "webrtc/base/basictypes.h" |
23 #include "webrtc/base/common.h" | 23 #include "webrtc/base/common.h" |
24 #include "webrtc/base/constructormagic.h" | 24 #include "webrtc/base/constructormagic.h" |
| 25 #include "webrtc/base/linked_ptr.h" |
25 #include "webrtc/base/refcount.h" | 26 #include "webrtc/base/refcount.h" |
26 #include "webrtc/base/scoped_ref_ptr.h" | 27 #include "webrtc/base/scoped_ref_ptr.h" |
27 #include "webrtc/base/stringencode.h" | 28 #include "webrtc/base/stringencode.h" |
28 #include "webrtc/base/thread_checker.h" | 29 #include "webrtc/base/thread_checker.h" |
29 | 30 |
30 namespace webrtc { | 31 namespace webrtc { |
31 | 32 |
32 class StatsReport { | 33 class StatsReport { |
33 public: | 34 public: |
34 // Indicates whether a track is for sending or receiving. | 35 // Indicates whether a track is for sending or receiving. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 const char* static_string_; | 314 const char* static_string_; |
314 Id* id_; | 315 Id* id_; |
315 } value_; | 316 } value_; |
316 | 317 |
317 private: | 318 private: |
318 RTC_DISALLOW_COPY_AND_ASSIGN(Value); | 319 RTC_DISALLOW_COPY_AND_ASSIGN(Value); |
319 }; | 320 }; |
320 | 321 |
321 // TODO(tommi): Consider using a similar approach to how we store Ids using | 322 // TODO(tommi): Consider using a similar approach to how we store Ids using |
322 // scoped_refptr for values. | 323 // scoped_refptr for values. |
323 typedef std::unique_ptr<Value> ValuePtr; | 324 typedef rtc::linked_ptr<Value> ValuePtr; |
324 typedef std::map<StatsValueName, ValuePtr> Values; | 325 typedef std::map<StatsValueName, ValuePtr> Values; |
325 | 326 |
326 // Ownership of |id| is passed to |this|. | 327 // Ownership of |id| is passed to |this|. |
327 explicit StatsReport(const Id& id); | 328 explicit StatsReport(const Id& id); |
328 | 329 |
329 // Factory functions for various types of stats IDs. | 330 // Factory functions for various types of stats IDs. |
330 static Id NewBandwidthEstimationId(); | 331 static Id NewBandwidthEstimationId(); |
331 static Id NewTypedId(StatsType type, const std::string& id); | 332 static Id NewTypedId(StatsType type, const std::string& id); |
332 static Id NewTypedIntId(StatsType type, int id); | 333 static Id NewTypedIntId(StatsType type, int id); |
333 static Id NewIdWithDirection( | 334 static Id NewIdWithDirection( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 StatsReport* Find(const StatsReport::Id& id); | 403 StatsReport* Find(const StatsReport::Id& id); |
403 | 404 |
404 private: | 405 private: |
405 Container list_; | 406 Container list_; |
406 rtc::ThreadChecker thread_checker_; | 407 rtc::ThreadChecker thread_checker_; |
407 }; | 408 }; |
408 | 409 |
409 } // namespace webrtc | 410 } // namespace webrtc |
410 | 411 |
411 #endif // WEBRTC_API_STATSTYPES_H_ | 412 #endif // WEBRTC_API_STATSTYPES_H_ |
OLD | NEW |