summaryrefslogtreecommitdiffstats
path: root/base/id_map.h
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-16 09:15:38 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-16 09:15:38 +0000
commit2de069ee4f16b2b5f89c0c435c0ca3788e317d5c (patch)
tree919a1bca247f2a2cc5e4ab9acafdfe37154edb16 /base/id_map.h
parent9beaf2987dfc53dc150ac8c22336ea5046da005c (diff)
downloadchromium_src-2de069ee4f16b2b5f89c0c435c0ca3788e317d5c.zip
chromium_src-2de069ee4f16b2b5f89c0c435c0ca3788e317d5c.tar.gz
chromium_src-2de069ee4f16b2b5f89c0c435c0ca3788e317d5c.tar.bz2
Correctly recognize emptiness of IDMap.
This prevents a leak of RenderProcessHost, and possibly other bad bugs. TEST=Added to base_unittests; also existing browser and unit tests. BUG=35571 Review URL: http://codereview.chromium.org/604048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39084 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/id_map.h')
-rw-r--r--base/id_map.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/base/id_map.h b/base/id_map.h
index b108dbd..acfba42 100644
--- a/base/id_map.h
+++ b/base/id_map.h
@@ -82,7 +82,7 @@ class IDMap {
}
bool IsEmpty() const {
- return data_.empty();
+ return size() == 0u;
}
T* Lookup(KeyType id) const {
@@ -93,7 +93,7 @@ class IDMap {
}
size_t size() const {
- return data_.size();
+ return data_.size() - removed_ids_.size();
}
// It is safe to remove elements from the map during iteration. All iterators