Chromium Code Reviews| Index: net/dns/mdns_client_impl.h |
| diff --git a/net/dns/mdns_client_impl.h b/net/dns/mdns_client_impl.h |
| index b69677bb74739416c9d0f4673f78b260e299dce6..91a06b0e9fbf08def4c0ab2c8b67f1372a60f2cf 100644 |
| --- a/net/dns/mdns_client_impl.h |
| +++ b/net/dns/mdns_client_impl.h |
| @@ -27,11 +27,23 @@ namespace net { |
| // DnsResponse objects and alerts the delegate that a packet has been received. |
| class NET_EXPORT_PRIVATE MDnsConnection { |
| public: |
| + class Socket { |
|
szym
2013/11/27 00:28:09
When compared to the more direct route of using Da
Vitaly Buka (NO REVIEWS)
2013/11/27 00:45:45
1. Cleaner tests because no need to mock unnecessa
szym
2013/11/27 02:25:28
True, but less _test_ code is not a reason to slow
|
| + public: |
| + virtual ~Socket() {}; |
| + |
| + virtual int RecvFrom(IOBuffer* buf, |
| + int buf_len, |
| + IPEndPoint* address, |
| + const CompletionCallback& callback) = 0; |
| + virtual int SendTo(IOBuffer* buf, |
|
szym
2013/11/27 07:37:44
Does not take an address, so this should be |Send|
Vitaly Buka (NO REVIEWS)
2013/11/27 08:45:37
This one does not, that was a point, make implemen
|
| + int buf_len, |
| + const CompletionCallback& callback) = 0; |
| + }; |
| + |
| class SocketFactory { |
| public: |
| virtual ~SocketFactory() {} |
| - |
| - virtual scoped_ptr<DatagramServerSocket> CreateSocket() = 0; |
| + virtual void CreateSockets(ScopedVector<Socket>* sockets) = 0; |
| static scoped_ptr<SocketFactory> CreateDefault(); |
| }; |
| @@ -45,7 +57,6 @@ class NET_EXPORT_PRIVATE MDnsConnection { |
| }; |
| explicit MDnsConnection(MDnsConnection::Delegate* delegate); |
| - |
| virtual ~MDnsConnection(); |
| // Both methods return true if at least one of the socket handlers succeeded. |
| @@ -55,13 +66,10 @@ class NET_EXPORT_PRIVATE MDnsConnection { |
| private: |
| class SocketHandler { |
| public: |
| - SocketHandler(MDnsConnection* connection, |
| - const IPEndPoint& multicast_addr, |
| - SocketFactory* socket_factory); |
| + SocketHandler(scoped_ptr<Socket> socket, MDnsConnection* connection); |
| ~SocketHandler(); |
| - int Bind(); |
| - int Start(); |
| + int Start(); |
| int Send(IOBuffer* buffer, unsigned size); |
| private: |
| @@ -71,12 +79,12 @@ class NET_EXPORT_PRIVATE MDnsConnection { |
| // Callback for when sending a query has finished. |
| void SendDone(int rv); |
| - scoped_ptr<DatagramServerSocket> socket_; |
| - |
| + scoped_ptr<Socket> socket_; |
| MDnsConnection* connection_; |
| IPEndPoint recv_addr_; |
| - scoped_ptr<DnsResponse> response_; |
| - IPEndPoint multicast_addr_; |
| + DnsResponse response_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SocketHandler); |
| }; |
| // Callback for handling a datagram being received on either ipv4 or ipv6. |