Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 #include <map> | 36 #include <map> |
| 37 #include <string> | 37 #include <string> |
| 38 | 38 |
| 39 #include "webrtc/base/basictypes.h" | 39 #include "webrtc/base/basictypes.h" |
| 40 #include "webrtc/base/common.h" | 40 #include "webrtc/base/common.h" |
| 41 #include "webrtc/base/refcount.h" | 41 #include "webrtc/base/refcount.h" |
| 42 #include "webrtc/base/scoped_ptr.h" | 42 #include "webrtc/base/scoped_ptr.h" |
| 43 #include "webrtc/base/linked_ptr.h" | 43 #include "webrtc/base/linked_ptr.h" |
| 44 #include "webrtc/base/scoped_ref_ptr.h" | 44 #include "webrtc/base/scoped_ref_ptr.h" |
| 45 #include "webrtc/base/stringencode.h" | 45 #include "webrtc/base/stringencode.h" |
| 46 #include <webrtc/base/thread_checker.h> | |
|
tommi
2015/08/07 13:06:07
oh, missed this... should be "
joachim
2015/08/07 13:08:51
Whoops, sorry. Changed.
| |
| 46 | 47 |
| 47 namespace webrtc { | 48 namespace webrtc { |
| 48 | 49 |
| 49 class StatsReport { | 50 class StatsReport { |
| 50 public: | 51 public: |
| 51 // Indicates whether a track is for sending or receiving. | 52 // Indicates whether a track is for sending or receiving. |
| 52 // Used in reports for audio/video tracks. | 53 // Used in reports for audio/video tracks. |
| 53 enum Direction { | 54 enum Direction { |
| 54 kSend = 0, | 55 kSend = 0, |
| 55 kReceive, | 56 kReceive, |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 // Typedef for an array of const StatsReport pointers. | 377 // Typedef for an array of const StatsReport pointers. |
| 377 // Ownership of the pointers held by this implementation is assumed to lie | 378 // Ownership of the pointers held by this implementation is assumed to lie |
| 378 // elsewhere and lifetime guarantees are made by the implementation that uses | 379 // elsewhere and lifetime guarantees are made by the implementation that uses |
| 379 // this type. In the StatsCollector, object ownership lies with the | 380 // this type. In the StatsCollector, object ownership lies with the |
| 380 // StatsCollection class. | 381 // StatsCollection class. |
| 381 typedef std::vector<const StatsReport*> StatsReports; | 382 typedef std::vector<const StatsReport*> StatsReports; |
| 382 | 383 |
| 383 // A map from the report id to the report. | 384 // A map from the report id to the report. |
| 384 // This class wraps an STL container and provides a limited set of | 385 // This class wraps an STL container and provides a limited set of |
| 385 // functionality in order to keep things simple. | 386 // functionality in order to keep things simple. |
| 386 // TODO(tommi): Use a thread checker here (currently not in libjingle). | |
| 387 class StatsCollection { | 387 class StatsCollection { |
| 388 public: | 388 public: |
| 389 StatsCollection(); | 389 StatsCollection(); |
| 390 ~StatsCollection(); | 390 ~StatsCollection(); |
| 391 | 391 |
| 392 typedef std::list<StatsReport*> Container; | 392 typedef std::list<StatsReport*> Container; |
| 393 typedef Container::iterator iterator; | 393 typedef Container::iterator iterator; |
| 394 typedef Container::const_iterator const_iterator; | 394 typedef Container::const_iterator const_iterator; |
| 395 | 395 |
| 396 const_iterator begin() const; | 396 const_iterator begin() const; |
| 397 const_iterator end() const; | 397 const_iterator end() const; |
| 398 size_t size() const; | 398 size_t size() const; |
| 399 | 399 |
| 400 // Creates a new report object with |id| that does not already | 400 // Creates a new report object with |id| that does not already |
| 401 // exist in the list of reports. | 401 // exist in the list of reports. |
| 402 StatsReport* InsertNew(const StatsReport::Id& id); | 402 StatsReport* InsertNew(const StatsReport::Id& id); |
| 403 StatsReport* FindOrAddNew(const StatsReport::Id& id); | 403 StatsReport* FindOrAddNew(const StatsReport::Id& id); |
| 404 StatsReport* ReplaceOrAddNew(const StatsReport::Id& id); | 404 StatsReport* ReplaceOrAddNew(const StatsReport::Id& id); |
| 405 | 405 |
| 406 // Looks for a report with the given |id|. If one is not found, NULL | 406 // Looks for a report with the given |id|. If one is not found, NULL |
| 407 // will be returned. | 407 // will be returned. |
| 408 StatsReport* Find(const StatsReport::Id& id); | 408 StatsReport* Find(const StatsReport::Id& id); |
| 409 | 409 |
| 410 private: | 410 private: |
| 411 Container list_; | 411 Container list_; |
| 412 rtc::ThreadChecker thread_checker_; | |
| 412 }; | 413 }; |
| 413 | 414 |
| 414 } // namespace webrtc | 415 } // namespace webrtc |
| 415 | 416 |
| 416 #endif // TALK_APP_WEBRTC_STATSTYPES_H_ | 417 #endif // TALK_APP_WEBRTC_STATSTYPES_H_ |
| OLD | NEW |