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

Unified Diff: media/base/user_input_monitor.cc

Issue 23190045: Switch ObserverList::size() to ObserverList::might_have_observers() Pt.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge Created 7 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 | « content/browser/notification_service_impl.cc ('k') | net/dns/mdns_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/user_input_monitor.cc
diff --git a/media/base/user_input_monitor.cc b/media/base/user_input_monitor.cc
index 18b4c8060f64e34437d4e3e9222fde4d18af520a..8a1f1da5b895d1ede4f740dda81121786493f484 100644
--- a/media/base/user_input_monitor.cc
+++ b/media/base/user_input_monitor.cc
@@ -33,7 +33,7 @@ void UserInputMonitor::AddMouseListener(MouseEventListener* listener) {
void UserInputMonitor::RemoveMouseListener(MouseEventListener* listener) {
base::AutoLock auto_lock(lock_);
mouse_listeners_.RemoveObserver(listener);
- if (mouse_listeners_.size() == 0) {
+ if (!mouse_listeners_.might_have_observers()) {
StopMouseMonitoring();
monitoring_mouse_ = false;
DVLOG(2) << "Stopped mouse monitoring.";
@@ -51,7 +51,7 @@ void UserInputMonitor::AddKeyStrokeListener(KeyStrokeListener* listener) {
void UserInputMonitor::RemoveKeyStrokeListener(KeyStrokeListener* listener) {
base::AutoLock auto_lock(lock_);
key_stroke_listeners_.RemoveObserver(listener);
- if (key_stroke_listeners_.size() == 0) {
+ if (!key_stroke_listeners_.might_have_observers()) {
StopKeyboardMonitoring();
monitoring_keyboard_ = false;
DVLOG(2) << "Stopped keyboard monitoring.";
« no previous file with comments | « content/browser/notification_service_impl.cc ('k') | net/dns/mdns_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698