summaryrefslogtreecommitdiffstats
path: root/content/public
diff options
context:
space:
mode:
authormlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 13:26:45 +0000
committermlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 13:26:45 +0000
commitace95a2d218e7016a61503e16227169b5ccd4e09 (patch)
treef580f3973815ab89763f144febb2f3bafa0f5255 /content/public
parent3ab0a113e25728e951472bf68a00b4c631bdc5e7 (diff)
downloadchromium_src-ace95a2d218e7016a61503e16227169b5ccd4e09.zip
chromium_src-ace95a2d218e7016a61503e16227169b5ccd4e09.tar.gz
chromium_src-ace95a2d218e7016a61503e16227169b5ccd4e09.tar.bz2
Expose size() and isEmpty() in ObserverList.
BUG=347558 Review URL: https://codereview.chromium.org/198093004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public')
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ScreenOrientationListener.java13
1 files changed, 2 insertions, 11 deletions
diff --git a/content/public/android/java/src/org/chromium/content/browser/ScreenOrientationListener.java b/content/public/android/java/src/org/chromium/content/browser/ScreenOrientationListener.java
index 6125b70..b5068aa 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ScreenOrientationListener.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ScreenOrientationListener.java
@@ -144,11 +144,6 @@ class ScreenOrientationListener {
private final ObserverList<ScreenOrientationObserver> mObservers =
new ObserverList<ScreenOrientationObserver>();
- // Number of observers currently in |mObservers|.
- // TODO(mlamouri): hopefully, we can get ObserverList to provide that,
- // http://crbug.com/347558
- private int mObserverCount;
-
// mOrientation will be updated every time the orientation changes. When not
// listening for changes, the value will be invalid and will be updated when
// starting to listen again.
@@ -210,10 +205,9 @@ class ScreenOrientationListener {
Log.w(TAG, "Adding an observer that is already present!");
return;
}
- mObserverCount++;
// If we got our first observer, we should start listening.
- if (mObserverCount == 1) {
+ if (mObservers.size() == 1) {
updateOrientation();
mBackend.startListening();
}
@@ -240,14 +234,11 @@ class ScreenOrientationListener {
Log.w(TAG, "Removing an inexistent observer!");
return;
}
- mObserverCount--;
- if (mObserverCount == 0) {
+ if (mObservers.isEmpty()) {
// The last observer was removed, we should just stop listening.
mBackend.stopListening();
}
-
- assert mObserverCount >= 0;
}
/**