OLD | NEW |
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 #include "chrome/browser/local_discovery/privet_traffic_detector.h" | 5 #include "chrome/browser/local_discovery/privet_traffic_detector.h" |
6 | 6 |
| 7 #include "base/location.h" |
7 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/single_thread_task_runner.h" |
8 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
9 #include "net/base/dns_util.h" | 11 #include "net/base/dns_util.h" |
10 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
11 #include "net/dns/dns_protocol.h" | 13 #include "net/dns/dns_protocol.h" |
12 #include "net/dns/dns_response.h" | 14 #include "net/dns/dns_response.h" |
13 #include "net/dns/mdns_client.h" | 15 #include "net/dns/mdns_client.h" |
14 #include "net/log/net_log.h" | 16 #include "net/log/net_log.h" |
15 #include "net/udp/datagram_server_socket.h" | 17 #include "net/udp/datagram_server_socket.h" |
16 #include "net/udp/udp_server_socket.h" | 18 #include "net/udp/udp_server_socket.h" |
17 | 19 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 54 } |
53 | 55 |
54 } // namespace | 56 } // namespace |
55 | 57 |
56 namespace local_discovery { | 58 namespace local_discovery { |
57 | 59 |
58 PrivetTrafficDetector::PrivetTrafficDetector( | 60 PrivetTrafficDetector::PrivetTrafficDetector( |
59 net::AddressFamily address_family, | 61 net::AddressFamily address_family, |
60 const base::Closure& on_traffic_detected) | 62 const base::Closure& on_traffic_detected) |
61 : on_traffic_detected_(on_traffic_detected), | 63 : on_traffic_detected_(on_traffic_detected), |
62 callback_runner_(base::MessageLoop::current()->message_loop_proxy()), | 64 callback_runner_(base::MessageLoop::current()->task_runner()), |
63 address_family_(address_family), | 65 address_family_(address_family), |
64 io_buffer_( | 66 io_buffer_( |
65 new net::IOBufferWithSize(net::dns_protocol::kMaxMulticastSize)), | 67 new net::IOBufferWithSize(net::dns_protocol::kMaxMulticastSize)), |
66 restart_attempts_(kMaxRestartAttempts), | 68 restart_attempts_(kMaxRestartAttempts), |
67 weak_ptr_factory_(this) { | 69 weak_ptr_factory_(this) { |
68 } | 70 } |
69 | 71 |
70 void PrivetTrafficDetector::Start() { | 72 void PrivetTrafficDetector::Start() { |
71 content::BrowserThread::PostTask( | 73 content::BrowserThread::PostTask( |
72 content::BrowserThread::IO, | 74 content::BrowserThread::IO, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 base::Unretained(this))); | 191 base::Unretained(this))); |
190 } while (rv > 0); | 192 } while (rv > 0); |
191 | 193 |
192 if (rv != net::ERR_IO_PENDING) | 194 if (rv != net::ERR_IO_PENDING) |
193 return rv; | 195 return rv; |
194 | 196 |
195 return net::OK; | 197 return net::OK; |
196 } | 198 } |
197 | 199 |
198 } // namespace local_discovery | 200 } // namespace local_discovery |
OLD | NEW |