| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // From ppb_udp_socket.idl modified Tue Aug 20 08:13:36 2013. | 5 // From ppb_udp_socket.idl modified Mon Jun 24 15:10:54 2013. |
| 6 | 6 |
| 7 #include "ppapi/c/pp_completion_callback.h" | 7 #include "ppapi/c/pp_completion_callback.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/c/ppb_udp_socket.h" | 9 #include "ppapi/c/ppb_udp_socket.h" |
| 10 #include "ppapi/shared_impl/tracked_callback.h" | 10 #include "ppapi/shared_impl/tracked_callback.h" |
| 11 #include "ppapi/thunk/enter.h" | 11 #include "ppapi/thunk/enter.h" |
| 12 #include "ppapi/thunk/ppapi_thunk_export.h" | 12 #include "ppapi/thunk/ppapi_thunk_export.h" |
| 13 #include "ppapi/thunk/ppb_udp_socket_api.h" | 13 #include "ppapi/thunk/ppb_udp_socket_api.h" |
| 14 | 14 |
| 15 namespace ppapi { | 15 namespace ppapi { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 int32_t RecvFrom(PP_Resource udp_socket, | 52 int32_t RecvFrom(PP_Resource udp_socket, |
| 53 char* buffer, | 53 char* buffer, |
| 54 int32_t num_bytes, | 54 int32_t num_bytes, |
| 55 PP_Resource* addr, | 55 PP_Resource* addr, |
| 56 struct PP_CompletionCallback callback) { | 56 struct PP_CompletionCallback callback) { |
| 57 VLOG(4) << "PPB_UDPSocket::RecvFrom()"; | 57 VLOG(4) << "PPB_UDPSocket::RecvFrom()"; |
| 58 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); | 58 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); |
| 59 if (enter.failed()) | 59 if (enter.failed()) |
| 60 return enter.retval(); | 60 return enter.retval(); |
| 61 return enter.SetResult(enter.object()->RecvFrom(buffer, | 61 return enter.SetResult( |
| 62 num_bytes, | 62 enter.object()->RecvFrom(buffer, num_bytes, addr, enter.callback())); |
| 63 addr, | |
| 64 enter.callback())); | |
| 65 } | 63 } |
| 66 | 64 |
| 67 int32_t SendTo(PP_Resource udp_socket, | 65 int32_t SendTo(PP_Resource udp_socket, |
| 68 const char* buffer, | 66 const char* buffer, |
| 69 int32_t num_bytes, | 67 int32_t num_bytes, |
| 70 PP_Resource addr, | 68 PP_Resource addr, |
| 71 struct PP_CompletionCallback callback) { | 69 struct PP_CompletionCallback callback) { |
| 72 VLOG(4) << "PPB_UDPSocket::SendTo()"; | 70 VLOG(4) << "PPB_UDPSocket::SendTo()"; |
| 73 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); | 71 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); |
| 74 if (enter.failed()) | 72 if (enter.failed()) |
| 75 return enter.retval(); | 73 return enter.retval(); |
| 76 return enter.SetResult(enter.object()->SendTo(buffer, | 74 return enter.SetResult( |
| 77 num_bytes, | 75 enter.object()->SendTo(buffer, num_bytes, addr, enter.callback())); |
| 78 addr, | |
| 79 enter.callback())); | |
| 80 } | 76 } |
| 81 | 77 |
| 82 void Close(PP_Resource udp_socket) { | 78 void Close(PP_Resource udp_socket) { |
| 83 VLOG(4) << "PPB_UDPSocket::Close()"; | 79 VLOG(4) << "PPB_UDPSocket::Close()"; |
| 84 EnterResource<PPB_UDPSocket_API> enter(udp_socket, true); | 80 EnterResource<PPB_UDPSocket_API> enter(udp_socket, true); |
| 85 if (enter.failed()) | 81 if (enter.failed()) |
| 86 return; | 82 return; |
| 87 enter.object()->Close(); | 83 enter.object()->Close(); |
| 88 } | 84 } |
| 89 | 85 |
| 90 int32_t SetOption(PP_Resource udp_socket, | 86 int32_t SetOption(PP_Resource udp_socket, |
| 91 PP_UDPSocket_Option name, | 87 PP_UDPSocket_Option name, |
| 92 struct PP_Var value, | 88 struct PP_Var value, |
| 93 struct PP_CompletionCallback callback) { | 89 struct PP_CompletionCallback callback) { |
| 94 VLOG(4) << "PPB_UDPSocket::SetOption()"; | 90 VLOG(4) << "PPB_UDPSocket::SetOption()"; |
| 95 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); | 91 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); |
| 96 if (enter.failed()) | 92 if (enter.failed()) |
| 97 return enter.retval(); | 93 return enter.retval(); |
| 98 return enter.SetResult(enter.object()->SetOption(name, | 94 return enter.SetResult( |
| 99 value, | 95 enter.object()->SetOption(name, value, enter.callback())); |
| 100 enter.callback())); | |
| 101 } | 96 } |
| 102 | 97 |
| 103 const PPB_UDPSocket_1_0 g_ppb_udpsocket_thunk_1_0 = { | 98 const PPB_UDPSocket_1_0 g_ppb_udpsocket_thunk_1_0 = { // |
| 104 &Create, | 99 &Create, // |
| 105 &IsUDPSocket, | 100 &IsUDPSocket, // |
| 106 &Bind, | 101 &Bind, // |
| 107 &GetBoundAddress, | 102 &GetBoundAddress, // |
| 108 &RecvFrom, | 103 &RecvFrom, // |
| 109 &SendTo, | 104 &SendTo, // |
| 110 &Close, | 105 &Close, // |
| 111 &SetOption | 106 &SetOption // |
| 112 }; | 107 }; |
| 113 | 108 |
| 114 } // namespace | 109 } // namespace |
| 115 | 110 |
| 116 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_0* GetPPB_UDPSocket_1_0_Thunk() { | 111 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_0* GetPPB_UDPSocket_1_0_Thunk() { |
| 117 return &g_ppb_udpsocket_thunk_1_0; | 112 return &g_ppb_udpsocket_thunk_1_0; |
| 118 } | 113 } |
| 119 | 114 |
| 120 } // namespace thunk | 115 } // namespace thunk |
| 121 } // namespace ppapi | 116 } // namespace ppapi |
| OLD | NEW |