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

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..19a1ad515ddd9e7a67d55f02115869bae9300449
--- /dev/null
+++ b/net/dns/dns_socket_pool.h
@@ -0,0 +1,56 @@
+// 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:
+ static scoped_ptr<DnsSocketPool> CreateDefault(
+ ClientSocketFactory* factory);
+
szym 2012/09/26 11:16:12 IMPORTANT: Needs a virtual destructor.
Deprecated (see juliatuttle) 2012/09/26 20:44:50 Done.
+ virtual void Initialize(
+ NetLog* net_log,
szym 2012/09/26 11:16:12 I suggest reversing the order of arguments here. |
Deprecated (see juliatuttle) 2012/09/26 20:44:50 Done.
+ const std::vector<IPEndPoint>* nameservers) = 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(
+ NetLog* net_log,
+ const std::vector<IPEndPoint>* nameservers);
+
+ 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
szym 2012/09/26 11:16:12 nit: add // NET_DNS_DNS...
Deprecated (see juliatuttle) 2012/09/26 20:44:50 Done.

Powered by Google App Engine
This is Rietveld 408576698