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 Mon Jun 24 15:10:54 2013. | 5 // From ppb_udp_socket.idl modified Fri Feb 20 20:28:39 2015. |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 void Close(PP_Resource udp_socket) { | 78 void Close(PP_Resource udp_socket) { |
79 VLOG(4) << "PPB_UDPSocket::Close()"; | 79 VLOG(4) << "PPB_UDPSocket::Close()"; |
80 EnterResource<PPB_UDPSocket_API> enter(udp_socket, true); | 80 EnterResource<PPB_UDPSocket_API> enter(udp_socket, true); |
81 if (enter.failed()) | 81 if (enter.failed()) |
82 return; | 82 return; |
83 enter.object()->Close(); | 83 enter.object()->Close(); |
84 } | 84 } |
85 | 85 |
86 int32_t SetOption1_0(PP_Resource udp_socket, | 86 int32_t SetOption_1_0(PP_Resource udp_socket, |
87 PP_UDPSocket_Option name, | 87 PP_UDPSocket_Option name, |
88 struct PP_Var value, | 88 struct PP_Var value, |
89 struct PP_CompletionCallback callback) { | 89 struct PP_CompletionCallback callback) { |
90 VLOG(4) << "PPB_UDPSocket::SetOption1_0()"; | 90 VLOG(4) << "PPB_UDPSocket::SetOption()"; |
91 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); | 91 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); |
92 if (enter.failed()) | 92 if (enter.failed()) |
93 return enter.retval(); | 93 return enter.retval(); |
94 return enter.SetResult( | 94 return enter.SetResult( |
95 enter.object()->SetOption1_0(name, value, enter.callback())); | 95 enter.object()->SetOption1_0(name, value, enter.callback())); |
96 } | 96 } |
97 | 97 |
| 98 int32_t SetOption_1_1(PP_Resource udp_socket, |
| 99 PP_UDPSocket_Option name, |
| 100 struct PP_Var value, |
| 101 struct PP_CompletionCallback callback) { |
| 102 VLOG(4) << "PPB_UDPSocket::SetOption()"; |
| 103 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); |
| 104 if (enter.failed()) |
| 105 return enter.retval(); |
| 106 return enter.SetResult( |
| 107 enter.object()->SetOption1_1(name, value, enter.callback())); |
| 108 } |
| 109 |
98 int32_t SetOption(PP_Resource udp_socket, | 110 int32_t SetOption(PP_Resource udp_socket, |
99 PP_UDPSocket_Option name, | 111 PP_UDPSocket_Option name, |
100 struct PP_Var value, | 112 struct PP_Var value, |
101 struct PP_CompletionCallback callback) { | 113 struct PP_CompletionCallback callback) { |
102 VLOG(4) << "PPB_UDPSocket::SetOption()"; | 114 VLOG(4) << "PPB_UDPSocket::SetOption()"; |
103 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); | 115 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); |
104 if (enter.failed()) | 116 if (enter.failed()) |
105 return enter.retval(); | 117 return enter.retval(); |
106 return enter.SetResult( | 118 return enter.SetResult( |
107 enter.object()->SetOption(name, value, enter.callback())); | 119 enter.object()->SetOption(name, value, enter.callback())); |
108 } | 120 } |
109 | 121 |
110 const PPB_UDPSocket_1_0 g_ppb_udpsocket_thunk_1_0 = { | 122 int32_t JoinGroup(PP_Resource udp_socket, |
111 &Create, | 123 PP_Resource group, |
112 &IsUDPSocket, | 124 struct PP_CompletionCallback callback) { |
113 &Bind, | 125 VLOG(4) << "PPB_UDPSocket::JoinGroup()"; |
114 &GetBoundAddress, | 126 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); |
115 &RecvFrom, | 127 if (enter.failed()) |
116 &SendTo, | 128 return enter.retval(); |
117 &Close, | 129 return enter.SetResult(enter.object()->JoinGroup(group, enter.callback())); |
118 &SetOption1_0 | 130 } |
119 }; | |
120 | 131 |
121 const PPB_UDPSocket_1_1 g_ppb_udpsocket_thunk_1_1 = { | 132 int32_t LeaveGroup(PP_Resource udp_socket, |
122 &Create, | 133 PP_Resource group, |
123 &IsUDPSocket, | 134 struct PP_CompletionCallback callback) { |
124 &Bind, | 135 VLOG(4) << "PPB_UDPSocket::LeaveGroup()"; |
125 &GetBoundAddress, | 136 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); |
126 &RecvFrom, | 137 if (enter.failed()) |
127 &SendTo, | 138 return enter.retval(); |
128 &Close, | 139 return enter.SetResult(enter.object()->LeaveGroup(group, enter.callback())); |
129 &SetOption | 140 } |
130 }; | 141 |
| 142 const PPB_UDPSocket_1_0 g_ppb_udpsocket_thunk_1_0 = {&Create, |
| 143 &IsUDPSocket, |
| 144 &Bind, |
| 145 &GetBoundAddress, |
| 146 &RecvFrom, |
| 147 &SendTo, |
| 148 &Close, |
| 149 &SetOption_1_0}; |
| 150 |
| 151 const PPB_UDPSocket_1_1 g_ppb_udpsocket_thunk_1_1 = {&Create, |
| 152 &IsUDPSocket, |
| 153 &Bind, |
| 154 &GetBoundAddress, |
| 155 &RecvFrom, |
| 156 &SendTo, |
| 157 &Close, |
| 158 &SetOption_1_1}; |
| 159 |
| 160 const PPB_UDPSocket_1_2 g_ppb_udpsocket_thunk_1_2 = {&Create, |
| 161 &IsUDPSocket, |
| 162 &Bind, |
| 163 &GetBoundAddress, |
| 164 &RecvFrom, |
| 165 &SendTo, |
| 166 &Close, |
| 167 &SetOption, |
| 168 &JoinGroup, |
| 169 &LeaveGroup}; |
131 | 170 |
132 } // namespace | 171 } // namespace |
133 | 172 |
134 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_0* GetPPB_UDPSocket_1_0_Thunk() { | 173 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_0* GetPPB_UDPSocket_1_0_Thunk() { |
135 return &g_ppb_udpsocket_thunk_1_0; | 174 return &g_ppb_udpsocket_thunk_1_0; |
136 } | 175 } |
137 | 176 |
138 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_1* GetPPB_UDPSocket_1_1_Thunk() { | 177 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_1* GetPPB_UDPSocket_1_1_Thunk() { |
139 return &g_ppb_udpsocket_thunk_1_1; | 178 return &g_ppb_udpsocket_thunk_1_1; |
140 } | 179 } |
141 | 180 |
| 181 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_2* GetPPB_UDPSocket_1_2_Thunk() { |
| 182 return &g_ppb_udpsocket_thunk_1_2; |
| 183 } |
| 184 |
142 } // namespace thunk | 185 } // namespace thunk |
143 } // namespace ppapi | 186 } // namespace ppapi |
OLD | NEW |