| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 g_id_to_socket = new IDToSocketMap(); | 47 g_id_to_socket = new IDToSocketMap(); |
| 48 DCHECK(g_id_to_socket->find(socket_id) == g_id_to_socket->end()); | 48 DCHECK(g_id_to_socket->find(socket_id) == g_id_to_socket->end()); |
| 49 (*g_id_to_socket)[socket_id] = this; | 49 (*g_id_to_socket)[socket_id] = this; |
| 50 } | 50 } |
| 51 | 51 |
| 52 UDPSocket::~UDPSocket() { | 52 UDPSocket::~UDPSocket() { |
| 53 Close(); | 53 Close(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void UDPSocket::SendBind(const PP_NetAddress_Private& addr) { | 56 void UDPSocket::SendBind(const PP_NetAddress_Private& addr) { |
| 57 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_Bind(socket_id_, addr)); | 57 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_Bind( |
| 58 API_ID_PPB_UDPSOCKET_PRIVATE, socket_id_, addr)); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void UDPSocket::SendRecvFrom(int32_t num_bytes) { | 61 void UDPSocket::SendRecvFrom(int32_t num_bytes) { |
| 61 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id_, num_bytes)); | 62 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id_, num_bytes)); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void UDPSocket::SendSendTo(const std::string& data, | 65 void UDPSocket::SendSendTo(const std::string& data, |
| 65 const PP_NetAddress_Private& addr) { | 66 const PP_NetAddress_Private& addr) { |
| 66 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_SendTo(socket_id_, data, addr)); | 67 SendToBrowser(new PpapiHostMsg_PPBUDPSocket_SendTo(socket_id_, data, addr)); |
| 67 } | 68 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return; | 163 return; |
| 163 } | 164 } |
| 164 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); | 165 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); |
| 165 if (iter == g_id_to_socket->end()) | 166 if (iter == g_id_to_socket->end()) |
| 166 return; | 167 return; |
| 167 iter->second->OnSendToCompleted(succeeded, bytes_written); | 168 iter->second->OnSendToCompleted(succeeded, bytes_written); |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace proxy | 171 } // namespace proxy |
| 171 } // namespace ppapi | 172 } // namespace ppapi |
| OLD | NEW |