| 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 "ppapi/proxy/ppb_udp_socket_private_proxy.h" | 5 #include "ppapi/proxy/ppb_udp_socket_private_proxy.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ppapi/c/private/ppb_udp_socket_private.h" | 10 #include "ppapi/c/private/ppb_udp_socket_private.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_Bind( | 64 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_Bind( |
| 65 API_ID_PPB_UDPSOCKET_PRIVATE, socket_id_, addr)); | 65 API_ID_PPB_UDPSOCKET_PRIVATE, socket_id_, addr)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void UDPSocket::SendRecvFrom(int32_t num_bytes) { | 68 void UDPSocket::SendRecvFrom(int32_t num_bytes) { |
| 69 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id_, num_bytes)); | 69 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id_, num_bytes)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void UDPSocket::SendSendTo(const std::string& data, | 72 void UDPSocket::SendSendTo(const std::string& data, |
| 73 const PP_NetAddress_Private& addr) { | 73 const PP_NetAddress_Private& addr) { |
| 74 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_SendTo(socket_id_, data, addr)); | 74 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_SendTo( |
| 75 API_ID_PPB_UDPSOCKET_PRIVATE, socket_id_, data, addr)); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void UDPSocket::SendClose() { | 78 void UDPSocket::SendClose() { |
| 78 // After removed from the mapping, this object won't receive any notifications | 79 // After removed from the mapping, this object won't receive any notifications |
| 79 // from the proxy. | 80 // from the proxy. |
| 80 DCHECK(g_id_to_socket->find(socket_id_) != g_id_to_socket->end()); | 81 DCHECK(g_id_to_socket->find(socket_id_) != g_id_to_socket->end()); |
| 81 g_id_to_socket->erase(socket_id_); | 82 g_id_to_socket->erase(socket_id_); |
| 82 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_Close(socket_id_)); | 83 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_Close(socket_id_)); |
| 83 } | 84 } |
| 84 | 85 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return; | 172 return; |
| 172 } | 173 } |
| 173 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); | 174 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); |
| 174 if (iter == g_id_to_socket->end()) | 175 if (iter == g_id_to_socket->end()) |
| 175 return; | 176 return; |
| 176 iter->second->OnSendToCompleted(succeeded, bytes_written); | 177 iter->second->OnSendToCompleted(succeeded, bytes_written); |
| 177 } | 178 } |
| 178 | 179 |
| 179 } // namespace proxy | 180 } // namespace proxy |
| 180 } // namespace ppapi | 181 } // namespace ppapi |
| OLD | NEW |