summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-17 15:24:38 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-17 15:24:38 +0000
commit54ae3ff2256c591e32d3fd63786c7617d2aba6ee (patch)
tree428ed1c0771a95bec4c09a21b59e8d5585278453 /base
parent8f87e81d4abba954a3a11d619e71bbd685164b77 (diff)
downloadchromium_src-54ae3ff2256c591e32d3fd63786c7617d2aba6ee.zip
chromium_src-54ae3ff2256c591e32d3fd63786c7617d2aba6ee.tar.gz
chromium_src-54ae3ff2256c591e32d3fd63786c7617d2aba6ee.tar.bz2
Add connected socket function to ClientSocketPool and ClientSocketHandle.
Provide a new api in ClientSocketPool and ClientSocketHandle for clients (notably HttpNetworkTransaction) to request connected sockets, rather than having to allocate and Connect() sockets themselves. Add a bunch of tests for it. Have not begun switching clients over to using this. Review URL: http://codereview.chromium.org/99143 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-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_