From fd305c12b3fe8b4d2496f67aed089ff703f19b6d Mon Sep 17 00:00:00 2001 From: hidehiko Date: Wed, 10 Dec 2014 22:01:47 -0800 Subject: Remove timing limitation of SetOption invocation for PPAPI sockets. Currently PPAPI has timing limitation for sockets' SetOption. NODELAY, and BROADCAST need to be before Connect() or Bind(), while RCVBUF_SIZE and SNFBUF_SIZE need to be after it. This CL removes such a limitation. Along with the change, pepper_udp_socket_message_filter starts to use UDPSocket instead of UDPServerSocket, so that the implementation direction gets closer to TCP message filter a little bit. BUG=425563, 420697 TEST=Ran trybots. Review URL: https://codereview.chromium.org/690903002 Cr-Commit-Position: refs/heads/master@{#307867} --- ppapi/api/ppb_tcp_socket.idl | 35 +++++++++++++++++++++++++++++++---- ppapi/api/ppb_udp_socket.idl | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 61 insertions(+), 10 deletions(-) (limited to 'ppapi/api') diff --git a/ppapi/api/ppb_tcp_socket.idl b/ppapi/api/ppb_tcp_socket.idl index 543cd30..5851f1d 100644 --- a/ppapi/api/ppb_tcp_socket.idl +++ b/ppapi/api/ppb_tcp_socket.idl @@ -9,7 +9,8 @@ label Chrome { M29 = 1.0, - M31 = 1.1 + M31 = 1.1, + M41 = 1.2 }; /** @@ -20,14 +21,18 @@ enum PP_TCPSocket_Option { /** * Disables coalescing of small writes to make TCP segments, and instead * delivers data immediately. Value's type is PP_VARTYPE_BOOL. - * This option can only be set after a successful Connect() call. + * On version 1.1 or earlier, this option can only be set after a successful + * Connect() call. On version 1.2 or later, there is no such + * limitation. */ PP_TCPSOCKET_OPTION_NO_DELAY = 0, /** * Specifies the total per-socket buffer space reserved for sends. Value's * type should be PP_VARTYPE_INT32. - * This option can only be set after a successful Connect() call. + * On version 1.1 or earlier, this option can only be set after a successful + * Connect() call. On version 1.2 or later, there is no such + * limitation. * * Note: This is only treated as a hint for the browser to set the buffer * size. Even if SetOption() succeeds, the browser doesn't @@ -38,7 +43,9 @@ enum PP_TCPSocket_Option { /** * Specifies the total per-socket buffer space reserved for receives. Value's * type should be PP_VARTYPE_INT32. - * This option can only be set after a successful Connect() call. + * On version 1.1 or earlier, this option can only be set after a successful + * Connect() call. On version 1.2 or later, there is no such + * limitation. * * Note: This is only treated as a hint for the browser to set the buffer * size. Even if SetOption() succeeds, the browser doesn't @@ -261,4 +268,24 @@ interface PPB_TCPSocket { [in] PP_TCPSocket_Option name, [in] PP_Var value, [in] PP_CompletionCallback callback); + + /** + * Sets a socket option on the TCP socket. + * Please see the PP_TCPSocket_Option description for option + * names, value types and allowed values. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.2] + int32_t SetOption([in] PP_Resource tcp_socket, + [in] PP_TCPSocket_Option name, + [in] PP_Var value, + [in] PP_CompletionCallback callback); }; diff --git a/ppapi/api/ppb_udp_socket.idl b/ppapi/api/ppb_udp_socket.idl index e4c87b2..8226c00 100644 --- a/ppapi/api/ppb_udp_socket.idl +++ b/ppapi/api/ppb_udp_socket.idl @@ -7,10 +7,9 @@ * This file defines the PPB_UDPSocket interface. */ -[generate_thunk] - label Chrome { - M29 = 1.0 + M29 = 1.0, + M41 = 1.1 }; /** @@ -28,14 +27,17 @@ enum PP_UDPSocket_Option { /** * Allows sending and receiving packets to and from broadcast addresses. * Value's type should be PP_VARTYPE_BOOL. - * This option can only be set before calling Bind(). + * On version 1.0, this option can only be set before calling + * Bind(). On version 1.1 or later, there is no such limitation. */ PP_UDPSOCKET_OPTION_BROADCAST = 1, /** * Specifies the total per-socket buffer space reserved for sends. Value's * type should be PP_VARTYPE_INT32. - * This option can only be set after a successful Bind() call. + * On version 1.0, this option can only be set after a successful + * Bind() call. On version 1.1 or later, there is no such + * limitation. * * Note: This is only treated as a hint for the browser to set the buffer * size. Even if SetOption() succeeds, the browser doesn't @@ -46,7 +48,9 @@ enum PP_UDPSocket_Option { /** * Specifies the total per-socket buffer space reserved for receives. Value's * type should be PP_VARTYPE_INT32. - * This option can only be set after a successful Bind() call. + * On version 1.0, this option can only be set after a successful + * Bind() call. On version 1.1 or later, there is no such + * limitation. * * Note: This is only treated as a hint for the browser to set the buffer * size. Even if SetOption() succeeds, the browser doesn't @@ -193,4 +197,24 @@ interface PPB_UDPSocket { [in] PP_UDPSocket_Option name, [in] PP_Var value, [in] PP_CompletionCallback callback); + + /** + * Sets a socket option on the UDP socket. + * Please see the PP_UDPSocket_Option description for option + * names, value types and allowed values. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.1] + int32_t SetOption([in] PP_Resource udp_socket, + [in] PP_UDPSocket_Option name, + [in] PP_Var value, + [in] PP_CompletionCallback callback); }; -- cgit v1.1