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

Unified Diff: talk/app/webrtc/statstypes.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/statstypes.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/statstypes.cc
diff --git a/talk/app/webrtc/statstypes.cc b/talk/app/webrtc/statstypes.cc
index a902210478c7d112611fa8a89b8cbb39928b76b0..a23b95903310cfe792c536fc6205422017e4686c 100644
--- a/talk/app/webrtc/statstypes.cc
+++ b/talk/app/webrtc/statstypes.cc
@@ -720,23 +720,28 @@ StatsCollection::StatsCollection() {
}
StatsCollection::~StatsCollection() {
+ DCHECK(thread_checker_.CalledOnValidThread());
for (auto* r : list_)
delete r;
}
StatsCollection::const_iterator StatsCollection::begin() const {
+ DCHECK(thread_checker_.CalledOnValidThread());
return list_.begin();
}
StatsCollection::const_iterator StatsCollection::end() const {
+ DCHECK(thread_checker_.CalledOnValidThread());
return list_.end();
}
size_t StatsCollection::size() const {
+ DCHECK(thread_checker_.CalledOnValidThread());
return list_.size();
}
StatsReport* StatsCollection::InsertNew(const StatsReport::Id& id) {
+ DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(Find(id) == nullptr);
StatsReport* report = new StatsReport(id);
list_.push_back(report);
@@ -744,11 +749,13 @@ StatsReport* StatsCollection::InsertNew(const StatsReport::Id& id) {
}
StatsReport* StatsCollection::FindOrAddNew(const StatsReport::Id& id) {
+ DCHECK(thread_checker_.CalledOnValidThread());
StatsReport* ret = Find(id);
return ret ? ret : InsertNew(id);
}
StatsReport* StatsCollection::ReplaceOrAddNew(const StatsReport::Id& id) {
+ DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(id.get());
Container::iterator it = std::find_if(list_.begin(), list_.end(),
[&id](const StatsReport* r)->bool { return r->id()->Equals(id); });
@@ -764,6 +771,7 @@ StatsReport* StatsCollection::ReplaceOrAddNew(const StatsReport::Id& id) {
// Looks for a report with the given |id|. If one is not found, NULL
// will be returned.
StatsReport* StatsCollection::Find(const StatsReport::Id& id) {
+ DCHECK(thread_checker_.CalledOnValidThread());
Container::iterator it = std::find_if(list_.begin(), list_.end(),
[&id](const StatsReport* r)->bool { return r->id()->Equals(id); });
return it == list_.end() ? nullptr : *it;
« no previous file with comments | « talk/app/webrtc/statstypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698