Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: ppapi/thunk/ppb_udp_socket_private_thunk.cc

Issue 9212047: Add GetBoundAddress to PPB_UDPSocket_Private (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: add backward compatability to interface, fix other review comments Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/thunk/enter.h" 8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_udp_socket_private_api.h" 9 #include "ppapi/thunk/ppb_udp_socket_private_api.h"
10 #include "ppapi/thunk/resource_creation_api.h" 10 #include "ppapi/thunk/resource_creation_api.h"
(...skipping 20 matching lines...) Expand all
31 31
32 int32_t Bind(PP_Resource udp_socket, 32 int32_t Bind(PP_Resource udp_socket,
33 const PP_NetAddress_Private *addr, 33 const PP_NetAddress_Private *addr,
34 PP_CompletionCallback callback) { 34 PP_CompletionCallback callback) {
35 EnterUDP enter(udp_socket, callback, true); 35 EnterUDP enter(udp_socket, callback, true);
36 if (enter.failed()) 36 if (enter.failed())
37 return enter.retval(); 37 return enter.retval();
38 return enter.SetResult(enter.object()->Bind(addr, callback)); 38 return enter.SetResult(enter.object()->Bind(addr, callback));
39 } 39 }
40 40
41 PP_Bool GetBoundAddress(PP_Resource udp_socket,
42 PP_NetAddress_Private* addr) {
43 EnterResource<PPB_UDPSocket_Private_API> enter(udp_socket, true);
yzshen1 2012/02/06 18:12:50 Please be consistent with others, use EnterUDP.
mtilburg1 2012/02/07 12:48:53 Done.
44 if (enter.failed())
45 return PP_FALSE;
46 return enter.object()->GetBoundAddress(addr);
47 }
48
41 int32_t RecvFrom(PP_Resource udp_socket, 49 int32_t RecvFrom(PP_Resource udp_socket,
42 char* buffer, 50 char* buffer,
43 int32_t num_bytes, 51 int32_t num_bytes,
44 PP_CompletionCallback callback) { 52 PP_CompletionCallback callback) {
45 EnterUDP enter(udp_socket, callback, true); 53 EnterUDP enter(udp_socket, callback, true);
46 if (enter.failed()) 54 if (enter.failed())
47 return enter.retval(); 55 return enter.retval();
48 return enter.SetResult(enter.object()->RecvFrom(buffer, num_bytes, callback)); 56 return enter.SetResult(enter.object()->RecvFrom(buffer, num_bytes, callback));
49 } 57 }
50 58
(...skipping 16 matching lines...) Expand all
67 return enter.SetResult(enter.object()->SendTo(buffer, num_bytes, addr, 75 return enter.SetResult(enter.object()->SendTo(buffer, num_bytes, addr,
68 callback)); 76 callback));
69 } 77 }
70 78
71 void Close(PP_Resource udp_socket) { 79 void Close(PP_Resource udp_socket) {
72 EnterUDP enter(udp_socket, true); 80 EnterUDP enter(udp_socket, true);
73 if (enter.succeeded()) 81 if (enter.succeeded())
74 enter.object()->Close(); 82 enter.object()->Close();
75 } 83 }
76 84
77 const PPB_UDPSocket_Private g_ppb_udp_socket_thunk = { 85 const PPB_UDPSocket_Private_0_2 g_ppb_udp_socket_thunk_0_2 = {
78 &Create, 86 &Create,
79 &IsUDPSocket, 87 &IsUDPSocket,
80 &Bind, 88 &Bind,
81 &RecvFrom, 89 &RecvFrom,
82 &GetRecvFromAddress, 90 &GetRecvFromAddress,
83 &SendTo, 91 &SendTo,
84 &Close 92 &Close
85 }; 93 };
86 94
95 const PPB_UDPSocket_Private_0_3 g_ppb_udp_socket_thunk_0_3 = {
96 &Create,
97 &IsUDPSocket,
98 &Bind,
99 &GetBoundAddress,
100 &RecvFrom,
101 &GetRecvFromAddress,
102 &SendTo,
103 &Close
104 };
105
87 } // namespace 106 } // namespace
88 107
89 const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() { 108 const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() {
90 return &g_ppb_udp_socket_thunk; 109 return &g_ppb_udp_socket_thunk_0_2;
110 }
111
112 const PPB_UDPSocket_Private_0_3* GetPPB_UDPSocket_Private_0_3_Thunk() {
113 return &g_ppb_udp_socket_thunk_0_3;
91 } 114 }
92 115
93 } // namespace thunk 116 } // namespace thunk
94 } // namespace ppapi 117 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698