Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: net/dns/dns_socket_pool.h

Issue 10878090: Keep pool of pre-connected DNS sockets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/dns/dns_socket_pool.h
diff --git a/net/dns/dns_socket_pool.h b/net/dns/dns_socket_pool.h
new file mode 100644
index 0000000000000000000000000000000000000000..4d5d16fd0f6087a0c729c0846119f1d26ec85854
--- /dev/null
+++ b/net/dns/dns_socket_pool.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_DNS_DNS_SOCKET_POOL_H_
+#define NET_DNS_DNS_SOCKET_POOL_H_
+
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+
+namespace net {
+
+class ClientSocketFactory;
+class DatagramClientSocket;
+class IPEndPoint;
+class NetLog;
+
+class DnsSocketPool {
+ public:
+ ~DnsSocketPool() { }
szym 2012/09/26 21:03:33 IMPORTANT: This has to be virtual to work.
Deprecated (see juliatuttle) 2012/10/01 21:30:07 Done.
+
+ static scoped_ptr<DnsSocketPool> CreateDefault(
+ ClientSocketFactory* factory);
+
+ virtual void Initialize(
+ const std::vector<IPEndPoint>* nameservers,
+ NetLog* net_log) = 0;
+
+ virtual scoped_ptr<DatagramClientSocket> AllocateSocket(
+ unsigned server_index) = 0;
+
+ virtual void FreeSocket(
+ unsigned server_index,
+ scoped_ptr<DatagramClientSocket> socket) = 0;
+
+ protected:
+ DnsSocketPool(ClientSocketFactory* socket_factory);
+
+ void InitializeInternal(
+ const std::vector<IPEndPoint>* nameservers,
+ NetLog* net_log);
+
+ scoped_ptr<DatagramClientSocket> CreateConnectedSocket(
+ unsigned server_index);
+
+ private:
+ ClientSocketFactory* socket_factory_;
+ NetLog* net_log_;
+ const std::vector<IPEndPoint>* nameservers_;
+ bool initialized_;
+
+ DISALLOW_COPY_AND_ASSIGN(DnsSocketPool);
+};
+
+} // namespace net
+
+#endif // NET_DNS_DNS_SOCKET_POOL_H_

Powered by Google App Engine
This is Rietveld 408576698