summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk/ppb_udp_socket_private_thunk.cc
diff options
context:
space:
mode:
authorygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-29 18:19:30 +0000
committerygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-29 18:19:30 +0000
commit51cea8ecdfac3d655f19b27ab4ad59a49401043d (patch)
tree7867ed86cedddbc0c7539e5ee252816150da375b /ppapi/thunk/ppb_udp_socket_private_thunk.cc
parentce638d154c6e8618b8df761115a5a9e2c9d8a106 (diff)
downloadchromium_src-51cea8ecdfac3d655f19b27ab4ad59a49401043d.zip
chromium_src-51cea8ecdfac3d655f19b27ab4ad59a49401043d.tar.gz
chromium_src-51cea8ecdfac3d655f19b27ab4ad59a49401043d.tar.bz2
Implemented queued UDP SendTo/RecvFrom requests. Exposed SO_SNDBUF and SO_RVFBUF socket options.
BUG=154338 TEST=browser_tests:*UDPSocketPrivate* TBR=jschuh Review URL: https://chromiumcodereview.appspot.com/12316095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191401 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk/ppb_udp_socket_private_thunk.cc')
-rw-r--r--ppapi/thunk/ppb_udp_socket_private_thunk.cc67
1 files changed, 54 insertions, 13 deletions
diff --git a/ppapi/thunk/ppb_udp_socket_private_thunk.cc b/ppapi/thunk/ppb_udp_socket_private_thunk.cc
index a493666..0b98e01 100644
--- a/ppapi/thunk/ppb_udp_socket_private_thunk.cc
+++ b/ppapi/thunk/ppb_udp_socket_private_thunk.cc
@@ -30,15 +30,25 @@ PP_Bool IsUDPSocket(PP_Resource resource) {
return PP_FromBool(enter.succeeded());
}
-int32_t SetSocketFeature(PP_Resource udp_socket,
- PP_UDPSocketFeature_Private name,
- PP_Var value) {
+int32_t SetSocketFeature_0_5(PP_Resource udp_socket,
+ PP_UDPSocketFeature_Private name,
+ PP_Var value) {
EnterUDP enter(udp_socket, true);
if (enter.failed())
return PP_ERROR_BADRESOURCE;
return enter.object()->SetSocketFeature(name, value);
}
+int32_t SetSocketFeature_0_4(PP_Resource udp_socket,
+ PP_UDPSocketFeature_Private name,
+ PP_Var value) {
+ if (name != PP_UDPSOCKETFEATURE_ADDRESS_REUSE &&
+ name != PP_UDPSOCKETFEATURE_BROADCAST) {
+ return PP_ERROR_BADARGUMENT;
+ }
+ return SetSocketFeature_0_5(udp_socket, name, value);
+}
+
int32_t Bind(PP_Resource udp_socket,
const PP_NetAddress_Private *addr,
PP_CompletionCallback callback) {
@@ -56,10 +66,26 @@ PP_Bool GetBoundAddress(PP_Resource udp_socket,
return enter.object()->GetBoundAddress(addr);
}
-int32_t RecvFrom(PP_Resource udp_socket,
- char* buffer,
- int32_t num_bytes,
- PP_CompletionCallback callback) {
+int32_t RecvFrom_0_4(PP_Resource udp_socket,
+ char* buffer,
+ int32_t num_bytes,
+ PP_CompletionCallback callback) {
+#ifdef NDEBUG
+ EnterUDP enter(udp_socket, callback, false);
+#else
+ EnterUDP enter(udp_socket, callback, true);
+#endif
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->RecvFrom_0_4(buffer, num_bytes,
+ enter.callback()));
+}
+
+int32_t RecvFrom_0_5(PP_Resource udp_socket,
+ char* buffer,
+ int32_t num_bytes,
+ PP_NetAddress_Private* addr,
+ PP_CompletionCallback callback) {
#ifdef NDEBUG
EnterUDP enter(udp_socket, callback, false);
#else
@@ -67,8 +93,8 @@ int32_t RecvFrom(PP_Resource udp_socket,
#endif
if (enter.failed())
return enter.retval();
- return enter.SetResult(enter.object()->RecvFrom(buffer, num_bytes,
- enter.callback()));
+ return enter.SetResult(enter.object()->RecvFrom_0_5(buffer, num_bytes, addr,
+ enter.callback()));
}
PP_Bool GetRecvFromAddress(PP_Resource udp_socket,
@@ -101,7 +127,7 @@ const PPB_UDPSocket_Private_0_2 g_ppb_udp_socket_thunk_0_2 = {
&Create,
&IsUDPSocket,
&Bind,
- &RecvFrom,
+ &RecvFrom_0_4,
&GetRecvFromAddress,
&SendTo,
&Close
@@ -112,7 +138,7 @@ const PPB_UDPSocket_Private_0_3 g_ppb_udp_socket_thunk_0_3 = {
&IsUDPSocket,
&Bind,
&GetBoundAddress,
- &RecvFrom,
+ &RecvFrom_0_4,
&GetRecvFromAddress,
&SendTo,
&Close
@@ -121,15 +147,26 @@ const PPB_UDPSocket_Private_0_3 g_ppb_udp_socket_thunk_0_3 = {
const PPB_UDPSocket_Private_0_4 g_ppb_udp_socket_thunk_0_4 = {
&Create,
&IsUDPSocket,
- &SetSocketFeature,
+ &SetSocketFeature_0_4,
&Bind,
&GetBoundAddress,
- &RecvFrom,
+ &RecvFrom_0_4,
&GetRecvFromAddress,
&SendTo,
&Close
};
+const PPB_UDPSocket_Private_0_5 g_ppb_udp_socket_thunk_0_5 = {
+ &Create,
+ &IsUDPSocket,
+ &SetSocketFeature_0_5,
+ &Bind,
+ &GetBoundAddress,
+ &RecvFrom_0_5,
+ &SendTo,
+ &Close
+};
+
} // namespace
const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() {
@@ -144,5 +181,9 @@ const PPB_UDPSocket_Private_0_4* GetPPB_UDPSocket_Private_0_4_Thunk() {
return &g_ppb_udp_socket_thunk_0_4;
}
+const PPB_UDPSocket_Private_0_5* GetPPB_UDPSocket_Private_0_5_Thunk() {
+ return &g_ppb_udp_socket_thunk_0_5;
+}
+
} // namespace thunk
} // namespace ppapi