| 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 #include "content/renderer/p2p/socket_dispatcher.h" | 5 #include "content/renderer/p2p/socket_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "content/child/child_process.h" | 9 #include "content/child/child_process.h" |
| 10 #include "content/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 void P2PSocketDispatcher::OnFilterAdded(IPC::Sender* sender) { | 74 void P2PSocketDispatcher::OnFilterAdded(IPC::Sender* sender) { |
| 75 DVLOG(1) << "P2PSocketDispatcher::OnFilterAdded()"; | 75 DVLOG(1) << "P2PSocketDispatcher::OnFilterAdded()"; |
| 76 sender_ = sender; | 76 sender_ = sender; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void P2PSocketDispatcher::OnFilterRemoved() { | 79 void P2PSocketDispatcher::OnFilterRemoved() { |
| 80 sender_ = NULL; | 80 sender_ = NULL; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void P2PSocketDispatcher::OnChannelConnected(int32 peer_id) { | 83 void P2PSocketDispatcher::OnChannelConnected(int32_t peer_id) { |
| 84 connected_ = true; | 84 connected_ = true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void P2PSocketDispatcher::OnChannelClosing() { | 87 void P2PSocketDispatcher::OnChannelClosing() { |
| 88 sender_ = NULL; | 88 sender_ = NULL; |
| 89 connected_ = false; | 89 connected_ = false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 base::SingleThreadTaskRunner* P2PSocketDispatcher::task_runner() { | 92 base::SingleThreadTaskRunner* P2PSocketDispatcher::task_runner() { |
| 93 return ipc_task_runner_.get(); | 93 return ipc_task_runner_.get(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void P2PSocketDispatcher::OnNetworkListChanged( | 126 void P2PSocketDispatcher::OnNetworkListChanged( |
| 127 const net::NetworkInterfaceList& networks, | 127 const net::NetworkInterfaceList& networks, |
| 128 const net::IPAddressNumber& default_ipv4_local_address, | 128 const net::IPAddressNumber& default_ipv4_local_address, |
| 129 const net::IPAddressNumber& default_ipv6_local_address) { | 129 const net::IPAddressNumber& default_ipv6_local_address) { |
| 130 network_list_observers_->Notify( | 130 network_list_observers_->Notify( |
| 131 FROM_HERE, &NetworkListObserver::OnNetworkListChanged, networks, | 131 FROM_HERE, &NetworkListObserver::OnNetworkListChanged, networks, |
| 132 default_ipv4_local_address, default_ipv6_local_address); | 132 default_ipv4_local_address, default_ipv6_local_address); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void P2PSocketDispatcher::OnGetHostAddressResult( | 135 void P2PSocketDispatcher::OnGetHostAddressResult( |
| 136 int32 request_id, | 136 int32_t request_id, |
| 137 const net::IPAddressList& addresses) { | 137 const net::IPAddressList& addresses) { |
| 138 P2PAsyncAddressResolver* request = host_address_requests_.Lookup(request_id); | 138 P2PAsyncAddressResolver* request = host_address_requests_.Lookup(request_id); |
| 139 if (!request) { | 139 if (!request) { |
| 140 DVLOG(1) << "Received P2P message for socket that doesn't exist."; | 140 DVLOG(1) << "Received P2P message for socket that doesn't exist."; |
| 141 return; | 141 return; |
| 142 } | 142 } |
| 143 | 143 |
| 144 request->OnResponse(addresses); | 144 request->OnResponse(addresses); |
| 145 } | 145 } |
| 146 | 146 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // hasn't processed the close message by the time it sends the | 195 // hasn't processed the close message by the time it sends the |
| 196 // message to the renderer. | 196 // message to the renderer. |
| 197 DVLOG(1) << "Received P2P message for socket that doesn't exist."; | 197 DVLOG(1) << "Received P2P message for socket that doesn't exist."; |
| 198 return NULL; | 198 return NULL; |
| 199 } | 199 } |
| 200 | 200 |
| 201 return client; | 201 return client; |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace content | 204 } // namespace content |
| OLD | NEW |