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/c/pp_completion_callback.h" | 5 #include "ppapi/c/pp_completion_callback.h" |
6 #include "ppapi/c/pp_errors.h" | 6 #include "ppapi/c/pp_errors.h" |
7 #include "ppapi/c/private/ppb_udp_socket_private.h" | 7 #include "ppapi/c/private/ppb_udp_socket_private.h" |
8 #include "ppapi/shared_impl/tracked_callback.h" | 8 #include "ppapi/shared_impl/tracked_callback.h" |
9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
10 #include "ppapi/thunk/ppb_udp_socket_private_api.h" | 10 #include "ppapi/thunk/ppb_udp_socket_private_api.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 EnterUDP enter(udp_socket, true); | 44 EnterUDP enter(udp_socket, true); |
45 if (enter.failed()) | 45 if (enter.failed()) |
46 return PP_FALSE; | 46 return PP_FALSE; |
47 return enter.object()->GetBoundAddress(addr); | 47 return enter.object()->GetBoundAddress(addr); |
48 } | 48 } |
49 | 49 |
50 int32_t RecvFrom(PP_Resource udp_socket, | 50 int32_t RecvFrom(PP_Resource udp_socket, |
51 char* buffer, | 51 char* buffer, |
52 int32_t num_bytes, | 52 int32_t num_bytes, |
53 PP_CompletionCallback callback) { | 53 PP_CompletionCallback callback) { |
54 #ifndef NDEBUG | |
viettrungluu
2012/07/31 16:44:00
Why not #ifdef NDEBUG (reversing the contents of c
jschuh
2012/07/31 16:55:17
Done.
| |
54 EnterUDP enter(udp_socket, callback, true); | 55 EnterUDP enter(udp_socket, callback, true); |
56 #else | |
57 EnterUDP enter(udp_socket, callback, false); | |
58 #endif | |
55 if (enter.failed()) | 59 if (enter.failed()) |
56 return enter.retval(); | 60 return enter.retval(); |
57 return enter.SetResult(enter.object()->RecvFrom(buffer, num_bytes, | 61 return enter.SetResult(enter.object()->RecvFrom(buffer, num_bytes, |
58 enter.callback())); | 62 enter.callback())); |
59 } | 63 } |
60 | 64 |
61 PP_Bool GetRecvFromAddress(PP_Resource udp_socket, | 65 PP_Bool GetRecvFromAddress(PP_Resource udp_socket, |
62 PP_NetAddress_Private* addr) { | 66 PP_NetAddress_Private* addr) { |
63 EnterUDP enter(udp_socket, true); | 67 EnterUDP enter(udp_socket, true); |
64 if (enter.failed()) | 68 if (enter.failed()) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() { | 114 const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() { |
111 return &g_ppb_udp_socket_thunk_0_2; | 115 return &g_ppb_udp_socket_thunk_0_2; |
112 } | 116 } |
113 | 117 |
114 const PPB_UDPSocket_Private_0_3* GetPPB_UDPSocket_Private_0_3_Thunk() { | 118 const PPB_UDPSocket_Private_0_3* GetPPB_UDPSocket_Private_0_3_Thunk() { |
115 return &g_ppb_udp_socket_thunk_0_3; | 119 return &g_ppb_udp_socket_thunk_0_3; |
116 } | 120 } |
117 | 121 |
118 } // namespace thunk | 122 } // namespace thunk |
119 } // namespace ppapi | 123 } // namespace ppapi |
OLD | NEW |