summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcaitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-28 03:55:41 +0000
committercaitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-28 03:55:41 +0000
commit2fae558ee831dd987f6cbce605e201d3357ef26a (patch)
tree69bc08083b69b9449e44feec61b92811a0fee415
parent8fb1c7e9ea99db0b0eca967b0d3ea2d9b1229a8e (diff)
downloadchromium_src-2fae558ee831dd987f6cbce605e201d3357ef26a.zip
chromium_src-2fae558ee831dd987f6cbce605e201d3357ef26a.tar.gz
chromium_src-2fae558ee831dd987f6cbce605e201d3357ef26a.tar.bz2
Remove calls to ObserverList::size() from PluginInstaller.
(See issue for details on why this is being done). BUG=278526 TEST=no change Review URL: https://chromiumcodereview.appspot.com/22918027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219900 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/plugins/plugin_installer.cc7
-rw-r--r--chrome/browser/plugins/plugin_installer.h1
2 files changed, 6 insertions, 2 deletions
diff --git a/chrome/browser/plugins/plugin_installer.cc b/chrome/browser/plugins/plugin_installer.cc
index 099711e..6801d13 100644
--- a/chrome/browser/plugins/plugin_installer.cc
+++ b/chrome/browser/plugins/plugin_installer.cc
@@ -67,7 +67,8 @@ void BeginDownload(
} // namespace
PluginInstaller::PluginInstaller()
- : state_(INSTALLER_STATE_IDLE) {
+ : state_(INSTALLER_STATE_IDLE),
+ strong_observer_count_(0) {
}
PluginInstaller::~PluginInstaller() {
@@ -109,12 +110,14 @@ void PluginInstaller::OnDownloadDestroyed(DownloadItem* download) {
}
void PluginInstaller::AddObserver(PluginInstallerObserver* observer) {
+ strong_observer_count_++;
observers_.AddObserver(observer);
}
void PluginInstaller::RemoveObserver(PluginInstallerObserver* observer) {
+ strong_observer_count_--;
observers_.RemoveObserver(observer);
- if (observers_.size() == weak_observers_.size()) {
+ if (strong_observer_count_ == 0) {
FOR_EACH_OBSERVER(WeakPluginInstallerObserver, weak_observers_,
OnlyWeakObserversLeft());
}
diff --git a/chrome/browser/plugins/plugin_installer.h b/chrome/browser/plugins/plugin_installer.h
index 978fe1a..abcfe6f 100644
--- a/chrome/browser/plugins/plugin_installer.h
+++ b/chrome/browser/plugins/plugin_installer.h
@@ -58,6 +58,7 @@ class PluginInstaller : public content::DownloadItem::Observer {
InstallerState state_;
ObserverList<PluginInstallerObserver> observers_;
+ int strong_observer_count_;
ObserverList<WeakPluginInstallerObserver> weak_observers_;
DISALLOW_COPY_AND_ASSIGN(PluginInstaller);