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 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" | 13 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" |
14 #include "content/common/p2p_socket_type.h" | 14 #include "content/common/p2p_socket_type.h" |
15 #include "content/public/browser/browser_message_filter.h" | 15 #include "content/public/browser/browser_message_filter.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/render_process_host.h" | |
18 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
19 #include "net/base/network_change_notifier.h" | 18 #include "net/base/network_change_notifier.h" |
20 | 19 |
21 namespace net { | 20 namespace net { |
22 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
23 } | 22 } |
24 | 23 |
25 namespace talk_base { | 24 namespace talk_base { |
26 struct PacketOptions; | 25 struct PacketOptions; |
27 } | 26 } |
(...skipping 11 matching lines...) Expand all Loading... |
39 net::URLRequestContextGetter* url_context); | 38 net::URLRequestContextGetter* url_context); |
40 | 39 |
41 // content::BrowserMessageFilter overrides. | 40 // content::BrowserMessageFilter overrides. |
42 virtual void OnChannelClosing() OVERRIDE; | 41 virtual void OnChannelClosing() OVERRIDE; |
43 virtual void OnDestruct() const OVERRIDE; | 42 virtual void OnDestruct() const OVERRIDE; |
44 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
45 | 44 |
46 // net::NetworkChangeNotifier::IPAddressObserver interface. | 45 // net::NetworkChangeNotifier::IPAddressObserver interface. |
47 virtual void OnIPAddressChanged() OVERRIDE; | 46 virtual void OnIPAddressChanged() OVERRIDE; |
48 | 47 |
49 // Starts the RTP packet header dumping. Must be called on the IO thread. | |
50 void StartRtpDump( | |
51 bool incoming, | |
52 bool outgoing, | |
53 const RenderProcessHost::WebRtcRtpPacketCallback& packet_callback); | |
54 | |
55 // Stops the RTP packet header dumping. Must be Called on the UI thread. | |
56 void StopRtpDumpOnUIThread(bool incoming, bool outgoing); | |
57 | |
58 protected: | 48 protected: |
59 virtual ~P2PSocketDispatcherHost(); | 49 virtual ~P2PSocketDispatcherHost(); |
60 | 50 |
61 private: | 51 private: |
62 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 52 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
63 friend class base::DeleteHelper<P2PSocketDispatcherHost>; | 53 friend class base::DeleteHelper<P2PSocketDispatcherHost>; |
64 | 54 |
65 typedef std::map<int, P2PSocketHost*> SocketsMap; | 55 typedef std::map<int, P2PSocketHost*> SocketsMap; |
66 | 56 |
67 class DnsRequest; | 57 class DnsRequest; |
(...skipping 20 matching lines...) Expand all Loading... |
88 uint64 packet_id); | 78 uint64 packet_id); |
89 void OnSetOption(int socket_id, P2PSocketOption option, int value); | 79 void OnSetOption(int socket_id, P2PSocketOption option, int value); |
90 void OnDestroySocket(int socket_id); | 80 void OnDestroySocket(int socket_id); |
91 | 81 |
92 void DoGetNetworkList(); | 82 void DoGetNetworkList(); |
93 void SendNetworkList(const net::NetworkInterfaceList& list); | 83 void SendNetworkList(const net::NetworkInterfaceList& list); |
94 | 84 |
95 void OnAddressResolved(DnsRequest* request, | 85 void OnAddressResolved(DnsRequest* request, |
96 const net::IPAddressList& addresses); | 86 const net::IPAddressList& addresses); |
97 | 87 |
98 void StopRtpDumpOnIOThread(bool incoming, bool outgoing); | |
99 | |
100 content::ResourceContext* resource_context_; | 88 content::ResourceContext* resource_context_; |
101 scoped_refptr<net::URLRequestContextGetter> url_context_; | 89 scoped_refptr<net::URLRequestContextGetter> url_context_; |
102 | 90 |
103 SocketsMap sockets_; | 91 SocketsMap sockets_; |
104 | 92 |
105 bool monitoring_networks_; | 93 bool monitoring_networks_; |
106 | 94 |
107 std::set<DnsRequest*> dns_requests_; | 95 std::set<DnsRequest*> dns_requests_; |
108 P2PMessageThrottler throttler_; | 96 P2PMessageThrottler throttler_; |
109 | 97 |
110 bool dump_incoming_rtp_packet_; | |
111 bool dump_outgoing_rtp_packet_; | |
112 RenderProcessHost::WebRtcRtpPacketCallback packet_callback_; | |
113 | |
114 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); | 98 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); |
115 }; | 99 }; |
116 | 100 |
117 } // namespace content | 101 } // namespace content |
118 | 102 |
119 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ | 103 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ |
OLD | NEW |