diff options
Diffstat (limited to 'ppapi')
25 files changed, 297 insertions, 302 deletions
diff --git a/ppapi/api/dev/ppb_tcp_socket_dev.idl b/ppapi/api/ppb_tcp_socket.idl index 3453de1..833879c 100644 --- a/ppapi/api/dev/ppb_tcp_socket_dev.idl +++ b/ppapi/api/ppb_tcp_socket.idl @@ -4,20 +4,20 @@ */ /** - * This file defines the <code>PPB_TCPSocket_Dev</code> interface. + * This file defines the <code>PPB_TCPSocket</code> interface. */ [generate_thunk] label Chrome { - M29 = 0.1 + M29 = 1.0 }; /** * Option names used by <code>SetOption()</code>. */ [assert_size(4)] -enum PP_TCPSocket_Option_Dev { +enum PP_TCPSocket_Option { /** * Disables coalescing of small writes to make TCP segments, and instead * delivers data immediately. Value's type is <code>PP_VARTYPE_BOOL</code>. @@ -49,14 +49,14 @@ enum PP_TCPSocket_Option_Dev { }; /** - * The <code>PPB_TCPSocket_Dev</code> interface provides TCP socket operations. + * The <code>PPB_TCPSocket</code> interface provides TCP socket operations. * * Permissions: Apps permission <code>socket</code> with subrule * <code>tcp-connect</code> is required for <code>Connect()</code>. * For more details about network communication permissions, please see: * http://developer.chrome.com/apps/app_network.html */ -interface PPB_TCPSocket_Dev { +interface PPB_TCPSocket { /** * Creates a TCP socket resource. * @@ -74,8 +74,7 @@ interface PPB_TCPSocket_Dev { * @param[in] resource A <code>PP_Resource</code> to check. * * @return <code>PP_TRUE</code> if the input is a - * <code>PPB_TCPSocket_Dev</code> resource; <code>PP_FALSE</code> - * otherwise. + * <code>PPB_TCPSocket</code> resource; <code>PP_FALSE</code> otherwise. */ PP_Bool IsTCPSocket([in] PP_Resource resource); @@ -181,7 +180,7 @@ interface PPB_TCPSocket_Dev { /** * Sets a socket option on the TCP socket. - * Please see the <code>PP_TCPSocket_Option_Dev</code> description for option + * Please see the <code>PP_TCPSocket_Option</code> description for option * names, value types and allowed values. * * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP @@ -194,7 +193,7 @@ interface PPB_TCPSocket_Dev { * @return An int32_t containing an error code from <code>pp_errors.h</code>. */ int32_t SetOption([in] PP_Resource tcp_socket, - [in] PP_TCPSocket_Option_Dev name, + [in] PP_TCPSocket_Option name, [in] PP_Var value, [in] PP_CompletionCallback callback); }; diff --git a/ppapi/c/dev/ppb_tcp_socket_dev.h b/ppapi/c/ppb_tcp_socket.h index 0859709..467656f 100644 --- a/ppapi/c/dev/ppb_tcp_socket_dev.h +++ b/ppapi/c/ppb_tcp_socket.h @@ -3,10 +3,10 @@ * found in the LICENSE file. */ -/* From dev/ppb_tcp_socket_dev.idl modified Thu Jun 20 15:14:26 2013. */ +/* From ppb_tcp_socket.idl modified Sat Jun 22 11:17:34 2013. */ -#ifndef PPAPI_C_DEV_PPB_TCP_SOCKET_DEV_H_ -#define PPAPI_C_DEV_PPB_TCP_SOCKET_DEV_H_ +#ifndef PPAPI_C_PPB_TCP_SOCKET_H_ +#define PPAPI_C_PPB_TCP_SOCKET_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_completion_callback.h" @@ -16,12 +16,12 @@ #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" -#define PPB_TCPSOCKET_DEV_INTERFACE_0_1 "PPB_TCPSocket(Dev);0.1" -#define PPB_TCPSOCKET_DEV_INTERFACE PPB_TCPSOCKET_DEV_INTERFACE_0_1 +#define PPB_TCPSOCKET_INTERFACE_1_0 "PPB_TCPSocket;1.0" +#define PPB_TCPSOCKET_INTERFACE PPB_TCPSOCKET_INTERFACE_1_0 /** * @file - * This file defines the <code>PPB_TCPSocket_Dev</code> interface. + * This file defines the <code>PPB_TCPSocket</code> interface. */ @@ -59,8 +59,8 @@ typedef enum { * guarantee it will conform to the size. */ PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 -} PP_TCPSocket_Option_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option_Dev, 4); +} PP_TCPSocket_Option; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option, 4); /** * @} */ @@ -70,14 +70,14 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option_Dev, 4); * @{ */ /** - * The <code>PPB_TCPSocket_Dev</code> interface provides TCP socket operations. + * The <code>PPB_TCPSocket</code> interface provides TCP socket operations. * * Permissions: Apps permission <code>socket</code> with subrule * <code>tcp-connect</code> is required for <code>Connect()</code>. * For more details about network communication permissions, please see: * http://developer.chrome.com/apps/app_network.html */ -struct PPB_TCPSocket_Dev_0_1 { +struct PPB_TCPSocket_1_0 { /** * Creates a TCP socket resource. * @@ -94,8 +94,7 @@ struct PPB_TCPSocket_Dev_0_1 { * @param[in] resource A <code>PP_Resource</code> to check. * * @return <code>PP_TRUE</code> if the input is a - * <code>PPB_TCPSocket_Dev</code> resource; <code>PP_FALSE</code> - * otherwise. + * <code>PPB_TCPSocket</code> resource; <code>PP_FALSE</code> otherwise. */ PP_Bool (*IsTCPSocket)(PP_Resource resource); /** @@ -194,7 +193,7 @@ struct PPB_TCPSocket_Dev_0_1 { void (*Close)(PP_Resource tcp_socket); /** * Sets a socket option on the TCP socket. - * Please see the <code>PP_TCPSocket_Option_Dev</code> description for option + * Please see the <code>PP_TCPSocket_Option</code> description for option * names, value types and allowed values. * * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP @@ -207,15 +206,15 @@ struct PPB_TCPSocket_Dev_0_1 { * @return An int32_t containing an error code from <code>pp_errors.h</code>. */ int32_t (*SetOption)(PP_Resource tcp_socket, - PP_TCPSocket_Option_Dev name, + PP_TCPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback); }; -typedef struct PPB_TCPSocket_Dev_0_1 PPB_TCPSocket_Dev; +typedef struct PPB_TCPSocket_1_0 PPB_TCPSocket; /** * @} */ -#endif /* PPAPI_C_DEV_PPB_TCP_SOCKET_DEV_H_ */ +#endif /* PPAPI_C_PPB_TCP_SOCKET_H_ */ diff --git a/ppapi/cpp/dev/tcp_socket_dev.cc b/ppapi/cpp/dev/tcp_socket_dev.cc deleted file mode 100644 index 03628a8..0000000 --- a/ppapi/cpp/dev/tcp_socket_dev.cc +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/dev/tcp_socket_dev.h" - -#include "ppapi/c/pp_errors.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/instance_handle.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_TCPSocket_Dev_0_1>() { - return PPB_TCPSOCKET_DEV_INTERFACE_0_1; -} - -} // namespace - -TCPSocket_Dev::TCPSocket_Dev() { -} - -TCPSocket_Dev::TCPSocket_Dev(const InstanceHandle& instance) { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) { - PassRefFromConstructor(get_interface<PPB_TCPSocket_Dev_0_1>()->Create( - instance.pp_instance())); - } -} - -TCPSocket_Dev::TCPSocket_Dev(PassRef, PP_Resource resource) - : Resource(PASS_REF, resource) { -} - -TCPSocket_Dev::TCPSocket_Dev(const TCPSocket_Dev& other) : Resource(other) { -} - -TCPSocket_Dev::~TCPSocket_Dev() { -} - -TCPSocket_Dev& TCPSocket_Dev::operator=(const TCPSocket_Dev& other) { - Resource::operator=(other); - return *this; -} - -// static -bool TCPSocket_Dev::IsAvailable() { - return has_interface<PPB_TCPSocket_Dev_0_1>(); -} - -int32_t TCPSocket_Dev::Connect(const NetAddress& addr, - const CompletionCallback& callback) { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) { - return get_interface<PPB_TCPSocket_Dev_0_1>()->Connect( - pp_resource(), addr.pp_resource(), callback.pp_completion_callback()); - } - return callback.MayForce(PP_ERROR_NOINTERFACE); -} - -NetAddress TCPSocket_Dev::GetLocalAddress() const { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) { - return NetAddress( - PASS_REF, - get_interface<PPB_TCPSocket_Dev_0_1>()->GetLocalAddress(pp_resource())); - } - return NetAddress(); -} - -NetAddress TCPSocket_Dev::GetRemoteAddress() const { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) { - return NetAddress( - PASS_REF, - get_interface<PPB_TCPSocket_Dev_0_1>()->GetRemoteAddress( - pp_resource())); - } - return NetAddress(); -} - -int32_t TCPSocket_Dev::Read(char* buffer, - int32_t bytes_to_read, - const CompletionCallback& callback) { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) { - return get_interface<PPB_TCPSocket_Dev_0_1>()->Read( - pp_resource(), buffer, bytes_to_read, - callback.pp_completion_callback()); - } - return callback.MayForce(PP_ERROR_NOINTERFACE); -} - -int32_t TCPSocket_Dev::Write(const char* buffer, - int32_t bytes_to_write, - const CompletionCallback& callback) { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) { - return get_interface<PPB_TCPSocket_Dev_0_1>()->Write( - pp_resource(), buffer, bytes_to_write, - callback.pp_completion_callback()); - } - return callback.MayForce(PP_ERROR_NOINTERFACE); -} - -void TCPSocket_Dev::Close() { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) - get_interface<PPB_TCPSocket_Dev_0_1>()->Close(pp_resource()); -} - -int32_t TCPSocket_Dev::SetOption(PP_TCPSocket_Option_Dev name, - const Var& value, - const CompletionCallback& callback) { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) { - return get_interface<PPB_TCPSocket_Dev_0_1>()->SetOption( - pp_resource(), name, value.pp_var(), callback.pp_completion_callback()); - } - return callback.MayForce(PP_ERROR_NOINTERFACE); -} - -} // namespace pp diff --git a/ppapi/cpp/tcp_socket.cc b/ppapi/cpp/tcp_socket.cc new file mode 100644 index 0000000..f0002fa --- /dev/null +++ b/ppapi/cpp/tcp_socket.cc @@ -0,0 +1,116 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/cpp/tcp_socket.h" + +#include "ppapi/c/pp_errors.h" +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/instance_handle.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_TCPSocket_1_0>() { + return PPB_TCPSOCKET_INTERFACE_1_0; +} + +} // namespace + +TCPSocket::TCPSocket() { +} + +TCPSocket::TCPSocket(const InstanceHandle& instance) { + if (has_interface<PPB_TCPSocket_1_0>()) { + PassRefFromConstructor(get_interface<PPB_TCPSocket_1_0>()->Create( + instance.pp_instance())); + } +} + +TCPSocket::TCPSocket(PassRef, PP_Resource resource) + : Resource(PASS_REF, resource) { +} + +TCPSocket::TCPSocket(const TCPSocket& other) : Resource(other) { +} + +TCPSocket::~TCPSocket() { +} + +TCPSocket& TCPSocket::operator=(const TCPSocket& other) { + Resource::operator=(other); + return *this; +} + +// static +bool TCPSocket::IsAvailable() { + return has_interface<PPB_TCPSocket_1_0>(); +} + +int32_t TCPSocket::Connect(const NetAddress& addr, + const CompletionCallback& callback) { + if (has_interface<PPB_TCPSocket_1_0>()) { + return get_interface<PPB_TCPSocket_1_0>()->Connect( + pp_resource(), addr.pp_resource(), callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +NetAddress TCPSocket::GetLocalAddress() const { + if (has_interface<PPB_TCPSocket_1_0>()) { + return NetAddress( + PASS_REF, + get_interface<PPB_TCPSocket_1_0>()->GetLocalAddress(pp_resource())); + } + return NetAddress(); +} + +NetAddress TCPSocket::GetRemoteAddress() const { + if (has_interface<PPB_TCPSocket_1_0>()) { + return NetAddress( + PASS_REF, + get_interface<PPB_TCPSocket_1_0>()->GetRemoteAddress(pp_resource())); + } + return NetAddress(); +} + +int32_t TCPSocket::Read(char* buffer, + int32_t bytes_to_read, + const CompletionCallback& callback) { + if (has_interface<PPB_TCPSocket_1_0>()) { + return get_interface<PPB_TCPSocket_1_0>()->Read( + pp_resource(), buffer, bytes_to_read, + callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +int32_t TCPSocket::Write(const char* buffer, + int32_t bytes_to_write, + const CompletionCallback& callback) { + if (has_interface<PPB_TCPSocket_1_0>()) { + return get_interface<PPB_TCPSocket_1_0>()->Write( + pp_resource(), buffer, bytes_to_write, + callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +void TCPSocket::Close() { + if (has_interface<PPB_TCPSocket_1_0>()) + get_interface<PPB_TCPSocket_1_0>()->Close(pp_resource()); +} + +int32_t TCPSocket::SetOption(PP_TCPSocket_Option name, + const Var& value, + const CompletionCallback& callback) { + if (has_interface<PPB_TCPSocket_1_0>()) { + return get_interface<PPB_TCPSocket_1_0>()->SetOption( + pp_resource(), name, value.pp_var(), callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +} // namespace pp diff --git a/ppapi/cpp/dev/tcp_socket_dev.h b/ppapi/cpp/tcp_socket.h index 4067bf0..5a5e0f4 100644 --- a/ppapi/cpp/dev/tcp_socket_dev.h +++ b/ppapi/cpp/tcp_socket.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef PPAPI_CPP_DEV_TCP_SOCKET_DEV_H_ -#define PPAPI_CPP_DEV_TCP_SOCKET_DEV_H_ +#ifndef PPAPI_CPP_TCP_SOCKET_H_ +#define PPAPI_CPP_TCP_SOCKET_H_ -#include "ppapi/c/dev/ppb_tcp_socket_dev.h" +#include "ppapi/c/ppb_tcp_socket.h" #include "ppapi/cpp/net_address.h" #include "ppapi/cpp/pass_ref.h" #include "ppapi/cpp/resource.h" @@ -15,47 +15,47 @@ namespace pp { class CompletionCallback; class InstanceHandle; -/// The <code>TCPSocket_Dev</code> class provides TCP socket operations. +/// The <code>TCPSocket</code> class provides TCP socket operations. /// /// Permissions: Apps permission <code>socket</code> with subrule /// <code>tcp-connect</code> is required for <code>Connect()</code>. /// For more details about network communication permissions, please see: /// http://developer.chrome.com/apps/app_network.html -class TCPSocket_Dev: public Resource { +class TCPSocket : public Resource { public: - /// Default constructor for creating an is_null() <code>TCPSocket_Dev</code> + /// Default constructor for creating an is_null() <code>TCPSocket</code> /// object. - TCPSocket_Dev(); + TCPSocket(); - /// A constructor used to create a <code>TCPSocket_Dev</code> object. + /// A constructor used to create a <code>TCPSocket</code> object. /// /// @param[in] instance The instance with which this resource will be /// associated. - explicit TCPSocket_Dev(const InstanceHandle& instance); + explicit TCPSocket(const InstanceHandle& instance); /// A constructor used when you have received a <code>PP_Resource</code> as a /// return value that has had 1 ref added for you. /// - /// @param[in] resource A <code>PPB_TCPSocket_Dev</code> resource. - TCPSocket_Dev(PassRef, PP_Resource resource); + /// @param[in] resource A <code>PPB_TCPSocket</code> resource. + TCPSocket(PassRef, PP_Resource resource); - /// The copy constructor for <code>TCPSocket_Dev</code>. + /// The copy constructor for <code>TCPSocket</code>. /// - /// @param[in] other A reference to another <code>TCPSocket_Dev</code>. - TCPSocket_Dev(const TCPSocket_Dev& other); + /// @param[in] other A reference to another <code>TCPSocket</code>. + TCPSocket(const TCPSocket& other); /// The destructor. - virtual ~TCPSocket_Dev(); + virtual ~TCPSocket(); - /// The assignment operator for <code>TCPSocket_Dev</code>. + /// The assignment operator for <code>TCPSocket</code>. /// - /// @param[in] other A reference to another <code>TCPSocket_Dev</code>. + /// @param[in] other A reference to another <code>TCPSocket</code>. /// - /// @return A reference to this <code>TCPSocket_Dev</code> object. - TCPSocket_Dev& operator=(const TCPSocket_Dev& other); + /// @return A reference to this <code>TCPSocket</code> object. + TCPSocket& operator=(const TCPSocket& other); /// Static function for determining whether the browser supports the - /// <code>PPB_TCPSocket_Dev</code> interface. + /// <code>PPB_TCPSocket</code> interface. /// /// @return true if the interface is available, false otherwise. static bool IsAvailable(); @@ -101,7 +101,7 @@ class TCPSocket_Dev: public Resource { /// of your class. When your class goes out of scope, the callback factory /// will not actually cancel the operation, but will rather just skip issuing /// the callback on your class. This means that if the underlying - /// <code>PPB_TCPSocket_Dev</code> resource outlives your class, the browser + /// <code>PPB_TCPSocket</code> resource outlives your class, the browser /// will still try to write into your buffer when the operation completes. /// The buffer must be kept valid until then to avoid memory corruption. /// If you want to release the buffer while the <code>Read()</code> call is @@ -146,7 +146,7 @@ class TCPSocket_Dev: public Resource { void Close(); /// Sets a socket option on the TCP socket. - /// Please see the <code>PP_TCPSocket_Option_Dev</code> description for option + /// Please see the <code>PP_TCPSocket_Option</code> description for option /// names, value types and allowed values. /// /// @param[in] name The option to set. @@ -156,11 +156,11 @@ class TCPSocket_Dev: public Resource { /// /// @return An int32_t containing an error code from <code>pp_errors.h</code>. //// - int32_t SetOption(PP_TCPSocket_Option_Dev name, + int32_t SetOption(PP_TCPSocket_Option name, const Var& value, const CompletionCallback& callback); }; } // namespace pp -#endif // PPAPI_CPP_DEV_TCP_SOCKET__DevDEV_H_ +#endif // PPAPI_CPP_TCP_SOCKET_H_ diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 7e4d65b..2246475 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -23,7 +23,6 @@ #include "ppapi/c/dev/ppb_printing_dev.h" #include "ppapi/c/dev/ppb_resource_array_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" -#include "ppapi/c/dev/ppb_tcp_socket_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_text_input_dev.h" #include "ppapi/c/dev/ppb_trace_event_dev.h" @@ -66,6 +65,7 @@ #include "ppapi/c/ppb_mouse_cursor.h" #include "ppapi/c/ppb_mouse_lock.h" #include "ppapi/c/ppb_net_address.h" +#include "ppapi/c/ppb_tcp_socket.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" @@ -151,6 +151,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MessageLoop_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Messaging_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseLock_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_1_0; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLLoader_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLRequestInfo_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLResponseInfo_1_0; @@ -171,7 +172,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_7; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_9; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_91; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_92; @@ -928,6 +928,55 @@ static PP_Bool Pnacl_M29_PPB_NetAddress_DescribeAsIPv6Address(PP_Resource addr, /* End wrapper methods for PPB_NetAddress_1_0 */ +/* Begin wrapper methods for PPB_TCPSocket_1_0 */ + +static PP_Resource Pnacl_M29_PPB_TCPSocket_Create(PP_Instance instance) { + const struct PPB_TCPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_1_0.real_iface; + return iface->Create(instance); +} + +static PP_Bool Pnacl_M29_PPB_TCPSocket_IsTCPSocket(PP_Resource resource) { + const struct PPB_TCPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_1_0.real_iface; + return iface->IsTCPSocket(resource); +} + +static int32_t Pnacl_M29_PPB_TCPSocket_Connect(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback* callback) { + const struct PPB_TCPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_1_0.real_iface; + return iface->Connect(tcp_socket, addr, *callback); +} + +static PP_Resource Pnacl_M29_PPB_TCPSocket_GetLocalAddress(PP_Resource tcp_socket) { + const struct PPB_TCPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_1_0.real_iface; + return iface->GetLocalAddress(tcp_socket); +} + +static PP_Resource Pnacl_M29_PPB_TCPSocket_GetRemoteAddress(PP_Resource tcp_socket) { + const struct PPB_TCPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_1_0.real_iface; + return iface->GetRemoteAddress(tcp_socket); +} + +static int32_t Pnacl_M29_PPB_TCPSocket_Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback* callback) { + const struct PPB_TCPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_1_0.real_iface; + return iface->Read(tcp_socket, buffer, bytes_to_read, *callback); +} + +static int32_t Pnacl_M29_PPB_TCPSocket_Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback* callback) { + const struct PPB_TCPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_1_0.real_iface; + return iface->Write(tcp_socket, buffer, bytes_to_write, *callback); +} + +static void Pnacl_M29_PPB_TCPSocket_Close(PP_Resource tcp_socket) { + const struct PPB_TCPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_1_0.real_iface; + iface->Close(tcp_socket); +} + +static int32_t Pnacl_M29_PPB_TCPSocket_SetOption(PP_Resource tcp_socket, PP_TCPSocket_Option name, struct PP_Var* value, struct PP_CompletionCallback* callback) { + const struct PPB_TCPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_1_0.real_iface; + return iface->SetOption(tcp_socket, name, *value, *callback); +} + +/* End wrapper methods for PPB_TCPSocket_1_0 */ + /* Begin wrapper methods for PPB_URLLoader_1_0 */ static PP_Resource Pnacl_M14_PPB_URLLoader_Create(PP_Instance instance) { @@ -1618,55 +1667,6 @@ static int32_t Pnacl_M23_PPB_Printing_Dev_GetDefaultPrintSettings(PP_Resource re /* Not generating wrapper methods for PPB_Scrollbar_Dev_0_5 */ -/* Begin wrapper methods for PPB_TCPSocket_Dev_0_1 */ - -static PP_Resource Pnacl_M29_PPB_TCPSocket_Dev_Create(PP_Instance instance) { - const struct PPB_TCPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1.real_iface; - return iface->Create(instance); -} - -static PP_Bool Pnacl_M29_PPB_TCPSocket_Dev_IsTCPSocket(PP_Resource resource) { - const struct PPB_TCPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1.real_iface; - return iface->IsTCPSocket(resource); -} - -static int32_t Pnacl_M29_PPB_TCPSocket_Dev_Connect(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback* callback) { - const struct PPB_TCPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1.real_iface; - return iface->Connect(tcp_socket, addr, *callback); -} - -static PP_Resource Pnacl_M29_PPB_TCPSocket_Dev_GetLocalAddress(PP_Resource tcp_socket) { - const struct PPB_TCPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1.real_iface; - return iface->GetLocalAddress(tcp_socket); -} - -static PP_Resource Pnacl_M29_PPB_TCPSocket_Dev_GetRemoteAddress(PP_Resource tcp_socket) { - const struct PPB_TCPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1.real_iface; - return iface->GetRemoteAddress(tcp_socket); -} - -static int32_t Pnacl_M29_PPB_TCPSocket_Dev_Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback* callback) { - const struct PPB_TCPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1.real_iface; - return iface->Read(tcp_socket, buffer, bytes_to_read, *callback); -} - -static int32_t Pnacl_M29_PPB_TCPSocket_Dev_Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback* callback) { - const struct PPB_TCPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1.real_iface; - return iface->Write(tcp_socket, buffer, bytes_to_write, *callback); -} - -static void Pnacl_M29_PPB_TCPSocket_Dev_Close(PP_Resource tcp_socket) { - const struct PPB_TCPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1.real_iface; - iface->Close(tcp_socket); -} - -static int32_t Pnacl_M29_PPB_TCPSocket_Dev_SetOption(PP_Resource tcp_socket, PP_TCPSocket_Option_Dev name, struct PP_Var* value, struct PP_CompletionCallback* callback) { - const struct PPB_TCPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1.real_iface; - return iface->SetOption(tcp_socket, name, *value, *callback); -} - -/* End wrapper methods for PPB_TCPSocket_Dev_0_1 */ - /* Not generating wrapper methods for PPB_Testing_Dev_0_7 */ /* Not generating wrapper methods for PPB_Testing_Dev_0_8 */ @@ -3955,6 +3955,18 @@ struct PPB_NetAddress_1_0 Pnacl_Wrappers_PPB_NetAddress_1_0 = { .DescribeAsIPv6Address = (PP_Bool (*)(PP_Resource addr, struct PP_NetAddress_IPv6* ipv6_addr))&Pnacl_M29_PPB_NetAddress_DescribeAsIPv6Address }; +struct PPB_TCPSocket_1_0 Pnacl_Wrappers_PPB_TCPSocket_1_0 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M29_PPB_TCPSocket_Create, + .IsTCPSocket = (PP_Bool (*)(PP_Resource resource))&Pnacl_M29_PPB_TCPSocket_IsTCPSocket, + .Connect = (int32_t (*)(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_TCPSocket_Connect, + .GetLocalAddress = (PP_Resource (*)(PP_Resource tcp_socket))&Pnacl_M29_PPB_TCPSocket_GetLocalAddress, + .GetRemoteAddress = (PP_Resource (*)(PP_Resource tcp_socket))&Pnacl_M29_PPB_TCPSocket_GetRemoteAddress, + .Read = (int32_t (*)(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_TCPSocket_Read, + .Write = (int32_t (*)(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_TCPSocket_Write, + .Close = (void (*)(PP_Resource tcp_socket))&Pnacl_M29_PPB_TCPSocket_Close, + .SetOption = (int32_t (*)(PP_Resource tcp_socket, PP_TCPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_TCPSocket_SetOption +}; + struct PPB_URLLoader_1_0 Pnacl_Wrappers_PPB_URLLoader_1_0 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M14_PPB_URLLoader_Create, .IsURLLoader = (PP_Bool (*)(PP_Resource resource))&Pnacl_M14_PPB_URLLoader_IsURLLoader, @@ -4175,18 +4187,6 @@ struct PPB_Printing_Dev_0_7 Pnacl_Wrappers_PPB_Printing_Dev_0_7 = { /* Not generating wrapper interface for PPB_Scrollbar_Dev_0_5 */ -struct PPB_TCPSocket_Dev_0_1 Pnacl_Wrappers_PPB_TCPSocket_Dev_0_1 = { - .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M29_PPB_TCPSocket_Dev_Create, - .IsTCPSocket = (PP_Bool (*)(PP_Resource resource))&Pnacl_M29_PPB_TCPSocket_Dev_IsTCPSocket, - .Connect = (int32_t (*)(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_TCPSocket_Dev_Connect, - .GetLocalAddress = (PP_Resource (*)(PP_Resource tcp_socket))&Pnacl_M29_PPB_TCPSocket_Dev_GetLocalAddress, - .GetRemoteAddress = (PP_Resource (*)(PP_Resource tcp_socket))&Pnacl_M29_PPB_TCPSocket_Dev_GetRemoteAddress, - .Read = (int32_t (*)(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_TCPSocket_Dev_Read, - .Write = (int32_t (*)(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_TCPSocket_Dev_Write, - .Close = (void (*)(PP_Resource tcp_socket))&Pnacl_M29_PPB_TCPSocket_Dev_Close, - .SetOption = (int32_t (*)(PP_Resource tcp_socket, PP_TCPSocket_Option_Dev name, struct PP_Var value, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_TCPSocket_Dev_SetOption -}; - /* Not generating wrapper interface for PPB_Testing_Dev_0_7 */ /* Not generating wrapper interface for PPB_Testing_Dev_0_8 */ @@ -4872,6 +4872,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_1_0 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_1_0 = { + .iface_macro = PPB_TCPSOCKET_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_TCPSocket_1_0, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLLoader_1_0 = { .iface_macro = PPB_URLLOADER_INTERFACE_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_URLLoader_1_0, @@ -4992,12 +4998,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_7 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1 = { - .iface_macro = PPB_TCPSOCKET_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_TCPSocket_Dev_0_1, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_9 = { .iface_macro = PPB_TESTING_DEV_INTERFACE_0_9, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Testing_Dev_0_9, @@ -5318,6 +5318,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_Messaging_1_0, &Pnacl_WrapperInfo_PPB_MouseLock_1_0, &Pnacl_WrapperInfo_PPB_NetAddress_1_0, + &Pnacl_WrapperInfo_PPB_TCPSocket_1_0, &Pnacl_WrapperInfo_PPB_URLLoader_1_0, &Pnacl_WrapperInfo_PPB_URLRequestInfo_1_0, &Pnacl_WrapperInfo_PPB_URLResponseInfo_1_0, @@ -5337,7 +5338,6 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1, &Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2, &Pnacl_WrapperInfo_PPB_Printing_Dev_0_7, - &Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1, &Pnacl_WrapperInfo_PPB_Testing_Dev_0_9, &Pnacl_WrapperInfo_PPB_Testing_Dev_0_91, &Pnacl_WrapperInfo_PPB_Testing_Dev_0_92, diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index a8eda9b..14cc7ad 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -229,9 +229,9 @@ 'thunk/ppb_tcp_server_socket_private_api.h', 'thunk/ppb_tcp_server_socket_private_thunk.cc', 'thunk/ppb_tcp_socket_api.h', - 'thunk/ppb_tcp_socket_dev_thunk.cc', 'thunk/ppb_tcp_socket_private_api.h', 'thunk/ppb_tcp_socket_private_thunk.cc', + 'thunk/ppb_tcp_socket_thunk.cc', 'thunk/ppb_text_input_thunk.cc', 'thunk/ppb_truetype_font_api.h', 'thunk/ppb_truetype_font_singleton_api.h', diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index ad188bc..8548295 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -43,6 +43,7 @@ 'c/ppb_mouse_lock.h', 'c/ppb_net_address.h', 'c/ppb_opengles2.h', + 'c/ppb_tcp_socket.h', 'c/pp_touch_point.h', 'c/ppb_url_loader.h', 'c/ppb_url_request_info.h', @@ -76,7 +77,6 @@ 'c/dev/ppb_printing_dev.h', 'c/dev/ppb_resource_array_dev.h', 'c/dev/ppb_scrollbar_dev.h', - 'c/dev/ppb_tcp_socket_dev.h', 'c/dev/ppb_testing_dev.h', 'c/dev/ppb_text_input_dev.h', 'c/dev/ppb_truetype_font_dev.h', @@ -196,6 +196,8 @@ 'cpp/resource.cc', 'cpp/resource.h', 'cpp/size.h', + 'cpp/tcp_socket.cc', + 'cpp/tcp_socket.h', 'cpp/touch_point.h', 'cpp/url_loader.cc', 'cpp/url_loader.h', @@ -249,8 +251,6 @@ 'cpp/dev/scrollbar_dev.h', 'cpp/dev/selection_dev.cc', 'cpp/dev/selection_dev.h', - 'cpp/dev/tcp_socket_dev.cc', - 'cpp/dev/tcp_socket_dev.h', 'cpp/dev/text_input_dev.cc', 'cpp/dev/text_input_dev.h', 'cpp/dev/truetype_font_dev.cc', diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index 87a7359..0944a60 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -22,7 +22,6 @@ #include "ppapi/c/dev/ppb_opengles2ext_dev.h" #include "ppapi/c/dev/ppb_printing_dev.h" #include "ppapi/c/dev/ppb_resource_array_dev.h" -#include "ppapi/c/dev/ppb_tcp_socket_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_text_input_dev.h" #include "ppapi/c/dev/ppb_trace_event_dev.h" @@ -51,6 +50,7 @@ #include "ppapi/c/ppb_mouse_lock.h" #include "ppapi/c/ppb_net_address.h" #include "ppapi/c/ppb_opengles2.h" +#include "ppapi/c/ppb_tcp_socket.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index a977dca..753fa02 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -21,7 +21,6 @@ #include "ipc/ipc_platform_file.h" #include "ppapi/c/dev/pp_video_capture_dev.h" #include "ppapi/c/dev/pp_video_dev.h" -#include "ppapi/c/dev/ppb_tcp_socket_dev.h" #include "ppapi/c/dev/ppb_text_input_dev.h" #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/dev/ppb_udp_socket_dev.h" @@ -38,6 +37,7 @@ #include "ppapi/c/pp_time.h" #include "ppapi/c/ppb_audio_config.h" #include "ppapi/c/ppb_image_data.h" +#include "ppapi/c/ppb_tcp_socket.h" #include "ppapi/c/private/pp_content_decryptor.h" #include "ppapi/c/private/pp_private_font_charset.h" #include "ppapi/c/private/ppb_flash.h" @@ -96,7 +96,7 @@ IPC_ENUM_TRAITS(PP_ResourceString) IPC_ENUM_TRAITS_MAX_VALUE(PP_TalkEvent, PP_TALKEVENT_NUM_EVENTS - 1) IPC_ENUM_TRAITS_MAX_VALUE(PP_TalkPermission, PP_TALKPERMISSION_NUM_PERMISSIONS - 1) -IPC_ENUM_TRAITS_MAX_VALUE(PP_TCPSocket_Option_Dev, +IPC_ENUM_TRAITS_MAX_VALUE(PP_TCPSocket_Option, PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE) IPC_ENUM_TRAITS(PP_TextInput_Type) IPC_ENUM_TRAITS(PP_TrueTypeFontFamily_Dev) @@ -1222,7 +1222,7 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_PPBTCPSocket_Disconnect, uint32 /* socket_id */) IPC_MESSAGE_CONTROL3(PpapiHostMsg_PPBTCPSocket_SetOption, uint32 /* socket_id */, - PP_TCPSocket_Option_Dev /* name */, + PP_TCPSocket_Option /* name */, ppapi::SocketOptionData /* value */) // PPB_TCPServerSocket_Private. diff --git a/ppapi/proxy/ppb_tcp_socket_private_proxy.cc b/ppapi/proxy/ppb_tcp_socket_private_proxy.cc index 7075657..58199fd 100644 --- a/ppapi/proxy/ppb_tcp_socket_private_proxy.cc +++ b/ppapi/proxy/ppb_tcp_socket_private_proxy.cc @@ -47,7 +47,7 @@ class TCPSocket : public TCPSocketPrivateImpl { virtual void SendRead(int32_t bytes_to_read) OVERRIDE; virtual void SendWrite(const std::string& buffer) OVERRIDE; virtual void SendDisconnect() OVERRIDE; - virtual void SendSetOption(PP_TCPSocket_Option_Dev name, + virtual void SendSetOption(PP_TCPSocket_Option name, const SocketOptionData& value) OVERRIDE; private: @@ -119,7 +119,7 @@ void TCPSocket::SendDisconnect() { SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id_)); } -void TCPSocket::SendSetOption(PP_TCPSocket_Option_Dev name, +void TCPSocket::SendSetOption(PP_TCPSocket_Option name, const SocketOptionData& value) { SendToBrowser( new PpapiHostMsg_PPBTCPSocket_SetOption(socket_id_, name, value)); diff --git a/ppapi/proxy/ppb_tcp_socket_proxy.cc b/ppapi/proxy/ppb_tcp_socket_proxy.cc index 6e41c91..2ec1660 100644 --- a/ppapi/proxy/ppb_tcp_socket_proxy.cc +++ b/ppapi/proxy/ppb_tcp_socket_proxy.cc @@ -51,7 +51,7 @@ class TCPSocket : public thunk::PPB_TCPSocket_API, int32_t bytes_to_write, scoped_refptr<TrackedCallback> callback) OVERRIDE; virtual void Close() OVERRIDE; - virtual int32_t SetOption(PP_TCPSocket_Option_Dev name, + virtual int32_t SetOption(PP_TCPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback) OVERRIDE; @@ -67,7 +67,7 @@ class TCPSocket : public thunk::PPB_TCPSocket_API, virtual void SendRead(int32_t bytes_to_read) OVERRIDE; virtual void SendWrite(const std::string& buffer) OVERRIDE; virtual void SendDisconnect() OVERRIDE; - virtual void SendSetOption(PP_TCPSocket_Option_Dev name, + virtual void SendSetOption(PP_TCPSocket_Option name, const SocketOptionData& value) OVERRIDE; virtual Resource* GetOwnerResource() OVERRIDE; @@ -144,7 +144,7 @@ void TCPSocket::Close() { DisconnectImpl(); } -int32_t TCPSocket::SetOption(PP_TCPSocket_Option_Dev name, +int32_t TCPSocket::SetOption(PP_TCPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback) { return SetOptionImpl(name, value, callback); @@ -183,7 +183,7 @@ void TCPSocket::SendDisconnect() { SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id_)); } -void TCPSocket::SendSetOption(PP_TCPSocket_Option_Dev name, +void TCPSocket::SendSetOption(PP_TCPSocket_Option name, const SocketOptionData& value) { SendToBrowser( new PpapiHostMsg_PPBTCPSocket_SetOption(socket_id_, name, value)); diff --git a/ppapi/shared_impl/tcp_socket_shared.cc b/ppapi/shared_impl/tcp_socket_shared.cc index eae4fc3..ae23b28 100644 --- a/ppapi/shared_impl/tcp_socket_shared.cc +++ b/ppapi/shared_impl/tcp_socket_shared.cc @@ -312,7 +312,7 @@ void TCPSocketShared::DisconnectImpl() { } int32_t TCPSocketShared::SetOptionImpl( - PP_TCPSocket_Option_Dev name, + PP_TCPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback) { if (!IsConnected()) diff --git a/ppapi/shared_impl/tcp_socket_shared.h b/ppapi/shared_impl/tcp_socket_shared.h index 46b29dc..20e8e51 100644 --- a/ppapi/shared_impl/tcp_socket_shared.h +++ b/ppapi/shared_impl/tcp_socket_shared.h @@ -10,7 +10,7 @@ #include <vector> #include "base/compiler_specific.h" -#include "ppapi/c/dev/ppb_tcp_socket_dev.h" +#include "ppapi/c/ppb_tcp_socket.h" #include "ppapi/c/private/ppb_net_address_private.h" #include "ppapi/shared_impl/resource.h" #include "ppapi/shared_impl/tracked_callback.h" @@ -66,7 +66,7 @@ class PPAPI_SHARED_EXPORT TCPSocketShared { virtual void SendRead(int32_t bytes_to_read) = 0; virtual void SendWrite(const std::string& buffer) = 0; virtual void SendDisconnect() = 0; - virtual void SendSetOption(PP_TCPSocket_Option_Dev name, + virtual void SendSetOption(PP_TCPSocket_Option name, const SocketOptionData& value) = 0; virtual Resource* GetOwnerResource() = 0; @@ -111,7 +111,7 @@ class PPAPI_SHARED_EXPORT TCPSocketShared { int32_t bytes_to_write, scoped_refptr<TrackedCallback> callback); void DisconnectImpl(); - int32_t SetOptionImpl(PP_TCPSocket_Option_Dev name, + int32_t SetOptionImpl(PP_TCPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback); diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index d11a8c9..8da795e 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -26,7 +26,6 @@ #include "ppapi/c/dev/ppb_printing_dev.h" #include "ppapi/c/dev/ppb_resource_array_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" -#include "ppapi/c/dev/ppb_tcp_socket_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_text_input_dev.h" #include "ppapi/c/dev/ppb_trace_event_dev.h" @@ -86,6 +85,7 @@ #include "ppapi/c/ppb_mouse_lock.h" #include "ppapi/c/ppb_net_address.h" #include "ppapi/c/ppb_opengles2.h" +#include "ppapi/c/ppb_tcp_socket.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h index 6edcc7f..c5332dc 100644 --- a/ppapi/tests/all_cpp_includes.h +++ b/ppapi/tests/all_cpp_includes.h @@ -26,7 +26,6 @@ #include "ppapi/cpp/dev/scriptable_object_deprecated.h" #include "ppapi/cpp/dev/scrollbar_dev.h" #include "ppapi/cpp/dev/selection_dev.h" -#include "ppapi/cpp/dev/tcp_socket_dev.h" #include "ppapi/cpp/dev/text_input_dev.h" #include "ppapi/cpp/dev/udp_socket_dev.h" #include "ppapi/cpp/dev/url_util_dev.h" @@ -68,6 +67,7 @@ #include "ppapi/cpp/rect.h" #include "ppapi/cpp/resource.h" #include "ppapi/cpp/size.h" +#include "ppapi/cpp/tcp_socket.h" #include "ppapi/cpp/touch_point.h" #include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/url_request_info.h" diff --git a/ppapi/tests/test_host_resolver.cc b/ppapi/tests/test_host_resolver.cc index 8c97ce5..ddfb388 100644 --- a/ppapi/tests/test_host_resolver.cc +++ b/ppapi/tests/test_host_resolver.cc @@ -5,8 +5,8 @@ #include "ppapi/tests/test_host_resolver.h" #include "ppapi/cpp/dev/host_resolver_dev.h" -#include "ppapi/cpp/dev/tcp_socket_dev.h" #include "ppapi/cpp/net_address.h" +#include "ppapi/cpp/tcp_socket.h" #include "ppapi/cpp/var.h" #include "ppapi/tests/test_utils.h" #include "ppapi/tests/testing_instance.h" @@ -22,7 +22,7 @@ bool TestHostResolver::Init() { if (!host_resolver_is_available) instance_->AppendError("PPB_HostResolver interface not available"); - bool tcp_socket_is_available = pp::TCPSocket_Dev::IsAvailable(); + bool tcp_socket_is_available = pp::TCPSocket::IsAvailable(); if (!tcp_socket_is_available) instance_->AppendError("PPB_TCPSocket interface not available"); @@ -45,7 +45,7 @@ void TestHostResolver::RunTests(const std::string& filter) { } std::string TestHostResolver::SyncConnect( - pp::TCPSocket_Dev* socket, + pp::TCPSocket* socket, const pp::NetAddress& address) { TestCompletionCallback callback(instance_->pp_instance(), callback_type()); callback.WaitForResult(socket->Connect(address, callback.GetCallback())); @@ -54,7 +54,7 @@ std::string TestHostResolver::SyncConnect( PASS(); } -std::string TestHostResolver::SyncRead(pp::TCPSocket_Dev* socket, +std::string TestHostResolver::SyncRead(pp::TCPSocket* socket, char* buffer, int32_t num_bytes, int32_t* bytes_read) { @@ -67,7 +67,7 @@ std::string TestHostResolver::SyncRead(pp::TCPSocket_Dev* socket, PASS(); } -std::string TestHostResolver::SyncWrite(pp::TCPSocket_Dev* socket, +std::string TestHostResolver::SyncWrite(pp::TCPSocket* socket, const char* buffer, int32_t num_bytes, int32_t* bytes_written) { @@ -80,7 +80,7 @@ std::string TestHostResolver::SyncWrite(pp::TCPSocket_Dev* socket, PASS(); } -std::string TestHostResolver::CheckHTTPResponse(pp::TCPSocket_Dev* socket, +std::string TestHostResolver::CheckHTTPResponse(pp::TCPSocket* socket, const std::string& request, const std::string& response) { int32_t rv = 0; @@ -124,7 +124,7 @@ std::string TestHostResolver::ParameterizedTestResolve( address = host_resolver.GetNetAddress(i); ASSERT_NE(0, address.pp_resource()); - pp::TCPSocket_Dev socket(instance_); + pp::TCPSocket socket(instance_); ASSERT_SUBTEST_SUCCESS(SyncConnect(&socket, address)); ASSERT_SUBTEST_SUCCESS(CheckHTTPResponse(&socket, "GET / HTTP/1.0\r\n\r\n", diff --git a/ppapi/tests/test_host_resolver.h b/ppapi/tests/test_host_resolver.h index 4359c69..6cdeaee 100644 --- a/ppapi/tests/test_host_resolver.h +++ b/ppapi/tests/test_host_resolver.h @@ -13,7 +13,7 @@ namespace pp { class HostResolver_Dev; class NetAddress; -class TCPSocket_Dev; +class TCPSocket; } // namespace pp class TestHostResolver : public TestCase { @@ -25,17 +25,17 @@ class TestHostResolver : public TestCase { virtual void RunTests(const std::string& filter); private: - std::string SyncConnect(pp::TCPSocket_Dev* socket, + std::string SyncConnect(pp::TCPSocket* socket, const pp::NetAddress& address); - std::string SyncRead(pp::TCPSocket_Dev* socket, + std::string SyncRead(pp::TCPSocket* socket, char* buffer, int32_t num_bytes, int32_t* bytes_read); - std::string SyncWrite(pp::TCPSocket_Dev* socket, + std::string SyncWrite(pp::TCPSocket* socket, const char* buffer, int32_t num_bytes, int32_t* bytes_written); - std::string CheckHTTPResponse(pp::TCPSocket_Dev* socket, + std::string CheckHTTPResponse(pp::TCPSocket* socket, const std::string& request, const std::string& response); std::string SyncResolve(pp::HostResolver_Dev* host_resolver, diff --git a/ppapi/tests/test_tcp_socket.cc b/ppapi/tests/test_tcp_socket.cc index 699eff9..a4c56eb 100644 --- a/ppapi/tests/test_tcp_socket.cc +++ b/ppapi/tests/test_tcp_socket.cc @@ -4,7 +4,7 @@ #include "ppapi/tests/test_tcp_socket.h" -#include "ppapi/cpp/dev/tcp_socket_dev.h" +#include "ppapi/cpp/tcp_socket.h" #include "ppapi/tests/test_utils.h" #include "ppapi/tests/testing_instance.h" @@ -26,7 +26,7 @@ TestTCPSocket::TestTCPSocket(TestingInstance* instance) : TestCase(instance) { } bool TestTCPSocket::Init() { - if (!pp::TCPSocket_Dev::IsAvailable()) + if (!pp::TCPSocket::IsAvailable()) return false; // We need something to connect to, so we connect to the HTTP server whence we @@ -52,7 +52,7 @@ void TestTCPSocket::RunTests(const std::string& filter) { } std::string TestTCPSocket::TestConnect() { - pp::TCPSocket_Dev socket(instance_); + pp::TCPSocket socket(instance_); TestCompletionCallback cb(instance_->pp_instance(), callback_type()); cb.WaitForResult(socket.Connect(addr_, cb.GetCallback())); @@ -73,7 +73,7 @@ std::string TestTCPSocket::TestConnect() { } std::string TestTCPSocket::TestReadWrite() { - pp::TCPSocket_Dev socket(instance_); + pp::TCPSocket socket(instance_); TestCompletionCallback cb(instance_->pp_instance(), callback_type()); cb.WaitForResult(socket.Connect(addr_, cb.GetCallback())); @@ -91,7 +91,7 @@ std::string TestTCPSocket::TestReadWrite() { } std::string TestTCPSocket::TestSetOption() { - pp::TCPSocket_Dev socket(instance_); + pp::TCPSocket socket(instance_); TestCompletionCallback cb_1(instance_->pp_instance(), callback_type()); TestCompletionCallback cb_2(instance_->pp_instance(), callback_type()); TestCompletionCallback cb_3(instance_->pp_instance(), callback_type()); @@ -142,7 +142,7 @@ std::string TestTCPSocket::TestSetOption() { PASS(); } -int32_t TestTCPSocket::ReadFirstLineFromSocket(pp::TCPSocket_Dev* socket, +int32_t TestTCPSocket::ReadFirstLineFromSocket(pp::TCPSocket* socket, std::string* s) { char buffer[1000]; @@ -168,7 +168,7 @@ int32_t TestTCPSocket::ReadFirstLineFromSocket(pp::TCPSocket_Dev* socket, return PP_ERROR_FAILED; } -int32_t TestTCPSocket::WriteStringToSocket(pp::TCPSocket_Dev* socket, +int32_t TestTCPSocket::WriteStringToSocket(pp::TCPSocket* socket, const std::string& s) { const char* buffer = s.data(); size_t written = 0; diff --git a/ppapi/tests/test_tcp_socket.h b/ppapi/tests/test_tcp_socket.h index 3f8ba86..44c7321 100644 --- a/ppapi/tests/test_tcp_socket.h +++ b/ppapi/tests/test_tcp_socket.h @@ -12,7 +12,7 @@ #include "ppapi/tests/test_case.h" namespace pp { -class TCPSocket_Dev; +class TCPSocket; } class TestTCPSocket: public TestCase { @@ -28,8 +28,8 @@ class TestTCPSocket: public TestCase { std::string TestReadWrite(); std::string TestSetOption(); - int32_t ReadFirstLineFromSocket(pp::TCPSocket_Dev* socket, std::string* s); - int32_t WriteStringToSocket(pp::TCPSocket_Dev* socket, const std::string& s); + int32_t ReadFirstLineFromSocket(pp::TCPSocket* socket, std::string* s); + int32_t WriteStringToSocket(pp::TCPSocket* socket, const std::string& s); pp::NetAddress addr_; }; diff --git a/ppapi/tests/test_udp_socket.cc b/ppapi/tests/test_udp_socket.cc index f558443..ec5554e 100644 --- a/ppapi/tests/test_udp_socket.cc +++ b/ppapi/tests/test_udp_socket.cc @@ -6,9 +6,9 @@ #include <vector> -#include "ppapi/cpp/dev/tcp_socket_dev.h" #include "ppapi/cpp/dev/udp_socket_dev.h" #include "ppapi/cpp/pass_ref.h" +#include "ppapi/cpp/tcp_socket.h" #include "ppapi/cpp/var.h" #include "ppapi/tests/test_utils.h" #include "ppapi/tests/testing_instance.h" @@ -51,7 +51,7 @@ TestUDPSocket::TestUDPSocket(TestingInstance* instance) : TestCase(instance) { } bool TestUDPSocket::Init() { - bool tcp_socket_is_available = pp::TCPSocket_Dev::IsAvailable(); + bool tcp_socket_is_available = pp::TCPSocket::IsAvailable(); if (!tcp_socket_is_available) instance_->AppendError("PPB_TCPSocket interface not available"); @@ -86,7 +86,7 @@ void TestUDPSocket::RunTests(const std::string& filter) { } std::string TestUDPSocket::GetLocalAddress(pp::NetAddress* address) { - pp::TCPSocket_Dev socket(instance_); + pp::TCPSocket socket(instance_); TestCompletionCallback callback(instance_->pp_instance(), callback_type()); callback.WaitForResult(socket.Connect(address_, callback.GetCallback())); CHECK_CALLBACK_BEHAVIOR(callback); diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index f18dfab..b3fac7b 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -7,8 +7,6 @@ #include "ppapi/thunk/interfaces_preamble.h" -PROXIED_API(PPB_TCPSocket) - // Map the old dev console interface to the stable one (which is the same) to // keep Flash, etc. working. PROXIED_IFACE(PPB_Instance, "PPB_Console(Dev);0.1", PPB_Console_1_0) @@ -36,8 +34,6 @@ PROXIED_IFACE(NoAPIName, PPB_PRINTING_DEV_INTERFACE_0_7, PPB_Printing_Dev_0_7) PROXIED_IFACE(NoAPIName, PPB_RESOURCEARRAY_DEV_INTERFACE_0_1, PPB_ResourceArray_Dev_0_1) -PROXIED_IFACE(PPB_TCPSocket, PPB_TCPSOCKET_DEV_INTERFACE_0_1, - PPB_TCPSocket_Dev_0_1) PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_2, PPB_TextInput_Dev_0_2) PROXIED_IFACE(NoAPIName, PPB_TRUETYPEFONT_DEV_INTERFACE_0_1, diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h index a59f447..b9c15a3 100644 --- a/ppapi/thunk/interfaces_ppb_public_stable.h +++ b/ppapi/thunk/interfaces_ppb_public_stable.h @@ -23,6 +23,7 @@ PROXIED_API(PPB_FileRef) PROXIED_API(PPB_Graphics3D) PROXIED_API(PPB_ImageData) PROXIED_API(PPB_Instance) +PROXIED_API(PPB_TCPSocket) // AudioConfig isn't proxied in the normal way, we have only local classes and // serialize it to a struct when we need it on the host side. @@ -73,6 +74,7 @@ PROXIED_IFACE(PPB_Instance, PPB_MESSAGING_INTERFACE_1_0, PPB_Messaging_1_0) PROXIED_IFACE(PPB_Instance, PPB_MOUSECURSOR_INTERFACE_1_0, PPB_MouseCursor_1_0) PROXIED_IFACE(PPB_Instance, PPB_MOUSELOCK_INTERFACE_1_0, PPB_MouseLock_1_0) PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_INTERFACE_1_0, PPB_NetAddress_1_0) +PROXIED_IFACE(PPB_TCPSocket, PPB_TCPSOCKET_INTERFACE_1_0, PPB_TCPSocket_1_0) PROXIED_IFACE(NoAPIName, PPB_URLLOADER_INTERFACE_1_0, PPB_URLLoader_1_0) PROXIED_IFACE(NoAPIName, PPB_URLREQUESTINFO_INTERFACE_1_0, PPB_URLRequestInfo_1_0) diff --git a/ppapi/thunk/ppb_tcp_socket_api.h b/ppapi/thunk/ppb_tcp_socket_api.h index 1b94a83..d33685f 100644 --- a/ppapi/thunk/ppb_tcp_socket_api.h +++ b/ppapi/thunk/ppb_tcp_socket_api.h @@ -6,7 +6,7 @@ #define PPAPI_THUNK_PPB_TCP_SOCKET_API_H_ #include "base/memory/ref_counted.h" -#include "ppapi/c/dev/ppb_tcp_socket_dev.h" +#include "ppapi/c/ppb_tcp_socket.h" #include "ppapi/thunk/ppapi_thunk_export.h" namespace ppapi { @@ -30,7 +30,7 @@ class PPAPI_THUNK_EXPORT PPB_TCPSocket_API { int32_t bytes_to_write, scoped_refptr<TrackedCallback> callback) = 0; virtual void Close() = 0; - virtual int32_t SetOption(PP_TCPSocket_Option_Dev name, + virtual int32_t SetOption(PP_TCPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback) = 0; }; diff --git a/ppapi/thunk/ppb_tcp_socket_dev_thunk.cc b/ppapi/thunk/ppb_tcp_socket_thunk.cc index 43a1968..ff612fb 100644 --- a/ppapi/thunk/ppb_tcp_socket_dev_thunk.cc +++ b/ppapi/thunk/ppb_tcp_socket_thunk.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From dev/ppb_tcp_socket_dev.idl modified Wed Jun 05 23:11:18 2013. +// From ppb_tcp_socket.idl modified Thu Jun 20 16:36:53 2013. -#include "ppapi/c/dev/ppb_tcp_socket_dev.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_tcp_socket.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_instance_api.h" @@ -20,7 +20,7 @@ namespace thunk { namespace { PP_Resource Create(PP_Instance instance) { - VLOG(4) << "PPB_TCPSocket_Dev::Create()"; + VLOG(4) << "PPB_TCPSocket::Create()"; EnterResourceCreation enter(instance); if (enter.failed()) return 0; @@ -28,7 +28,7 @@ PP_Resource Create(PP_Instance instance) { } PP_Bool IsTCPSocket(PP_Resource resource) { - VLOG(4) << "PPB_TCPSocket_Dev::IsTCPSocket()"; + VLOG(4) << "PPB_TCPSocket::IsTCPSocket()"; EnterResource<PPB_TCPSocket_API> enter(resource, false); return PP_FromBool(enter.succeeded()); } @@ -36,7 +36,7 @@ PP_Bool IsTCPSocket(PP_Resource resource) { int32_t Connect(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_TCPSocket_Dev::Connect()"; + VLOG(4) << "PPB_TCPSocket::Connect()"; EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true); if (enter.failed()) return enter.retval(); @@ -44,7 +44,7 @@ int32_t Connect(PP_Resource tcp_socket, } PP_Resource GetLocalAddress(PP_Resource tcp_socket) { - VLOG(4) << "PPB_TCPSocket_Dev::GetLocalAddress()"; + VLOG(4) << "PPB_TCPSocket::GetLocalAddress()"; EnterResource<PPB_TCPSocket_API> enter(tcp_socket, true); if (enter.failed()) return 0; @@ -52,7 +52,7 @@ PP_Resource GetLocalAddress(PP_Resource tcp_socket) { } PP_Resource GetRemoteAddress(PP_Resource tcp_socket) { - VLOG(4) << "PPB_TCPSocket_Dev::GetRemoteAddress()"; + VLOG(4) << "PPB_TCPSocket::GetRemoteAddress()"; EnterResource<PPB_TCPSocket_API> enter(tcp_socket, true); if (enter.failed()) return 0; @@ -63,7 +63,7 @@ int32_t Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_TCPSocket_Dev::Read()"; + VLOG(4) << "PPB_TCPSocket::Read()"; EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true); if (enter.failed()) return enter.retval(); @@ -76,7 +76,7 @@ int32_t Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_TCPSocket_Dev::Write()"; + VLOG(4) << "PPB_TCPSocket::Write()"; EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true); if (enter.failed()) return enter.retval(); @@ -86,7 +86,7 @@ int32_t Write(PP_Resource tcp_socket, } void Close(PP_Resource tcp_socket) { - VLOG(4) << "PPB_TCPSocket_Dev::Close()"; + VLOG(4) << "PPB_TCPSocket::Close()"; EnterResource<PPB_TCPSocket_API> enter(tcp_socket, true); if (enter.failed()) return; @@ -94,10 +94,10 @@ void Close(PP_Resource tcp_socket) { } int32_t SetOption(PP_Resource tcp_socket, - PP_TCPSocket_Option_Dev name, + PP_TCPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_TCPSocket_Dev::SetOption()"; + VLOG(4) << "PPB_TCPSocket::SetOption()"; EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true); if (enter.failed()) return enter.retval(); @@ -106,7 +106,7 @@ int32_t SetOption(PP_Resource tcp_socket, enter.callback())); } -const PPB_TCPSocket_Dev_0_1 g_ppb_tcpsocket_dev_thunk_0_1 = { +const PPB_TCPSocket_1_0 g_ppb_tcpsocket_thunk_1_0 = { &Create, &IsTCPSocket, &Connect, @@ -120,8 +120,8 @@ const PPB_TCPSocket_Dev_0_1 g_ppb_tcpsocket_dev_thunk_0_1 = { } // namespace -const PPB_TCPSocket_Dev_0_1* GetPPB_TCPSocket_Dev_0_1_Thunk() { - return &g_ppb_tcpsocket_dev_thunk_0_1; +const PPB_TCPSocket_1_0* GetPPB_TCPSocket_1_0_Thunk() { + return &g_ppb_tcpsocket_thunk_1_0; } } // namespace thunk |