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

Unified Diff: chromecast/base/observer.h

Issue 2920723002: Use ContainsValue() instead of std::find() in chromecast/ (Closed)
Patch Set: Adding blank line and removing an extra line. Created 3 years, 7 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 | « no previous file | chromecast/graphics/cast_focus_client_aura.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/base/observer.h
diff --git a/chromecast/base/observer.h b/chromecast/base/observer.h
index a1b6d48f39ac36e6c196086c67a78489f954ccf7..8aa5af3d86f328b7071131b85a53d64c9fee2f48 100644
--- a/chromecast/base/observer.h
+++ b/chromecast/base/observer.h
@@ -114,6 +114,7 @@
#include "base/memory/ref_counted.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
+#include "base/stl_util.h"
#include "base/synchronization/lock.h"
#include "base/threading/sequenced_task_runner_handle.h"
@@ -266,16 +267,14 @@ class ObservableInternals
void AddObserver(Observer<T>* observer) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(observer);
- DCHECK(std::find(observers_.begin(), observers_.end(), observer) ==
- observers_.end());
+ DCHECK(!base::ContainsValue(observers_, observer));
observers_.push_back(observer);
}
void RemoveObserver(Observer<T>* observer) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(observer);
- DCHECK(std::find(observers_.begin(), observers_.end(), observer) !=
- observers_.end());
+ DCHECK(base::ContainsValue(observers_, observer));
observers_.erase(
std::remove(observers_.begin(), observers_.end(), observer),
observers_.end());
« no previous file with comments | « no previous file | chromecast/graphics/cast_focus_client_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698