| Index: content/browser/renderer_host/p2p/socket_dispatcher_host.cc
|
| diff --git a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
|
| index 5f20f4bcded415b94efa0a20e0349a15d21d9507..7862e473f0858dd0fd88116f5228a0ab1e633ab4 100644
|
| --- a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
|
| +++ b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
|
| @@ -106,14 +106,6 @@ P2PSocketDispatcherHost::P2PSocketDispatcherHost(
|
| monitoring_networks_(false) {
|
| }
|
|
|
| -P2PSocketDispatcherHost::~P2PSocketDispatcherHost() {
|
| - DCHECK(sockets_.empty());
|
| - DCHECK(dns_requests_.empty());
|
| -
|
| - if (monitoring_networks_)
|
| - net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
|
| -}
|
| -
|
| void P2PSocketDispatcherHost::OnChannelClosing() {
|
| BrowserMessageFilter::OnChannelClosing();
|
|
|
| @@ -148,6 +140,21 @@ bool P2PSocketDispatcherHost::OnMessageReceived(const IPC::Message& message,
|
| return handled;
|
| }
|
|
|
| +void P2PSocketDispatcherHost::OnIPAddressChanged() {
|
| + // Notify the renderer about changes to list of network interfaces.
|
| + BrowserThread::PostTask(
|
| + BrowserThread::FILE, FROM_HERE, base::Bind(
|
| + &P2PSocketDispatcherHost::DoGetNetworkList, this));
|
| +}
|
| +
|
| +P2PSocketDispatcherHost::~P2PSocketDispatcherHost() {
|
| + DCHECK(sockets_.empty());
|
| + DCHECK(dns_requests_.empty());
|
| +
|
| + if (monitoring_networks_)
|
| + net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
|
| +}
|
| +
|
| P2PSocketHost* P2PSocketDispatcherHost::LookupSocket(
|
| int32 routing_id, int socket_id) {
|
| SocketsMap::iterator it = sockets_.find(
|
| @@ -177,29 +184,6 @@ void P2PSocketDispatcherHost::OnStopNetworkNotifications(
|
| notifications_routing_ids_.erase(msg.routing_id());
|
| }
|
|
|
| -void P2PSocketDispatcherHost::OnIPAddressChanged() {
|
| - // Notify the renderer about changes to list of network interfaces.
|
| - BrowserThread::PostTask(
|
| - BrowserThread::FILE, FROM_HERE, base::Bind(
|
| - &P2PSocketDispatcherHost::DoGetNetworkList, this));
|
| -}
|
| -
|
| -void P2PSocketDispatcherHost::DoGetNetworkList() {
|
| - net::NetworkInterfaceList list;
|
| - net::GetNetworkList(&list);
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO, FROM_HERE, base::Bind(
|
| - &P2PSocketDispatcherHost::SendNetworkList, this, list));
|
| -}
|
| -
|
| -void P2PSocketDispatcherHost::SendNetworkList(
|
| - const net::NetworkInterfaceList& list) {
|
| - for (std::set<int>::iterator it = notifications_routing_ids_.begin();
|
| - it != notifications_routing_ids_.end(); ++it) {
|
| - Send(new P2PMsg_NetworkListChanged(*it, list));
|
| - }
|
| -}
|
| -
|
| void P2PSocketDispatcherHost::OnGetHostAddress(const IPC::Message& msg,
|
| const std::string& host_name,
|
| int32 request_id) {
|
| @@ -211,16 +195,6 @@ void P2PSocketDispatcherHost::OnGetHostAddress(const IPC::Message& msg,
|
| base::Unretained(this), request));
|
| }
|
|
|
| -void P2PSocketDispatcherHost::OnAddressResolved(
|
| - DnsRequest* request,
|
| - const net::IPAddressNumber& result) {
|
| - Send(new P2PMsg_GetHostAddressResult(
|
| - request->routing_id(), request->request_id(), result));
|
| -
|
| - dns_requests_.erase(request);
|
| - delete request;
|
| -}
|
| -
|
| void P2PSocketDispatcherHost::OnCreateSocket(
|
| const IPC::Message& msg, P2PSocketType type, int socket_id,
|
| const net::IPEndPoint& local_address,
|
| @@ -286,4 +260,30 @@ void P2PSocketDispatcherHost::OnDestroySocket(const IPC::Message& msg,
|
| }
|
| }
|
|
|
| +void P2PSocketDispatcherHost::DoGetNetworkList() {
|
| + net::NetworkInterfaceList list;
|
| + net::GetNetworkList(&list);
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO, FROM_HERE, base::Bind(
|
| + &P2PSocketDispatcherHost::SendNetworkList, this, list));
|
| +}
|
| +
|
| +void P2PSocketDispatcherHost::SendNetworkList(
|
| + const net::NetworkInterfaceList& list) {
|
| + for (std::set<int>::iterator it = notifications_routing_ids_.begin();
|
| + it != notifications_routing_ids_.end(); ++it) {
|
| + Send(new P2PMsg_NetworkListChanged(*it, list));
|
| + }
|
| +}
|
| +
|
| +void P2PSocketDispatcherHost::OnAddressResolved(
|
| + DnsRequest* request,
|
| + const net::IPAddressNumber& result) {
|
| + Send(new P2PMsg_GetHostAddressResult(
|
| + request->routing_id(), request->request_id(), result));
|
| +
|
| + dns_requests_.erase(request);
|
| + delete request;
|
| +}
|
| +
|
| } // namespace content
|
|
|