Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: talk/app/webrtc/statstypes.h

Issue 1235263003: Add thread checker to StatsCollection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed #include Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | talk/app/webrtc/statstypes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
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
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_
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/statstypes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698