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

Side by Side Diff: net/dns/mdns_client_impl.h

Issue 2684113002: [ON HOLD] Deallocate read buffer in MDnsClientImpl::SocketHandler if done reading (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/dns/mdns_client_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_DNS_MDNS_CLIENT_IMPL_H_ 5 #ifndef NET_DNS_MDNS_CLIENT_IMPL_H_
6 #define NET_DNS_MDNS_CLIENT_IMPL_H_ 6 #define NET_DNS_MDNS_CLIENT_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 class SocketHandler { 69 class SocketHandler {
70 public: 70 public:
71 SocketHandler(std::unique_ptr<DatagramServerSocket> socket, 71 SocketHandler(std::unique_ptr<DatagramServerSocket> socket,
72 MDnsConnection* connection); 72 MDnsConnection* connection);
73 ~SocketHandler(); 73 ~SocketHandler();
74 74
75 int Start(); 75 int Start();
76 void Send(const scoped_refptr<IOBuffer>& buffer, unsigned size); 76 void Send(const scoped_refptr<IOBuffer>& buffer, unsigned size);
77 77
78 private: 78 private:
79 int DoLoop(int rv); 79 int DoRead(int rv);
80 void OnDatagramReceived(int rv); 80 void OnDatagramReceived(int rv);
81 81
82 // Callback for when sending a query has finished. 82 // Callback for when sending a query has finished.
83 void SendDone(int rv); 83 void SendDone(int rv);
84 84
85 std::unique_ptr<DatagramServerSocket> socket_; 85 std::unique_ptr<DatagramServerSocket> socket_;
86 MDnsConnection* connection_; 86 MDnsConnection* connection_;
87 IPEndPoint recv_addr_; 87 IPEndPoint recv_addr_;
88 DnsResponse response_; 88 std::unique_ptr<DnsResponse> response_;
89 IPEndPoint multicast_addr_; 89 IPEndPoint multicast_addr_;
90 bool send_in_progress_; 90 bool send_in_progress_;
91 std::queue<std::pair<scoped_refptr<IOBuffer>, unsigned> > send_queue_; 91 std::queue<std::pair<scoped_refptr<IOBuffer>, unsigned> > send_queue_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(SocketHandler); 93 DISALLOW_COPY_AND_ASSIGN(SocketHandler);
94 }; 94 };
95 95
96 // Callback for handling a datagram being received on either ipv4 or ipv6. 96 // Callback for handling a datagram being received on either ipv4 or ipv6.
97 void OnDatagramReceived(DnsResponse* response, 97 void OnDatagramReceived(DnsResponse* response,
98 const IPEndPoint& recv_addr, 98 const IPEndPoint& recv_addr,
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 MDnsClientImpl* client_; 326 MDnsClientImpl* client_;
327 327
328 bool started_; 328 bool started_;
329 int flags_; 329 int flags_;
330 330
331 DISALLOW_COPY_AND_ASSIGN(MDnsTransactionImpl); 331 DISALLOW_COPY_AND_ASSIGN(MDnsTransactionImpl);
332 }; 332 };
333 333
334 } // namespace net 334 } // namespace net
335 #endif // NET_DNS_MDNS_CLIENT_IMPL_H_ 335 #endif // NET_DNS_MDNS_CLIENT_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/dns/mdns_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698