OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // P2PSocketDispatcher is a per-renderer object that dispatchers all | 5 // P2PSocketDispatcher is a per-renderer object that dispatchers all |
6 // P2P messages received from the browser and relays all P2P messages | 6 // P2P messages received from the browser and relays all P2P messages |
7 // sent to the browser. P2PSocketClient instances register themselves | 7 // sent to the browser. P2PSocketClient instances register themselves |
8 // with the dispatcher using RegisterClient() and UnregisterClient(). | 8 // with the dispatcher using RegisterClient() and UnregisterClient(). |
9 // | 9 // |
10 // Relationship of classes. | 10 // Relationship of classes. |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "base/compiler_specific.h" | 29 #include "base/compiler_specific.h" |
30 #include "base/id_map.h" | 30 #include "base/id_map.h" |
31 #include "base/macros.h" | 31 #include "base/macros.h" |
32 #include "base/observer_list_threadsafe.h" | 32 #include "base/observer_list_threadsafe.h" |
33 #include "base/synchronization/lock.h" | 33 #include "base/synchronization/lock.h" |
34 #include "content/common/content_export.h" | 34 #include "content/common/content_export.h" |
35 #include "content/common/p2p_socket_type.h" | 35 #include "content/common/p2p_socket_type.h" |
36 #include "content/renderer/p2p/network_list_manager.h" | 36 #include "content/renderer/p2p/network_list_manager.h" |
37 #include "ipc/message_filter.h" | 37 #include "ipc/message_filter.h" |
38 #include "net/base/ip_address.h" | 38 #include "net/base/ip_address.h" |
39 #include "net/base/ip_address_number.h" | |
40 #include "net/base/ip_endpoint.h" | |
41 #include "net/base/network_interfaces.h" | 39 #include "net/base/network_interfaces.h" |
42 | 40 |
43 namespace base { | 41 namespace base { |
44 class SingleThreadTaskRunner; | 42 class SingleThreadTaskRunner; |
45 } // namespace base | 43 } // namespace base |
46 | 44 |
47 namespace net { | 45 namespace net { |
48 class IPEndPoint; | 46 class IPEndPoint; |
49 } // namespace net | 47 } // namespace net |
50 | 48 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Called by P2PSocketClient. | 88 // Called by P2PSocketClient. |
91 int RegisterClient(P2PSocketClientImpl* client); | 89 int RegisterClient(P2PSocketClientImpl* client); |
92 void UnregisterClient(int id); | 90 void UnregisterClient(int id); |
93 void SendP2PMessage(IPC::Message* msg); | 91 void SendP2PMessage(IPC::Message* msg); |
94 | 92 |
95 // Called by DnsRequest. | 93 // Called by DnsRequest. |
96 int RegisterHostAddressRequest(P2PAsyncAddressResolver* request); | 94 int RegisterHostAddressRequest(P2PAsyncAddressResolver* request); |
97 void UnregisterHostAddressRequest(int id); | 95 void UnregisterHostAddressRequest(int id); |
98 | 96 |
99 // Incoming message handlers. | 97 // Incoming message handlers. |
100 void OnNetworkListChanged( | 98 void OnNetworkListChanged(const net::NetworkInterfaceList& networks, |
101 const net::NetworkInterfaceList& networks, | 99 const net::IPAddress& default_ipv4_local_address, |
102 const net::IPAddressNumber& default_ipv4_local_address, | 100 const net::IPAddress& default_ipv6_local_address); |
103 const net::IPAddressNumber& default_ipv6_local_address); | |
104 void OnGetHostAddressResult(int32_t request_id, | 101 void OnGetHostAddressResult(int32_t request_id, |
105 const net::IPAddressList& addresses); | 102 const net::IPAddressList& addresses); |
106 void OnSocketCreated(int socket_id, | 103 void OnSocketCreated(int socket_id, |
107 const net::IPEndPoint& local_address, | 104 const net::IPEndPoint& local_address, |
108 const net::IPEndPoint& remote_address); | 105 const net::IPEndPoint& remote_address); |
109 void OnIncomingTcpConnection(int socket_id, const net::IPEndPoint& address); | 106 void OnIncomingTcpConnection(int socket_id, const net::IPEndPoint& address); |
110 void OnSendComplete(int socket_id, const P2PSendPacketMetrics& send_metrics); | 107 void OnSendComplete(int socket_id, const P2PSendPacketMetrics& send_metrics); |
111 void OnError(int socket_id); | 108 void OnError(int socket_id); |
112 void OnDataReceived(int socket_id, const net::IPEndPoint& address, | 109 void OnDataReceived(int socket_id, const net::IPEndPoint& address, |
113 const std::vector<char>& data, | 110 const std::vector<char>& data, |
(...skipping 14 matching lines...) Expand all Loading... |
128 | 125 |
129 // To indicate whether IPC could be invoked on this dispatcher. | 126 // To indicate whether IPC could be invoked on this dispatcher. |
130 bool connected_ = false; | 127 bool connected_ = false; |
131 | 128 |
132 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); | 129 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); |
133 }; | 130 }; |
134 | 131 |
135 } // namespace content | 132 } // namespace content |
136 | 133 |
137 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 134 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
OLD | NEW |