summaryrefslogtreecommitdiffstats
path: root/base/stl_util-inl.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 05:28:40 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 05:28:40 +0000
commitd207a5f9ff5af30e4d1dabdeb61c2164a926fd2b (patch)
tree0d4619b4a982a79f4af8e29ccfcc623e51d9aca5 /base/stl_util-inl.h
parent079fc0db5e3faeda06f20dcf36bbaad49381069c (diff)
downloadchromium_src-d207a5f9ff5af30e4d1dabdeb61c2164a926fd2b.zip
chromium_src-d207a5f9ff5af30e4d1dabdeb61c2164a926fd2b.tar.gz
chromium_src-d207a5f9ff5af30e4d1dabdeb61c2164a926fd2b.tar.bz2
Reland my ClientSocketPool refactor again...
The bug was that the handle was getting reused, so the ConnectingSocket doesn't know that it got canceled. It just keeps chugging away. I added a map to keep track of the ConnectingSockets so they can be canceled if we detect a reuse. TBR=wtc Review URL: http://codereview.chromium.org/118219 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17606 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/stl_util-inl.h')
-rw-r--r--base/stl_util-inl.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/base/stl_util-inl.h b/base/stl_util-inl.h
index 54b7b29..70fa69e 100644
--- a/base/stl_util-inl.h
+++ b/base/stl_util-inl.h
@@ -447,4 +447,11 @@ std::vector<T> SetToVector(const std::set<T>& values) {
return result;
}
+// Test to see if a set, map, hash_set or hash_map contains a particular key.
+// Returns true if the key is in the collection.
+template <typename Collection, typename Key>
+bool ContainsKey(const Collection& collection, const Key& key) {
+ return collection.find(key) != collection.end();
+}
+
#endif // BASE_STL_UTIL_INL_H_