diff options
author | Ben Murdoch <benm@google.com> | 2013-07-10 11:40:50 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2013-07-10 11:40:50 +0100 |
commit | eb525c5499e34cc9c4b825d6d9e75bb07cc06ace (patch) | |
tree | d908ce4bfe1717d2cd53f41327d8b9ba8304355f /ppapi | |
parent | 3c54152607de4272b3da0c146b71dcba8a0e5610 (diff) | |
download | chromium_org-eb525c5499e34cc9c4b825d6d9e75bb07cc06ace.tar.gz |
Merge from Chromium at DEPS revision r210036
This commit was generated by merge_to_master.py.
Change-Id: Ib0e33a83ad5dfa541481e83d7acfc6970e68f471
Diffstat (limited to 'ppapi')
214 files changed, 7806 insertions, 4977 deletions
diff --git a/ppapi/api/OWNERS b/ppapi/api/OWNERS index 8dd086cdf0..f7c2b72326 100644 --- a/ppapi/api/OWNERS +++ b/ppapi/api/OWNERS @@ -1 +1,3 @@ noelallen@chromium.org +binji@chromium.org +nfullagar@chromium.org diff --git a/ppapi/api/dev/ppb_audio_input_dev.idl b/ppapi/api/dev/ppb_audio_input_dev.idl index 29c60cc36a..191c6d5cd8 100644 --- a/ppapi/api/dev/ppb_audio_input_dev.idl +++ b/ppapi/api/dev/ppb_audio_input_dev.idl @@ -8,20 +8,26 @@ * provides realtime audio input capture. */ -[generate_thunk] - label Chrome { M19 = 0.2, - M25 = 0.3 + M25 = 0.3, + M29 = 0.4 }; /** * <code>PPB_AudioInput_Callback</code> defines the type of an audio callback * function used to provide the audio buffer with data. This callback will be * called on a separate thread from the creation thread. + * + * @param[in] sample_buffer A buffer providing audio input data. + * @param[in] buffer_size_in_bytes The size of the buffer in bytes. + * @param[in] latency The time that has elapsed since the data was recorded. + * @param[inout] user_data An opaque pointer that was passed into + * <code>PPB_AudioInput_Dev.Open()</code>. */ typedef void PPB_AudioInput_Callback([in] mem_t sample_buffer, [in] uint32_t buffer_size_in_bytes, + [in, version=0.4] PP_TimeDelta latency, [inout] mem_t user_data); /** diff --git a/ppapi/api/dev/ppb_host_resolver_dev.idl b/ppapi/api/dev/ppb_host_resolver_dev.idl deleted file mode 100644 index cf27434153..0000000000 --- a/ppapi/api/dev/ppb_host_resolver_dev.idl +++ /dev/null @@ -1,82 +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. - */ - -/** - * This file defines the <code>PPB_HostResolver_Dev</code> interface. - * TODO(yzshen): Tidy up the document. - */ - -[generate_thunk] - -label Chrome { - M29 = 0.1 -}; - -/** - * The <code>PP_HostResolver_Flags_Dev</code> is an enumeration of the - * different types of flags, that can be OR-ed and passed to host - * resolver. - */ -[assert_size(4)] -enum PP_HostResolver_Flags_Dev { - /** - * AI_CANONNAME - */ - PP_HOSTRESOLVER_FLAGS_CANONNAME = 1 << 0, - /** - * Hint to the resolver that only loopback addresses are configured. - */ - PP_HOSTRESOLVER_FLAGS_LOOPBACK_ONLY = 1 << 1 -}; - -[assert_size(8)] -struct PP_HostResolver_Hint_Dev { - PP_NetAddress_Family_Dev family; - int32_t flags; -}; - -interface PPB_HostResolver_Dev { - /** - * Allocates a Host Resolver resource. - */ - PP_Resource Create([in] PP_Instance instance); - - /** - * Determines if a given resource is a Host Resolver. - */ - PP_Bool IsHostResolver([in] PP_Resource resource); - - /** - * Creates a new request to Host Resolver. |callback| is invoked when request - * is processed and a list of network addresses is obtained. These addresses - * can be used in Connect, Bind or Listen calls to connect to a given |host| - * and |port|. - */ - int32_t Resolve([in] PP_Resource host_resolver, - [in] str_t host, - [in] uint16_t port, - [in] PP_HostResolver_Hint_Dev hint, - [in] PP_CompletionCallback callback); - - /** - * Gets canonical name of host. Returns an undefined var if there is a pending - * Resolve call or the previous Resolve call failed. - */ - PP_Var GetCanonicalName([in] PP_Resource host_resolver); - - /** - * Gets number of network addresses obtained after Resolve call. Returns 0 if - * there is a pending Resolve call or the previous Resolve call failed. - */ - uint32_t GetNetAddressCount([in] PP_Resource host_resolver); - - /** - * Gets the |index|-th network address. - * Returns 0 if there is a pending Resolve call or the previous Resolve call - * failed, or |index| is not less than the number of available addresses. - */ - PP_Resource GetNetAddress([in] PP_Resource host_resolver, - [in] uint32_t index); -}; diff --git a/ppapi/api/dev/ppb_net_address_dev.idl b/ppapi/api/dev/ppb_net_address_dev.idl deleted file mode 100644 index b3d1d1b864..0000000000 --- a/ppapi/api/dev/ppb_net_address_dev.idl +++ /dev/null @@ -1,118 +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. - */ - -/** - * This file defines the <code>PPB_NetAddress_Dev</code> interface. - */ - -label Chrome { - M29 = 0.1 -}; - -[assert_size(4)] -enum PP_NetAddress_Family_Dev { - /** - * The address family is unspecified. - */ - PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, - /** - * The Internet Protocol version 4 (IPv4) address family. - */ - PP_NETADDRESS_FAMILY_IPV4 = 1, - /** - * The Internet Protocol version 6 (IPv6) address family. - */ - PP_NETADDRESS_FAMILY_IPV6 = 2 -}; - -/** - * All members are expressed in network byte order. - */ -[assert_size(6)] -struct PP_NetAddress_IPv4_Dev { - /** - * Port number. - */ - uint16_t port; - /** - * IPv4 address. - */ - uint8_t[4] addr; -}; - -/** - * All members are expressed in network byte order. - */ -[assert_size(18)] -struct PP_NetAddress_IPv6_Dev { - /** - * Port number. - */ - uint16_t port; - /** - * IPv6 address. - */ - uint8_t[16] addr; -}; - -/** - * The <code>PPB_NetAddress_Dev</code> interface provides operations on - * network addresses. - */ -interface PPB_NetAddress_Dev { - /** - * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv4 - * address. - */ - PP_Resource CreateFromIPv4Address([in] PP_Instance instance, - [in] PP_NetAddress_IPv4_Dev ipv4_addr); - - /** - * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv6 - * address. - */ - PP_Resource CreateFromIPv6Address([in] PP_Instance instance, - [in] PP_NetAddress_IPv6_Dev ipv6_addr); - - /** - * Determines if a given resource is a network address. - */ - PP_Bool IsNetAddress([in] PP_Resource addr); - - /** - * Gets the address family. - */ - PP_NetAddress_Family_Dev GetFamily([in] PP_Resource addr); - - /** - * Returns a human-readable description of the network address. The - * description is in the form of host [ ":" port ] and conforms to - * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses - * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). - * Returns an undefined var on failure. - */ - PP_Var DescribeAsString([in] PP_Resource addr, - [in] PP_Bool include_port); - - /** - * Fills a <code>PP_NetAddress_IPv4_Dev</code> structure if the network - * address is of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. - * Returns PP_FALSE on failure. Note that passing a network address of - * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the - * address is an IPv4-mapped IPv6 address. - */ - PP_Bool DescribeAsIPv4Address([in] PP_Resource addr, - [out] PP_NetAddress_IPv4_Dev ipv4_addr); - - /** - * Fills a <code>PP_NetAddress_IPv6_Dev</code> structure if the network - * address is of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. - * Returns PP_FALSE on failure. Note that passing a network address of - * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this - * method doesn't map it to an IPv6 address. - */ - PP_Bool DescribeAsIPv6Address([in] PP_Resource addr, - [out] PP_NetAddress_IPv6_Dev ipv6_addr); -}; diff --git a/ppapi/api/dev/ppb_tcp_socket_dev.idl b/ppapi/api/dev/ppb_tcp_socket_dev.idl deleted file mode 100644 index dfc038ad1d..0000000000 --- a/ppapi/api/dev/ppb_tcp_socket_dev.idl +++ /dev/null @@ -1,115 +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. - */ - -/** - * This file defines the <code>PPB_TCPSocket_Dev</code> interface. - */ - -[generate_thunk] - -label Chrome { - M29 = 0.1 -}; - -[assert_size(4)] -enum PP_TCPSocket_Option_Dev { - // Disables coalescing of small writes to make TCP segments, and instead - // deliver data immediately. Value type is PP_VARTYPE_BOOL. - PP_TCPSOCKET_OPTION_NO_DELAY = 0, - - // Specifies the socket send buffer in bytes. Value's type should be - // PP_VARTYPE_INT32. - // Note: This is only treated as a hint for the browser to set the buffer - // size. Even if SetOption() reports that this option has been successfully - // set, the browser doesn't guarantee to conform to it. - PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1, - - // Specifies the socket receive buffer in bytes. Value's type should be - // PP_VARTYPE_INT32. - // Note: This is only treated as a hint for the browser to set the buffer - // size. Even if SetOption() reports that this option has been successfully - // set, the browser doesn't guarantee to conform to it. - PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 -}; - -/** - * The <code>PPB_TCPSocket_Dev</code> interface provides TCP socket operations. - */ -interface PPB_TCPSocket_Dev { - /** - * Allocates a TCP socket resource. - */ - PP_Resource Create([in] PP_Instance instance); - - /** - * Determines if a given resource is TCP socket. - */ - PP_Bool IsTCPSocket([in] PP_Resource resource); - - /** - * Connects to an address given by |addr|, which is a PPB_NetAddress_Dev - * resource. - */ - int32_t Connect([in] PP_Resource tcp_socket, - [in] PP_Resource addr, - [in] PP_CompletionCallback callback); - - /** - * Gets the local address of the socket, if it has been connected. - * Returns a PPB_NetAddress_Dev resource on success; returns 0 on failure. - */ - PP_Resource GetLocalAddress([in] PP_Resource tcp_socket); - - /** - * Gets the remote address of the socket, if it has been connected. - * Returns a PPB_NetAddress_Dev resource on success; returns 0 on failure. - */ - PP_Resource GetRemoteAddress([in] PP_Resource tcp_socket); - - /** - * Reads data from the socket. The size of |buffer| must be at least as large - * as |bytes_to_read|. May perform a partial read. Returns the number of bytes - * read or an error code. If the return value is 0, then it indicates that - * end-of-file was reached. - * - * Multiple outstanding read requests are not supported. - */ - int32_t Read([in] PP_Resource tcp_socket, - [out] str_t buffer, - [in] int32_t bytes_to_read, - [in] PP_CompletionCallback callback); - - /** - * Writes data to the socket. May perform a partial write. Returns the number - * of bytes written or an error code. - * - * Multiple outstanding write requests are not supported. - */ - int32_t Write([in] PP_Resource tcp_socket, - [in] str_t buffer, - [in] int32_t bytes_to_write, - [in] PP_CompletionCallback callback); - - /** - * Cancels any IO that may be pending, and disconnects the socket. Any pending - * callbacks will still run, reporting PP_ERROR_ABORTED if pending IO was - * interrupted. It is NOT valid to call Connect() again after a call to this - * method. Note: If the socket is destroyed when it is still connected, then - * it will be implicitly disconnected, so you are not required to call this - * method. - */ - void Close([in] PP_Resource tcp_socket); - - /** - * Sets an option on |tcp_socket|. Supported |name| and |value| parameters - * are as described for PP_TCPSocketOption_Dev. |callback| will be - * invoked with PP_OK if setting the option succeeds, or an error code - * otherwise. The socket must be connected before SetOption is called. - */ - int32_t SetOption([in] PP_Resource tcp_socket, - [in] PP_TCPSocket_Option_Dev name, - [in] PP_Var value, - [in] PP_CompletionCallback callback); -}; diff --git a/ppapi/api/dev/ppb_trace_event_dev.idl b/ppapi/api/dev/ppb_trace_event_dev.idl index ff01dea328..8e483cd6e8 100644 --- a/ppapi/api/dev/ppb_trace_event_dev.idl +++ b/ppapi/api/dev/ppb_trace_event_dev.idl @@ -9,9 +9,15 @@ */ label Chrome { - M25 = 0.1 + M25 = 0.1, + M29 = 0.2 }; +/** + * A trace event timestamp. + */ +typedef int64_t PP_TraceEventTime; + interface PPB_Trace_Event_Dev { /** * Gets a pointer to a character for identifying a category name in the @@ -43,6 +49,34 @@ interface PPB_Trace_Event_Dev { [in] uint8_t flags); /** + * Version of the above interface that allows specifying a custom thread id + * and timestamp. This is useful for when tracing data cannot be registered + * in real time. For example, this could be used by storing timestamps + * internally and then registering the events retroactively. + */ + [version=0.2] + void AddTraceEventWithThreadIdAndTimestamp( + [in] int8_t phase, + [in] mem_t category_enabled, + [in] cstr_t name, + [in] uint64_t id, + [in] int32_t thread_id, + [in] PP_TraceEventTime timestamp, + [in] uint32_t num_args, + [in, size_as=num_args] str_t[] arg_names, + [in, size_as=num_args] uint8_t[] arg_types, + [in, size_as=num_args] uint64_t[] arg_values, + [in] uint8_t flags); + + /** + * Get the current clock value. Since this uses the same function as the trace + * events use internally, it can be used to create events with explicit time + * stamps. + */ + [version=0.2] + PP_TraceEventTime Now(); + + /** * Sets the thread name of the calling thread in the tracing system so it will * show up properly in chrome://tracing. */ diff --git a/ppapi/api/dev/ppb_udp_socket_dev.idl b/ppapi/api/dev/ppb_udp_socket_dev.idl deleted file mode 100644 index 32ad30a81b..0000000000 --- a/ppapi/api/dev/ppb_udp_socket_dev.idl +++ /dev/null @@ -1,107 +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. - */ - -/** - * This file defines the <code>PPB_UDPSocket_Dev</code> interface. - * TODO(yzshen): Tidy up the document. - */ - -[generate_thunk] - -label Chrome { - M29 = 0.1 -}; - -[assert_size(4)] -enum PP_UDPSocket_Option_Dev { - // Allows the socket to share the local address to which it will be bound with - // other processes. Value's type should be PP_VARTYPE_BOOL. - PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, - - // Allows sending and receiving packets to and from broadcast addresses. - // Value's type should be PP_VARTYPE_BOOL. - PP_UDPSOCKET_OPTION_BROADCAST = 1, - - // Specifies the total per-socket buffer space reserved for sends. Value's - // type should be PP_VARTYPE_INT32. - // Note: This is only treated as a hint for the browser to set the buffer - // size. Even if SetOption() reports that this option has been successfully - // set, the browser doesn't guarantee it will conform to it. - PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, - - // Specifies the total per-socket buffer space reserved for receives. Value's - // type should be PP_VARTYPE_INT32. - // Note: This is only treated as a hint for the browser to set the buffer - // size. Even if SetOption() reports that this option has been successfully - // set, the browser doesn't guarantee it will conform to it. - PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 -}; - -interface PPB_UDPSocket_Dev { - /** - * Creates a UDP socket resource. - */ - PP_Resource Create([in] PP_Instance instance); - - /** - * Determines if a given resource is a UDP socket. - */ - PP_Bool IsUDPSocket([in] PP_Resource resource); - - /** - * Binds to the address given by |addr|, which is a PPB_NetAddress_Dev - * resource. - */ - int32_t Bind([in] PP_Resource udp_socket, - [in] PP_Resource addr, - [in] PP_CompletionCallback callback); - - /** - * Returns the address that the socket has bound to, as a PPB_NetAddress_Dev - * resource. Bind must be called and succeed first. Returns 0 if Bind fails, - * or if Close has been called. - */ - PP_Resource GetBoundAddress([in] PP_Resource udp_socket); - - /** - * Performs a non-blocking recvfrom call on socket. - * Bind must be called first. |callback| is invoked when recvfrom reads data. - * |addr| will store a PPB_NetAddress_Dev resource on success. - */ - int32_t RecvFrom([in] PP_Resource udp_socket, - [out] str_t buffer, - [in] int32_t num_bytes, - [out] PP_Resource addr, - [in] PP_CompletionCallback callback); - - /** - * Performs a non-blocking sendto call on the socket. - * Bind must be called first. |addr| is a PPB_NetAddress_Dev resource holding - * the target address. |callback| is invoked when sendto completes. - */ - int32_t SendTo([in] PP_Resource udp_socket, - [in] str_t buffer, - [in] int32_t num_bytes, - [in] PP_Resource addr, - [in] PP_CompletionCallback callback); - - /** - * Cancels all pending reads and writes, and closes the socket. - */ - void Close([in] PP_Resource udp_socket); - - /** - * Sets a socket option to |udp_socket|. Should be called before Bind(). - * See the PP_UDPSocket_Option_Dev description for option names, value types - * and allowed values. - * Returns PP_OK on success. Otherwise, returns PP_ERROR_BADRESOURCE (if bad - * |udp_socket| provided), PP_ERROR_BADARGUMENT (if bad name/value/value's - * type provided) or PP_ERROR_FAILED in the case of internal errors. - */ - int32_t SetOption([in] PP_Resource udp_socket, - [in] PP_UDPSocket_Option_Dev name, - [in] PP_Var value, - [in] PP_CompletionCallback callback); -}; diff --git a/ppapi/api/pp_time.idl b/ppapi/api/pp_time.idl index 02de3aef69..fdcac59be4 100644 --- a/ppapi/api/pp_time.idl +++ b/ppapi/api/pp_time.idl @@ -4,7 +4,7 @@ */ /** - * This file defines time and time ticks types. + * This file defines time, time ticks and time delta types. */ @@ -29,3 +29,9 @@ typedef double_t PP_Time; [assert_size(8)] typedef double_t PP_TimeTicks; +/** + * A <code>PP_TimeDelta</code> value represents a duration of time which is + * measured in seconds. + */ +[assert_size(8)] +typedef double_t PP_TimeDelta; diff --git a/ppapi/api/ppb_host_resolver.idl b/ppapi/api/ppb_host_resolver.idl new file mode 100644 index 0000000000..20ff906a37 --- /dev/null +++ b/ppapi/api/ppb_host_resolver.idl @@ -0,0 +1,141 @@ +/* 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. + */ + +/** + * This file defines the <code>PPB_HostResolver</code> interface. + */ + +[generate_thunk] + +label Chrome { + M29 = 1.0 +}; + +/** + * <code>PP_HostResolver_Flag</code> is an enumeration of flags which can be + * OR-ed and passed to the host resolver. Currently there is only one flag + * defined. + */ +[assert_size(4)] +enum PP_HostResolver_Flag { + /** + * Hint to request the canonical name of the host, which can be retrieved by + * <code>GetCanonicalName()</code>. + */ + PP_HOSTRESOLVER_FLAG_CANONNAME = 1 << 0 +}; + +/** + * <code>PP_HostResolver_Hint</code> represents hints for host resolution. + */ +[assert_size(8)] +struct PP_HostResolver_Hint { + /** + * Network address family. + */ + PP_NetAddress_Family family; + /** + * Combination of flags from <code>PP_HostResolver_Flag</code>. + */ + int32_t flags; +}; + +/** + * The <code>PPB_HostResolver</code> interface supports host name + * resolution. + * + * Permissions: In order to run <code>Resolve()</code>, apps permission + * <code>socket</code> with subrule <code>resolve-host</code> is required. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +interface PPB_HostResolver { + /** + * Creates a host resolver resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a host reslover or 0 + * on failure. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a host resolver. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a + * <code>PPB_HostResolver</code> resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool IsHostResolver([in] PP_Resource resource); + + /** + * Requests resolution of a host name. If the call completes successfully, the + * results can be retrieved by <code>GetCanonicalName()</code>, + * <code>GetNetAddressCount()</code> and <code>GetNetAddress()</code>. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * @param[in] host The host name (or IP address literal) to resolve. + * @param[in] port The port number to be set in the resulting network + * addresses. + * @param[in] hint A <code>PP_HostResolver_Hint</code> structure providing + * hints for host resolution. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. <code>PP_ERROR_NAME_NOT_RESOLVED</code> will be + * returned if the host name couldn't be resolved. + */ + int32_t Resolve([in] PP_Resource host_resolver, + [in] str_t host, + [in] uint16_t port, + [in] PP_HostResolver_Hint hint, + [in] PP_CompletionCallback callback); + + /** + * Gets the canonical name of the host. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * + * @return A string <code>PP_Var</code> on success, which is an empty string + * if <code>PP_HOSTRESOLVER_FLAG_CANONNAME</code> is not set in the hint flags + * when calling <code>Resolve()</code>; an undefined <code>PP_Var</code> if + * there is a pending <code>Resolve()</code> call or the previous + * <code>Resolve()</code> call failed. + */ + PP_Var GetCanonicalName([in] PP_Resource host_resolver); + + /** + * Gets the number of network addresses. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * + * @return The number of available network addresses on success; 0 if there is + * a pending <code>Resolve()</code> call or the previous + * <code>Resolve()</code> call failed. + */ + uint32_t GetNetAddressCount([in] PP_Resource host_resolver); + + /** + * Gets a network address. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * @param[in] index An index indicating which address to return. + * + * @return A <code>PPB_NetAddress</code> resource on success; 0 if there is a + * pending <code>Resolve()</code> call or the previous <code>Resolve()</code> + * call failed, or the specified index is out of range. + */ + PP_Resource GetNetAddress([in] PP_Resource host_resolver, + [in] uint32_t index); +}; diff --git a/ppapi/api/ppb_net_address.idl b/ppapi/api/ppb_net_address.idl new file mode 100644 index 0000000000..ddd69b57e0 --- /dev/null +++ b/ppapi/api/ppb_net_address.idl @@ -0,0 +1,169 @@ +/* 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. + */ + +/** + * This file defines the <code>PPB_NetAddress</code> interface. + */ + +label Chrome { + M29 = 1.0 +}; + +/** + * Network address family types. + */ +[assert_size(4)] +enum PP_NetAddress_Family { + /** + * The address family is unspecified. + */ + PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, + /** + * The Internet Protocol version 4 (IPv4) address family. + */ + PP_NETADDRESS_FAMILY_IPV4 = 1, + /** + * The Internet Protocol version 6 (IPv6) address family. + */ + PP_NETADDRESS_FAMILY_IPV6 = 2 +}; + +/** + * All members are expressed in network byte order. + */ +[assert_size(6)] +struct PP_NetAddress_IPv4 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv4 address. + */ + uint8_t[4] addr; +}; + +/** + * All members are expressed in network byte order. + */ +[assert_size(18)] +struct PP_NetAddress_IPv6 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv6 address. + */ + uint8_t[16] addr; +}; + +/** + * The <code>PPB_NetAddress</code> interface provides operations on network + * addresses. + */ +interface PPB_NetAddress { + /** + * Creates a <code>PPB_NetAddress</code> resource with the specified IPv4 + * address. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * @param[in] ipv4_addr An IPv4 address. + * + * @return A <code>PP_Resource</code> representing the same address as + * <code>ipv4_addr</code> or 0 on failure. + */ + PP_Resource CreateFromIPv4Address([in] PP_Instance instance, + [in] PP_NetAddress_IPv4 ipv4_addr); + + /** + * Creates a <code>PPB_NetAddress</code> resource with the specified IPv6 + * address. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * @param[in] ipv6_addr An IPv6 address. + * + * @return A <code>PP_Resource</code> representing the same address as + * <code>ipv6_addr</code> or 0 on failure. + */ + PP_Resource CreateFromIPv6Address([in] PP_Instance instance, + [in] PP_NetAddress_IPv6 ipv6_addr); + + /** + * Determines if a given resource is a network address. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a <code>PPB_NetAddress</code> + * resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool IsNetAddress([in] PP_Resource resource); + + /** + * Gets the address family. + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * + * @return The address family on success; + * <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure. + */ + PP_NetAddress_Family GetFamily([in] PP_Resource addr); + + /** + * Returns a human-readable description of the network address. The + * description is in the form of host [ ":" port ] and conforms to + * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses + * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * @param[in] include_port Whether to include the port number in the + * description. + * + * @return A string <code>PP_Var</code> on success; an undefined + * <code>PP_Var</code> on failure. + */ + PP_Var DescribeAsString([in] PP_Resource addr, + [in] PP_Bool include_port); + + /** + * Fills a <code>PP_NetAddress_IPv4</code> structure if the network address is + * of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. + * Note that passing a network address of + * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the + * address is an IPv4-mapped IPv6 address. + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * @param[out] ipv4_addr A <code>PP_NetAddress_IPv4</code> structure to store + * the result. + * + * @return A <code>PP_Bool</code> value indicating whether the operation + * succeeded. + */ + PP_Bool DescribeAsIPv4Address([in] PP_Resource addr, + [out] PP_NetAddress_IPv4 ipv4_addr); + + /** + * Fills a <code>PP_NetAddress_IPv6</code> structure if the network address is + * of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. + * Note that passing a network address of + * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this + * method doesn't map it to an IPv6 address. + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * @param[out] ipv6_addr A <code>PP_NetAddress_IPv6</code> structure to store + * the result. + * + * @return A <code>PP_Bool</code> value indicating whether the operation + * succeeded. + */ + PP_Bool DescribeAsIPv6Address([in] PP_Resource addr, + [out] PP_NetAddress_IPv6 ipv6_addr); +}; diff --git a/ppapi/api/ppb_network_proxy.idl b/ppapi/api/ppb_network_proxy.idl new file mode 100644 index 0000000000..6957f4a6ba --- /dev/null +++ b/ppapi/api/ppb_network_proxy.idl @@ -0,0 +1,53 @@ +/* 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. + */ + +/** + * This file defines the <code>PPB_NetworkProxy</code> interface. + */ + +[generate_thunk] + +label Chrome { + M29 = 1.0 +}; + +/** + * This interface provides a way to determine the appropriate proxy settings + * for a given URL. + * + * Permissions: Apps permission <code>socket</code> with subrule + * <code>resolve-proxy</code> is required for using this API. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +[singleton] +interface PPB_NetworkProxy { + /** + * Retrieves the proxy that will be used for the given URL. The result will + * be a string in PAC format. For more details about PAC format, please see + * http://en.wikipedia.org/wiki/Proxy_auto-config + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @param[in] url A string <code>PP_Var</code> containing a URL. + * + * @param[out] proxy_string A <code>PP_Var</code> that GetProxyForURL will + * set upon successful completion. If the call fails, <code>proxy_string + * </code> will be unchanged. Otherwise, it will be set to a string <code> + * PP_Var</code> containing the appropriate PAC string for <code>url</code>. + * If set, <code>proxy_string</code> will have a reference count of 1 which + * the plugin must manage. + * + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t GetProxyForURL([in] PP_Instance instance, + [in] PP_Var url, + [out] PP_Var proxy_string, + [in] PP_CompletionCallback callback); +}; diff --git a/ppapi/api/ppb_tcp_socket.idl b/ppapi/api/ppb_tcp_socket.idl new file mode 100644 index 0000000000..833879c67e --- /dev/null +++ b/ppapi/api/ppb_tcp_socket.idl @@ -0,0 +1,199 @@ +/* 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. + */ + +/** + * This file defines the <code>PPB_TCPSocket</code> interface. + */ + +[generate_thunk] + +label Chrome { + M29 = 1.0 +}; + +/** + * Option names used by <code>SetOption()</code>. + */ +[assert_size(4)] +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>. + * This option can only be set after a successful <code>Connect()</code> call. + */ + PP_TCPSOCKET_OPTION_NO_DELAY = 0, + + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * This option can only be set after a successful <code>Connect()</code> call. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1, + + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * This option can only be set after a successful <code>Connect()</code> call. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 +}; + +/** + * 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 { + /** + * Creates a TCP socket resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0 + * on failure. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a TCP socket. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a + * <code>PPB_TCPSocket</code> resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool IsTCPSocket([in] PP_Resource resource); + + /** + * Connects the socket to the given address. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[in] addr A <code>PPB_NetAddress</code> resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>, + * including (but not limited to): + * - <code>PP_ERROR_NOACCESS</code>: the caller doesn't have required + * permissions. + * - <code>PP_ERROR_ADDRESS_UNREACHABLE</code>: <code>addr</code> is + * unreachable. + * - <code>PP_ERROR_CONNECTION_REFUSED</code>: the connection attempt was + * refused. + * - <code>PP_ERROR_CONNECTION_FAILED</code>: the connection attempt failed. + * - <code>PP_ERROR_CONNECTION_TIMEDOUT</code>: the connection attempt timed + * out. + */ + int32_t Connect([in] PP_Resource tcp_socket, + [in] PP_Resource addr, + [in] PP_CompletionCallback callback); + + /** + * Gets the local address of the socket, if it is connected. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * + * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. + */ + PP_Resource GetLocalAddress([in] PP_Resource tcp_socket); + + /** + * Gets the remote address of the socket, if it is connected. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * + * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. + */ + PP_Resource GetRemoteAddress([in] PP_Resource tcp_socket); + + /** + * Reads data from the socket. The socket must be connected. It may perform a + * partial read. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as <code>bytes_to_read</code>. + * @param[in] bytes_to_read The number of bytes to read. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been read, 0 means that end-of-file was reached; otherwise, an error code + * from <code>pp_errors.h</code>. + */ + int32_t Read([in] PP_Resource tcp_socket, + [out] str_t buffer, + [in] int32_t bytes_to_read, + [in] PP_CompletionCallback callback); + + /** + * Writes data to the socket. The socket must be connected. It may perform a + * partial write. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[in] buffer The buffer containing the data to write. + * @param[in] bytes_to_write The number of bytes to write. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been written; otherwise, an error code from <code>pp_errors.h</code>. + */ + int32_t Write([in] PP_Resource tcp_socket, + [in] str_t buffer, + [in] int32_t bytes_to_write, + [in] PP_CompletionCallback callback); + + /** + * Cancels all pending reads and writes and disconnects the socket. Any + * pending callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> + * if pending IO was interrupted. After a call to this method, no output + * buffer pointers passed into previous <code>Read()</code> calls will be + * accessed. It is not valid to call <code>Connect()</code> again. + * + * The socket is implicitly closed if it is destroyed, so you are not required + * to call this method. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + */ + void Close([in] PP_Resource tcp_socket); + + /** + * Sets a socket option on the TCP socket. + * 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 + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @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 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 new file mode 100644 index 0000000000..e4c87b2a1c --- /dev/null +++ b/ppapi/api/ppb_udp_socket.idl @@ -0,0 +1,196 @@ +/* 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. + */ + +/** + * This file defines the <code>PPB_UDPSocket</code> interface. + */ + +[generate_thunk] + +label Chrome { + M29 = 1.0 +}; + +/** + * Option names used by <code>SetOption()</code>. + */ +[assert_size(4)] +enum PP_UDPSocket_Option { + /** + * Allows the socket to share the local address to which it will be bound with + * other processes. Value's type should be <code>PP_VARTYPE_BOOL</code>. + * This option can only be set before calling <code>Bind()</code>. + */ + PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, + + /** + * Allows sending and receiving packets to and from broadcast addresses. + * Value's type should be <code>PP_VARTYPE_BOOL</code>. + * This option can only be set before calling <code>Bind()</code>. + */ + PP_UDPSOCKET_OPTION_BROADCAST = 1, + + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * This option can only be set after a successful <code>Bind()</code> call. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, + + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * This option can only be set after a successful <code>Bind()</code> call. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 +}; + +/** + * The <code>PPB_UDPSocket</code> interface provides UDP socket operations. + * + * Permissions: Apps permission <code>socket</code> with subrule + * <code>udp-bind</code> is required for <code>Bind()</code>; subrule + * <code>udp-send-to</code> is required for <code>SendTo()</code>. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +interface PPB_UDPSocket { + /** + * Creates a UDP socket resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a UDP socket or 0 + * on failure. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a UDP socket. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a <code>PPB_UDPSocket</code> + * resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool IsUDPSocket([in] PP_Resource resource); + + /** + * Binds the socket to the given address. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] addr A <code>PPB_NetAddress</code> resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. <code>PP_ERROR_ADDRESS_IN_USE</code> will be returned + * if the address is already in use. + */ + int32_t Bind([in] PP_Resource udp_socket, + [in] PP_Resource addr, + [in] PP_CompletionCallback callback); + + /** + * Gets the address that the socket is bound to. The socket must be bound. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * + * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. + */ + PP_Resource GetBoundAddress([in] PP_Resource udp_socket); + + /** + * Receives data from the socket and stores the source address. The socket + * must be bound. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as <code>num_bytes</code>. + * @param[in] num_bytes The number of bytes to receive. + * @param[out] addr A <code>PPB_NetAddress</code> resource to store the source + * address on success. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been received; otherwise, an error code from <code>pp_errors.h</code>. + */ + int32_t RecvFrom([in] PP_Resource udp_socket, + [out] str_t buffer, + [in] int32_t num_bytes, + [out] PP_Resource addr, + [in] PP_CompletionCallback callback); + + /** + * Sends data to a specific destination. The socket must be bound. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] buffer The buffer containing the data to send. + * @param[in] num_bytes The number of bytes to send. + * @param[in] addr A <code>PPB_NetAddress</code> resource holding the + * destination address. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been sent; otherwise, an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. + */ + int32_t SendTo([in] PP_Resource udp_socket, + [in] str_t buffer, + [in] int32_t num_bytes, + [in] PP_Resource addr, + [in] PP_CompletionCallback callback); + + /** + * Cancels all pending reads and writes, and closes the socket. Any pending + * callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> if + * pending IO was interrupted. After a call to this method, no output + * parameters passed into previous <code>RecvFrom()</code> calls will be + * accessed. It is not valid to call <code>Bind()</code> again. + * + * The socket is implicitly closed if it is destroyed, so you are not + * required to call this method. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + */ + void Close([in] PP_Resource udp_socket); + + /** + * Sets a socket option on the UDP socket. + * Please see the <code>PP_UDPSocket_Option</code> description for option + * names, value types and allowed values. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t SetOption([in] PP_Resource udp_socket, + [in] PP_UDPSocket_Option name, + [in] PP_Var value, + [in] PP_CompletionCallback callback); +}; diff --git a/ppapi/api/dev/ppb_var_array_dev.idl b/ppapi/api/ppb_var_array.idl index 78db3b0e9c..9925e4471f 100644 --- a/ppapi/api/dev/ppb_var_array_dev.idl +++ b/ppapi/api/ppb_var_array.idl @@ -1,19 +1,19 @@ -/* Copyright (c) 2013 The Chromium Authors. All rights reserved. +/* 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. */ /** - * This file defines the <code>PPB_VarArray_Dev</code> struct providing + * This file defines the <code>PPB_VarArray</code> struct providing * a way to interact with array vars. */ label Chrome { - M27 = 0.1 + M29 = 1.0 }; -[macro="PPB_VAR_ARRAY_DEV_INTERFACE"] -interface PPB_VarArray_Dev { +[macro="PPB_VAR_ARRAY_INTERFACE"] +interface PPB_VarArray { /** * Creates an array var, i.e., a <code>PP_Var</code> with type set to * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0. @@ -29,9 +29,10 @@ interface PPB_VarArray_Dev { * @param[in] array An array var. * @param[in] index An index indicating which element to return. * - * @return The element at the specified position. The reference count is - * incremented on behalf of the caller. If <code>index</code> is larger than - * or equal to the array length, an undefined var is returned. + * @return The element at the specified position. The reference count of the + * element returned is incremented on behalf of the caller. If + * <code>index</code> is larger than or equal to the array length, an + * undefined var is returned. */ PP_Var Get([in] PP_Var array, [in] uint32_t index); @@ -66,9 +67,9 @@ interface PPB_VarArray_Dev { * @param[in] array An array var. * @param[in] length The new array length. If <code>length</code> is smaller * than its current value, the array is truncated to the new length; any - * elements that no longer fit are removed. If <code>length</code> is larger - * than its current value, undefined vars are appended to increase the array - * to the specified length. + * elements that no longer fit are removed and the references to them will be + * released. If <code>length</code> is larger than its current value, + * undefined vars are appended to increase the array to the specified length. * * @return A <code>PP_Bool</code> indicating whether the operation succeeds. */ diff --git a/ppapi/api/dev/ppb_var_dictionary_dev.idl b/ppapi/api/ppb_var_dictionary.idl index f3e7407438..b4b9c06070 100644 --- a/ppapi/api/dev/ppb_var_dictionary_dev.idl +++ b/ppapi/api/ppb_var_dictionary.idl @@ -1,15 +1,15 @@ -/* Copyright (c) 2013 The Chromium Authors. All rights reserved. +/* 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. */ /** - * This file defines the <code>PPB_VarDictionary_Dev</code> struct providing + * This file defines the <code>PPB_VarDictionary</code> struct providing * a way to interact with dictionary vars. */ label Chrome { - M27 = 0.1 + M29 = 1.0 }; /** @@ -17,8 +17,8 @@ label Chrome { * strings while the values can be arbitrary vars. Key comparison is always * done by value instead of by reference. */ -[macro="PPB_VAR_DICTIONARY_DEV_INTERFACE"] -interface PPB_VarDictionary_Dev { +[macro="PPB_VAR_DICTIONARY_INTERFACE"] +interface PPB_VarDictionary { /** * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to * <code>PP_VARTYPE_DICTIONARY</code>. @@ -35,28 +35,29 @@ interface PPB_VarDictionary_Dev { * @param[in] key A string var. * * @return The value that is associated with <code>key</code>. The reference - * count is incremented on behalf of the caller. If <code>key</code> is not a - * string var, or it doesn't exist in <code>dict</code>, an undefined var is - * returned. + * count of the element returned is incremented on behalf of the caller. If + * <code>key</code> is not a string var, or it doesn't exist in + * <code>dict</code>, an undefined var is returned. */ PP_Var Get([in] PP_Var dict, [in] PP_Var key); /** - * Sets the value associated with the specified key. The dictionary is - * responsible for holding references to its children to keep them alive. + * Sets the value associated with the specified key. * * @param[in] dict A dictionary var. * @param[in] key A string var. If this key hasn't existed in * <code>dict</code>, it is added and associated with <code>value</code>; * otherwise, the previous value is replaced with <code>value</code>. - * @param[in] value The value to set. + * @param[in] value The value to set. The dictionary holds a reference to it + * on success. * * @return A <code>PP_Bool</code> indicating whether the operation succeeds. */ PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value); /** - * Deletes the specified key and its associated value, if the key exists. + * Deletes the specified key and its associated value, if the key exists. The + * reference to the element will be released. * * @param[in] dict A dictionary var. * @param[in] key A string var. diff --git a/ppapi/api/private/ppb_host_resolver_private.idl b/ppapi/api/private/ppb_host_resolver_private.idl index 4db93bf73a..f7b0e4a5c2 100644 --- a/ppapi/api/private/ppb_host_resolver_private.idl +++ b/ppapi/api/private/ppb_host_resolver_private.idl @@ -21,11 +21,11 @@ enum PP_HostResolver_Private_Flags { /** * AI_CANONNAME */ - PP_HOST_RESOLVER_FLAGS_CANONNAME = 1 << 0, + PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME = 1 << 0, /** * Hint to the resolver that only loopback addresses are configured. */ - PP_HOST_RESOLVER_FLAGS_LOOPBACK_ONLY = 1 << 1 + PP_HOST_RESOLVER_PRIVATE_FLAGS_LOOPBACK_ONLY = 1 << 1 }; [assert_size(8)] diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl index bb4dd7ce0d..a687bc2bbf 100644 --- a/ppapi/api/private/ppb_nacl_private.idl +++ b/ppapi/api/private/ppb_nacl_private.idl @@ -108,6 +108,33 @@ interface PPB_NaCl_Private { */ PP_FileHandle CreateTemporaryFile([in] PP_Instance instance); + /* Create a temporary file, which will be deleted by the time the last + * handle is closed (or earlier on POSIX systems), to use for the nexe + * with the cache key given by |cache_key|. If the nexe is already present + * in the cache, |is_hit| is set to PP_TRUE and the contents of the nexe + * will be copied into the temporary file. Otherwise |is_hit| is set to + * PP_FALSE and the temporary file will be writeable. + * Currently the implementation is a stub, which always sets is_hit to false + * and calls the implementation of CreateTemporaryFile. In a subsequent CL + * it will call into the browser which will remember the association between + * the cache key and the fd, and copy the nexe into the cache after the + * translation finishes. + */ + int32_t GetNexeFd([in] PP_Instance instance, + [in] str_t cache_key, + [out] PP_Bool is_hit, + [out] PP_FileHandle nexe_handle, + [in] PP_CompletionCallback callback); + + /* Report to the browser that translation of the pexe for |instance| + * has finished. The browser may then store the translation in the + * cache. The renderer must first have called GetNexeFd for the same + * instance. (It is not guaranteed to, however; if there is an error + * or the file is too big for the cache, or the browser is in incognito + * mode, no notification will be delivered to the plugin.) + */ + void ReportTranslationFinished([in] PP_Instance instance); + /* Return true if we are off the record. */ PP_Bool IsOffTheRecord(); diff --git a/ppapi/api/private/ppb_net_address_private.idl b/ppapi/api/private/ppb_net_address_private.idl index cf6804c822..9feb503050 100644 --- a/ppapi/api/private/ppb_net_address_private.idl +++ b/ppapi/api/private/ppb_net_address_private.idl @@ -19,15 +19,15 @@ enum PP_NetAddressFamily_Private { /** * The address family is unspecified. */ - PP_NETADDRESSFAMILY_UNSPECIFIED = 0, + PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED = 0, /** * The Internet Protocol version 4 (IPv4) address family. */ - PP_NETADDRESSFAMILY_IPV4 = 1, + PP_NETADDRESSFAMILY_PRIVATE_IPV4 = 1, /** * The Internet Protocol version 6 (IPv6) address family. */ - PP_NETADDRESSFAMILY_IPV6 = 2 + PP_NETADDRESSFAMILY_PRIVATE_IPV6 = 2 }; /** diff --git a/ppapi/api/private/ppb_tcp_socket_private.idl b/ppapi/api/private/ppb_tcp_socket_private.idl index 5c5d54af41..b9913bccfe 100644 --- a/ppapi/api/private/ppb_tcp_socket_private.idl +++ b/ppapi/api/private/ppb_tcp_socket_private.idl @@ -16,12 +16,12 @@ label Chrome { [assert_size(4)] enum PP_TCPSocketOption_Private { // Special value used for testing. Guaranteed to fail SetOption(). - PP_TCPSOCKETOPTION_INVALID = 0, + PP_TCPSOCKETOPTION_PRIVATE_INVALID = 0, // Disable coalescing of small writes to make TCP segments, and instead // deliver data immediately. For SSL sockets, this option must be set before // SSLHandshake() is called. Value type is PP_VARTYPE_BOOL. - PP_TCPSOCKETOPTION_NO_DELAY = 1 + PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY = 1 }; /** diff --git a/ppapi/api/private/ppb_udp_socket_private.idl b/ppapi/api/private/ppb_udp_socket_private.idl index fc4fe1c9c6..9888a548e9 100644 --- a/ppapi/api/private/ppb_udp_socket_private.idl +++ b/ppapi/api/private/ppb_udp_socket_private.idl @@ -18,15 +18,15 @@ enum PP_UDPSocketFeature_Private { // Allow the socket to share the local address to which socket will // be bound with other processes. Value's type should be // PP_VARTYPE_BOOL. - PP_UDPSOCKETFEATURE_ADDRESS_REUSE = 0, + PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE = 0, // Allow sending and receiving packets sent to and from broadcast // addresses. Value's type should be PP_VARTYPE_BOOL. - PP_UDPSOCKETFEATURE_BROADCAST = 1, + PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST = 1, // Special value for counting the number of available // features. Should not be passed to SetSocketFeature(). - PP_UDPSOCKETFEATURE_COUNT = 2 + PP_UDPSOCKETFEATURE_PRIVATE_COUNT = 2 }; interface PPB_UDPSocket_Private { diff --git a/ppapi/c/dev/ppb_audio_input_dev.h b/ppapi/c/dev/ppb_audio_input_dev.h index b47c7ea71a..2fd4d0709f 100644 --- a/ppapi/c/dev/ppb_audio_input_dev.h +++ b/ppapi/c/dev/ppb_audio_input_dev.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From dev/ppb_audio_input_dev.idl modified Tue Dec 04 15:13:31 2012. */ +/* From dev/ppb_audio_input_dev.idl modified Fri May 10 16:06:35 2013. */ #ifndef PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ #define PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ @@ -16,10 +16,12 @@ #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_2 "PPB_AudioInput(Dev);0.2" #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_3 "PPB_AudioInput(Dev);0.3" -#define PPB_AUDIO_INPUT_DEV_INTERFACE PPB_AUDIO_INPUT_DEV_INTERFACE_0_3 +#define PPB_AUDIO_INPUT_DEV_INTERFACE_0_4 "PPB_AudioInput(Dev);0.4" +#define PPB_AUDIO_INPUT_DEV_INTERFACE PPB_AUDIO_INPUT_DEV_INTERFACE_0_4 /** * @file @@ -36,10 +38,21 @@ * <code>PPB_AudioInput_Callback</code> defines the type of an audio callback * function used to provide the audio buffer with data. This callback will be * called on a separate thread from the creation thread. + * + * @param[in] sample_buffer A buffer providing audio input data. + * @param[in] buffer_size_in_bytes The size of the buffer in bytes. + * @param[in] latency The time that has elapsed since the data was recorded. + * @param[inout] user_data An opaque pointer that was passed into + * <code>PPB_AudioInput_Dev.Open()</code>. */ typedef void (*PPB_AudioInput_Callback)(const void* sample_buffer, uint32_t buffer_size_in_bytes, + PP_TimeDelta latency, void* user_data); + +typedef void (*PPB_AudioInput_Callback_0_2)(const void* sample_buffer, + uint32_t buffer_size_in_bytes, + void* user_data); /** * @} */ @@ -65,7 +78,7 @@ typedef void (*PPB_AudioInput_Callback)(const void* sample_buffer, * device. We may want to move the "recommend" functions to the input or output * classes rather than the config. */ -struct PPB_AudioInput_Dev_0_3 { +struct PPB_AudioInput_Dev_0_4 { /** * Creates an audio input resource. * @@ -196,7 +209,7 @@ struct PPB_AudioInput_Dev_0_3 { void (*Close)(PP_Resource audio_input); }; -typedef struct PPB_AudioInput_Dev_0_3 PPB_AudioInput_Dev; +typedef struct PPB_AudioInput_Dev_0_4 PPB_AudioInput_Dev; struct PPB_AudioInput_Dev_0_2 { PP_Resource (*Create)(PP_Instance instance); @@ -207,7 +220,28 @@ struct PPB_AudioInput_Dev_0_2 { int32_t (*Open)(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, - PPB_AudioInput_Callback audio_input_callback, + PPB_AudioInput_Callback_0_2 audio_input_callback, + void* user_data, + struct PP_CompletionCallback callback); + PP_Resource (*GetCurrentConfig)(PP_Resource audio_input); + PP_Bool (*StartCapture)(PP_Resource audio_input); + PP_Bool (*StopCapture)(PP_Resource audio_input); + void (*Close)(PP_Resource audio_input); +}; + +struct PPB_AudioInput_Dev_0_3 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsAudioInput)(PP_Resource resource); + int32_t (*EnumerateDevices)(PP_Resource audio_input, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + int32_t (*MonitorDeviceChange)(PP_Resource audio_input, + PP_MonitorDeviceChangeCallback callback, + void* user_data); + int32_t (*Open)(PP_Resource audio_input, + PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback_0_2 audio_input_callback, void* user_data, struct PP_CompletionCallback callback); PP_Resource (*GetCurrentConfig)(PP_Resource audio_input); diff --git a/ppapi/c/dev/ppb_host_resolver_dev.h b/ppapi/c/dev/ppb_host_resolver_dev.h deleted file mode 100644 index b1c01f2abf..0000000000 --- a/ppapi/c/dev/ppb_host_resolver_dev.h +++ /dev/null @@ -1,115 +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. - */ - -/* From dev/ppb_host_resolver_dev.idl modified Mon Jun 10 13:42:25 2013. */ - -#ifndef PPAPI_C_DEV_PPB_HOST_RESOLVER_DEV_H_ -#define PPAPI_C_DEV_PPB_HOST_RESOLVER_DEV_H_ - -#include "ppapi/c/dev/ppb_net_address_dev.h" -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_var.h" - -#define PPB_HOSTRESOLVER_DEV_INTERFACE_0_1 "PPB_HostResolver(Dev);0.1" -#define PPB_HOSTRESOLVER_DEV_INTERFACE PPB_HOSTRESOLVER_DEV_INTERFACE_0_1 - -/** - * @file - * This file defines the <code>PPB_HostResolver_Dev</code> interface. - * TODO(yzshen): Tidy up the document. - */ - - -/** - * @addtogroup Enums - * @{ - */ -/** - * The <code>PP_HostResolver_Flags_Dev</code> is an enumeration of the - * different types of flags, that can be OR-ed and passed to host - * resolver. - */ -typedef enum { - /** - * AI_CANONNAME - */ - PP_HOSTRESOLVER_FLAGS_CANONNAME = 1 << 0, - /** - * Hint to the resolver that only loopback addresses are configured. - */ - PP_HOSTRESOLVER_FLAGS_LOOPBACK_ONLY = 1 << 1 -} PP_HostResolver_Flags_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Flags_Dev, 4); -/** - * @} - */ - -/** - * @addtogroup Structs - * @{ - */ -struct PP_HostResolver_Hint_Dev { - PP_NetAddress_Family_Dev family; - int32_t flags; -}; -PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_HostResolver_Hint_Dev, 8); -/** - * @} - */ - -/** - * @addtogroup Interfaces - * @{ - */ -struct PPB_HostResolver_Dev_0_1 { - /** - * Allocates a Host Resolver resource. - */ - PP_Resource (*Create)(PP_Instance instance); - /** - * Determines if a given resource is a Host Resolver. - */ - PP_Bool (*IsHostResolver)(PP_Resource resource); - /** - * Creates a new request to Host Resolver. |callback| is invoked when request - * is processed and a list of network addresses is obtained. These addresses - * can be used in Connect, Bind or Listen calls to connect to a given |host| - * and |port|. - */ - int32_t (*Resolve)(PP_Resource host_resolver, - const char* host, - uint16_t port, - const struct PP_HostResolver_Hint_Dev* hint, - struct PP_CompletionCallback callback); - /** - * Gets canonical name of host. Returns an undefined var if there is a pending - * Resolve call or the previous Resolve call failed. - */ - struct PP_Var (*GetCanonicalName)(PP_Resource host_resolver); - /** - * Gets number of network addresses obtained after Resolve call. Returns 0 if - * there is a pending Resolve call or the previous Resolve call failed. - */ - uint32_t (*GetNetAddressCount)(PP_Resource host_resolver); - /** - * Gets the |index|-th network address. - * Returns 0 if there is a pending Resolve call or the previous Resolve call - * failed, or |index| is not less than the number of available addresses. - */ - PP_Resource (*GetNetAddress)(PP_Resource host_resolver, uint32_t index); -}; - -typedef struct PPB_HostResolver_Dev_0_1 PPB_HostResolver_Dev; -/** - * @} - */ - -#endif /* PPAPI_C_DEV_PPB_HOST_RESOLVER_DEV_H_ */ - diff --git a/ppapi/c/dev/ppb_net_address_dev.h b/ppapi/c/dev/ppb_net_address_dev.h deleted file mode 100644 index 3ce3f523b7..0000000000 --- a/ppapi/c/dev/ppb_net_address_dev.h +++ /dev/null @@ -1,152 +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. - */ - -/* From dev/ppb_net_address_dev.idl modified Mon Jun 10 17:42:43 2013. */ - -#ifndef PPAPI_C_DEV_PPB_NET_ADDRESS_DEV_H_ -#define PPAPI_C_DEV_PPB_NET_ADDRESS_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_var.h" - -#define PPB_NETADDRESS_DEV_INTERFACE_0_1 "PPB_NetAddress(Dev);0.1" -#define PPB_NETADDRESS_DEV_INTERFACE PPB_NETADDRESS_DEV_INTERFACE_0_1 - -/** - * @file - * This file defines the <code>PPB_NetAddress_Dev</code> interface. - */ - - -/** - * @addtogroup Enums - * @{ - */ -typedef enum { - /** - * The address family is unspecified. - */ - PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, - /** - * The Internet Protocol version 4 (IPv4) address family. - */ - PP_NETADDRESS_FAMILY_IPV4 = 1, - /** - * The Internet Protocol version 6 (IPv6) address family. - */ - PP_NETADDRESS_FAMILY_IPV6 = 2 -} PP_NetAddress_Family_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddress_Family_Dev, 4); -/** - * @} - */ - -/** - * @addtogroup Structs - * @{ - */ -/** - * All members are expressed in network byte order. - */ -struct PP_NetAddress_IPv4_Dev { - /** - * Port number. - */ - uint16_t port; - /** - * IPv4 address. - */ - uint8_t addr[4]; -}; -PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv4_Dev, 6); - -/** - * All members are expressed in network byte order. - */ -struct PP_NetAddress_IPv6_Dev { - /** - * Port number. - */ - uint16_t port; - /** - * IPv6 address. - */ - uint8_t addr[16]; -}; -PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv6_Dev, 18); -/** - * @} - */ - -/** - * @addtogroup Interfaces - * @{ - */ -/** - * The <code>PPB_NetAddress_Dev</code> interface provides operations on - * network addresses. - */ -struct PPB_NetAddress_Dev_0_1 { - /** - * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv4 - * address. - */ - PP_Resource (*CreateFromIPv4Address)( - PP_Instance instance, - const struct PP_NetAddress_IPv4_Dev* ipv4_addr); - /** - * Creates a <code>PPB_NetAddress_Dev</code> resource with the specified IPv6 - * address. - */ - PP_Resource (*CreateFromIPv6Address)( - PP_Instance instance, - const struct PP_NetAddress_IPv6_Dev* ipv6_addr); - /** - * Determines if a given resource is a network address. - */ - PP_Bool (*IsNetAddress)(PP_Resource addr); - /** - * Gets the address family. - */ - PP_NetAddress_Family_Dev (*GetFamily)(PP_Resource addr); - /** - * Returns a human-readable description of the network address. The - * description is in the form of host [ ":" port ] and conforms to - * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses - * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). - * Returns an undefined var on failure. - */ - struct PP_Var (*DescribeAsString)(PP_Resource addr, PP_Bool include_port); - /** - * Fills a <code>PP_NetAddress_IPv4_Dev</code> structure if the network - * address is of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. - * Returns PP_FALSE on failure. Note that passing a network address of - * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the - * address is an IPv4-mapped IPv6 address. - */ - PP_Bool (*DescribeAsIPv4Address)(PP_Resource addr, - struct PP_NetAddress_IPv4_Dev* ipv4_addr); - /** - * Fills a <code>PP_NetAddress_IPv6_Dev</code> structure if the network - * address is of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. - * Returns PP_FALSE on failure. Note that passing a network address of - * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this - * method doesn't map it to an IPv6 address. - */ - PP_Bool (*DescribeAsIPv6Address)(PP_Resource addr, - struct PP_NetAddress_IPv6_Dev* ipv6_addr); -}; - -typedef struct PPB_NetAddress_Dev_0_1 PPB_NetAddress_Dev; -/** - * @} - */ - -#endif /* PPAPI_C_DEV_PPB_NET_ADDRESS_DEV_H_ */ - diff --git a/ppapi/c/dev/ppb_tcp_socket_dev.h b/ppapi/c/dev/ppb_tcp_socket_dev.h deleted file mode 100644 index d59bc31af3..0000000000 --- a/ppapi/c/dev/ppb_tcp_socket_dev.h +++ /dev/null @@ -1,136 +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. - */ - -/* From dev/ppb_tcp_socket_dev.idl modified Wed Jun 12 11:16:37 2013. */ - -#ifndef PPAPI_C_DEV_PPB_TCP_SOCKET_DEV_H_ -#define PPAPI_C_DEV_PPB_TCP_SOCKET_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_resource.h" -#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 - -/** - * @file - * This file defines the <code>PPB_TCPSocket_Dev</code> interface. - */ - - -/** - * @addtogroup Enums - * @{ - */ -typedef enum { - /* Disables coalescing of small writes to make TCP segments, and instead - * deliver data immediately. Value type is PP_VARTYPE_BOOL. */ - PP_TCPSOCKET_OPTION_NO_DELAY = 0, - /* Specifies the socket send buffer in bytes. Value's type should be - * PP_VARTYPE_INT32. - * Note: This is only treated as a hint for the browser to set the buffer - * size. Even if SetOption() reports that this option has been successfully - * set, the browser doesn't guarantee to conform to it. */ - PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1, - /* Specifies the socket receive buffer in bytes. Value's type should be - * PP_VARTYPE_INT32. - * Note: This is only treated as a hint for the browser to set the buffer - * size. Even if SetOption() reports that this option has been successfully - * set, the browser doesn't guarantee to conform to it. */ - PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 -} PP_TCPSocket_Option_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option_Dev, 4); -/** - * @} - */ - -/** - * @addtogroup Interfaces - * @{ - */ -/** - * The <code>PPB_TCPSocket_Dev</code> interface provides TCP socket operations. - */ -struct PPB_TCPSocket_Dev_0_1 { - /** - * Allocates a TCP socket resource. - */ - PP_Resource (*Create)(PP_Instance instance); - /** - * Determines if a given resource is TCP socket. - */ - PP_Bool (*IsTCPSocket)(PP_Resource resource); - /** - * Connects to an address given by |addr|, which is a PPB_NetAddress_Dev - * resource. - */ - int32_t (*Connect)(PP_Resource tcp_socket, - PP_Resource addr, - struct PP_CompletionCallback callback); - /** - * Gets the local address of the socket, if it has been connected. - * Returns a PPB_NetAddress_Dev resource on success; returns 0 on failure. - */ - PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket); - /** - * Gets the remote address of the socket, if it has been connected. - * Returns a PPB_NetAddress_Dev resource on success; returns 0 on failure. - */ - PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket); - /** - * Reads data from the socket. The size of |buffer| must be at least as large - * as |bytes_to_read|. May perform a partial read. Returns the number of bytes - * read or an error code. If the return value is 0, then it indicates that - * end-of-file was reached. - * - * Multiple outstanding read requests are not supported. - */ - int32_t (*Read)(PP_Resource tcp_socket, - char* buffer, - int32_t bytes_to_read, - struct PP_CompletionCallback callback); - /** - * Writes data to the socket. May perform a partial write. Returns the number - * of bytes written or an error code. - * - * Multiple outstanding write requests are not supported. - */ - int32_t (*Write)(PP_Resource tcp_socket, - const char* buffer, - int32_t bytes_to_write, - struct PP_CompletionCallback callback); - /** - * Cancels any IO that may be pending, and disconnects the socket. Any pending - * callbacks will still run, reporting PP_ERROR_ABORTED if pending IO was - * interrupted. It is NOT valid to call Connect() again after a call to this - * method. Note: If the socket is destroyed when it is still connected, then - * it will be implicitly disconnected, so you are not required to call this - * method. - */ - void (*Close)(PP_Resource tcp_socket); - /** - * Sets an option on |tcp_socket|. Supported |name| and |value| parameters - * are as described for PP_TCPSocketOption_Dev. |callback| will be - * invoked with PP_OK if setting the option succeeds, or an error code - * otherwise. The socket must be connected before SetOption is called. - */ - int32_t (*SetOption)(PP_Resource tcp_socket, - PP_TCPSocket_Option_Dev name, - struct PP_Var value, - struct PP_CompletionCallback callback); -}; - -typedef struct PPB_TCPSocket_Dev_0_1 PPB_TCPSocket_Dev; -/** - * @} - */ - -#endif /* PPAPI_C_DEV_PPB_TCP_SOCKET_DEV_H_ */ - diff --git a/ppapi/c/dev/ppb_trace_event_dev.h b/ppapi/c/dev/ppb_trace_event_dev.h index 153fca89a0..0fb8cc5a68 100644 --- a/ppapi/c/dev/ppb_trace_event_dev.h +++ b/ppapi/c/dev/ppb_trace_event_dev.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From dev/ppb_trace_event_dev.idl modified Wed Jan 2 16:11:35 2013. */ +/* From dev/ppb_trace_event_dev.idl modified Tue Jun 25 16:12:08 2013. */ #ifndef PPAPI_C_DEV_PPB_TRACE_EVENT_DEV_H_ #define PPAPI_C_DEV_PPB_TRACE_EVENT_DEV_H_ @@ -12,7 +12,8 @@ #include "ppapi/c/pp_stdint.h" #define PPB_TRACE_EVENT_DEV_INTERFACE_0_1 "PPB_Trace_Event(Dev);0.1" -#define PPB_TRACE_EVENT_DEV_INTERFACE PPB_TRACE_EVENT_DEV_INTERFACE_0_1 +#define PPB_TRACE_EVENT_DEV_INTERFACE_0_2 "PPB_Trace_Event(Dev);0.2" +#define PPB_TRACE_EVENT_DEV_INTERFACE PPB_TRACE_EVENT_DEV_INTERFACE_0_2 /** * @file @@ -22,10 +23,22 @@ /** + * @addtogroup Typedefs + * @{ + */ +/** + * A trace event timestamp. + */ +typedef int64_t PP_TraceEventTime; +/** + * @} + */ + +/** * @addtogroup Interfaces * @{ */ -struct PPB_Trace_Event_Dev_0_1 { +struct PPB_Trace_Event_Dev_0_2 { /** * Gets a pointer to a character for identifying a category name in the * tracing system as well as for being able to early exit in client-side @@ -53,13 +66,50 @@ struct PPB_Trace_Event_Dev_0_1 { const uint64_t arg_values[], uint8_t flags); /** + * Version of the above interface that allows specifying a custom thread id + * and timestamp. This is useful for when tracing data cannot be registered + * in real time. For example, this could be used by storing timestamps + * internally and then registering the events retroactively. + */ + void (*AddTraceEventWithThreadIdAndTimestamp)(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + int32_t thread_id, + PP_TraceEventTime timestamp, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + /** + * Get the current clock value. Since this uses the same function as the trace + * events use internally, it can be used to create events with explicit time + * stamps. + */ + PP_TraceEventTime (*Now)(void); + /** * Sets the thread name of the calling thread in the tracing system so it will * show up properly in chrome://tracing. */ void (*SetThreadName)(const char* thread_name); }; -typedef struct PPB_Trace_Event_Dev_0_1 PPB_Trace_Event_Dev; +typedef struct PPB_Trace_Event_Dev_0_2 PPB_Trace_Event_Dev; + +struct PPB_Trace_Event_Dev_0_1 { + void* (*GetCategoryEnabled)(const char* category_name); + void (*AddTraceEvent)(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + void (*SetThreadName)(const char* thread_name); +}; /** * @} */ diff --git a/ppapi/c/dev/ppb_udp_socket_dev.h b/ppapi/c/dev/ppb_udp_socket_dev.h deleted file mode 100644 index 5aba58070b..0000000000 --- a/ppapi/c/dev/ppb_udp_socket_dev.h +++ /dev/null @@ -1,128 +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. - */ - -/* From dev/ppb_udp_socket_dev.idl modified Thu Jun 13 09:38:45 2013. */ - -#ifndef PPAPI_C_DEV_PPB_UDP_SOCKET_DEV_H_ -#define PPAPI_C_DEV_PPB_UDP_SOCKET_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_var.h" - -#define PPB_UDPSOCKET_DEV_INTERFACE_0_1 "PPB_UDPSocket(Dev);0.1" -#define PPB_UDPSOCKET_DEV_INTERFACE PPB_UDPSOCKET_DEV_INTERFACE_0_1 - -/** - * @file - * This file defines the <code>PPB_UDPSocket_Dev</code> interface. - * TODO(yzshen): Tidy up the document. - */ - - -/** - * @addtogroup Enums - * @{ - */ -typedef enum { - /* Allows the socket to share the local address to which it will be bound with - * other processes. Value's type should be PP_VARTYPE_BOOL. */ - PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, - /* Allows sending and receiving packets to and from broadcast addresses. - * Value's type should be PP_VARTYPE_BOOL. */ - PP_UDPSOCKET_OPTION_BROADCAST = 1, - /* Specifies the total per-socket buffer space reserved for sends. Value's - * type should be PP_VARTYPE_INT32. - * Note: This is only treated as a hint for the browser to set the buffer - * size. Even if SetOption() reports that this option has been successfully - * set, the browser doesn't guarantee it will conform to it. */ - PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, - /* Specifies the total per-socket buffer space reserved for receives. Value's - * type should be PP_VARTYPE_INT32. - * Note: This is only treated as a hint for the browser to set the buffer - * size. Even if SetOption() reports that this option has been successfully - * set, the browser doesn't guarantee it will conform to it. */ - PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 -} PP_UDPSocket_Option_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocket_Option_Dev, 4); -/** - * @} - */ - -/** - * @addtogroup Interfaces - * @{ - */ -struct PPB_UDPSocket_Dev_0_1 { - /** - * Creates a UDP socket resource. - */ - PP_Resource (*Create)(PP_Instance instance); - /** - * Determines if a given resource is a UDP socket. - */ - PP_Bool (*IsUDPSocket)(PP_Resource resource); - /** - * Binds to the address given by |addr|, which is a PPB_NetAddress_Dev - * resource. - */ - int32_t (*Bind)(PP_Resource udp_socket, - PP_Resource addr, - struct PP_CompletionCallback callback); - /** - * Returns the address that the socket has bound to, as a PPB_NetAddress_Dev - * resource. Bind must be called and succeed first. Returns 0 if Bind fails, - * or if Close has been called. - */ - PP_Resource (*GetBoundAddress)(PP_Resource udp_socket); - /** - * Performs a non-blocking recvfrom call on socket. - * Bind must be called first. |callback| is invoked when recvfrom reads data. - * |addr| will store a PPB_NetAddress_Dev resource on success. - */ - int32_t (*RecvFrom)(PP_Resource udp_socket, - char* buffer, - int32_t num_bytes, - PP_Resource* addr, - struct PP_CompletionCallback callback); - /** - * Performs a non-blocking sendto call on the socket. - * Bind must be called first. |addr| is a PPB_NetAddress_Dev resource holding - * the target address. |callback| is invoked when sendto completes. - */ - int32_t (*SendTo)(PP_Resource udp_socket, - const char* buffer, - int32_t num_bytes, - PP_Resource addr, - struct PP_CompletionCallback callback); - /** - * Cancels all pending reads and writes, and closes the socket. - */ - void (*Close)(PP_Resource udp_socket); - /** - * Sets a socket option to |udp_socket|. Should be called before Bind(). - * See the PP_UDPSocket_Option_Dev description for option names, value types - * and allowed values. - * Returns PP_OK on success. Otherwise, returns PP_ERROR_BADRESOURCE (if bad - * |udp_socket| provided), PP_ERROR_BADARGUMENT (if bad name/value/value's - * type provided) or PP_ERROR_FAILED in the case of internal errors. - */ - int32_t (*SetOption)(PP_Resource udp_socket, - PP_UDPSocket_Option_Dev name, - struct PP_Var value, - struct PP_CompletionCallback callback); -}; - -typedef struct PPB_UDPSocket_Dev_0_1 PPB_UDPSocket_Dev; -/** - * @} - */ - -#endif /* PPAPI_C_DEV_PPB_UDP_SOCKET_DEV_H_ */ - diff --git a/ppapi/c/pp_time.h b/ppapi/c/pp_time.h index 103e405996..145ca46d43 100644 --- a/ppapi/c/pp_time.h +++ b/ppapi/c/pp_time.h @@ -1,9 +1,9 @@ -/* Copyright (c) 2011 The Chromium Authors. All rights reserved. +/* Copyright (c) 2012 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. */ -/* From pp_time.idl modified Tue Jul 5 16:02:03 2011. */ +/* From pp_time.idl modified Fri May 10 15:48:42 2013. */ #ifndef PPAPI_C_PP_TIME_H_ #define PPAPI_C_PP_TIME_H_ @@ -13,7 +13,7 @@ /** * @file - * This file defines time and time ticks types. + * This file defines time, time ticks and time delta types. */ @@ -41,6 +41,13 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Time, 8); */ typedef double PP_TimeTicks; PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TimeTicks, 8); + +/** + * A <code>PP_TimeDelta</code> value represents a duration of time which is + * measured in seconds. + */ +typedef double PP_TimeDelta; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TimeDelta, 8); /** * @} */ diff --git a/ppapi/c/ppb_host_resolver.h b/ppapi/c/ppb_host_resolver.h new file mode 100644 index 0000000000..cc66ffacc6 --- /dev/null +++ b/ppapi/c/ppb_host_resolver.h @@ -0,0 +1,174 @@ +/* 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. + */ + +/* From ppb_host_resolver.idl modified Sat Jun 22 11:11:38 2013. */ + +#ifndef PPAPI_C_PPB_HOST_RESOLVER_H_ +#define PPAPI_C_PPB_HOST_RESOLVER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/ppb_net_address.h" + +#define PPB_HOSTRESOLVER_INTERFACE_1_0 "PPB_HostResolver;1.0" +#define PPB_HOSTRESOLVER_INTERFACE PPB_HOSTRESOLVER_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_HostResolver</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * <code>PP_HostResolver_Flag</code> is an enumeration of flags which can be + * OR-ed and passed to the host resolver. Currently there is only one flag + * defined. + */ +typedef enum { + /** + * Hint to request the canonical name of the host, which can be retrieved by + * <code>GetCanonicalName()</code>. + */ + PP_HOSTRESOLVER_FLAG_CANONNAME = 1 << 0 +} PP_HostResolver_Flag; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Flag, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * <code>PP_HostResolver_Hint</code> represents hints for host resolution. + */ +struct PP_HostResolver_Hint { + /** + * Network address family. + */ + PP_NetAddress_Family family; + /** + * Combination of flags from <code>PP_HostResolver_Flag</code>. + */ + int32_t flags; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_HostResolver_Hint, 8); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_HostResolver</code> interface supports host name + * resolution. + * + * Permissions: In order to run <code>Resolve()</code>, apps permission + * <code>socket</code> with subrule <code>resolve-host</code> is required. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_HostResolver_1_0 { + /** + * Creates a host resolver resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a host reslover or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a host resolver. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a + * <code>PPB_HostResolver</code> resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsHostResolver)(PP_Resource resource); + /** + * Requests resolution of a host name. If the call completes successfully, the + * results can be retrieved by <code>GetCanonicalName()</code>, + * <code>GetNetAddressCount()</code> and <code>GetNetAddress()</code>. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * @param[in] host The host name (or IP address literal) to resolve. + * @param[in] port The port number to be set in the resulting network + * addresses. + * @param[in] hint A <code>PP_HostResolver_Hint</code> structure providing + * hints for host resolution. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. <code>PP_ERROR_NAME_NOT_RESOLVED</code> will be + * returned if the host name couldn't be resolved. + */ + int32_t (*Resolve)(PP_Resource host_resolver, + const char* host, + uint16_t port, + const struct PP_HostResolver_Hint* hint, + struct PP_CompletionCallback callback); + /** + * Gets the canonical name of the host. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * + * @return A string <code>PP_Var</code> on success, which is an empty string + * if <code>PP_HOSTRESOLVER_FLAG_CANONNAME</code> is not set in the hint flags + * when calling <code>Resolve()</code>; an undefined <code>PP_Var</code> if + * there is a pending <code>Resolve()</code> call or the previous + * <code>Resolve()</code> call failed. + */ + struct PP_Var (*GetCanonicalName)(PP_Resource host_resolver); + /** + * Gets the number of network addresses. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * + * @return The number of available network addresses on success; 0 if there is + * a pending <code>Resolve()</code> call or the previous + * <code>Resolve()</code> call failed. + */ + uint32_t (*GetNetAddressCount)(PP_Resource host_resolver); + /** + * Gets a network address. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * @param[in] index An index indicating which address to return. + * + * @return A <code>PPB_NetAddress</code> resource on success; 0 if there is a + * pending <code>Resolve()</code> call or the previous <code>Resolve()</code> + * call failed, or the specified index is out of range. + */ + PP_Resource (*GetNetAddress)(PP_Resource host_resolver, uint32_t index); +}; + +typedef struct PPB_HostResolver_1_0 PPB_HostResolver; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_HOST_RESOLVER_H_ */ + diff --git a/ppapi/c/ppb_net_address.h b/ppapi/c/ppb_net_address.h new file mode 100644 index 0000000000..7f15183223 --- /dev/null +++ b/ppapi/c/ppb_net_address.h @@ -0,0 +1,203 @@ +/* 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. + */ + +/* From ppb_net_address.idl modified Sat Jun 22 10:14:31 2013. */ + +#ifndef PPAPI_C_PPB_NET_ADDRESS_H_ +#define PPAPI_C_PPB_NET_ADDRESS_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_NETADDRESS_INTERFACE_1_0 "PPB_NetAddress;1.0" +#define PPB_NETADDRESS_INTERFACE PPB_NETADDRESS_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_NetAddress</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * Network address family types. + */ +typedef enum { + /** + * The address family is unspecified. + */ + PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, + /** + * The Internet Protocol version 4 (IPv4) address family. + */ + PP_NETADDRESS_FAMILY_IPV4 = 1, + /** + * The Internet Protocol version 6 (IPv6) address family. + */ + PP_NETADDRESS_FAMILY_IPV6 = 2 +} PP_NetAddress_Family; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddress_Family, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * All members are expressed in network byte order. + */ +struct PP_NetAddress_IPv4 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv4 address. + */ + uint8_t addr[4]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv4, 6); + +/** + * All members are expressed in network byte order. + */ +struct PP_NetAddress_IPv6 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv6 address. + */ + uint8_t addr[16]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv6, 18); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_NetAddress</code> interface provides operations on network + * addresses. + */ +struct PPB_NetAddress_1_0 { + /** + * Creates a <code>PPB_NetAddress</code> resource with the specified IPv4 + * address. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * @param[in] ipv4_addr An IPv4 address. + * + * @return A <code>PP_Resource</code> representing the same address as + * <code>ipv4_addr</code> or 0 on failure. + */ + PP_Resource (*CreateFromIPv4Address)( + PP_Instance instance, + const struct PP_NetAddress_IPv4* ipv4_addr); + /** + * Creates a <code>PPB_NetAddress</code> resource with the specified IPv6 + * address. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * @param[in] ipv6_addr An IPv6 address. + * + * @return A <code>PP_Resource</code> representing the same address as + * <code>ipv6_addr</code> or 0 on failure. + */ + PP_Resource (*CreateFromIPv6Address)( + PP_Instance instance, + const struct PP_NetAddress_IPv6* ipv6_addr); + /** + * Determines if a given resource is a network address. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a <code>PPB_NetAddress</code> + * resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsNetAddress)(PP_Resource resource); + /** + * Gets the address family. + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * + * @return The address family on success; + * <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure. + */ + PP_NetAddress_Family (*GetFamily)(PP_Resource addr); + /** + * Returns a human-readable description of the network address. The + * description is in the form of host [ ":" port ] and conforms to + * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses + * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * @param[in] include_port Whether to include the port number in the + * description. + * + * @return A string <code>PP_Var</code> on success; an undefined + * <code>PP_Var</code> on failure. + */ + struct PP_Var (*DescribeAsString)(PP_Resource addr, PP_Bool include_port); + /** + * Fills a <code>PP_NetAddress_IPv4</code> structure if the network address is + * of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. + * Note that passing a network address of + * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the + * address is an IPv4-mapped IPv6 address. + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * @param[out] ipv4_addr A <code>PP_NetAddress_IPv4</code> structure to store + * the result. + * + * @return A <code>PP_Bool</code> value indicating whether the operation + * succeeded. + */ + PP_Bool (*DescribeAsIPv4Address)(PP_Resource addr, + struct PP_NetAddress_IPv4* ipv4_addr); + /** + * Fills a <code>PP_NetAddress_IPv6</code> structure if the network address is + * of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. + * Note that passing a network address of + * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this + * method doesn't map it to an IPv6 address. + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * @param[out] ipv6_addr A <code>PP_NetAddress_IPv6</code> structure to store + * the result. + * + * @return A <code>PP_Bool</code> value indicating whether the operation + * succeeded. + */ + PP_Bool (*DescribeAsIPv6Address)(PP_Resource addr, + struct PP_NetAddress_IPv6* ipv6_addr); +}; + +typedef struct PPB_NetAddress_1_0 PPB_NetAddress; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_NET_ADDRESS_H_ */ + diff --git a/ppapi/c/ppb_network_proxy.h b/ppapi/c/ppb_network_proxy.h new file mode 100644 index 0000000000..90a35b8f8d --- /dev/null +++ b/ppapi/c/ppb_network_proxy.h @@ -0,0 +1,75 @@ +/* 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. + */ + +/* From ppb_network_proxy.idl modified Fri Jun 21 09:37:20 2013. */ + +#ifndef PPAPI_C_PPB_NETWORK_PROXY_H_ +#define PPAPI_C_PPB_NETWORK_PROXY_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_NETWORKPROXY_INTERFACE_1_0 "PPB_NetworkProxy;1.0" +#define PPB_NETWORKPROXY_INTERFACE PPB_NETWORKPROXY_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_NetworkProxy</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * This interface provides a way to determine the appropriate proxy settings + * for a given URL. + * + * Permissions: Apps permission <code>socket</code> with subrule + * <code>resolve-proxy</code> is required for using this API. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_NetworkProxy_1_0 { + /** + * Retrieves the proxy that will be used for the given URL. The result will + * be a string in PAC format. For more details about PAC format, please see + * http://en.wikipedia.org/wiki/Proxy_auto-config + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @param[in] url A string <code>PP_Var</code> containing a URL. + * + * @param[out] proxy_string A <code>PP_Var</code> that GetProxyForURL will + * set upon successful completion. If the call fails, <code>proxy_string + * </code> will be unchanged. Otherwise, it will be set to a string <code> + * PP_Var</code> containing the appropriate PAC string for <code>url</code>. + * If set, <code>proxy_string</code> will have a reference count of 1 which + * the plugin must manage. + * + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*GetProxyForURL)(PP_Instance instance, + struct PP_Var url, + struct PP_Var* proxy_string, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_NetworkProxy_1_0 PPB_NetworkProxy; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_NETWORK_PROXY_H_ */ + diff --git a/ppapi/c/ppb_tcp_socket.h b/ppapi/c/ppb_tcp_socket.h new file mode 100644 index 0000000000..467656fe88 --- /dev/null +++ b/ppapi/c/ppb_tcp_socket.h @@ -0,0 +1,220 @@ +/* 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. + */ + +/* From ppb_tcp_socket.idl modified Sat Jun 22 11:17:34 2013. */ + +#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" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#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</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * Option names used by <code>SetOption()</code>. + */ +typedef enum { + /** + * Disables coalescing of small writes to make TCP segments, and instead + * delivers data immediately. Value's type is <code>PP_VARTYPE_BOOL</code>. + * This option can only be set after a successful <code>Connect()</code> call. + */ + PP_TCPSOCKET_OPTION_NO_DELAY = 0, + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * This option can only be set after a successful <code>Connect()</code> call. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1, + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * This option can only be set after a successful <code>Connect()</code> call. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 +} PP_TCPSocket_Option; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * 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_1_0 { + /** + * Creates a TCP socket resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a TCP socket. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a + * <code>PPB_TCPSocket</code> resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsTCPSocket)(PP_Resource resource); + /** + * Connects the socket to the given address. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[in] addr A <code>PPB_NetAddress</code> resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>, + * including (but not limited to): + * - <code>PP_ERROR_NOACCESS</code>: the caller doesn't have required + * permissions. + * - <code>PP_ERROR_ADDRESS_UNREACHABLE</code>: <code>addr</code> is + * unreachable. + * - <code>PP_ERROR_CONNECTION_REFUSED</code>: the connection attempt was + * refused. + * - <code>PP_ERROR_CONNECTION_FAILED</code>: the connection attempt failed. + * - <code>PP_ERROR_CONNECTION_TIMEDOUT</code>: the connection attempt timed + * out. + */ + int32_t (*Connect)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Gets the local address of the socket, if it is connected. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * + * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. + */ + PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket); + /** + * Gets the remote address of the socket, if it is connected. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * + * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. + */ + PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket); + /** + * Reads data from the socket. The socket must be connected. It may perform a + * partial read. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as <code>bytes_to_read</code>. + * @param[in] bytes_to_read The number of bytes to read. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been read, 0 means that end-of-file was reached; otherwise, an error code + * from <code>pp_errors.h</code>. + */ + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + /** + * Writes data to the socket. The socket must be connected. It may perform a + * partial write. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[in] buffer The buffer containing the data to write. + * @param[in] bytes_to_write The number of bytes to write. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been written; otherwise, an error code from <code>pp_errors.h</code>. + */ + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + /** + * Cancels all pending reads and writes and disconnects the socket. Any + * pending callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> + * if pending IO was interrupted. After a call to this method, no output + * buffer pointers passed into previous <code>Read()</code> calls will be + * accessed. It is not valid to call <code>Connect()</code> again. + * + * The socket is implicitly closed if it is destroyed, so you are not required + * to call this method. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + */ + void (*Close)(PP_Resource tcp_socket); + /** + * Sets a socket option on the TCP socket. + * 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 + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*SetOption)(PP_Resource tcp_socket, + PP_TCPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_TCPSocket_1_0 PPB_TCPSocket; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_TCP_SOCKET_H_ */ + diff --git a/ppapi/c/ppb_udp_socket.h b/ppapi/c/ppb_udp_socket.h new file mode 100644 index 0000000000..5551c3388f --- /dev/null +++ b/ppapi/c/ppb_udp_socket.h @@ -0,0 +1,217 @@ +/* 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. + */ + +/* From ppb_udp_socket.idl modified Sat Jun 22 10:56:26 2013. */ + +#ifndef PPAPI_C_PPB_UDP_SOCKET_H_ +#define PPAPI_C_PPB_UDP_SOCKET_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_UDPSOCKET_INTERFACE_1_0 "PPB_UDPSocket;1.0" +#define PPB_UDPSOCKET_INTERFACE PPB_UDPSOCKET_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_UDPSocket</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * Option names used by <code>SetOption()</code>. + */ +typedef enum { + /** + * Allows the socket to share the local address to which it will be bound with + * other processes. Value's type should be <code>PP_VARTYPE_BOOL</code>. + * This option can only be set before calling <code>Bind()</code>. + */ + PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, + /** + * Allows sending and receiving packets to and from broadcast addresses. + * Value's type should be <code>PP_VARTYPE_BOOL</code>. + * This option can only be set before calling <code>Bind()</code>. + */ + PP_UDPSOCKET_OPTION_BROADCAST = 1, + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * This option can only be set after a successful <code>Bind()</code> call. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * This option can only be set after a successful <code>Bind()</code> call. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 +} PP_UDPSocket_Option; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocket_Option, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_UDPSocket</code> interface provides UDP socket operations. + * + * Permissions: Apps permission <code>socket</code> with subrule + * <code>udp-bind</code> is required for <code>Bind()</code>; subrule + * <code>udp-send-to</code> is required for <code>SendTo()</code>. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_UDPSocket_1_0 { + /** + * Creates a UDP socket resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a UDP socket or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a UDP socket. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a <code>PPB_UDPSocket</code> + * resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsUDPSocket)(PP_Resource resource); + /** + * Binds the socket to the given address. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] addr A <code>PPB_NetAddress</code> resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. <code>PP_ERROR_ADDRESS_IN_USE</code> will be returned + * if the address is already in use. + */ + int32_t (*Bind)(PP_Resource udp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Gets the address that the socket is bound to. The socket must be bound. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * + * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. + */ + PP_Resource (*GetBoundAddress)(PP_Resource udp_socket); + /** + * Receives data from the socket and stores the source address. The socket + * must be bound. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as <code>num_bytes</code>. + * @param[in] num_bytes The number of bytes to receive. + * @param[out] addr A <code>PPB_NetAddress</code> resource to store the source + * address on success. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been received; otherwise, an error code from <code>pp_errors.h</code>. + */ + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + PP_Resource* addr, + struct PP_CompletionCallback callback); + /** + * Sends data to a specific destination. The socket must be bound. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] buffer The buffer containing the data to send. + * @param[in] num_bytes The number of bytes to send. + * @param[in] addr A <code>PPB_NetAddress</code> resource holding the + * destination address. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been sent; otherwise, an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. + */ + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Cancels all pending reads and writes, and closes the socket. Any pending + * callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> if + * pending IO was interrupted. After a call to this method, no output + * parameters passed into previous <code>RecvFrom()</code> calls will be + * accessed. It is not valid to call <code>Bind()</code> again. + * + * The socket is implicitly closed if it is destroyed, so you are not + * required to call this method. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + */ + void (*Close)(PP_Resource udp_socket); + /** + * Sets a socket option on the UDP socket. + * Please see the <code>PP_UDPSocket_Option</code> description for option + * names, value types and allowed values. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*SetOption)(PP_Resource udp_socket, + PP_UDPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_UDPSocket_1_0 PPB_UDPSocket; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_UDP_SOCKET_H_ */ + diff --git a/ppapi/c/dev/ppb_var_array_dev.h b/ppapi/c/ppb_var_array.h index 3ce07fb88e..615e4590b6 100644 --- a/ppapi/c/dev/ppb_var_array_dev.h +++ b/ppapi/c/ppb_var_array.h @@ -1,24 +1,24 @@ -/* Copyright (c) 2013 The Chromium Authors. All rights reserved. +/* 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. */ -/* From dev/ppb_var_array_dev.idl modified Thu Mar 14 13:41:46 2013. */ +/* From ppb_var_array.idl modified Sun Jun 16 15:37:27 2013. */ -#ifndef PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_ -#define PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_ +#ifndef PPAPI_C_PPB_VAR_ARRAY_H_ +#define PPAPI_C_PPB_VAR_ARRAY_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" -#define PPB_VAR_ARRAY_DEV_INTERFACE_0_1 "PPB_VarArray(Dev);0.1" -#define PPB_VAR_ARRAY_DEV_INTERFACE PPB_VAR_ARRAY_DEV_INTERFACE_0_1 +#define PPB_VAR_ARRAY_INTERFACE_1_0 "PPB_VarArray;1.0" +#define PPB_VAR_ARRAY_INTERFACE PPB_VAR_ARRAY_INTERFACE_1_0 /** * @file - * This file defines the <code>PPB_VarArray_Dev</code> struct providing + * This file defines the <code>PPB_VarArray</code> struct providing * a way to interact with array vars. */ @@ -27,7 +27,7 @@ * @addtogroup Interfaces * @{ */ -struct PPB_VarArray_Dev_0_1 { +struct PPB_VarArray_1_0 { /** * Creates an array var, i.e., a <code>PP_Var</code> with type set to * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0. @@ -42,9 +42,10 @@ struct PPB_VarArray_Dev_0_1 { * @param[in] array An array var. * @param[in] index An index indicating which element to return. * - * @return The element at the specified position. The reference count is - * incremented on behalf of the caller. If <code>index</code> is larger than - * or equal to the array length, an undefined var is returned. + * @return The element at the specified position. The reference count of the + * element returned is incremented on behalf of the caller. If + * <code>index</code> is larger than or equal to the array length, an + * undefined var is returned. */ struct PP_Var (*Get)(struct PP_Var array, uint32_t index); /** @@ -76,19 +77,19 @@ struct PPB_VarArray_Dev_0_1 { * @param[in] array An array var. * @param[in] length The new array length. If <code>length</code> is smaller * than its current value, the array is truncated to the new length; any - * elements that no longer fit are removed. If <code>length</code> is larger - * than its current value, undefined vars are appended to increase the array - * to the specified length. + * elements that no longer fit are removed and the references to them will be + * released. If <code>length</code> is larger than its current value, + * undefined vars are appended to increase the array to the specified length. * * @return A <code>PP_Bool</code> indicating whether the operation succeeds. */ PP_Bool (*SetLength)(struct PP_Var array, uint32_t length); }; -typedef struct PPB_VarArray_Dev_0_1 PPB_VarArray_Dev; +typedef struct PPB_VarArray_1_0 PPB_VarArray; /** * @} */ -#endif /* PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_ */ +#endif /* PPAPI_C_PPB_VAR_ARRAY_H_ */ diff --git a/ppapi/c/dev/ppb_var_dictionary_dev.h b/ppapi/c/ppb_var_dictionary.h index d601071a28..712da679b4 100644 --- a/ppapi/c/dev/ppb_var_dictionary_dev.h +++ b/ppapi/c/ppb_var_dictionary.h @@ -1,24 +1,24 @@ -/* Copyright (c) 2013 The Chromium Authors. All rights reserved. +/* 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. */ -/* From dev/ppb_var_dictionary_dev.idl modified Wed Mar 13 21:47:05 2013. */ +/* From ppb_var_dictionary.idl modified Sat Jun 8 23:03:54 2013. */ -#ifndef PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ -#define PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ +#ifndef PPAPI_C_PPB_VAR_DICTIONARY_H_ +#define PPAPI_C_PPB_VAR_DICTIONARY_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" -#define PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1 "PPB_VarDictionary(Dev);0.1" -#define PPB_VAR_DICTIONARY_DEV_INTERFACE PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1 +#define PPB_VAR_DICTIONARY_INTERFACE_1_0 "PPB_VarDictionary;1.0" +#define PPB_VAR_DICTIONARY_INTERFACE PPB_VAR_DICTIONARY_INTERFACE_1_0 /** * @file - * This file defines the <code>PPB_VarDictionary_Dev</code> struct providing + * This file defines the <code>PPB_VarDictionary</code> struct providing * a way to interact with dictionary vars. */ @@ -32,7 +32,7 @@ * strings while the values can be arbitrary vars. Key comparison is always * done by value instead of by reference. */ -struct PPB_VarDictionary_Dev_0_1 { +struct PPB_VarDictionary_1_0 { /** * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to * <code>PP_VARTYPE_DICTIONARY</code>. @@ -48,26 +48,27 @@ struct PPB_VarDictionary_Dev_0_1 { * @param[in] key A string var. * * @return The value that is associated with <code>key</code>. The reference - * count is incremented on behalf of the caller. If <code>key</code> is not a - * string var, or it doesn't exist in <code>dict</code>, an undefined var is - * returned. + * count of the element returned is incremented on behalf of the caller. If + * <code>key</code> is not a string var, or it doesn't exist in + * <code>dict</code>, an undefined var is returned. */ struct PP_Var (*Get)(struct PP_Var dict, struct PP_Var key); /** - * Sets the value associated with the specified key. The dictionary is - * responsible for holding references to its children to keep them alive. + * Sets the value associated with the specified key. * * @param[in] dict A dictionary var. * @param[in] key A string var. If this key hasn't existed in * <code>dict</code>, it is added and associated with <code>value</code>; * otherwise, the previous value is replaced with <code>value</code>. - * @param[in] value The value to set. + * @param[in] value The value to set. The dictionary holds a reference to it + * on success. * * @return A <code>PP_Bool</code> indicating whether the operation succeeds. */ PP_Bool (*Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value); /** - * Deletes the specified key and its associated value, if the key exists. + * Deletes the specified key and its associated value, if the key exists. The + * reference to the element will be released. * * @param[in] dict A dictionary var. * @param[in] key A string var. @@ -97,10 +98,10 @@ struct PPB_VarDictionary_Dev_0_1 { struct PP_Var (*GetKeys)(struct PP_Var dict); }; -typedef struct PPB_VarDictionary_Dev_0_1 PPB_VarDictionary_Dev; +typedef struct PPB_VarDictionary_1_0 PPB_VarDictionary; /** * @} */ -#endif /* PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ */ +#endif /* PPAPI_C_PPB_VAR_DICTIONARY_H_ */ diff --git a/ppapi/c/private/ppb_host_resolver_private.h b/ppapi/c/private/ppb_host_resolver_private.h index 34346eb2c2..3845386bf3 100644 --- a/ppapi/c/private/ppb_host_resolver_private.h +++ b/ppapi/c/private/ppb_host_resolver_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_host_resolver_private.idl, - * modified Mon Mar 5 17:39:57 2012. + * modified Mon Jun 24 09:49:40 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_HOST_RESOLVER_PRIVATE_H_ @@ -42,11 +42,11 @@ typedef enum { /** * AI_CANONNAME */ - PP_HOST_RESOLVER_FLAGS_CANONNAME = 1 << 0, + PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME = 1 << 0, /** * Hint to the resolver that only loopback addresses are configured. */ - PP_HOST_RESOLVER_FLAGS_LOOPBACK_ONLY = 1 << 1 + PP_HOST_RESOLVER_PRIVATE_FLAGS_LOOPBACK_ONLY = 1 << 1 } PP_HostResolver_Private_Flags; PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Private_Flags, 4); /** diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h index ec51d1c9e7..2b6c215dc5 100644 --- a/ppapi/c/private/ppb_nacl_private.h +++ b/ppapi/c/private/ppb_nacl_private.h @@ -3,12 +3,13 @@ * found in the LICENSE file. */ -/* From private/ppb_nacl_private.idl modified Fri Jun 7 17:01:22 2013. */ +/* From private/ppb_nacl_private.idl modified Tue Jun 25 15:57:09 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_stdint.h" @@ -125,6 +126,31 @@ struct PPB_NaCl_Private_1_0 { * returns a posix handle to that temporary file. */ PP_FileHandle (*CreateTemporaryFile)(PP_Instance instance); + /* Create a temporary file, which will be deleted by the time the last + * handle is closed (or earlier on POSIX systems), to use for the nexe + * with the cache key given by |cache_key|. If the nexe is already present + * in the cache, |is_hit| is set to PP_TRUE and the contents of the nexe + * will be copied into the temporary file. Otherwise |is_hit| is set to + * PP_FALSE and the temporary file will be writeable. + * Currently the implementation is a stub, which always sets is_hit to false + * and calls the implementation of CreateTemporaryFile. In a subsequent CL + * it will call into the browser which will remember the association between + * the cache key and the fd, and copy the nexe into the cache after the + * translation finishes. + */ + int32_t (*GetNexeFd)(PP_Instance instance, + const char* cache_key, + PP_Bool* is_hit, + PP_FileHandle* nexe_handle, + struct PP_CompletionCallback callback); + /* Report to the browser that translation of the pexe for |instance| + * has finished. The browser may then store the translation in the + * cache. The renderer must first have called GetNexeFd for the same + * instance. (It is not guaranteed to, however; if there is an error + * or the file is too big for the cache, or the browser is in incognito + * mode, no notification will be delivered to the plugin.) + */ + void (*ReportTranslationFinished)(PP_Instance instance); /* Return true if we are off the record. */ PP_Bool (*IsOffTheRecord)(void); diff --git a/ppapi/c/private/ppb_net_address_private.h b/ppapi/c/private/ppb_net_address_private.h index 2ae1366697..82f6e4557e 100644 --- a/ppapi/c/private/ppb_net_address_private.h +++ b/ppapi/c/private/ppb_net_address_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_net_address_private.idl, - * modified Sat Oct 20 12:39:54 2012. + * modified Mon Jun 24 09:52:39 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ @@ -35,15 +35,15 @@ typedef enum { /** * The address family is unspecified. */ - PP_NETADDRESSFAMILY_UNSPECIFIED = 0, + PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED = 0, /** * The Internet Protocol version 4 (IPv4) address family. */ - PP_NETADDRESSFAMILY_IPV4 = 1, + PP_NETADDRESSFAMILY_PRIVATE_IPV4 = 1, /** * The Internet Protocol version 6 (IPv6) address family. */ - PP_NETADDRESSFAMILY_IPV6 = 2 + PP_NETADDRESSFAMILY_PRIVATE_IPV6 = 2 } PP_NetAddressFamily_Private; PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddressFamily_Private, 4); /** diff --git a/ppapi/c/private/ppb_tcp_socket_private.h b/ppapi/c/private/ppb_tcp_socket_private.h index 6aad46750a..8d47872afd 100644 --- a/ppapi/c/private/ppb_tcp_socket_private.h +++ b/ppapi/c/private/ppb_tcp_socket_private.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_tcp_socket_private.idl modified Sun Feb 10 00:28:07 2013. */ +/* From private/ppb_tcp_socket_private.idl modified Mon Jun 24 09:53:12 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ @@ -34,11 +34,11 @@ */ typedef enum { /* Special value used for testing. Guaranteed to fail SetOption(). */ - PP_TCPSOCKETOPTION_INVALID = 0, + PP_TCPSOCKETOPTION_PRIVATE_INVALID = 0, /* Disable coalescing of small writes to make TCP segments, and instead * deliver data immediately. For SSL sockets, this option must be set before * SSLHandshake() is called. Value type is PP_VARTYPE_BOOL. */ - PP_TCPSOCKETOPTION_NO_DELAY = 1 + PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY = 1 } PP_TCPSocketOption_Private; PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocketOption_Private, 4); /** diff --git a/ppapi/c/private/ppb_udp_socket_private.h b/ppapi/c/private/ppb_udp_socket_private.h index 27770b1643..d6e283c42c 100644 --- a/ppapi/c/private/ppb_udp_socket_private.h +++ b/ppapi/c/private/ppb_udp_socket_private.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_udp_socket_private.idl modified Thu Aug 23 12:32:12 2012. */ +/* From private/ppb_udp_socket_private.idl modified Mon Jun 24 09:53:43 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ @@ -36,13 +36,13 @@ typedef enum { /* Allow the socket to share the local address to which socket will * be bound with other processes. Value's type should be * PP_VARTYPE_BOOL. */ - PP_UDPSOCKETFEATURE_ADDRESS_REUSE = 0, + PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE = 0, /* Allow sending and receiving packets sent to and from broadcast * addresses. Value's type should be PP_VARTYPE_BOOL. */ - PP_UDPSOCKETFEATURE_BROADCAST = 1, + PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST = 1, /* Special value for counting the number of available * features. Should not be passed to SetSocketFeature(). */ - PP_UDPSOCKETFEATURE_COUNT = 2 + PP_UDPSOCKETFEATURE_PRIVATE_COUNT = 2 } PP_UDPSocketFeature_Private; PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocketFeature_Private, 4); /** diff --git a/ppapi/cpp/dev/audio_input_dev.cc b/ppapi/cpp/dev/audio_input_dev.cc index cc0f08b452..0c2f37786f 100644 --- a/ppapi/cpp/dev/audio_input_dev.cc +++ b/ppapi/cpp/dev/audio_input_dev.cc @@ -22,13 +22,20 @@ template <> const char* interface_name<PPB_AudioInput_Dev_0_3>() { return PPB_AUDIO_INPUT_DEV_INTERFACE_0_3; } +template <> const char* interface_name<PPB_AudioInput_Dev_0_4>() { + return PPB_AUDIO_INPUT_DEV_INTERFACE_0_4; +} + } // namespace AudioInput_Dev::AudioInput_Dev() { } AudioInput_Dev::AudioInput_Dev(const InstanceHandle& instance) { - if (has_interface<PPB_AudioInput_Dev_0_3>()) { + if (has_interface<PPB_AudioInput_Dev_0_4>()) { + PassRefFromConstructor(get_interface<PPB_AudioInput_Dev_0_4>()->Create( + instance.pp_instance())); + } else if (has_interface<PPB_AudioInput_Dev_0_3>()) { PassRefFromConstructor(get_interface<PPB_AudioInput_Dev_0_3>()->Create( instance.pp_instance())); } else if (has_interface<PPB_AudioInput_Dev_0_2>()) { @@ -42,12 +49,17 @@ AudioInput_Dev::~AudioInput_Dev() { // static bool AudioInput_Dev::IsAvailable() { - return has_interface<PPB_AudioInput_Dev_0_3>() || + return has_interface<PPB_AudioInput_Dev_0_4>() || + has_interface<PPB_AudioInput_Dev_0_3>() || has_interface<PPB_AudioInput_Dev_0_2>(); } int32_t AudioInput_Dev::EnumerateDevices( const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >& callback) { + if (has_interface<PPB_AudioInput_Dev_0_4>()) { + return get_interface<PPB_AudioInput_Dev_0_4>()->EnumerateDevices( + pp_resource(), callback.output(), callback.pp_completion_callback()); + } if (has_interface<PPB_AudioInput_Dev_0_3>()) { return get_interface<PPB_AudioInput_Dev_0_3>()->EnumerateDevices( pp_resource(), callback.output(), callback.pp_completion_callback()); @@ -72,6 +84,10 @@ int32_t AudioInput_Dev::EnumerateDevices( int32_t AudioInput_Dev::MonitorDeviceChange( PP_MonitorDeviceChangeCallback callback, void* user_data) { + if (has_interface<PPB_AudioInput_Dev_0_4>()) { + return get_interface<PPB_AudioInput_Dev_0_4>()->MonitorDeviceChange( + pp_resource(), callback, user_data); + } if (has_interface<PPB_AudioInput_Dev_0_3>()) { return get_interface<PPB_AudioInput_Dev_0_3>()->MonitorDeviceChange( pp_resource(), callback, user_data); @@ -85,21 +101,40 @@ int32_t AudioInput_Dev::Open(const DeviceRef_Dev& device_ref, PPB_AudioInput_Callback audio_input_callback, void* user_data, const CompletionCallback& callback) { + if (has_interface<PPB_AudioInput_Dev_0_4>()) { + return get_interface<PPB_AudioInput_Dev_0_4>()->Open( + pp_resource(), device_ref.pp_resource(), config.pp_resource(), + audio_input_callback, user_data, callback.pp_completion_callback()); + } + + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +int32_t AudioInput_Dev::Open( + const DeviceRef_Dev& device_ref, + const AudioConfig& config, + PPB_AudioInput_Callback_0_2 audio_input_callback_0_2, + void* user_data, + const CompletionCallback& callback) { if (has_interface<PPB_AudioInput_Dev_0_3>()) { return get_interface<PPB_AudioInput_Dev_0_3>()->Open( pp_resource(), device_ref.pp_resource(), config.pp_resource(), - audio_input_callback, user_data, callback.pp_completion_callback()); + audio_input_callback_0_2, user_data, callback.pp_completion_callback()); } if (has_interface<PPB_AudioInput_Dev_0_2>()) { return get_interface<PPB_AudioInput_Dev_0_2>()->Open( pp_resource(), device_ref.pp_resource(), config.pp_resource(), - audio_input_callback, user_data, callback.pp_completion_callback()); + audio_input_callback_0_2, user_data, callback.pp_completion_callback()); } return callback.MayForce(PP_ERROR_NOINTERFACE); } bool AudioInput_Dev::StartCapture() { + if (has_interface<PPB_AudioInput_Dev_0_4>()) { + return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_4>()->StartCapture( + pp_resource())); + } if (has_interface<PPB_AudioInput_Dev_0_3>()) { return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_3>()->StartCapture( pp_resource())); @@ -113,6 +148,10 @@ bool AudioInput_Dev::StartCapture() { } bool AudioInput_Dev::StopCapture() { + if (has_interface<PPB_AudioInput_Dev_0_4>()) { + return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_4>()->StopCapture( + pp_resource())); + } if (has_interface<PPB_AudioInput_Dev_0_3>()) { return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_3>()->StopCapture( pp_resource())); @@ -126,7 +165,9 @@ bool AudioInput_Dev::StopCapture() { } void AudioInput_Dev::Close() { - if (has_interface<PPB_AudioInput_Dev_0_3>()) { + if (has_interface<PPB_AudioInput_Dev_0_4>()) { + get_interface<PPB_AudioInput_Dev_0_4>()->Close(pp_resource()); + } else if (has_interface<PPB_AudioInput_Dev_0_3>()) { get_interface<PPB_AudioInput_Dev_0_3>()->Close(pp_resource()); } else if (has_interface<PPB_AudioInput_Dev_0_2>()) { get_interface<PPB_AudioInput_Dev_0_2>()->Close(pp_resource()); diff --git a/ppapi/cpp/dev/audio_input_dev.h b/ppapi/cpp/dev/audio_input_dev.h index 22408cdffb..cb1f4ef6cd 100644 --- a/ppapi/cpp/dev/audio_input_dev.h +++ b/ppapi/cpp/dev/audio_input_dev.h @@ -42,12 +42,21 @@ class AudioInput_Dev : public Resource { /// If |device_ref| is null (i.e., is_null() returns true), the default device /// will be used. + /// + /// Requires <code>PPB_AudioInput_Dev</code> version 0.4 or up. int32_t Open(const DeviceRef_Dev& device_ref, const AudioConfig& config, PPB_AudioInput_Callback audio_input_callback, void* user_data, const CompletionCallback& callback); + /// Requires <code>PPB_AudioInput_Dev</code> version 0.2 or 0.3. + int32_t Open(const DeviceRef_Dev& device_ref, + const AudioConfig& config, + PPB_AudioInput_Callback_0_2 audio_input_callback_0_2, + void* user_data, + const CompletionCallback& callback); + bool StartCapture(); bool StopCapture(); void Close(); diff --git a/ppapi/cpp/dev/host_resolver_dev.cc b/ppapi/cpp/dev/host_resolver_dev.cc deleted file mode 100644 index d5229a1b54..0000000000 --- a/ppapi/cpp/dev/host_resolver_dev.cc +++ /dev/null @@ -1,95 +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/host_resolver_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_HostResolver_Dev_0_1>() { - return PPB_HOSTRESOLVER_DEV_INTERFACE_0_1; -} - -} // namespace - -HostResolver_Dev::HostResolver_Dev() { -} - -HostResolver_Dev::HostResolver_Dev(const InstanceHandle& instance) { - if (has_interface<PPB_HostResolver_Dev_0_1>()) { - PassRefFromConstructor(get_interface<PPB_HostResolver_Dev_0_1>()->Create( - instance.pp_instance())); - } -} - -HostResolver_Dev::HostResolver_Dev(PassRef, PP_Resource resource) - : Resource(PASS_REF, resource) { -} - -HostResolver_Dev::HostResolver_Dev(const HostResolver_Dev& other) - : Resource(other) { -} - -HostResolver_Dev::~HostResolver_Dev() { -} - -HostResolver_Dev& HostResolver_Dev::operator=(const HostResolver_Dev& other) { - Resource::operator=(other); - return *this; -} - -// static -bool HostResolver_Dev::IsAvailable() { - return has_interface<PPB_HostResolver_Dev_0_1>(); -} - -int32_t HostResolver_Dev::Resolve(const char* host, - uint16_t port, - const PP_HostResolver_Hint_Dev& hint, - const CompletionCallback& callback) { - if (has_interface<PPB_HostResolver_Dev_0_1>()) { - return get_interface<PPB_HostResolver_Dev_0_1>()->Resolve( - pp_resource(), host, port, &hint, callback.pp_completion_callback()); - } - - return callback.MayForce(PP_ERROR_NOINTERFACE); -} - -Var HostResolver_Dev::GetCanonicalName() const { - if (has_interface<PPB_HostResolver_Dev_0_1>()) { - return Var(PASS_REF, - get_interface<PPB_HostResolver_Dev_0_1>()->GetCanonicalName( - pp_resource())); - } - - return Var(); -} - -uint32_t HostResolver_Dev::GetNetAddressCount() const { - if (has_interface<PPB_HostResolver_Dev_0_1>()) { - return get_interface<PPB_HostResolver_Dev_0_1>()->GetNetAddressCount( - pp_resource()); - } - - return 0; -} - -NetAddress_Dev HostResolver_Dev::GetNetAddress(uint32_t index) const { - if (has_interface<PPB_HostResolver_Dev_0_1>()) { - return NetAddress_Dev( - PASS_REF, - get_interface<PPB_HostResolver_Dev_0_1>()->GetNetAddress( - pp_resource(), index)); - } - - return NetAddress_Dev(); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/host_resolver_dev.h b/ppapi/cpp/dev/host_resolver_dev.h deleted file mode 100644 index 592fd74832..0000000000 --- a/ppapi/cpp/dev/host_resolver_dev.h +++ /dev/null @@ -1,48 +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. - -#ifndef PPAPI_CPP_DEV_HOST_RESOLVER_DEV_H_ -#define PPAPI_CPP_DEV_HOST_RESOLVER_DEV_H_ - -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/dev/ppb_host_resolver_dev.h" -#include "ppapi/cpp/dev/net_address_dev.h" -#include "ppapi/cpp/pass_ref.h" -#include "ppapi/cpp/resource.h" -#include "ppapi/cpp/var.h" - -namespace pp { - -class CompletionCallback; -class InstanceHandle; - -class HostResolver_Dev : public Resource { - public: - HostResolver_Dev(); - - explicit HostResolver_Dev(const InstanceHandle& instance); - - HostResolver_Dev(PassRef, PP_Resource resource); - - HostResolver_Dev(const HostResolver_Dev& other); - - virtual ~HostResolver_Dev(); - - HostResolver_Dev& operator=(const HostResolver_Dev& other); - - // Returns true if the required interface is available. - static bool IsAvailable(); - - int32_t Resolve(const char* host, - uint16_t port, - const PP_HostResolver_Hint_Dev& hint, - const CompletionCallback& callback); - Var GetCanonicalName() const; - uint32_t GetNetAddressCount() const; - NetAddress_Dev GetNetAddress(uint32_t index) const; -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_HOST_RESOLVER_DEV_H_ diff --git a/ppapi/cpp/dev/net_address_dev.cc b/ppapi/cpp/dev/net_address_dev.cc deleted file mode 100644 index ec09caaa8d..0000000000 --- a/ppapi/cpp/dev/net_address_dev.cc +++ /dev/null @@ -1,101 +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/net_address_dev.h" - -#include "ppapi/c/pp_bool.h" -#include "ppapi/cpp/instance_handle.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_NetAddress_Dev_0_1>() { - return PPB_NETADDRESS_DEV_INTERFACE_0_1; -} - -} // namespace - -NetAddress_Dev::NetAddress_Dev() { -} - -NetAddress_Dev::NetAddress_Dev(PassRef, PP_Resource resource) - : Resource(PASS_REF, resource) { -} - -NetAddress_Dev::NetAddress_Dev(const InstanceHandle& instance, - const PP_NetAddress_IPv4_Dev& ipv4_addr) { - if (has_interface<PPB_NetAddress_Dev_0_1>()) { - PassRefFromConstructor( - get_interface<PPB_NetAddress_Dev_0_1>()->CreateFromIPv4Address( - instance.pp_instance(), &ipv4_addr)); - } -} - -NetAddress_Dev::NetAddress_Dev(const InstanceHandle& instance, - const PP_NetAddress_IPv6_Dev& ipv6_addr) { - if (has_interface<PPB_NetAddress_Dev_0_1>()) { - PassRefFromConstructor( - get_interface<PPB_NetAddress_Dev_0_1>()->CreateFromIPv6Address( - instance.pp_instance(), &ipv6_addr)); - } -} - -NetAddress_Dev::NetAddress_Dev(const NetAddress_Dev& other) : Resource(other) { -} - -NetAddress_Dev::~NetAddress_Dev() { -} - -NetAddress_Dev& NetAddress_Dev::operator=(const NetAddress_Dev& other) { - Resource::operator=(other); - return *this; -} - -// static -bool NetAddress_Dev::IsAvailable() { - return has_interface<PPB_NetAddress_Dev_0_1>(); -} - -PP_NetAddress_Family_Dev NetAddress_Dev::GetFamily() const { - if (has_interface<PPB_NetAddress_Dev_0_1>()) - return get_interface<PPB_NetAddress_Dev_0_1>()->GetFamily(pp_resource()); - - return PP_NETADDRESS_FAMILY_UNSPECIFIED; -} - -Var NetAddress_Dev::DescribeAsString(bool include_port) const { - if (has_interface<PPB_NetAddress_Dev_0_1>()) { - return Var(PASS_REF, - get_interface<PPB_NetAddress_Dev_0_1>()->DescribeAsString( - pp_resource(), PP_FromBool(include_port))); - } - - return Var(); -} - -bool NetAddress_Dev::DescribeAsIPv4Address( - PP_NetAddress_IPv4_Dev* ipv4_addr) const { - if (has_interface<PPB_NetAddress_Dev_0_1>()) { - return PP_ToBool( - get_interface<PPB_NetAddress_Dev_0_1>()->DescribeAsIPv4Address( - pp_resource(), ipv4_addr)); - } - - return false; -} - -bool NetAddress_Dev::DescribeAsIPv6Address( - PP_NetAddress_IPv6_Dev* ipv6_addr) const { - if (has_interface<PPB_NetAddress_Dev_0_1>()) { - return PP_ToBool( - get_interface<PPB_NetAddress_Dev_0_1>()->DescribeAsIPv6Address( - pp_resource(), ipv6_addr)); - } - - return false; -} - -} // namespace pp diff --git a/ppapi/cpp/dev/net_address_dev.h b/ppapi/cpp/dev/net_address_dev.h deleted file mode 100644 index e7039801d3..0000000000 --- a/ppapi/cpp/dev/net_address_dev.h +++ /dev/null @@ -1,52 +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. - -#ifndef PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_ -#define PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_ - -#include "ppapi/c/dev/ppb_net_address_dev.h" -#include "ppapi/cpp/pass_ref.h" -#include "ppapi/cpp/resource.h" -#include "ppapi/cpp/var.h" - -namespace pp { - -class InstanceHandle; - -class NetAddress_Dev : public Resource { - public: - NetAddress_Dev(); - - NetAddress_Dev(PassRef, PP_Resource resource); - - NetAddress_Dev(const InstanceHandle& instance, - const PP_NetAddress_IPv4_Dev& ipv4_addr); - - NetAddress_Dev(const InstanceHandle& instance, - const PP_NetAddress_IPv6_Dev& ipv6_addr); - - NetAddress_Dev(const NetAddress_Dev& other); - - virtual ~NetAddress_Dev(); - - NetAddress_Dev& operator=(const NetAddress_Dev& other); - - /// Static function for determining whether the browser supports the required - /// NetAddress interface. - /// - /// @return true if the interface is available, false otherwise. - static bool IsAvailable(); - - PP_NetAddress_Family_Dev GetFamily() const; - - Var DescribeAsString(bool include_port) const; - - bool DescribeAsIPv4Address(PP_NetAddress_IPv4_Dev* ipv4_addr) const; - - bool DescribeAsIPv6Address(PP_NetAddress_IPv6_Dev* ipv6_addr) const; -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_ diff --git a/ppapi/cpp/dev/tcp_socket_dev.cc b/ppapi/cpp/dev/tcp_socket_dev.cc deleted file mode 100644 index 4ff9514cde..0000000000 --- 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_Dev& 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_Dev TCPSocket_Dev::GetLocalAddress() const { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) { - return NetAddress_Dev( - PASS_REF, - get_interface<PPB_TCPSocket_Dev_0_1>()->GetLocalAddress(pp_resource())); - } - return NetAddress_Dev(); -} - -NetAddress_Dev TCPSocket_Dev::GetRemoteAddress() const { - if (has_interface<PPB_TCPSocket_Dev_0_1>()) { - return NetAddress_Dev( - PASS_REF, - get_interface<PPB_TCPSocket_Dev_0_1>()->GetRemoteAddress( - pp_resource())); - } - return NetAddress_Dev(); -} - -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/dev/tcp_socket_dev.h b/ppapi/cpp/dev/tcp_socket_dev.h deleted file mode 100644 index 16d7deedba..0000000000 --- a/ppapi/cpp/dev/tcp_socket_dev.h +++ /dev/null @@ -1,53 +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. - -#ifndef PPAPI_CPP_DEV_TCP_SOCKET_DEV_H_ -#define PPAPI_CPP_DEV_TCP_SOCKET_DEV_H_ - -#include "ppapi/c/dev/ppb_tcp_socket_dev.h" -#include "ppapi/cpp/dev/net_address_dev.h" -#include "ppapi/cpp/pass_ref.h" -#include "ppapi/cpp/resource.h" - -namespace pp { - -class CompletionCallback; -class InstanceHandle; - -class TCPSocket_Dev: public Resource { - public: - TCPSocket_Dev(); - - explicit TCPSocket_Dev(const InstanceHandle& instance); - - TCPSocket_Dev(PassRef, PP_Resource resource); - - TCPSocket_Dev(const TCPSocket_Dev& other); - - virtual ~TCPSocket_Dev(); - - TCPSocket_Dev& operator=(const TCPSocket_Dev& other); - - // Returns true if the required interface is available. - static bool IsAvailable(); - - int32_t Connect(const NetAddress_Dev& addr, - const CompletionCallback& callback); - NetAddress_Dev GetLocalAddress() const; - NetAddress_Dev GetRemoteAddress() const; - int32_t Read(char* buffer, - int32_t bytes_to_read, - const CompletionCallback& callback); - int32_t Write(const char* buffer, - int32_t bytes_to_write, - const CompletionCallback& callback); - void Close(); - int32_t SetOption(PP_TCPSocket_Option_Dev name, - const Var& value, - const CompletionCallback& callback); -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_TCP_SOCKET_DEV_H_ diff --git a/ppapi/cpp/dev/udp_socket_dev.cc b/ppapi/cpp/dev/udp_socket_dev.cc deleted file mode 100644 index dd8ffd0a2d..0000000000 --- a/ppapi/cpp/dev/udp_socket_dev.cc +++ /dev/null @@ -1,111 +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/udp_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" -#include "ppapi/cpp/var.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_UDPSocket_Dev_0_1>() { - return PPB_UDPSOCKET_DEV_INTERFACE_0_1; -} - -} // namespace - -UDPSocket_Dev::UDPSocket_Dev() { -} - -UDPSocket_Dev::UDPSocket_Dev(const InstanceHandle& instance) { - if (has_interface<PPB_UDPSocket_Dev_0_1>()) { - PassRefFromConstructor(get_interface<PPB_UDPSocket_Dev_0_1>()->Create( - instance.pp_instance())); - } -} - -UDPSocket_Dev::UDPSocket_Dev(PassRef, PP_Resource resource) - : Resource(PASS_REF, resource) { -} - -UDPSocket_Dev::UDPSocket_Dev(const UDPSocket_Dev& other) : Resource(other) { -} - -UDPSocket_Dev::~UDPSocket_Dev() { -} - -UDPSocket_Dev& UDPSocket_Dev::operator=(const UDPSocket_Dev& other) { - Resource::operator=(other); - return *this; -} - -// static -bool UDPSocket_Dev::IsAvailable() { - return has_interface<PPB_UDPSocket_Dev_0_1>(); -} - -int32_t UDPSocket_Dev::Bind(const NetAddress_Dev& addr, - const CompletionCallback& callback) { - if (has_interface<PPB_UDPSocket_Dev_0_1>()) { - return get_interface<PPB_UDPSocket_Dev_0_1>()->Bind( - pp_resource(), addr.pp_resource(), callback.pp_completion_callback()); - } - return callback.MayForce(PP_ERROR_NOINTERFACE); -} - -NetAddress_Dev UDPSocket_Dev::GetBoundAddress() { - if (has_interface<PPB_UDPSocket_Dev_0_1>()) { - return NetAddress_Dev( - PASS_REF, - get_interface<PPB_UDPSocket_Dev_0_1>()->GetBoundAddress(pp_resource())); - } - return NetAddress_Dev(); -} - -int32_t UDPSocket_Dev::RecvFrom( - char* buffer, - int32_t num_bytes, - const CompletionCallbackWithOutput<NetAddress_Dev>& callback) { - if (has_interface<PPB_UDPSocket_Dev_0_1>()) { - return get_interface<PPB_UDPSocket_Dev_0_1>()->RecvFrom( - pp_resource(), buffer, num_bytes, callback.output(), - callback.pp_completion_callback()); - } - return callback.MayForce(PP_ERROR_NOINTERFACE); -} - -int32_t UDPSocket_Dev::SendTo(const char* buffer, - int32_t num_bytes, - const NetAddress_Dev& addr, - const CompletionCallback& callback) { - if (has_interface<PPB_UDPSocket_Dev_0_1>()) { - return get_interface<PPB_UDPSocket_Dev_0_1>()->SendTo( - pp_resource(), buffer, num_bytes, addr.pp_resource(), - callback.pp_completion_callback()); - } - return callback.MayForce(PP_ERROR_NOINTERFACE); -} - -void UDPSocket_Dev::Close() { - if (has_interface<PPB_UDPSocket_Dev_0_1>()) - return get_interface<PPB_UDPSocket_Dev_0_1>()->Close(pp_resource()); -} - -int32_t UDPSocket_Dev::SetOption(PP_UDPSocket_Option_Dev name, - const Var& value, - const CompletionCallback& callback) { - if (has_interface<PPB_UDPSocket_Dev_0_1>()) { - return get_interface<PPB_UDPSocket_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/dev/udp_socket_dev.h b/ppapi/cpp/dev/udp_socket_dev.h deleted file mode 100644 index 9f46f0a39e..0000000000 --- a/ppapi/cpp/dev/udp_socket_dev.h +++ /dev/null @@ -1,57 +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. - -#ifndef PPAPI_CPP_DEV_UDP_SOCKET_DEV_H_ -#define PPAPI_CPP_DEV_UDP_SOCKET_DEV_H_ - -#include "ppapi/c/dev/ppb_udp_socket_dev.h" -#include "ppapi/cpp/dev/net_address_dev.h" -#include "ppapi/cpp/pass_ref.h" -#include "ppapi/cpp/resource.h" - -namespace pp { - -class CompletionCallback; -class InstanceHandle; -class Var; - -template <typename T> class CompletionCallbackWithOutput; - -class UDPSocket_Dev: public Resource { - public: - UDPSocket_Dev(); - - explicit UDPSocket_Dev(const InstanceHandle& instance); - - UDPSocket_Dev(PassRef, PP_Resource resource); - - UDPSocket_Dev(const UDPSocket_Dev& other); - - virtual ~UDPSocket_Dev(); - - UDPSocket_Dev& operator=(const UDPSocket_Dev& other); - - // Returns true if the required interface is available. - static bool IsAvailable(); - - int32_t Bind(const NetAddress_Dev& addr, - const CompletionCallback& callback); - NetAddress_Dev GetBoundAddress(); - int32_t RecvFrom( - char* buffer, - int32_t num_bytes, - const CompletionCallbackWithOutput<NetAddress_Dev>& callback); - int32_t SendTo(const char* buffer, - int32_t num_bytes, - const NetAddress_Dev& addr, - const CompletionCallback& callback); - void Close(); - int32_t SetOption(PP_UDPSocket_Option_Dev name, - const Var& value, - const CompletionCallback& callback); -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_UDP_SOCKET_DEV_H_ diff --git a/ppapi/cpp/dev/var_array_dev.cc b/ppapi/cpp/dev/var_array_dev.cc deleted file mode 100644 index 247e9c4420..0000000000 --- a/ppapi/cpp/dev/var_array_dev.cc +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 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/var_array_dev.h" - -#include "ppapi/c/dev/ppb_var_array_dev.h" -#include "ppapi/cpp/logging.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_VarArray_Dev_0_1>() { - return PPB_VAR_ARRAY_DEV_INTERFACE_0_1; -} - -} // namespace - -VarArray_Dev::VarArray_Dev() : Var(Null()) { - if (has_interface<PPB_VarArray_Dev_0_1>()) - var_ = get_interface<PPB_VarArray_Dev_0_1>()->Create(); - else - PP_NOTREACHED(); -} - -VarArray_Dev::VarArray_Dev(const Var& var) : Var(var) { - if (!var.is_array()) { - PP_NOTREACHED(); - - // This takes care of releasing the reference that this object holds. - Var::operator=(Var(Null())); - } -} - -VarArray_Dev::VarArray_Dev(const PP_Var& var) : Var(var) { - if (var.type != PP_VARTYPE_ARRAY) { - PP_NOTREACHED(); - - // This takes care of releasing the reference that this object holds. - Var::operator=(Var(Null())); - } -} - -VarArray_Dev::VarArray_Dev(const VarArray_Dev& other) : Var(other) { -} - -VarArray_Dev::~VarArray_Dev() { -} - -VarArray_Dev& VarArray_Dev::operator=(const VarArray_Dev& other) { - Var::operator=(other); - return *this; -} - -Var& VarArray_Dev::operator=(const Var& other) { - if (other.is_array()) { - Var::operator=(other); - } else { - PP_NOTREACHED(); - Var::operator=(Var(Null())); - } - return *this; -} - -Var VarArray_Dev::Get(uint32_t index) const { - if (!has_interface<PPB_VarArray_Dev_0_1>()) - return Var(); - - return Var(PASS_REF, get_interface<PPB_VarArray_Dev_0_1>()->Get(var_, index)); -} - -PP_Bool VarArray_Dev::Set(uint32_t index, const Var& value) { - if (!has_interface<PPB_VarArray_Dev_0_1>()) - return PP_FALSE; - - return get_interface<PPB_VarArray_Dev_0_1>()->Set(var_, index, - value.pp_var()); -} - -uint32_t VarArray_Dev::GetLength() const { - if (!has_interface<PPB_VarArray_Dev_0_1>()) - return 0; - - return get_interface<PPB_VarArray_Dev_0_1>()->GetLength(var_); -} - -PP_Bool VarArray_Dev::SetLength(uint32_t length) { - if (!has_interface<PPB_VarArray_Dev_0_1>()) - return PP_FALSE; - - return get_interface<PPB_VarArray_Dev_0_1>()->SetLength(var_, length); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/var_dictionary_dev.cc b/ppapi/cpp/dev/var_dictionary_dev.cc deleted file mode 100644 index 8fa3f6c10d..0000000000 --- a/ppapi/cpp/dev/var_dictionary_dev.cc +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 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/var_dictionary_dev.h" - -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" -#include "ppapi/cpp/logging.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_VarDictionary_Dev_0_1>() { - return PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1; -} - -} // namespace - -VarDictionary_Dev::VarDictionary_Dev() : Var(Null()) { - if (has_interface<PPB_VarDictionary_Dev_0_1>()) - var_ = get_interface<PPB_VarDictionary_Dev_0_1>()->Create(); - else - PP_NOTREACHED(); -} - -VarDictionary_Dev::VarDictionary_Dev(const Var& var) : Var(var) { - if (!var.is_dictionary()) { - PP_NOTREACHED(); - - // This takes care of releasing the reference that this object holds. - Var::operator=(Var(Null())); - } -} - -VarDictionary_Dev::VarDictionary_Dev(const PP_Var& var) : Var(var) { - if (var.type != PP_VARTYPE_DICTIONARY) { - PP_NOTREACHED(); - - // This takes care of releasing the reference that this object holds. - Var::operator=(Var(Null())); - } -} - -VarDictionary_Dev::VarDictionary_Dev(const VarDictionary_Dev& other) - : Var(other) { -} - -VarDictionary_Dev::~VarDictionary_Dev() { -} - -VarDictionary_Dev& VarDictionary_Dev::operator=( - const VarDictionary_Dev& other) { - Var::operator=(other); - return *this; -} - -Var& VarDictionary_Dev::operator=(const Var& other) { - if (other.is_dictionary()) { - Var::operator=(other); - } else { - PP_NOTREACHED(); - Var::operator=(Var(Null())); - } - return *this; -} - -Var VarDictionary_Dev::Get(const Var& key) const { - if (!has_interface<PPB_VarDictionary_Dev_0_1>()) - return Var(); - - return Var( - PASS_REF, - get_interface<PPB_VarDictionary_Dev_0_1>()->Get(var_, key.pp_var())); -} - -PP_Bool VarDictionary_Dev::Set(const Var& key, const Var& value) { - if (!has_interface<PPB_VarDictionary_Dev_0_1>()) - return PP_FALSE; - - return get_interface<PPB_VarDictionary_Dev_0_1>()->Set(var_, key.pp_var(), - value.pp_var()); -} - -void VarDictionary_Dev::Delete(const Var& key) { - if (has_interface<PPB_VarDictionary_Dev_0_1>()) - get_interface<PPB_VarDictionary_Dev_0_1>()->Delete(var_, key.pp_var()); -} - -PP_Bool VarDictionary_Dev::HasKey(const Var& key) const { - if (!has_interface<PPB_VarDictionary_Dev_0_1>()) - return PP_FALSE; - - return get_interface<PPB_VarDictionary_Dev_0_1>()->HasKey(var_, key.pp_var()); -} - -VarArray_Dev VarDictionary_Dev::GetKeys() const { - if (!has_interface<PPB_VarDictionary_Dev_0_1>()) - return VarArray_Dev(); - - Var result(PASS_REF, - get_interface<PPB_VarDictionary_Dev_0_1>()->GetKeys(var_)); - if (result.is_array()) - return VarArray_Dev(result); - else - return VarArray_Dev(); -} - -} // namespace pp diff --git a/ppapi/cpp/extensions/dev/alarms_dev.cc b/ppapi/cpp/extensions/dev/alarms_dev.cc index 94baf47438..1cf8464635 100644 --- a/ppapi/cpp/extensions/dev/alarms_dev.cc +++ b/ppapi/cpp/extensions/dev/alarms_dev.cc @@ -5,11 +5,11 @@ #include "ppapi/cpp/extensions/dev/alarms_dev.h" #include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/optional.h" #include "ppapi/cpp/extensions/to_var_converter.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { @@ -41,7 +41,7 @@ bool Alarm_Dev::Populate(const PP_Ext_Alarms_Alarm_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = name.Populate(dict); result = scheduled_time.Populate(dict) && result; result = period_in_minutes.Populate(dict) && result; @@ -50,7 +50,7 @@ bool Alarm_Dev::Populate(const PP_Ext_Alarms_Alarm_Dev& value) { } Var Alarm_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = name.AddTo(&dict); result = scheduled_time.AddTo(&dict) && result; @@ -78,7 +78,7 @@ bool AlarmCreateInfo_Dev::Populate( if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = when.Populate(dict); result = delay_in_minutes.Populate(dict) && result; result = period_in_minutes.Populate(dict) && result; @@ -87,7 +87,7 @@ bool AlarmCreateInfo_Dev::Populate( } Var AlarmCreateInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = when.MayAddTo(&dict); result = delay_in_minutes.MayAddTo(&dict) && result; diff --git a/ppapi/cpp/extensions/dev/socket_dev.cc b/ppapi/cpp/extensions/dev/socket_dev.cc index 558f01e9b7..a2c9e7f5ec 100644 --- a/ppapi/cpp/extensions/dev/socket_dev.cc +++ b/ppapi/cpp/extensions/dev/socket_dev.cc @@ -76,14 +76,14 @@ bool CreateInfo_Dev::Populate(const PP_Ext_Socket_CreateInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = socket_id.Populate(dict); return result; } Var CreateInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = socket_id.AddTo(&dict); // Suppress unused variable warnings. @@ -108,7 +108,7 @@ bool AcceptInfo_Dev::Populate(const PP_Ext_Socket_AcceptInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = result_code.Populate(dict); result = socket_id.Populate(dict) && result; @@ -116,7 +116,7 @@ bool AcceptInfo_Dev::Populate(const PP_Ext_Socket_AcceptInfo_Dev& value) { } Var AcceptInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = result_code.AddTo(&dict); result = socket_id.MayAddTo(&dict) && result; @@ -140,7 +140,7 @@ bool ReadInfo_Dev::Populate(const PP_Ext_Socket_ReadInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = result_code.Populate(dict); result = data.Populate(dict) && result; @@ -148,7 +148,7 @@ bool ReadInfo_Dev::Populate(const PP_Ext_Socket_ReadInfo_Dev& value) { } Var ReadInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = result_code.AddTo(&dict); result = data.AddTo(&dict) && result; @@ -170,14 +170,14 @@ bool WriteInfo_Dev::Populate(const PP_Ext_Socket_WriteInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = bytes_written.Populate(dict); return result; } Var WriteInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = bytes_written.AddTo(&dict); // Suppress unused variable warnings. @@ -206,7 +206,7 @@ bool RecvFromInfo_Dev::Populate(const PP_Ext_Socket_RecvFromInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = result_code.Populate(dict); result = data.Populate(dict) && result; result = address.Populate(dict) && result; @@ -216,7 +216,7 @@ bool RecvFromInfo_Dev::Populate(const PP_Ext_Socket_RecvFromInfo_Dev& value) { } Var RecvFromInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = result_code.AddTo(&dict); result = data.AddTo(&dict) && result; @@ -250,7 +250,7 @@ bool SocketInfo_Dev::Populate(const PP_Ext_Socket_SocketInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = socket_type.Populate(dict); result = connected.Populate(dict) && result; result = peer_address.Populate(dict) && result; @@ -262,7 +262,7 @@ bool SocketInfo_Dev::Populate(const PP_Ext_Socket_SocketInfo_Dev& value) { } Var SocketInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = socket_type.AddTo(&dict); result = connected.AddTo(&dict) && result; @@ -291,7 +291,7 @@ bool NetworkInterface_Dev::Populate( if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = name.Populate(dict); result = address.Populate(dict) && result; @@ -299,7 +299,7 @@ bool NetworkInterface_Dev::Populate( } Var NetworkInterface_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = name.AddTo(&dict); result = address.AddTo(&dict) && result; diff --git a/ppapi/cpp/extensions/dev/socket_dev.h b/ppapi/cpp/extensions/dev/socket_dev.h index 95e78d3cf7..b6ac7b58ad 100644 --- a/ppapi/cpp/extensions/dev/socket_dev.h +++ b/ppapi/cpp/extensions/dev/socket_dev.h @@ -9,12 +9,12 @@ #include <vector> #include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/dict_field.h" #include "ppapi/cpp/extensions/ext_output_traits.h" #include "ppapi/cpp/instance_handle.h" #include "ppapi/cpp/var.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { namespace ext { @@ -50,7 +50,7 @@ class SocketType_Dev { static const char* const kUdp; }; -typedef VarDictionary_Dev CreateOptions_Dev; +typedef VarDictionary CreateOptions_Dev; class CreateInfo_Dev { public: diff --git a/ppapi/cpp/extensions/dict_field.h b/ppapi/cpp/extensions/dict_field.h index 5a085c3af8..f332014e89 100644 --- a/ppapi/cpp/extensions/dict_field.h +++ b/ppapi/cpp/extensions/dict_field.h @@ -8,11 +8,11 @@ #include <string> #include "ppapi/c/pp_bool.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/from_var_converter.h" #include "ppapi/cpp/extensions/optional.h" #include "ppapi/cpp/extensions/to_var_converter.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { namespace ext { @@ -33,15 +33,15 @@ class DictField { const T& operator()() const { return value_; } // Adds this field to the dictionary var. - bool AddTo(VarDictionary_Dev* dict) const { + bool AddTo(VarDictionary* dict) const { if (!dict) return false; internal::ToVarConverter<T> converter(value_); - return PP_ToBool(dict->Set(Var(key_), converter.var())); + return dict->Set(Var(key_), converter.var()); } - bool Populate(const VarDictionary_Dev& dict) { + bool Populate(const VarDictionary& dict) { Var value_var = dict.Get(Var(key_)); if (value_var.is_undefined()) return false; @@ -72,17 +72,17 @@ class OptionalDictField { const Optional<T>& operator()() const { return value_; } // Adds this field to the dictionary var, if |value| has been set. - bool MayAddTo(VarDictionary_Dev* dict) const { + bool MayAddTo(VarDictionary* dict) const { if (!dict) return false; if (!value_.IsSet()) return true; internal::ToVarConverter<T> converter(*value_); - return PP_ToBool(dict->Set(Var(key_), converter.var())); + return dict->Set(Var(key_), converter.var()); } - bool Populate(const VarDictionary_Dev& dict) { + bool Populate(const VarDictionary& dict) { Var value_var = dict.Get(Var(key_)); internal::FromVarConverter<Optional<T> > converter(value_var.pp_var()); value_.Swap(&converter.value()); diff --git a/ppapi/cpp/extensions/ext_output_traits.h b/ppapi/cpp/extensions/ext_output_traits.h index 9c1cb2a4bb..08dc744c47 100644 --- a/ppapi/cpp/extensions/ext_output_traits.h +++ b/ppapi/cpp/extensions/ext_output_traits.h @@ -8,11 +8,11 @@ #include <vector> #include "ppapi/c/pp_var.h" -#include "ppapi/cpp/dev/var_array_dev.h" #include "ppapi/cpp/extensions/from_var_converter.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/pass_ref.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" namespace pp { namespace ext { @@ -92,7 +92,7 @@ class ArrayVarOutputAdapterWithStorage { Var var(PASS_REF, pp_var_); pp_var_ = PP_MakeUndefined(); if (var.is_array()) { - VarArray_Dev array(var); + VarArray array(var); uint32_t length = array.GetLength(); output_storage_.reserve(length); diff --git a/ppapi/cpp/extensions/from_var_converter.h b/ppapi/cpp/extensions/from_var_converter.h index 094f0c483f..06ae0df250 100644 --- a/ppapi/cpp/extensions/from_var_converter.h +++ b/ppapi/cpp/extensions/from_var_converter.h @@ -8,12 +8,12 @@ #include <string> #include "ppapi/c/pp_var.h" -#include "ppapi/cpp/dev/var_array_dev.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/optional.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { namespace ext { @@ -173,8 +173,8 @@ class FromVarConverter<Var> : public FromVarConverterBase<Var> { }; template <> -class FromVarConverter<VarArray_Dev> - : public FromVarConverterBase<VarArray_Dev> { +class FromVarConverter<VarArray> + : public FromVarConverterBase<VarArray> { public: FromVarConverter() { } @@ -187,13 +187,13 @@ class FromVarConverter<VarArray_Dev> } void Set(const PP_Var& var) { - FromVarConverterBase<VarArray_Dev>::value_ = Var(var); + FromVarConverterBase<VarArray>::value_ = Var(var); } }; template <> -class FromVarConverter<VarDictionary_Dev> - : public FromVarConverterBase<VarDictionary_Dev> { +class FromVarConverter<VarDictionary> + : public FromVarConverterBase<VarDictionary> { public: FromVarConverter() { } @@ -206,7 +206,7 @@ class FromVarConverter<VarDictionary_Dev> } void Set(const PP_Var& var) { - FromVarConverterBase<VarDictionary_Dev>::value_ = Var(var); + FromVarConverterBase<VarDictionary>::value_ = Var(var); } }; diff --git a/ppapi/cpp/extensions/to_var_converter.h b/ppapi/cpp/extensions/to_var_converter.h index 591365290f..e38499977f 100644 --- a/ppapi/cpp/extensions/to_var_converter.h +++ b/ppapi/cpp/extensions/to_var_converter.h @@ -8,11 +8,11 @@ #include <string> #include "ppapi/c/pp_var.h" -#include "ppapi/cpp/dev/var_array_dev.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/optional.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { namespace ext { @@ -120,7 +120,7 @@ class ToVarConverter<Var> : public ToVarConverterBase { }; template <> -class ToVarConverter<VarArray_Dev> : public ToVarConverterBase { +class ToVarConverter<VarArray> : public ToVarConverterBase { public: explicit ToVarConverter(const Var& object) : ToVarConverterBase(object) { } @@ -130,7 +130,7 @@ class ToVarConverter<VarArray_Dev> : public ToVarConverterBase { }; template <> -class ToVarConverter<VarDictionary_Dev> : public ToVarConverterBase { +class ToVarConverter<VarDictionary> : public ToVarConverterBase { public: explicit ToVarConverter(const Var& object) : ToVarConverterBase(object) { } diff --git a/ppapi/cpp/host_resolver.cc b/ppapi/cpp/host_resolver.cc new file mode 100644 index 0000000000..656c743775 --- /dev/null +++ b/ppapi/cpp/host_resolver.cc @@ -0,0 +1,93 @@ +// 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/host_resolver.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_HostResolver_1_0>() { + return PPB_HOSTRESOLVER_INTERFACE_1_0; +} + +} // namespace + +HostResolver::HostResolver() { +} + +HostResolver::HostResolver(const InstanceHandle& instance) { + if (has_interface<PPB_HostResolver_1_0>()) { + PassRefFromConstructor(get_interface<PPB_HostResolver_1_0>()->Create( + instance.pp_instance())); + } +} + +HostResolver::HostResolver(PassRef, PP_Resource resource) + : Resource(PASS_REF, resource) { +} + +HostResolver::HostResolver(const HostResolver& other) : Resource(other) { +} + +HostResolver::~HostResolver() { +} + +HostResolver& HostResolver::operator=(const HostResolver& other) { + Resource::operator=(other); + return *this; +} + +// static +bool HostResolver::IsAvailable() { + return has_interface<PPB_HostResolver_1_0>(); +} + +int32_t HostResolver::Resolve(const char* host, + uint16_t port, + const PP_HostResolver_Hint& hint, + const CompletionCallback& callback) { + if (has_interface<PPB_HostResolver_1_0>()) { + return get_interface<PPB_HostResolver_1_0>()->Resolve( + pp_resource(), host, port, &hint, callback.pp_completion_callback()); + } + + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +Var HostResolver::GetCanonicalName() const { + if (has_interface<PPB_HostResolver_1_0>()) { + return Var(PASS_REF, + get_interface<PPB_HostResolver_1_0>()->GetCanonicalName( + pp_resource())); + } + + return Var(); +} + +uint32_t HostResolver::GetNetAddressCount() const { + if (has_interface<PPB_HostResolver_1_0>()) { + return get_interface<PPB_HostResolver_1_0>()->GetNetAddressCount( + pp_resource()); + } + + return 0; +} + +NetAddress HostResolver::GetNetAddress(uint32_t index) const { + if (has_interface<PPB_HostResolver_1_0>()) { + return NetAddress(PASS_REF, + get_interface<PPB_HostResolver_1_0>()->GetNetAddress( + pp_resource(), index)); + } + + return NetAddress(); +} + +} // namespace pp diff --git a/ppapi/cpp/host_resolver.h b/ppapi/cpp/host_resolver.h new file mode 100644 index 0000000000..075ba6da0b --- /dev/null +++ b/ppapi/cpp/host_resolver.h @@ -0,0 +1,115 @@ +// 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. + +#ifndef PPAPI_CPP_HOST_RESOLVER_H_ +#define PPAPI_CPP_HOST_RESOLVER_H_ + +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb_host_resolver.h" +#include "ppapi/cpp/net_address.h" +#include "ppapi/cpp/pass_ref.h" +#include "ppapi/cpp/resource.h" +#include "ppapi/cpp/var.h" + +namespace pp { + +class CompletionCallback; +class InstanceHandle; + +/// The <code>HostResolver</code> class supports host name resolution. +/// +/// Permissions: In order to run <code>Resolve()</code>, apps permission +/// <code>socket</code> with subrule <code>resolve-host</code> is required. +/// For more details about network communication permissions, please see: +/// http://developer.chrome.com/apps/app_network.html +class HostResolver : public Resource { + public: + /// Default constructor for creating an is_null() <code>HostResolver</code> + /// object. + HostResolver(); + + /// A constructor used to create a <code>HostResolver</code> object. + /// + /// @param[in] instance The instance with which this resource will be + /// associated. + explicit HostResolver(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_HostResolver</code> resource. + HostResolver(PassRef, PP_Resource resource); + + /// The copy constructor for <code>HostResolver</code>. + /// + /// @param[in] other A reference to another <code>HostResolver</code>. + HostResolver(const HostResolver& other); + + /// The destructor. + virtual ~HostResolver(); + + /// The assignment operator for <code>HostResolver</code>. + /// + /// @param[in] other A reference to another <code>HostResolver</code>. + /// + /// @return A reference to this <code>HostResolver</code> object. + HostResolver& operator=(const HostResolver& other); + + /// Static function for determining whether the browser supports the + /// <code>PPB_HostResolver</code> interface. + /// + /// @return true if the interface is available, false otherwise. + static bool IsAvailable(); + + /// Requests resolution of a host name. If the call completes successully, the + /// results can be retrieved by <code>GetCanonicalName()</code>, + /// <code>GetNetAddressCount()</code> and <code>GetNetAddress()</code>. + /// + /// @param[in] host The host name (or IP address literal) to resolve. + /// @param[in] port The port number to be set in the resulting network + /// addresses. + /// @param[in] hint A <code>PP_HostResolver_Hint</code> structure + /// providing hints for host resolution. + /// @param[in] callback A <code>CompletionCallback</code> to be called upon + /// completion. + /// + /// @return An int32_t containing an error code from <code>pp_errors.h</code>. + /// <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + /// required permissions. <code>PP_ERROR_NAME_NOT_RESOLVED</code> will be + /// returned if the host name couldn't be resolved. + int32_t Resolve(const char* host, + uint16_t port, + const PP_HostResolver_Hint& hint, + const CompletionCallback& callback); + + /// Gets the canonical name of the host. + /// + /// @return A string <code>Var</code> on success, which is an empty string + /// if <code>PP_HOSTRESOLVER_FLAG_CANONNAME</code> is not set in the hint + /// flags when calling <code>Resolve()</code>; an undefined <code>Var</code> + /// if there is a pending <code>Resolve()</code> call or the previous + /// <code>Resolve()</code> call failed. + Var GetCanonicalName() const; + + /// Gets the number of network addresses. + /// + /// @return The number of available network addresses on success; 0 if there + /// is a pending <code>Resolve()</code> call or the previous + /// <code>Resolve()</code> call failed. + uint32_t GetNetAddressCount() const; + + /// Gets a network address. + /// + /// @param[in] index An index indicating which address to return. + /// + /// @return A <code>NetAddress</code> object. The object will be null + /// (i.e., is_null() returns true) if there is a pending + /// <code>Resolve()</code> call or the previous <code>Resolve()</code> call + /// failed, or the specified index is out of range. + NetAddress GetNetAddress(uint32_t index) const; +}; + +} // namespace pp + +#endif // PPAPI_CPP_HOST_RESOLVER_H_ diff --git a/ppapi/cpp/input_event.h b/ppapi/cpp/input_event.h index 44de16caf4..40e1df1c5e 100644 --- a/ppapi/cpp/input_event.h +++ b/ppapi/cpp/input_event.h @@ -33,7 +33,7 @@ class Var; /// /// bool MyInstance::HandleInputEvent(const pp::InputEvent& event) { /// switch (event.GetType()) { -/// case PP_INPUTEVENT_TYPE_MOUSE_DOWN { +/// case PP_INPUTEVENT_TYPE_MOUSEDOWN { /// pp::MouseInputEvent mouse_event(event); /// return HandleMouseDown(mouse_event.GetMousePosition()); /// } diff --git a/ppapi/cpp/net_address.cc b/ppapi/cpp/net_address.cc new file mode 100644 index 0000000000..e96b03da12 --- /dev/null +++ b/ppapi/cpp/net_address.cc @@ -0,0 +1,99 @@ +// 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/net_address.h" + +#include "ppapi/c/pp_bool.h" +#include "ppapi/cpp/instance_handle.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_NetAddress_1_0>() { + return PPB_NETADDRESS_INTERFACE_1_0; +} + +} // namespace + +NetAddress::NetAddress() { +} + +NetAddress::NetAddress(PassRef, PP_Resource resource) + : Resource(PASS_REF, resource) { +} + +NetAddress::NetAddress(const InstanceHandle& instance, + const PP_NetAddress_IPv4& ipv4_addr) { + if (has_interface<PPB_NetAddress_1_0>()) { + PassRefFromConstructor( + get_interface<PPB_NetAddress_1_0>()->CreateFromIPv4Address( + instance.pp_instance(), &ipv4_addr)); + } +} + +NetAddress::NetAddress(const InstanceHandle& instance, + const PP_NetAddress_IPv6& ipv6_addr) { + if (has_interface<PPB_NetAddress_1_0>()) { + PassRefFromConstructor( + get_interface<PPB_NetAddress_1_0>()->CreateFromIPv6Address( + instance.pp_instance(), &ipv6_addr)); + } +} + +NetAddress::NetAddress(const NetAddress& other) : Resource(other) { +} + +NetAddress::~NetAddress() { +} + +NetAddress& NetAddress::operator=(const NetAddress& other) { + Resource::operator=(other); + return *this; +} + +// static +bool NetAddress::IsAvailable() { + return has_interface<PPB_NetAddress_1_0>(); +} + +PP_NetAddress_Family NetAddress::GetFamily() const { + if (has_interface<PPB_NetAddress_1_0>()) + return get_interface<PPB_NetAddress_1_0>()->GetFamily(pp_resource()); + + return PP_NETADDRESS_FAMILY_UNSPECIFIED; +} + +Var NetAddress::DescribeAsString(bool include_port) const { + if (has_interface<PPB_NetAddress_1_0>()) { + return Var(PASS_REF, + get_interface<PPB_NetAddress_1_0>()->DescribeAsString( + pp_resource(), PP_FromBool(include_port))); + } + + return Var(); +} + +bool NetAddress::DescribeAsIPv4Address(PP_NetAddress_IPv4* ipv4_addr) const { + if (has_interface<PPB_NetAddress_1_0>()) { + return PP_ToBool( + get_interface<PPB_NetAddress_1_0>()->DescribeAsIPv4Address( + pp_resource(), ipv4_addr)); + } + + return false; +} + +bool NetAddress::DescribeAsIPv6Address(PP_NetAddress_IPv6* ipv6_addr) const { + if (has_interface<PPB_NetAddress_1_0>()) { + return PP_ToBool( + get_interface<PPB_NetAddress_1_0>()->DescribeAsIPv6Address( + pp_resource(), ipv6_addr)); + } + + return false; +} + +} // namespace pp diff --git a/ppapi/cpp/net_address.h b/ppapi/cpp/net_address.h new file mode 100644 index 0000000000..9f101f2478 --- /dev/null +++ b/ppapi/cpp/net_address.h @@ -0,0 +1,114 @@ +// 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. + +#ifndef PPAPI_CPP_NET_ADDRESS_H_ +#define PPAPI_CPP_NET_ADDRESS_H_ + +#include "ppapi/c/ppb_net_address.h" +#include "ppapi/cpp/pass_ref.h" +#include "ppapi/cpp/resource.h" +#include "ppapi/cpp/var.h" + +namespace pp { + +class InstanceHandle; + +/// The <code>NetAddress</code> class represents a network address. +class NetAddress : public Resource { + public: + /// Default constructor for creating an is_null() <code>NetAddress</code> + /// object. + NetAddress(); + + /// 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_NetAddress</code> resource. + NetAddress(PassRef, PP_Resource resource); + + /// A constructor used to create a <code>NetAddress</code> object with the + /// specified IPv4 address. + /// + /// @param[in] instance The instance with which this resource will be + /// associated. + /// @param[in] ipv4_addr An IPv4 address. + NetAddress(const InstanceHandle& instance, + const PP_NetAddress_IPv4& ipv4_addr); + + /// A constructor used to create a <code>NetAddress</code> object with the + /// specified IPv6 address. + /// + /// @param[in] instance The instance with which this resource will be + /// associated. + /// @param[in] ipv6_addr An IPv6 address. + NetAddress(const InstanceHandle& instance, + const PP_NetAddress_IPv6& ipv6_addr); + + /// The copy constructor for <code>NetAddress</code>. + /// + /// @param[in] other A reference to another <code>NetAddress</code>. + NetAddress(const NetAddress& other); + + /// The destructor. + virtual ~NetAddress(); + + /// The assignment operator for <code>NetAddress</code>. + /// + /// @param[in] other A reference to another <code>NetAddress</code>. + /// + /// @return A reference to this <code>NetAddress</code> object. + NetAddress& operator=(const NetAddress& other); + + /// Static function for determining whether the browser supports the + /// <code>PPB_NetAddress</code> interface. + /// + /// @return true if the interface is available, false otherwise. + static bool IsAvailable(); + + /// Gets the address family. + /// + /// @return The address family on success; + /// <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure. + PP_NetAddress_Family GetFamily() const; + + /// Returns a human-readable description of the network address. The + /// description is in the form of host [ ":" port ] and conforms to + /// http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses + /// (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). + /// + /// @param[in] include_port Whether to include the port number in the + /// description. + /// + /// @return A string <code>Var</code> on success; an undefined + /// <code>Var</code> on failure. + Var DescribeAsString(bool include_port) const; + + /// Fills a <code>PP_NetAddress_IPv4</code> structure if the network address + /// is of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. + /// Note that passing a network address of + /// <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if + /// the address is an IPv4-mapped IPv6 address. + /// + /// @param[out] ipv4_addr A <code>PP_NetAddress_IPv4</code> structure to store + /// the result. + /// + /// @return A boolean value indicating whether the operation succeeded. + bool DescribeAsIPv4Address(PP_NetAddress_IPv4* ipv4_addr) const; + + /// Fills a <code>PP_NetAddress_IPv6</code> structure if the network address + /// is of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. + /// Note that passing a network address of + /// <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this + /// method doesn't map it to an IPv6 address. + /// + /// @param[out] ipv6_addr A <code>PP_NetAddress_IPv6</code> structure to store + /// the result. + /// + /// @return A boolean value indicating whether the operation succeeded. + bool DescribeAsIPv6Address(PP_NetAddress_IPv6* ipv6_addr) const; +}; + +} // namespace pp + +#endif // PPAPI_CPP_NET_ADDRESS_H_ diff --git a/ppapi/cpp/network_proxy.cc b/ppapi/cpp/network_proxy.cc new file mode 100644 index 0000000000..2d81cb3f63 --- /dev/null +++ b/ppapi/cpp/network_proxy.cc @@ -0,0 +1,38 @@ +// 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/network_proxy.h" + +#include "ppapi/c/ppb_network_proxy.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_NetworkProxy_1_0>() { + return PPB_NETWORKPROXY_INTERFACE_1_0; +} + +} // namespace + +// static +bool NetworkProxy::IsAvailable() { + return has_interface<PPB_NetworkProxy_1_0>(); +} + +// static +int32_t NetworkProxy::GetProxyForURL( + const InstanceHandle& instance, + const Var& url, + const CompletionCallbackWithOutput<Var>& callback) { + if (!has_interface<PPB_NetworkProxy_1_0>()) + return callback.MayForce(PP_ERROR_NOINTERFACE); + + return get_interface<PPB_NetworkProxy_1_0>()->GetProxyForURL( + instance.pp_instance(), url.pp_var(), + callback.output(), callback.pp_completion_callback()); +} + +} // namespace pp diff --git a/ppapi/cpp/network_proxy.h b/ppapi/cpp/network_proxy.h new file mode 100644 index 0000000000..25696de5a4 --- /dev/null +++ b/ppapi/cpp/network_proxy.h @@ -0,0 +1,49 @@ +// 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. + +#ifndef PPAPI_CPP_NETWORK_PROXY_H_ +#define PPAPI_CPP_NETWORK_PROXY_H_ + +#include <string> + +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/instance_handle.h" + +namespace pp { + +/// This class provides a way to determine the appropriate proxy settings for +/// for a given URL. +/// +/// Permissions: Apps permission <code>socket</code> with subrule +/// <code>resolve-proxy</code> is required for using this API. +/// For more details about network communication permissions, please see: +/// http://developer.chrome.com/apps/app_network.html +class NetworkProxy { + public: + /// Returns true if the browser supports this API, false otherwise. + static bool IsAvailable(); + + /// Retrieves the proxy that will be used for the given URL. The result will + /// be a string in PAC format. For more details about PAC format, please see + /// http://en.wikipedia.org/wiki/Proxy_auto-config + /// + /// @param[in] instance An <code>InstanceHandle</code> identifying one + /// instance of a module. + /// + /// @param[in] url A string <code>Var</code> containing a URL. + /// + /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be + /// called upon completion. It will be passed a string <code>Var</code> + /// containing the appropriate PAC string for <code>url</code>. + /// + /// @return An int32_t containing an error code from <code>pp_errors.h</code>. + static int32_t GetProxyForURL( + const InstanceHandle& instance, + const Var& url, + const pp::CompletionCallbackWithOutput<Var>& callback); +}; + +} // namespace pp + +#endif // PPAPI_CPP_NETWORK_PROXY_H_ diff --git a/ppapi/cpp/private/net_address_private.cc b/ppapi/cpp/private/net_address_private.cc index 0e881c7c97..3a32827639 100644 --- a/ppapi/cpp/private/net_address_private.cc +++ b/ppapi/cpp/private/net_address_private.cc @@ -150,7 +150,7 @@ PP_NetAddressFamily_Private NetAddressPrivate::GetFamily( return get_interface<PPB_NetAddress_Private_1_1>()->GetFamily(&addr); if (has_interface<PPB_NetAddress_Private_1_0>()) return get_interface<PPB_NetAddress_Private_1_0>()->GetFamily(&addr); - return PP_NETADDRESSFAMILY_UNSPECIFIED; + return PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED; } // static diff --git a/ppapi/cpp/tcp_socket.cc b/ppapi/cpp/tcp_socket.cc new file mode 100644 index 0000000000..f0002fa554 --- /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/tcp_socket.h b/ppapi/cpp/tcp_socket.h new file mode 100644 index 0000000000..5a5e0f4149 --- /dev/null +++ b/ppapi/cpp/tcp_socket.h @@ -0,0 +1,166 @@ +// 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. + +#ifndef PPAPI_CPP_TCP_SOCKET_H_ +#define PPAPI_CPP_TCP_SOCKET_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" + +namespace pp { + +class CompletionCallback; +class InstanceHandle; + +/// 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 : public Resource { + public: + /// Default constructor for creating an is_null() <code>TCPSocket</code> + /// object. + TCPSocket(); + + /// A constructor used to create a <code>TCPSocket</code> object. + /// + /// @param[in] instance The instance with which this resource will be + /// associated. + 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</code> resource. + TCPSocket(PassRef, PP_Resource resource); + + /// The copy constructor for <code>TCPSocket</code>. + /// + /// @param[in] other A reference to another <code>TCPSocket</code>. + TCPSocket(const TCPSocket& other); + + /// The destructor. + virtual ~TCPSocket(); + + /// The assignment operator for <code>TCPSocket</code>. + /// + /// @param[in] other A reference to another <code>TCPSocket</code>. + /// + /// @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</code> interface. + /// + /// @return true if the interface is available, false otherwise. + static bool IsAvailable(); + + /// Connects the socket to the given address. + /// + /// @param[in] addr A <code>NetAddress</code> object. + /// @param[in] callback A <code>CompletionCallback</code> to be called upon + /// completion. + /// + /// @return An int32_t containing an error code from <code>pp_errors.h</code>, + /// including (but not limited to): + /// - <code>PP_ERROR_NOACCESS</code>: the caller doesn't have required + /// permissions. + /// - <code>PP_ERROR_ADDRESS_UNREACHABLE</code>: <code>addr</code> is + /// unreachable. + /// - <code>PP_ERROR_CONNECTION_REFUSED</code>: the connection attempt was + /// refused. + /// - <code>PP_ERROR_CONNECTION_FAILED</code>: the connection attempt failed. + /// - <code>PP_ERROR_CONNECTION_TIMEDOUT</code>: the connection attempt timed + /// out. + int32_t Connect(const NetAddress& addr, + const CompletionCallback& callback); + + /// Gets the local address of the socket, if it is connected. + /// + /// @return A <code>NetAddress</code> object. The object will be null + /// (i.e., is_null() returns true) on failure. + NetAddress GetLocalAddress() const; + + /// Gets the remote address of the socket, if it is connected. + /// + /// @return A <code>NetAddress</code> object. The object will be null + /// (i.e., is_null() returns true) on failure. + NetAddress GetRemoteAddress() const; + + /// Reads data from the socket. The socket must be connected. It may perform a + /// partial read. + /// + /// <strong>Caveat:</strong> You should be careful about the lifetime of + /// <code>buffer</code>. Typically you will use a + /// <code>CompletionCallbackFactory</code> to scope callbacks to the lifetime + /// 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</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 + /// still pending, you should call <code>Close()</code> to ensure that the + /// buffer won't be accessed in the future. + /// + /// @param[out] buffer The buffer to store the received data on success. It + /// must be at least as large as <code>bytes_to_read</code>. + /// @param[in] bytes_to_read The number of bytes to read. + /// @param[in] callback A <code>CompletionCallback</code> to be called upon + /// completion. + /// + /// @return A non-negative number on success to indicate how many bytes have + /// been read, 0 means that end-of-file was reached; otherwise, an error code + /// from <code>pp_errors.h</code>. + int32_t Read(char* buffer, + int32_t bytes_to_read, + const CompletionCallback& callback); + + /// Writes data to the socket. The socket must be connected. It may perform a + /// partial write. + /// + /// @param[in] buffer The buffer containing the data to write. + /// @param[in] bytes_to_write The number of bytes to write. + /// @param[in] callback A <code>CompletionCallback</code> to be called upon + /// completion. + /// + /// @return A non-negative number on success to indicate how many bytes have + /// been written; otherwise, an error code from <code>pp_errors.h</code>. + int32_t Write(const char* buffer, + int32_t bytes_to_write, + const CompletionCallback& callback); + + /// Cancels all pending reads and writes and disconnects the socket. Any + /// pending callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> + /// if pending IO was interrupted. After a call to this method, no output + /// buffer pointers passed into previous <code>Read()</code> calls will be + /// accessed. It is not valid to call <code>Connect()</code> again. + /// + /// The socket is implicitly closed if it is destroyed, so you are not + /// required to call this method. + void Close(); + + /// Sets a socket option on the TCP socket. + /// Please see the <code>PP_TCPSocket_Option</code> description for option + /// names, value types and allowed values. + /// + /// @param[in] name The option to set. + /// @param[in] value The option value to set. + /// @param[in] callback A <code>CompletionCallback</code> to be called upon + /// completion. + /// + /// @return An int32_t containing an error code from <code>pp_errors.h</code>. + //// + int32_t SetOption(PP_TCPSocket_Option name, + const Var& value, + const CompletionCallback& callback); +}; + +} // namespace pp + +#endif // PPAPI_CPP_TCP_SOCKET_H_ diff --git a/ppapi/cpp/udp_socket.cc b/ppapi/cpp/udp_socket.cc new file mode 100644 index 0000000000..bb4b1c895b --- /dev/null +++ b/ppapi/cpp/udp_socket.cc @@ -0,0 +1,110 @@ +// 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/udp_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" +#include "ppapi/cpp/var.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_UDPSocket_1_0>() { + return PPB_UDPSOCKET_INTERFACE_1_0; +} + +} // namespace + +UDPSocket::UDPSocket() { +} + +UDPSocket::UDPSocket(const InstanceHandle& instance) { + if (has_interface<PPB_UDPSocket_1_0>()) { + PassRefFromConstructor(get_interface<PPB_UDPSocket_1_0>()->Create( + instance.pp_instance())); + } +} + +UDPSocket::UDPSocket(PassRef, PP_Resource resource) + : Resource(PASS_REF, resource) { +} + +UDPSocket::UDPSocket(const UDPSocket& other) : Resource(other) { +} + +UDPSocket::~UDPSocket() { +} + +UDPSocket& UDPSocket::operator=(const UDPSocket& other) { + Resource::operator=(other); + return *this; +} + +// static +bool UDPSocket::IsAvailable() { + return has_interface<PPB_UDPSocket_1_0>(); +} + +int32_t UDPSocket::Bind(const NetAddress& addr, + const CompletionCallback& callback) { + if (has_interface<PPB_UDPSocket_1_0>()) { + return get_interface<PPB_UDPSocket_1_0>()->Bind( + pp_resource(), addr.pp_resource(), callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +NetAddress UDPSocket::GetBoundAddress() { + if (has_interface<PPB_UDPSocket_1_0>()) { + return NetAddress( + PASS_REF, + get_interface<PPB_UDPSocket_1_0>()->GetBoundAddress(pp_resource())); + } + return NetAddress(); +} + +int32_t UDPSocket::RecvFrom( + char* buffer, + int32_t num_bytes, + const CompletionCallbackWithOutput<NetAddress>& callback) { + if (has_interface<PPB_UDPSocket_1_0>()) { + return get_interface<PPB_UDPSocket_1_0>()->RecvFrom( + pp_resource(), buffer, num_bytes, callback.output(), + callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +int32_t UDPSocket::SendTo(const char* buffer, + int32_t num_bytes, + const NetAddress& addr, + const CompletionCallback& callback) { + if (has_interface<PPB_UDPSocket_1_0>()) { + return get_interface<PPB_UDPSocket_1_0>()->SendTo( + pp_resource(), buffer, num_bytes, addr.pp_resource(), + callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +void UDPSocket::Close() { + if (has_interface<PPB_UDPSocket_1_0>()) + return get_interface<PPB_UDPSocket_1_0>()->Close(pp_resource()); +} + +int32_t UDPSocket::SetOption(PP_UDPSocket_Option name, + const Var& value, + const CompletionCallback& callback) { + if (has_interface<PPB_UDPSocket_1_0>()) { + return get_interface<PPB_UDPSocket_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/udp_socket.h b/ppapi/cpp/udp_socket.h new file mode 100644 index 0000000000..fa599d71d8 --- /dev/null +++ b/ppapi/cpp/udp_socket.h @@ -0,0 +1,160 @@ +// 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. + +#ifndef PPAPI_CPP_UDP_SOCKET_H_ +#define PPAPI_CPP_UDP_SOCKET_H_ + +#include "ppapi/c/ppb_udp_socket.h" +#include "ppapi/cpp/net_address.h" +#include "ppapi/cpp/pass_ref.h" +#include "ppapi/cpp/resource.h" + +namespace pp { + +class CompletionCallback; +class InstanceHandle; +class Var; + +template <typename T> class CompletionCallbackWithOutput; + +/// The <code>UDPSocket</code> class provides UDP socket operations. +/// +/// Permissions: Apps permission <code>socket</code> with subrule +/// <code>udp-bind</code> is required for <code>Bind()</code>; subrule +/// <code>udp-send-to</code> is required for <code>SendTo()</code>. +/// For more details about network communication permissions, please see: +/// http://developer.chrome.com/apps/app_network.html +class UDPSocket : public Resource { + public: + /// Default constructor for creating an is_null() <code>UDPSocket</code> + /// object. + UDPSocket(); + + /// A constructor used to create a <code>UDPSocket</code> object. + /// + /// @param[in] instance The instance with which this resource will be + /// associated. + explicit UDPSocket(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_UDPSocket</code> resource. + UDPSocket(PassRef, PP_Resource resource); + + /// The copy constructor for <code>UDPSocket</code>. + /// + /// @param[in] other A reference to another <code>UDPSocket</code>. + UDPSocket(const UDPSocket& other); + + /// The destructor. + virtual ~UDPSocket(); + + /// The assignment operator for <code>UDPSocket</code>. + /// + /// @param[in] other A reference to another <code>UDPSocket</code>. + /// + /// @return A reference to this <code>UDPSocket</code> object. + UDPSocket& operator=(const UDPSocket& other); + + /// Static function for determining whether the browser supports the + /// <code>PPB_UDPSocket</code> interface. + /// + /// @return true if the interface is available, false otherwise. + static bool IsAvailable(); + + /// Binds the socket to the given address. + /// + /// @param[in] addr A <code>NetAddress</code> object. + /// @param[in] callback A <code>CompletionCallback</code> to be called upon + /// completion. + /// + /// @return An int32_t containing an error code from <code>pp_errors.h</code>. + /// <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + /// required permissions. <code>PP_ERROR_ADDRESS_IN_USE</code> will be + /// returned if the address is already in use. + int32_t Bind(const NetAddress& addr, + const CompletionCallback& callback); + + /// Get the address that the socket is bound to. The socket must be bound. + /// + /// @return A <code>NetAddress</code> object. The object will be null + /// (i.e., is_null() returns true) on failure. + NetAddress GetBoundAddress(); + + /// Receives data from the socket and stores the source address. The socket + /// must be bound. + /// + /// <strong>Caveat:</strong> You should be careful about the lifetime of + /// <code>buffer</code>. Typically you will use a + /// <code>CompletionCallbackFactory</code> to scope callbacks to the lifetime + /// 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_UDPSocket</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>RecvFrom()</code> call + /// is still pending, you should call <code>Close()</code> to ensure that the + /// buffer won't be accessed in the future. + /// + /// @param[out] buffer The buffer to store the received data on success. It + /// must be at least as large as <code>num_bytes</code>. + /// @param[in] num_bytes The number of bytes to receive. + /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be + /// called upon completion. + /// + /// @return A non-negative number on success to indicate how many bytes have + /// been received; otherwise, an error code from <code>pp_errors.h</code>. + int32_t RecvFrom( + char* buffer, + int32_t num_bytes, + const CompletionCallbackWithOutput<NetAddress>& callback); + + /// Sends data to a specific destination. The socket must be bound. + /// + /// @param[in] buffer The buffer containing the data to send. + /// @param[in] num_bytes The number of bytes to send. + /// @param[in] addr A <code>NetAddress</code> object holding the destination + /// address. + /// @param[in] callback A <code>CompletionCallback</code> to be called upon + /// completion. + /// + /// @return A non-negative number on success to indicate how many bytes have + /// been sent; otherwise, an error code from <code>pp_errors.h</code>. + /// <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + /// required permissions. + int32_t SendTo(const char* buffer, + int32_t num_bytes, + const NetAddress& addr, + const CompletionCallback& callback); + + /// Cancels all pending reads and writes, and closes the socket. Any pending + /// callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> if + /// pending IO was interrupted. After a call to this method, no output + /// paramters passed into previous <code>RecvFrom()</code> calls will be + /// accessed. It is not valid to call <code>Bind()</code> again. + /// + /// The socket is implicitly closed if it is destroyed, so you are not + /// required to call this method. + void Close(); + + /// Sets a socket option on the UDP socket. + /// Please see the <code>PP_UDPSocket_Option</code> description for option + /// names, value types and allowed values. + /// + /// @param[in] name The option to set. + /// @param[in] value The option value to set. + /// @param[in] callback A <code>CompletionCallback</code> to be called upon + /// completion. + /// + /// @return An int32_t containing an error code from <code>pp_errors.h</code>. + int32_t SetOption(PP_UDPSocket_Option name, + const Var& value, + const CompletionCallback& callback); +}; + +} // namespace pp + +#endif // PPAPI_CPP_UDP_SOCKET_H_ diff --git a/ppapi/cpp/var_array.cc b/ppapi/cpp/var_array.cc new file mode 100644 index 0000000000..7a504e7cb5 --- /dev/null +++ b/ppapi/cpp/var_array.cc @@ -0,0 +1,96 @@ +// 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/var_array.h" + +#include "ppapi/c/ppb_var_array.h" +#include "ppapi/cpp/logging.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_VarArray_1_0>() { + return PPB_VAR_ARRAY_INTERFACE_1_0; +} + +} // namespace + +VarArray::VarArray() : Var(Null()) { + if (has_interface<PPB_VarArray_1_0>()) + var_ = get_interface<PPB_VarArray_1_0>()->Create(); + else + PP_NOTREACHED(); +} + +VarArray::VarArray(const Var& var) : Var(var) { + if (!var.is_array()) { + PP_NOTREACHED(); + + // This takes care of releasing the reference that this object holds. + Var::operator=(Var(Null())); + } +} + +VarArray::VarArray(const PP_Var& var) : Var(var) { + if (var.type != PP_VARTYPE_ARRAY) { + PP_NOTREACHED(); + + // This takes care of releasing the reference that this object holds. + Var::operator=(Var(Null())); + } +} + +VarArray::VarArray(const VarArray& other) : Var(other) { +} + +VarArray::~VarArray() { +} + +VarArray& VarArray::operator=(const VarArray& other) { + Var::operator=(other); + return *this; +} + +Var& VarArray::operator=(const Var& other) { + if (other.is_array()) { + Var::operator=(other); + } else { + PP_NOTREACHED(); + Var::operator=(Var(Null())); + } + return *this; +} + +Var VarArray::Get(uint32_t index) const { + if (!has_interface<PPB_VarArray_1_0>()) + return Var(); + + return Var(PASS_REF, get_interface<PPB_VarArray_1_0>()->Get(var_, index)); +} + +bool VarArray::Set(uint32_t index, const Var& value) { + if (!has_interface<PPB_VarArray_1_0>()) + return false; + + return PP_ToBool(get_interface<PPB_VarArray_1_0>()->Set(var_, index, + value.pp_var())); +} + +uint32_t VarArray::GetLength() const { + if (!has_interface<PPB_VarArray_1_0>()) + return 0; + + return get_interface<PPB_VarArray_1_0>()->GetLength(var_); +} + +bool VarArray::SetLength(uint32_t length) { + if (!has_interface<PPB_VarArray_1_0>()) + return false; + + return PP_ToBool(get_interface<PPB_VarArray_1_0>()->SetLength(var_, length)); +} + +} // namespace pp diff --git a/ppapi/cpp/dev/var_array_dev.h b/ppapi/cpp/var_array.h index 17a3277029..49373ff260 100644 --- a/ppapi/cpp/dev/var_array_dev.h +++ b/ppapi/cpp/var_array.h @@ -1,9 +1,9 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// 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. -#ifndef PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ -#define PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ +#ifndef PPAPI_CPP_VAR_ARRAY_H_ +#define PPAPI_CPP_VAR_ARRAY_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_stdint.h" @@ -14,38 +14,38 @@ namespace pp { -class VarArray_Dev : public Var { +class VarArray : public Var { public: /// Constructs a new array var. - VarArray_Dev(); + VarArray(); - /// Constructs a <code>VarArray_Dev</code> given a var for which is_array() is + /// Constructs a <code>VarArray</code> given a var for which is_array() is /// true. This will refer to the same array var, but allow you to access /// methods specific to arrays. /// /// @param[in] var An array var. - explicit VarArray_Dev(const Var& var); + explicit VarArray(const Var& var); - /// Constructs a <code>VarArray_Dev</code> given a <code>PP_Var</code> of type + /// Constructs a <code>VarArray</code> given a <code>PP_Var</code> of type /// PP_VARTYPE_ARRAY. /// /// @param[in] var A <code>PP_Var</code> of type PP_VARTYPE_ARRAY. - explicit VarArray_Dev(const PP_Var& var); + explicit VarArray(const PP_Var& var); /// Copy constructor. - VarArray_Dev(const VarArray_Dev& other); + VarArray(const VarArray& other); - virtual ~VarArray_Dev(); + virtual ~VarArray(); /// Assignment operator. - VarArray_Dev& operator=(const VarArray_Dev& other); + VarArray& operator=(const VarArray& other); /// The <code>Var</code> assignment operator is overridden here so that we can - /// check for assigning a non-array var to a <code>VarArray_Dev</code>. + /// check for assigning a non-array var to a <code>VarArray</code>. /// /// @param[in] other The array var to be assigned. /// - /// @return The resulting <code>VarArray_Dev</code> (as a <code>Var</code>&). + /// @return The resulting <code>VarArray</code> (as a <code>Var</code>&). virtual Var& operator=(const Var& other); /// Gets an element from the array. @@ -65,8 +65,8 @@ class VarArray_Dev : public Var { /// type <code>PP_VARTYPE_UNDEFINED</code>. /// @param[in] value The value to set. /// - /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. - PP_Bool Set(uint32_t index, const Var& value); + /// @return A <code>bool</code> indicating whether the operation succeeds. + bool Set(uint32_t index, const Var& value); /// Gets the array length. /// @@ -81,10 +81,10 @@ class VarArray_Dev : public Var { /// than its current value, undefined vars are appended to increase the array /// to the specified length. /// - /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. - PP_Bool SetLength(uint32_t length); + /// @return A <code>bool</code> indicating whether the operation succeeds. + bool SetLength(uint32_t length); }; } // namespace pp -#endif // PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ +#endif // PPAPI_CPP_VAR_ARRAY_H_ diff --git a/ppapi/cpp/var_dictionary.cc b/ppapi/cpp/var_dictionary.cc new file mode 100644 index 0000000000..600b1f2d9d --- /dev/null +++ b/ppapi/cpp/var_dictionary.cc @@ -0,0 +1,111 @@ +// 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/var_dictionary.h" + +#include "ppapi/c/ppb_var_dictionary.h" +#include "ppapi/cpp/logging.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_VarDictionary_1_0>() { + return PPB_VAR_DICTIONARY_INTERFACE_1_0; +} + +} // namespace + +VarDictionary::VarDictionary() : Var(Null()) { + if (has_interface<PPB_VarDictionary_1_0>()) + var_ = get_interface<PPB_VarDictionary_1_0>()->Create(); + else + PP_NOTREACHED(); +} + +VarDictionary::VarDictionary(const Var& var) : Var(var) { + if (!var.is_dictionary()) { + PP_NOTREACHED(); + + // This takes care of releasing the reference that this object holds. + Var::operator=(Var(Null())); + } +} + +VarDictionary::VarDictionary(const PP_Var& var) : Var(var) { + if (var.type != PP_VARTYPE_DICTIONARY) { + PP_NOTREACHED(); + + // This takes care of releasing the reference that this object holds. + Var::operator=(Var(Null())); + } +} + +VarDictionary::VarDictionary(const VarDictionary& other) + : Var(other) { +} + +VarDictionary::~VarDictionary() { +} + +VarDictionary& VarDictionary::operator=( + const VarDictionary& other) { + Var::operator=(other); + return *this; +} + +Var& VarDictionary::operator=(const Var& other) { + if (other.is_dictionary()) { + Var::operator=(other); + } else { + PP_NOTREACHED(); + Var::operator=(Var(Null())); + } + return *this; +} + +Var VarDictionary::Get(const Var& key) const { + if (!has_interface<PPB_VarDictionary_1_0>()) + return Var(); + + return Var( + PASS_REF, + get_interface<PPB_VarDictionary_1_0>()->Get(var_, key.pp_var())); +} + +bool VarDictionary::Set(const Var& key, const Var& value) { + if (!has_interface<PPB_VarDictionary_1_0>()) + return false; + + return PP_ToBool(get_interface<PPB_VarDictionary_1_0>()->Set( + var_, key.pp_var(), value.pp_var())); +} + +void VarDictionary::Delete(const Var& key) { + if (has_interface<PPB_VarDictionary_1_0>()) + get_interface<PPB_VarDictionary_1_0>()->Delete(var_, key.pp_var()); +} + +bool VarDictionary::HasKey(const Var& key) const { + if (!has_interface<PPB_VarDictionary_1_0>()) + return false; + + return PP_ToBool(get_interface<PPB_VarDictionary_1_0>()->HasKey( + var_, key.pp_var())); +} + +VarArray VarDictionary::GetKeys() const { + if (!has_interface<PPB_VarDictionary_1_0>()) + return VarArray(); + + Var result(PASS_REF, + get_interface<PPB_VarDictionary_1_0>()->GetKeys(var_)); + if (result.is_array()) + return VarArray(result); + else + return VarArray(); +} + +} // namespace pp diff --git a/ppapi/cpp/dev/var_dictionary_dev.h b/ppapi/cpp/var_dictionary.h index 2b2e79d41a..1c5bd2bb2e 100644 --- a/ppapi/cpp/dev/var_dictionary_dev.h +++ b/ppapi/cpp/var_dictionary.h @@ -1,52 +1,52 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// 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. -#ifndef PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_ -#define PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_ +#ifndef PPAPI_CPP_VAR_DICTIONARY_H_ +#define PPAPI_CPP_VAR_DICTIONARY_H_ #include "ppapi/c/pp_bool.h" -#include "ppapi/cpp/dev/var_array_dev.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" /// @file /// This file defines the API for interacting with dictionary vars. namespace pp { -class VarDictionary_Dev : public Var { +class VarDictionary : public Var { public: /// Constructs a new dictionary var. - VarDictionary_Dev(); + VarDictionary(); - /// Constructs a <code>VarDictionary_Dev</code> given a var for which + /// Constructs a <code>VarDictionary</code> given a var for which /// is_dictionary() is true. This will refer to the same dictionary var, but /// allow you to access methods specific to dictionary. /// /// @param[in] var A dictionary var. - explicit VarDictionary_Dev(const Var& var); + explicit VarDictionary(const Var& var); - /// Constructs a <code>VarDictionary_Dev</code> given a <code>PP_Var</code> + /// Constructs a <code>VarDictionary</code> given a <code>PP_Var</code> /// of type PP_VARTYPE_DICTIONARY. /// /// @param[in] var A <code>PP_Var</code> of type PP_VARTYPE_DICTIONARY. - explicit VarDictionary_Dev(const PP_Var& var); + explicit VarDictionary(const PP_Var& var); /// Copy constructor. - VarDictionary_Dev(const VarDictionary_Dev& other); + VarDictionary(const VarDictionary& other); - virtual ~VarDictionary_Dev(); + virtual ~VarDictionary(); /// Assignment operator. - VarDictionary_Dev& operator=(const VarDictionary_Dev& other); + VarDictionary& operator=(const VarDictionary& other); /// The <code>Var</code> assignment operator is overridden here so that we can /// check for assigning a non-dictionary var to a - /// <code>VarDictionary_Dev</code>. + /// <code>VarDictionary</code>. /// /// @param[in] other The dictionary var to be assigned. /// - /// @return The resulting <code>VarDictionary_Dev</code> (as a + /// @return The resulting <code>VarDictionary</code> (as a /// <code>Var</code>&). virtual Var& operator=(const Var& other); @@ -66,8 +66,8 @@ class VarDictionary_Dev : public Var { /// previous value is replaced with <code>value</code>. /// @param[in] value The value to set. /// - /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. - PP_Bool Set(const Var& key, const Var& value); + /// @return A <code>bool</code> indicating whether the operation succeeds. + bool Set(const Var& key, const Var& value); /// Deletes the specified key and its associated value, if the key exists. /// @@ -78,16 +78,16 @@ class VarDictionary_Dev : public Var { /// /// @param[in] key A string var. /// - /// @return A <code>PP_Bool</code> indicating whether the key exists. - PP_Bool HasKey(const Var& key) const; + /// @return A <code>bool</code> indicating whether the key exists. + bool HasKey(const Var& key) const; /// Gets all the keys in the dictionary. /// /// @return An array var which contains all the keys of the dictionary. /// The elements are string vars. Returns an empty array var if failed. - VarArray_Dev GetKeys() const; + VarArray GetKeys() const; }; } // namespace pp -#endif // PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_ +#endif // PPAPI_CPP_VAR_DICTIONARY_H_ diff --git a/ppapi/examples/audio_input/audio_input.cc b/ppapi/examples/audio_input/audio_input.cc index e2df2b87ba..06cea4381b 100644 --- a/ppapi/examples/audio_input/audio_input.cc +++ b/ppapi/examples/audio_input/audio_input.cc @@ -20,6 +20,7 @@ #include "ppapi/cpp/rect.h" #include "ppapi/cpp/size.h" #include "ppapi/utility/completion_callback_factory.h" +#include "ppapi/utility/threading/lock.h" // When compiling natively on Windows, PostMessage can be #define-d to // something else. @@ -45,6 +46,7 @@ class MyInstance : public pp::Instance { sample_count_(0), channel_count_(0), samples_(NULL), + latency_(0), timer_interval_(0), pending_paint_(false), waiting_for_flush_completion_(false) { @@ -53,6 +55,8 @@ class MyInstance : public pp::Instance { device_detector_.MonitorDeviceChange(NULL, NULL); audio_input_.Close(); + // The audio input thread has exited before the previous call returned, so + // it is safe to do so now. delete[] samples_; } @@ -187,13 +191,25 @@ class MyInstance : public pp::Instance { *image.GetAddr32(pp::Point(x, mid_height - max_amplitude)) = 0xff404040; } - // Draw our samples. - for (int x = 0, i = 0; - x < std::min(size.width(), static_cast<int>(sample_count_)); - x++, i += channel_count_) { - int y = samples_[i] * max_amplitude / - (std::numeric_limits<int16_t>::max() + 1) + mid_height; - *image.GetAddr32(pp::Point(x, y)) = 0xffffffff; + { + pp::AutoLock auto_lock(lock_); + + // Draw the latency as a red bar at the bottom. + PP_DCHECK(latency_ >= 0); + int latency_bar_length = + latency_ < 1 ? size.width() * latency_ : size.width(); + for (int x = 0; x < latency_bar_length; ++x) { + *image.GetAddr32(pp::Point(x, mid_height + max_amplitude)) = 0xffff0000; + } + + // Draw our samples. + for (int x = 0, i = 0; + x < std::min(size.width(), static_cast<int>(sample_count_)); + x++, i += channel_count_) { + int y = samples_[i] * max_amplitude / + (std::numeric_limits<int16_t>::max() + 1) + mid_height; + *image.GetAddr32(pp::Point(x, y)) = 0xffffffff; + } } return image; @@ -252,14 +268,13 @@ class MyInstance : public pp::Instance { } } - // TODO(viettrungluu): Danger! We really should lock, but which thread - // primitives to use? In any case, the |StopCapture()| in the destructor - // shouldn't return until this callback is done, so at least we should be - // writing to a valid region of memory. static void CaptureCallback(const void* samples, uint32_t num_bytes, + PP_TimeDelta latency, void* ctx) { MyInstance* thiz = static_cast<MyInstance*>(ctx); + pp::AutoLock auto_lock(thiz->lock_); + thiz->latency_ = latency; uint32_t buffer_size = thiz->sample_count_ * thiz->channel_count_ * sizeof(int16_t); PP_DCHECK(num_bytes <= buffer_size); @@ -295,6 +310,8 @@ class MyInstance : public pp::Instance { uint32_t channel_count_; int16_t* samples_; + PP_TimeDelta latency_; + int32_t timer_interval_; // Painting stuff. @@ -311,6 +328,9 @@ class MyInstance : public pp::Instance { std::vector<pp::DeviceRef_Dev> enumerate_devices_; std::vector<pp::DeviceRef_Dev> monitor_devices_; + + // Protects |samples_| and |latency_|. + pp::Lock lock_; }; class MyModule : public pp::Module { diff --git a/ppapi/generators/OWNERS b/ppapi/generators/OWNERS index e5369e8b13..c3be9543d9 100644 --- a/ppapi/generators/OWNERS +++ b/ppapi/generators/OWNERS @@ -1,3 +1,4 @@ +yzshen@chromium.org noelallen@chromium.org noelallen@google.com sehr@google.com diff --git a/ppapi/generators/idl_c_proto.py b/ppapi/generators/idl_c_proto.py index fff3e656df..2989a09afd 100755 --- a/ppapi/generators/idl_c_proto.py +++ b/ppapi/generators/idl_c_proto.py @@ -276,11 +276,16 @@ class CGen(object): # If it's an enum, or typedef then return the Enum's name elif typeref.IsA('Enum', 'Typedef'): + if not typeref.LastRelease(release): + first = node.first_release[release] + ver = '_' + node.GetVersion(first).replace('.','_') + else: + ver = '' # The enum may have skipped having a typedef, we need prefix with 'enum'. if typeref.GetProperty('notypedef'): - name = 'enum %s%s' % (prefix, typeref.GetName()) + name = 'enum %s%s%s' % (prefix, typeref.GetName(), ver) else: - name = '%s%s' % (prefix, typeref.GetName()) + name = '%s%s%s' % (prefix, typeref.GetName(), ver) else: raise RuntimeError('Getting name of non-type %s.' % node) @@ -386,6 +391,8 @@ class CGen(object): if callnode: callspec = [] for param in callnode.GetListOf('Param'): + if not param.IsRelease(release): + continue mode = self.GetParamMode(param) ptype, pname, parray, pspec = self.GetComponents(param, release, mode) callspec.append((ptype, pname, parray, pspec)) @@ -460,13 +467,15 @@ class CGen(object): __pychecker__ = 'unusednames=comment' build_list = node.GetUniqueReleases(releases) - # TODO(noelallen) : Bug 157017 finish multiversion support - if len(build_list) != 1: - node.Error('Can not support multiple versions of node: %s' % build_list) - assert len(build_list) == 1 - - out = 'typedef %s;\n' % self.GetSignature(node, build_list[0], 'return', - prefix, True) + out = 'typedef %s;\n' % self.GetSignature(node, build_list[-1], 'return', + prefix, True, + include_version=False) + # Version mangle any other versions + for index, rel in enumerate(build_list[:-1]): + out += '\n' + out += 'typedef %s;\n' % self.GetSignature(node, rel, 'return', + prefix, True, + include_version=True) self.Log('DefineTypedef: %s' % out) return out diff --git a/ppapi/generators/idl_gen_pnacl.py b/ppapi/generators/idl_gen_pnacl.py index 1d7dc6e17e..2dc631b687 100755 --- a/ppapi/generators/idl_gen_pnacl.py +++ b/ppapi/generators/idl_gen_pnacl.py @@ -57,6 +57,8 @@ class PnaclGen(WrapperGen): """ if self._skip_opt: return True + if iface.GetName().endswith('Trusted'): + return False for member in iface.GetListOf('Member'): release = member.GetRelease(version) if self.MemberNeedsWrapping(member, release): diff --git a/ppapi/generators/idl_gen_wrapper.py b/ppapi/generators/idl_gen_wrapper.py index b828562c15..bbcfd71fae 100644 --- a/ppapi/generators/idl_gen_wrapper.py +++ b/ppapi/generators/idl_gen_wrapper.py @@ -157,7 +157,7 @@ static struct %(wrapper_struct)s *%(wrapper_prefix)sPPPShimIface( const void *__%(wrapper_prefix)s_PPBGetInterface(const char *name) { struct %(wrapper_struct)s *wrapper = %(wrapper_prefix)sPPBShimIface(name); if (wrapper == NULL) { - /* We don't have an IDL for this, for some reason. Take our chances. */ + /* We did not generate a wrapper for this, so return the real interface. */ return (*__real_PPBGetInterface)(name); } @@ -178,7 +178,7 @@ const void *__%(wrapper_prefix)s_PPBGetInterface(const char *name) { const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) { struct %(wrapper_struct)s *wrapper = %(wrapper_prefix)sPPPShimIface(name); if (wrapper == NULL) { - /* We don't have an IDL for this, for some reason. Take our chances. */ + /* We did not generate a wrapper for this, so return the real interface. */ return (*__real_PPPGetInterface)(name); } @@ -364,9 +364,7 @@ const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) { if iface.needs_wrapping: wrap_iface = '(void *) &%s_Wrappers_%s' % (self.wrapper_prefix, iface.struct_name) - else: - wrap_iface = 'NULL /* Still need slot for real_iface */' - out.Write("""static struct %s %s = { + out.Write("""static struct %s %s = { .iface_macro = %s, .wrapped_iface = %s, .real_iface = NULL @@ -379,10 +377,11 @@ const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) { ppb_wrapper_infos = [] ppp_wrapper_infos = [] for iface in iface_releases: - appender = PPKind.ChoosePPFunc(iface, - ppb_wrapper_infos.append, - ppp_wrapper_infos.append) - appender(' &%s' % self.GetWrapperInfoName(iface)) + if iface.needs_wrapping: + appender = PPKind.ChoosePPFunc(iface, + ppb_wrapper_infos.append, + ppp_wrapper_infos.append) + appender(' &%s' % self.GetWrapperInfoName(iface)) ppb_wrapper_infos.append(' NULL') ppp_wrapper_infos.append(' NULL') out.Write( @@ -399,8 +398,10 @@ const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) { """ out.Write('/* BEGIN Declarations for all Wrapper Infos */\n\n') for iface in iface_releases: - out.Write('static struct %s %s;\n' % - (self.GetWrapperMetadataName(), self.GetWrapperInfoName(iface))) + if iface.needs_wrapping: + out.Write('static struct %s %s;\n' % + (self.GetWrapperMetadataName(), + self.GetWrapperInfoName(iface))) out.Write('/* END Declarations for all Wrapper Infos. */\n\n') diff --git a/ppapi/generators/idl_node.py b/ppapi/generators/idl_node.py index ec40ffe6e2..a6b1c88c4f 100755 --- a/ppapi/generators/idl_node.py +++ b/ppapi/generators/idl_node.py @@ -70,6 +70,7 @@ class IDLNode(IDLRelease): self.typelist = None self.parent = None self.property_node = IDLPropertyNode() + self.unique_releases = None # A list of unique releases for this node self.releases = None @@ -297,9 +298,17 @@ class IDLNode(IDLRelease): remapped = self.first_release[rel] if not remapped: continue out |= set([remapped]) - out = sorted(out) - return out + # Cache the most recent set of unique_releases + self.unique_releases = sorted(out) + return self.unique_releases + + def LastRelease(self, release): + # Get the most recent release from the most recently generated set of + # cached unique releases. + if self.unique_releases and self.unique_releases[-1] > release: + return False + return True def GetRelease(self, version): filenode = self.GetProperty('FILE') diff --git a/ppapi/generators/idl_parser.py b/ppapi/generators/idl_parser.py index 95b0ddb708..40751e3f26 100755 --- a/ppapi/generators/idl_parser.py +++ b/ppapi/generators/idl_parser.py @@ -1162,6 +1162,7 @@ def TestVersionFiles(filter): ast = ParseFiles(testnames) errs = FindVersionError(ast.releases, ast) + errs += ast.errors if errs: ErrOut.Log("Failed version test.") diff --git a/ppapi/generators/idl_thunk.py b/ppapi/generators/idl_thunk.py index 1bb0de0d68..023335c9a2 100755 --- a/ppapi/generators/idl_thunk.py +++ b/ppapi/generators/idl_thunk.py @@ -502,7 +502,6 @@ class TGen(GeneratorByFile): build_list = filter(lambda r: child.InReleases([r]), build_list) if len(build_list) == 0: continue - assert(len(build_list) == 1) release = build_list[-1] include_version = not _IsNewestMember(child, members, releases) member = DefineMember(filenode, node, child, release, include_version, diff --git a/ppapi/generators/test_version/versions.idl b/ppapi/generators/test_version/versions.idl index ce39f2a1e6..4d1a42fc13 100644 --- a/ppapi/generators/test_version/versions.idl +++ b/ppapi/generators/test_version/versions.idl @@ -51,3 +51,16 @@ struct iX { [version=1.0] int32_t y; }; + +/** + * Typedef to generate M13-M14, M15 + */ +typedef int32_t callback_t([in] int32_t x, [in, version=2.0] int32_t y); + +/*REL: M13 M14 M15 */ +interface iFooX { + /** + * Comment for function Bar + */ + int32_t Bar([in, version=1.0] callback_t cb); +};
\ No newline at end of file diff --git a/ppapi/host/error_conversion.cc b/ppapi/host/error_conversion.cc index 4fc5b8b696..da985d3996 100644 --- a/ppapi/host/error_conversion.cc +++ b/ppapi/host/error_conversion.cc @@ -4,6 +4,7 @@ #include "ppapi/host/error_conversion.h" +#include "base/safe_numerics.h" #include "net/base/net_errors.h" #include "ppapi/c/pp_errors.h" @@ -12,7 +13,7 @@ namespace host { int32_t NetErrorToPepperError(int net_error) { if (net_error > 0) - return static_cast<int32_t>(net_error); + return base::checked_numeric_cast<int32_t>(net_error); switch (net_error) { case net::OK: diff --git a/ppapi/lib/gl/egl/egldriver.c b/ppapi/lib/gl/egl/egldriver.c deleted file mode 100644 index 05f266e01e..0000000000 --- a/ppapi/lib/gl/egl/egldriver.c +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2010 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 <stddef.h> - -#include "third_party/mesa/src/src/egl/main/egldriver.h" - -#include "third_party/mesa/src/src/egl/main/eglconfig.h" -#include "third_party/mesa/src/src/egl/main/eglcontext.h" -#include "third_party/mesa/src/src/egl/main/egldisplay.h" -#include "third_party/mesa/src/src/egl/main/eglmisc.h" -#include "third_party/mesa/src/src/egl/main/eglsurface.h" - -/** - * Functions for choosing and opening/loading device drivers. - */ - -static _EGLDriver *_eglDriver; - -static EGLBoolean _eglLoadDriver() { - assert(!_eglDriver); - - _eglDriver = _eglMain(NULL); - return _eglDriver ? EGL_TRUE : EGL_FALSE; -} - -/** - * Match a display to a driver. The display is initialized unless use_probe is - * true. - */ - -_EGLDriver * _eglMatchDriver(_EGLDisplay *dpy, EGLBoolean use_probe) { - _EGLDriver * drv = NULL; - EGLint major = 0, minor = 0; - - if (!_eglDriver && !_eglLoadDriver()) - return NULL; - - if (use_probe) { - if (_eglDriver->Probe) - _eglDriver->Probe(_eglDriver, dpy); - drv = _eglDriver; - } else { - if (_eglDriver->API.Initialize(_eglDriver, dpy, &major, &minor)) { - drv = _eglDriver; - dpy->Driver = drv; - dpy->Initialized = EGL_TRUE; - dpy->APImajor = major; - dpy->APIminor = minor; - } - } - - return drv; -} - -__eglMustCastToProperFunctionPointerType _eglGetDriverProc( - const char *procname) { - _EGLProc proc = NULL; - - return proc; -} - -/** - * Unload all drivers. - */ -void _eglUnloadDrivers(void) { - if (_eglDriver && _eglDriver->Unload) - _eglDriver->Unload(_eglDriver); - - _eglDriver = NULL; -} - -/** - * Plug all the available fallback routines into the given driver's - * dispatch table. - */ -void _eglInitDriverFallbacks(_EGLDriver *drv) { - /* If a pointer is set to NULL, then the device driver _really_ has - * to implement it. - */ - drv->API.Initialize = NULL; - drv->API.Terminate = NULL; - - drv->API.GetConfigs = _eglGetConfigs; - drv->API.ChooseConfig = _eglChooseConfig; - drv->API.GetConfigAttrib = _eglGetConfigAttrib; - - drv->API.CreateContext = _eglCreateContext; - drv->API.DestroyContext = _eglDestroyContext; - drv->API.MakeCurrent = _eglMakeCurrent; - drv->API.QueryContext = _eglQueryContext; - - drv->API.CreateWindowSurface = _eglCreateWindowSurface; - drv->API.CreatePixmapSurface = _eglCreatePixmapSurface; - drv->API.CreatePbufferSurface = _eglCreatePbufferSurface; - drv->API.DestroySurface = _eglDestroySurface; - drv->API.QuerySurface = _eglQuerySurface; - drv->API.SurfaceAttrib = _eglSurfaceAttrib; - drv->API.BindTexImage = _eglBindTexImage; - drv->API.ReleaseTexImage = _eglReleaseTexImage; - drv->API.SwapInterval = _eglSwapInterval; - drv->API.SwapBuffers = _eglSwapBuffers; - drv->API.CopyBuffers = _eglCopyBuffers; - - drv->API.QueryString = _eglQueryString; - drv->API.WaitClient = _eglWaitClient; - drv->API.WaitNative = _eglWaitNative; -} - diff --git a/ppapi/lib/gl/egl/egldriver_ppapi.c b/ppapi/lib/gl/egl/egldriver_ppapi.c deleted file mode 100644 index f88ebf1704..0000000000 --- a/ppapi/lib/gl/egl/egldriver_ppapi.c +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2010 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 <stdlib.h> -#include "third_party/mesa/src/src/egl/main/egldriver.h" - -/** - * This is an EGL driver that wraps PPAPI. - */ - -/** Subclass of _EGLDriver */ -typedef struct _egl_driver_ppapi { - _EGLDriver Base; /* base class */ -} _EGLDriverPPAPI; - -static EGLBoolean _eglInitializePPAPI(_EGLDriver *drv, - _EGLDisplay *dpy, - EGLint *major, - EGLint *minor) { - return EGL_FALSE; -} - -static EGLBoolean _eglTerminatePPAPI(_EGLDriver *drv, - _EGLDisplay *dpy) { - return EGL_FALSE; -} - -static _EGLContext *_eglCreateContextPPAPI(_EGLDriver *drv, - _EGLDisplay *dpy, - _EGLConfig *config, - _EGLContext *share, - const EGLint *attrib_list) { - return NULL; -} - -static EGLBoolean _eglDestroyContextPPAPI(_EGLDriver *drv, - _EGLDisplay *dpy, - _EGLContext *ctx) { - return EGL_FALSE; -} - -static _EGLSurface *_eglCreateWindowSurfacePPAPI(_EGLDriver *drv, - _EGLDisplay *dpy, - _EGLConfig *config, - EGLNativeWindowType window, - const EGLint *attrib_list) { - return NULL; -} - -static _EGLSurface *_eglCreatePbufferSurfacePPAPI(_EGLDriver *drv, - _EGLDisplay *dpy, - _EGLConfig *config, - const EGLint *attrib_list) { - return NULL; -} - -static EGLBoolean _eglDestroySurfacePPAPI(_EGLDriver *drv, - _EGLDisplay *dpy, - _EGLSurface *surface) { - return EGL_FALSE; -} - -static EGLBoolean _eglSwapBuffersPPAPI(_EGLDriver *drv, - _EGLDisplay *dpy, - _EGLSurface *draw) { - return EGL_FALSE; -} - -static void _unloadPPAPI(_EGLDriver *drv) { - free(drv); -} - -/** - * This is the main entrypoint into the driver, called by egl dispatch API. - * Create a new _EGLDriver object and init its dispatch table. - */ -_EGLDriver* _eglMain(const char *args) -{ - _EGLDriverPPAPI *drv = (_EGLDriverPPAPI *) - calloc(1, sizeof(_EGLDriverPPAPI)); - - if (!drv) - return NULL; - - _eglInitDriverFallbacks(&drv->Base); - drv->Base.API.Initialize = _eglInitializePPAPI; - drv->Base.API.Terminate = _eglTerminatePPAPI; - drv->Base.API.CreateContext = _eglCreateContextPPAPI; - drv->Base.API.DestroyContext = _eglDestroyContextPPAPI; - drv->Base.API.CreateWindowSurface = _eglCreateWindowSurfacePPAPI; - drv->Base.API.CreatePbufferSurface = _eglCreatePbufferSurfacePPAPI; - drv->Base.API.DestroySurface = _eglDestroySurfacePPAPI; - drv->Base.API.SwapBuffers = _eglSwapBuffersPPAPI; - - drv->Base.Name = "PPAPI"; - drv->Base.Unload = _unloadPPAPI; - - return &drv->Base; -} - diff --git a/ppapi/lib/gl/include/EGL/egl.h b/ppapi/lib/gl/include/EGL/egl.h deleted file mode 100644 index 99ea342a47..0000000000 --- a/ppapi/lib/gl/include/EGL/egl.h +++ /dev/null @@ -1,329 +0,0 @@ -/* -*- mode: c; tab-width: 8; -*- */ -/* vi: set sw=4 ts=8: */ -/* Reference version of egl.h for EGL 1.4. - * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ - */ - -/* -** Copyright (c) 2007-2009 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#ifndef __egl_h_ -#define __egl_h_ - -/* All platform-dependent types and macro boilerplate (such as EGLAPI - * and EGLAPIENTRY) should go in eglplatform.h. - */ -#include <EGL/eglplatform.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* EGL Types */ -/* EGLint is defined in eglplatform.h */ -typedef unsigned int EGLBoolean; -typedef unsigned int EGLenum; -typedef void *EGLConfig; -typedef void *EGLContext; -typedef void *EGLDisplay; -typedef void *EGLSurface; -typedef void *EGLClientBuffer; - -/* EGL Versioning */ -#define EGL_VERSION_1_0 1 -#define EGL_VERSION_1_1 1 -#define EGL_VERSION_1_2 1 -#define EGL_VERSION_1_3 1 -#define EGL_VERSION_1_4 1 - -/* EGL Enumerants. Bitmasks and other exceptional cases aside, most - * enums are assigned unique values starting at 0x3000. - */ - -/* EGL aliases */ -#define EGL_FALSE 0 -#define EGL_TRUE 1 - -/* Out-of-band handle values */ -#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) -#define EGL_NO_CONTEXT ((EGLContext)0) -#define EGL_NO_DISPLAY ((EGLDisplay)0) -#define EGL_NO_SURFACE ((EGLSurface)0) - -/* Out-of-band attribute value */ -#define EGL_DONT_CARE ((EGLint)-1) - -/* Errors / GetError return values */ -#define EGL_SUCCESS 0x3000 -#define EGL_NOT_INITIALIZED 0x3001 -#define EGL_BAD_ACCESS 0x3002 -#define EGL_BAD_ALLOC 0x3003 -#define EGL_BAD_ATTRIBUTE 0x3004 -#define EGL_BAD_CONFIG 0x3005 -#define EGL_BAD_CONTEXT 0x3006 -#define EGL_BAD_CURRENT_SURFACE 0x3007 -#define EGL_BAD_DISPLAY 0x3008 -#define EGL_BAD_MATCH 0x3009 -#define EGL_BAD_NATIVE_PIXMAP 0x300A -#define EGL_BAD_NATIVE_WINDOW 0x300B -#define EGL_BAD_PARAMETER 0x300C -#define EGL_BAD_SURFACE 0x300D -#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */ - -/* Reserved 0x300F-0x301F for additional errors */ - -/* Config attributes */ -#define EGL_BUFFER_SIZE 0x3020 -#define EGL_ALPHA_SIZE 0x3021 -#define EGL_BLUE_SIZE 0x3022 -#define EGL_GREEN_SIZE 0x3023 -#define EGL_RED_SIZE 0x3024 -#define EGL_DEPTH_SIZE 0x3025 -#define EGL_STENCIL_SIZE 0x3026 -#define EGL_CONFIG_CAVEAT 0x3027 -#define EGL_CONFIG_ID 0x3028 -#define EGL_LEVEL 0x3029 -#define EGL_MAX_PBUFFER_HEIGHT 0x302A -#define EGL_MAX_PBUFFER_PIXELS 0x302B -#define EGL_MAX_PBUFFER_WIDTH 0x302C -#define EGL_NATIVE_RENDERABLE 0x302D -#define EGL_NATIVE_VISUAL_ID 0x302E -#define EGL_NATIVE_VISUAL_TYPE 0x302F -#define EGL_SAMPLES 0x3031 -#define EGL_SAMPLE_BUFFERS 0x3032 -#define EGL_SURFACE_TYPE 0x3033 -#define EGL_TRANSPARENT_TYPE 0x3034 -#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 -#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 -#define EGL_TRANSPARENT_RED_VALUE 0x3037 -#define EGL_NONE 0x3038 /* Attrib list terminator */ -#define EGL_BIND_TO_TEXTURE_RGB 0x3039 -#define EGL_BIND_TO_TEXTURE_RGBA 0x303A -#define EGL_MIN_SWAP_INTERVAL 0x303B -#define EGL_MAX_SWAP_INTERVAL 0x303C -#define EGL_LUMINANCE_SIZE 0x303D -#define EGL_ALPHA_MASK_SIZE 0x303E -#define EGL_COLOR_BUFFER_TYPE 0x303F -#define EGL_RENDERABLE_TYPE 0x3040 -#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */ -#define EGL_CONFORMANT 0x3042 - -/* Reserved 0x3041-0x304F for additional config attributes */ - -/* Config attribute values */ -#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ -#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */ -#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ -#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */ -#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */ - -/* More config attribute values, for EGL_TEXTURE_FORMAT */ -#define EGL_NO_TEXTURE 0x305C -#define EGL_TEXTURE_RGB 0x305D -#define EGL_TEXTURE_RGBA 0x305E -#define EGL_TEXTURE_2D 0x305F - -/* Config attribute mask bits */ -#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */ - -#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */ -#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */ -#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */ -#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */ - -/* QueryString targets */ -#define EGL_VENDOR 0x3053 -#define EGL_VERSION 0x3054 -#define EGL_EXTENSIONS 0x3055 -#define EGL_CLIENT_APIS 0x308D - -/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */ -#define EGL_HEIGHT 0x3056 -#define EGL_WIDTH 0x3057 -#define EGL_LARGEST_PBUFFER 0x3058 -#define EGL_TEXTURE_FORMAT 0x3080 -#define EGL_TEXTURE_TARGET 0x3081 -#define EGL_MIPMAP_TEXTURE 0x3082 -#define EGL_MIPMAP_LEVEL 0x3083 -#define EGL_RENDER_BUFFER 0x3086 -#define EGL_VG_COLORSPACE 0x3087 -#define EGL_VG_ALPHA_FORMAT 0x3088 -#define EGL_HORIZONTAL_RESOLUTION 0x3090 -#define EGL_VERTICAL_RESOLUTION 0x3091 -#define EGL_PIXEL_ASPECT_RATIO 0x3092 -#define EGL_SWAP_BEHAVIOR 0x3093 -#define EGL_MULTISAMPLE_RESOLVE 0x3099 - -/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ -#define EGL_BACK_BUFFER 0x3084 -#define EGL_SINGLE_BUFFER 0x3085 - -/* OpenVG color spaces */ -#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */ -#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */ - -/* OpenVG alpha formats */ -#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */ -#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */ - -/* Constant scale factor by which fractional display resolutions & - * aspect ratio are scaled when queried as integer values. - */ -#define EGL_DISPLAY_SCALING 10000 - -/* Unknown display resolution/aspect ratio */ -#define EGL_UNKNOWN ((EGLint)-1) - -/* Back buffer swap behaviors */ -#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */ -#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */ - -/* CreatePbufferFromClientBuffer buffer types */ -#define EGL_OPENVG_IMAGE 0x3096 - -/* QueryContext targets */ -#define EGL_CONTEXT_CLIENT_TYPE 0x3097 - -/* CreateContext attributes */ -#define EGL_CONTEXT_CLIENT_VERSION 0x3098 - -/* Multisample resolution behaviors */ -#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */ -#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */ - -/* BindAPI/QueryAPI targets */ -#define EGL_OPENGL_ES_API 0x30A0 -#define EGL_OPENVG_API 0x30A1 -#define EGL_OPENGL_API 0x30A2 - -/* GetCurrentSurface targets */ -#define EGL_DRAW 0x3059 -#define EGL_READ 0x305A - -/* WaitNative engines */ -#define EGL_CORE_NATIVE_ENGINE 0x305B - -/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */ -#define EGL_COLORSPACE EGL_VG_COLORSPACE -#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT -#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB -#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR -#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE -#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE - -/* EGL extensions must request enum blocks from the Khronos - * API Registrar, who maintains the enumerant registry. Submit - * a bug in Khronos Bugzilla against task "Registry". - */ - - - -/* EGL Functions */ - -EGLAPI EGLint EGLAPIENTRY eglGetError(void); - -EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id); -EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); -EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy); - -EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name); - -EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, - EGLint config_size, EGLint *num_config); -EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, - EGLConfig *configs, EGLint config_size, - EGLint *num_config); -EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, - EGLint attribute, EGLint *value); - -EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, - EGLNativeWindowType win, - const EGLint *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, - EGLNativePixmapType pixmap, - const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface); -EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, - EGLint attribute, EGLint *value); - -EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api); -EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void); - -EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void); - -EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void); - -EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer( - EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, - EGLConfig config, const EGLint *attrib_list); - -EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, - EGLint attribute, EGLint value); -EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); -EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); - - -EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); - - -EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, - EGLContext share_context, - const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx); -EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, - EGLSurface read, EGLContext ctx); - -EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void); -EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw); -EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, - EGLint attribute, EGLint *value); - -EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void); -EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine); -EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); -EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, - EGLNativePixmapType target); - -/* This is a generic function pointer type, whose name indicates it must - * be cast to the proper type *and calling convention* before use. - */ -typedef void (*__eglMustCastToProperFunctionPointerType)(void); - -/* Now, define eglGetProcAddress using the generic function ptr. type */ -EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY - eglGetProcAddress(const char *procname); - -#ifdef __cplusplus -} -#endif - -#endif /* __egl_h_ */ diff --git a/ppapi/lib/gl/include/EGL/eglext.h b/ppapi/lib/gl/include/EGL/eglext.h deleted file mode 100644 index 62ffc9ee22..0000000000 --- a/ppapi/lib/gl/include/EGL/eglext.h +++ /dev/null @@ -1,300 +0,0 @@ -#ifndef __eglext_h_ -#define __eglext_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2007-2010 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#include <EGL/eglplatform.h> - -/*************************************************************/ - -/* Header file version number */ -/* Current version at http://www.khronos.org/registry/egl/ */ -/* $Revision: 13164 $ on $Date: 2010-12-09 01:26:57 -0800 (Thu, 09 Dec 2010) $ */ -#define EGL_EGLEXT_VERSION 9 - -#ifndef EGL_KHR_config_attribs -#define EGL_KHR_config_attribs 1 -#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */ -#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */ -#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */ -#endif - -#ifndef EGL_KHR_lock_surface -#define EGL_KHR_lock_surface 1 -#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ -#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ -#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */ -#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */ -#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */ -#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */ -#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */ -#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */ -#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */ -#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */ -#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */ -#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */ -#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */ -#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */ -#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */ -#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */ -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface); -#endif - -#ifndef EGL_KHR_image -#define EGL_KHR_image 1 -#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */ -typedef void *EGLImageKHR; -#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); -#endif - -#ifndef EGL_KHR_vg_parent_image -#define EGL_KHR_vg_parent_image 1 -#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */ -#endif - -#ifndef EGL_KHR_gl_texture_2D_image -#define EGL_KHR_gl_texture_2D_image 1 -#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */ -#endif - -#ifndef EGL_KHR_gl_texture_cubemap_image -#define EGL_KHR_gl_texture_cubemap_image 1 -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */ -#endif - -#ifndef EGL_KHR_gl_texture_3D_image -#define EGL_KHR_gl_texture_3D_image 1 -#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */ -#endif - -#ifndef EGL_KHR_gl_renderbuffer_image -#define EGL_KHR_gl_renderbuffer_image 1 -#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */ -#endif - -#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */ -#ifndef EGL_KHR_reusable_sync -#define EGL_KHR_reusable_sync 1 - -typedef void* EGLSyncKHR; -typedef khronos_utime_nanoseconds_t EGLTimeKHR; - -#define EGL_SYNC_STATUS_KHR 0x30F1 -#define EGL_SIGNALED_KHR 0x30F2 -#define EGL_UNSIGNALED_KHR 0x30F3 -#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 -#define EGL_CONDITION_SATISFIED_KHR 0x30F6 -#define EGL_SYNC_TYPE_KHR 0x30F7 -#define EGL_SYNC_REUSABLE_KHR 0x30FA -#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */ -#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull -#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync); -EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); -EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); -EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); -typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); -#endif -#endif - -#ifndef EGL_KHR_image_base -#define EGL_KHR_image_base 1 -/* Most interfaces defined by EGL_KHR_image_pixmap above */ -#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */ -#endif - -#ifndef EGL_KHR_image_pixmap -#define EGL_KHR_image_pixmap 1 -/* Interfaces defined by EGL_KHR_image above */ -#endif - -#ifndef EGL_IMG_context_priority -#define EGL_IMG_context_priority 1 -#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 -#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 -#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 -#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 -#endif - -#ifndef EGL_KHR_lock_surface2 -#define EGL_KHR_lock_surface2 1 -#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 -#endif - -#ifndef EGL_NV_coverage_sample -#define EGL_NV_coverage_sample 1 -#define EGL_COVERAGE_BUFFERS_NV 0x30E0 -#define EGL_COVERAGE_SAMPLES_NV 0x30E1 -#endif - -#ifndef EGL_NV_depth_nonlinear -#define EGL_NV_depth_nonlinear 1 -#define EGL_DEPTH_ENCODING_NV 0x30E2 -#define EGL_DEPTH_ENCODING_NONE_NV 0 -#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 -#endif - -#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */ -#ifndef EGL_NV_sync -#define EGL_NV_sync 1 -#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 -#define EGL_SYNC_STATUS_NV 0x30E7 -#define EGL_SIGNALED_NV 0x30E8 -#define EGL_UNSIGNALED_NV 0x30E9 -#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 -#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull -#define EGL_ALREADY_SIGNALED_NV 0x30EA -#define EGL_TIMEOUT_EXPIRED_NV 0x30EB -#define EGL_CONDITION_SATISFIED_NV 0x30EC -#define EGL_SYNC_TYPE_NV 0x30ED -#define EGL_SYNC_CONDITION_NV 0x30EE -#define EGL_SYNC_FENCE_NV 0x30EF -#define EGL_NO_SYNC_NV ((EGLSyncNV)0) -typedef void* EGLSyncNV; -typedef khronos_utime_nanoseconds_t EGLTimeNV; -#ifdef EGL_EGLEXT_PROTOTYPES -EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); -EGLBoolean eglDestroySyncNV (EGLSyncNV sync); -EGLBoolean eglFenceNV (EGLSyncNV sync); -EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); -EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); -EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); -typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); -#endif -#endif - -#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */ -#ifndef EGL_KHR_fence_sync -#define EGL_KHR_fence_sync 1 -/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */ -#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 -#define EGL_SYNC_CONDITION_KHR 0x30F8 -#define EGL_SYNC_FENCE_KHR 0x30F9 -#endif -#endif - -#ifndef EGL_HI_clientpixmap -#define EGL_HI_clientpixmap 1 - -/* Surface Attribute */ -#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 -/* - * Structure representing a client pixmap - * (pixmap's data is in client-space memory). - */ -struct EGLClientPixmapHI -{ - void* pData; - EGLint iWidth; - EGLint iHeight; - EGLint iStride; -}; - -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap); -#endif /* EGL_HI_clientpixmap */ - -#ifndef EGL_HI_colorformats -#define EGL_HI_colorformats 1 -/* Config Attribute */ -#define EGL_COLOR_FORMAT_HI 0x8F70 -/* Color Formats */ -#define EGL_COLOR_RGB_HI 0x8F71 -#define EGL_COLOR_RGBA_HI 0x8F72 -#define EGL_COLOR_ARGB_HI 0x8F73 -#endif /* EGL_HI_colorformats */ - -#ifndef EGL_MESA_drm_image -#define EGL_MESA_drm_image 1 -#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */ -#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */ -#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */ -#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */ -#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 -#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */ -#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */ -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); -#endif - -#ifndef EGL_NV_post_sub_buffer -#define EGL_NV_post_sub_buffer 1 -#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ppapi/lib/gl/include/EGL/eglplatform.h b/ppapi/lib/gl/include/EGL/eglplatform.h deleted file mode 100644 index a80755f8f5..0000000000 --- a/ppapi/lib/gl/include/EGL/eglplatform.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __eglplatform_h_ -#define __eglplatform_h_ - -/* -** Copyright (c) 2007-2009 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -/* Platform-specific types and definitions for egl.h - * $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $ - * - * Adopters may modify khrplatform.h and this file to suit their platform. - * You are encouraged to submit all modifications to the Khronos group so that - * they can be included in future versions of this file. Please submit changes - * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) - * by filing a bug against product "EGL" component "Registry". - */ - -#include <KHR/khrplatform.h> - -/* Macros used in EGL function prototype declarations. - * - * EGL functions should be prototyped as: - * - * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); - * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); - * - * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h - */ - -#ifndef EGLAPI -#define EGLAPI KHRONOS_APICALL -#endif - -#ifndef EGLAPIENTRY -#define EGLAPIENTRY KHRONOS_APIENTRY -#endif -#define EGLAPIENTRYP EGLAPIENTRY* - -/* The types NativeDisplayType, NativeWindowType, and NativePixmapType - * are aliases of window-system-dependent types, such as X Display * or - * Windows Device Context. They must be defined in platform-specific - * code below. The EGL-prefixed versions of Native*Type are the same - * types, renamed in EGL 1.3 so all types in the API start with "EGL". - * - * Khronos STRONGLY RECOMMENDS that you use the default definitions - * provided below, since these changes affect both binary and source - * portability of applications using EGL running on different EGL - * implementations. - */ - -#include "ppapi/c/pp_instance.h" - -typedef PP_Instance EGLNativeDisplayType; -typedef PP_Instance EGLNativeWindowType; -typedef khronos_int32_t EGLNativePixmapType; // Not supported. - -/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ -typedef EGLNativeDisplayType NativeDisplayType; -typedef EGLNativePixmapType NativePixmapType; -typedef EGLNativeWindowType NativeWindowType; - - -/* Define EGLint. This must be a signed integral type large enough to contain - * all legal attribute names and values passed into and out of EGL, whether - * their type is boolean, bitmask, enumerant (symbolic constant), integer, - * handle, or other. While in general a 32-bit integer will suffice, if - * handles are 64 bit types, then EGLint should be defined as a signed 64-bit - * integer type. - */ -typedef khronos_int32_t EGLint; - -#endif /* __eglplatform_h */ diff --git a/ppapi/native_client/chrome_main.scons b/ppapi/native_client/chrome_main.scons index 115d44a4d6..047fdf0cde 100644 --- a/ppapi/native_client/chrome_main.scons +++ b/ppapi/native_client/chrome_main.scons @@ -67,7 +67,9 @@ ppapi_scons_files['untrusted_scons_files'] = [ ] -EXTRA_ENV = ['XAUTHORITY', 'HOME', 'DISPLAY', 'SSH_TTY', 'KRB5CCNAME'] +EXTRA_ENV = [ + 'XAUTHORITY', 'HOME', 'DISPLAY', 'SSH_TTY', 'KRB5CCNAME', + 'CHROME_DEVEL_SANDBOX' ] def SetupBrowserEnv(env): for var_name in EXTRA_ENV: diff --git a/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc b/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc index 03a266e526..12fc1a3050 100644 --- a/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc +++ b/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc @@ -9,8 +9,8 @@ namespace { -// TODO(jvoung) use Tokenize from base/string_util.h when this moves -// to chromium. +// TODO(jvoung): Use Tokenize from base/strings/string_util.h when this moves +// to Chromium. void SplitString(const std::string& str, char delim, std::vector<std::string>* elems) { diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc index 02de2e0a0b..b042f0e2db 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc @@ -268,6 +268,9 @@ PnaclCoordinator::PnaclCoordinator( manifest_(new PnaclManifest()), pexe_url_(pexe_url), pnacl_options_(pnacl_options), + use_new_cache_(false), + is_cache_hit_(PP_FALSE), + nexe_handle_(PP_kInvalidFileHandle), error_already_reported_(false), off_the_record_(false), pnacl_init_time_(0), @@ -277,6 +280,10 @@ PnaclCoordinator::PnaclCoordinator( PLUGIN_PRINTF(("PnaclCoordinator::PnaclCoordinator (this=%p, plugin=%p)\n", static_cast<void*>(this), static_cast<void*>(plugin))); callback_factory_.Initialize(this); + if (getenv("PNACL_USE_NEW_CACHE")) { + PLUGIN_PRINTF(("PnaclCoordinator using new translation cache\n")); + use_new_cache_ = true; + } } PnaclCoordinator::~PnaclCoordinator() { @@ -295,8 +302,7 @@ PnaclCoordinator::~PnaclCoordinator() { void PnaclCoordinator::ReportNonPpapiError(enum PluginErrorCode err_code, const nacl::string& message) { - error_info_.SetReport(err_code, - nacl::string("PnaclCoordinator: ") + message); + error_info_.SetReport(err_code, message); ExitWithError(); } @@ -390,6 +396,14 @@ void PnaclCoordinator::TranslateFinished(int32_t pp_error) { // pointer to be able to read it again from the beginning. temp_nexe_file_->Reset(); + if (use_new_cache_) { + // Report to the browser that translation finished. The browser will take + // care of caching. + plugin_->nacl_interface()->ReportTranslationFinished( + plugin_->pp_instance()); + NexeReadDidOpen(PP_OK); + return; + } if (pnacl_options_.HasCacheKey() && cached_nexe_file_ != NULL) { // We are using a cache, but had a cache miss, which is why we did the // translation. Reset cached_nexe_file_ to have a random name, @@ -668,27 +682,31 @@ void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) { } if (!off_the_record_) { - // Open the local temporary FS to see if we get a hit in the cache. - pp::CompletionCallback cb = - callback_factory_.NewCallback(&PnaclCoordinator::FileSystemDidOpen); - int32_t open_error = file_system_->Open(0, cb); - if (open_error != PP_OK_COMPLETIONPENDING) { - // At this point, no async request has kicked off to check for - // permissions, space, etc., so the only error that can be detected - // now is that an open() is already in progress (or a really terrible - // error). - if (pp_error == PP_ERROR_INPROGRESS) { + if (use_new_cache_) { + OpenBitcodeStream(); + } else { + // Open the local temporary FS to see if we get a hit in the cache. + pp::CompletionCallback cb = + callback_factory_.NewCallback(&PnaclCoordinator::FileSystemDidOpen); + int32_t open_error = file_system_->Open(0, cb); + if (open_error != PP_OK_COMPLETIONPENDING) { + // At this point, no async request has kicked off to check for + // permissions, space, etc., so the only error that can be detected + // now is that an open() is already in progress (or a really terrible + // error). + if (pp_error == PP_ERROR_INPROGRESS) { + ReportPpapiError( + ERROR_PNACL_CACHE_OPEN_INPROGRESS, + pp_error, + "File system for PNaCl translation cache failed to open " + "(in progress)."); + return; + } ReportPpapiError( - ERROR_PNACL_CACHE_OPEN_INPROGRESS, + ERROR_PNACL_CACHE_OPEN_OTHER, pp_error, - "File system for PNaCl translation cache failed to open " - "(in progress)."); - return; + "File system for PNaCl translation cache failed to open."); } - ReportPpapiError( - ERROR_PNACL_CACHE_OPEN_OTHER, - pp_error, - "File system for PNaCl translation cache failed to open."); } } else { // We don't have a cache, so do the non-cached codepath. @@ -768,28 +786,37 @@ void PnaclCoordinator::OpenBitcodeStream() { // SRPCs won't get dropped. translate_thread_.reset(new PnaclTranslateThread()); if (translate_thread_ == NULL) { - ReportNonPpapiError(ERROR_PNACL_THREAD_CREATE, - "could not allocate translation thread."); + ReportNonPpapiError( + ERROR_PNACL_THREAD_CREATE, + "PnaclCoordinator: could not allocate translation thread."); return; } - // We also want to open the object file now so the - // translator can start writing to it during streaming translation. - obj_file_.reset(new TempFile(plugin_)); - pp::CompletionCallback obj_cb = - callback_factory_.NewCallback(&PnaclCoordinator::ObjectFileDidOpen); - obj_file_->Open(obj_cb); + if (!use_new_cache_) { + // We also want to open the object file now so the + // translator can start writing to it during streaming translation. + obj_file_.reset(new TempFile(plugin_)); + pp::CompletionCallback obj_cb = + callback_factory_.NewCallback(&PnaclCoordinator::ObjectFileDidOpen); + obj_file_->Open(obj_cb, true); + } pp::CompletionCallback cb = callback_factory_.NewCallback(&PnaclCoordinator::BitcodeStreamDidOpen); if (!streaming_downloader_->OpenStream(pexe_url_, cb, this)) { - ReportNonPpapiError(ERROR_PNACL_PEXE_FETCH_OTHER, - nacl::string("failed to open stream ") + pexe_url_); + ReportNonPpapiError( + ERROR_PNACL_PEXE_FETCH_OTHER, + nacl::string("PnaclCoordinator: failed to open stream ") + pexe_url_); + return; } } void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) { if (pp_error != PP_OK) { BitcodeStreamDidFinish(pp_error); + // In the new cache case, we have not spun up the translation process yet, + // so we need to call TranslateFinished here. + if (use_new_cache_) + TranslateFinished(pp_error); return; } @@ -813,19 +840,81 @@ void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) { // people from forging the URL for a different origin. pnacl_options_.set_cache_validators(cache_validators + url); } - cached_nexe_file_.reset(new LocalTempFile( - plugin_, file_system_.get(), - nacl::string(kPnaclTempDir), - pnacl_options_.GetCacheKey())); - pp::CompletionCallback cb = - callback_factory_.NewCallback(&PnaclCoordinator::CachedFileDidOpen); - cached_nexe_file_->OpenRead(cb); + if (use_new_cache_) { + pp::CompletionCallback cb = + callback_factory_.NewCallback(&PnaclCoordinator::NexeFdDidOpen); + int32_t nexe_fd_err = + plugin_->nacl_interface()->GetNexeFd( + plugin_->pp_instance(), + pnacl_options_.GetCacheKey().c_str(), + &is_cache_hit_, + &nexe_handle_, + cb.pp_completion_callback()); + if (nexe_fd_err < PP_OK_COMPLETIONPENDING) { + ReportPpapiError(ERROR_PNACL_CREATE_TEMP, nexe_fd_err, + nacl::string("Call to GetNexeFd failed")); + return; + } + } else { + cached_nexe_file_.reset(new LocalTempFile( + plugin_, file_system_.get(), + nacl::string(kPnaclTempDir), + pnacl_options_.GetCacheKey())); + pp::CompletionCallback cb = + callback_factory_.NewCallback(&PnaclCoordinator::CachedFileDidOpen); + cached_nexe_file_->OpenRead(cb); + } } else { // No cache case. CachedFileDidOpen(PP_ERROR_FAILED); } } +void PnaclCoordinator::NexeFdDidOpen(int32_t pp_error) { + PLUGIN_PRINTF(("PnaclCoordinator::NexeFdDidOpen (pp_error=%" + NACL_PRId32", hit=%d, handle=%d)\n", pp_error, + is_cache_hit_ == PP_TRUE, + nexe_handle_)); + if (pp_error < PP_OK) { + ReportPpapiError(ERROR_PNACL_CREATE_TEMP, pp_error, + nacl::string("GetNexeFd failed")); + return; + } + temp_nexe_file_.reset(new TempFile(plugin_)); + if (!temp_nexe_file_->SetExistingFd(nexe_handle_)) { + ReportNonPpapiError( + ERROR_PNACL_CREATE_TEMP, + nacl::string( + "PnaclCoordinator: Got bad temp file handle from GetNexeFd")); + return; + } + if (is_cache_hit_ == PP_TRUE) { + // Cache hit -- no need to stream the rest of the file. + streaming_downloader_.reset(NULL); + // TODO(dschuff): update UMA stats for hit/miss once there could actually + // be hits/misses. + // Open it for reading as the cached nexe file. + pp::CompletionCallback cb = + callback_factory_.NewCallback(&PnaclCoordinator::NexeReadDidOpen); + temp_nexe_file_->Open(cb, false); + } else { + // Open an object file first so the translator can start writing to it + // during streaming translation. + obj_file_.reset(new TempFile(plugin_)); + pp::CompletionCallback obj_cb = + callback_factory_.NewCallback(&PnaclCoordinator::ObjectFileDidOpen); + obj_file_->Open(obj_cb, true); + + // Meanwhile, a miss means we know we need to stream the bitcode, so stream + // the rest of it now. (Calling FinishStreaming means that the downloader + // will begin handing data to the coordinator, which is safe any time after + // the translate_thread_ object has been initialized). + pp::CompletionCallback finish_cb = callback_factory_.NewCallback( + &PnaclCoordinator::BitcodeStreamDidFinish); + streaming_downloader_->FinishStreaming(finish_cb); + } +} + void PnaclCoordinator::CachedFileDidOpen(int32_t pp_error) { PLUGIN_PRINTF(("PnaclCoordinator::CachedFileDidOpen (pp_error=%" NACL_PRId32")\n", pp_error)); @@ -941,12 +1030,15 @@ void PnaclCoordinator::ObjectFileDidOpen(int32_t pp_error) { "Failed to open scratch object file."); return; } - // Create the nexe file for connecting ld and sel_ldr. + // Open the nexe file for connecting ld and sel_ldr. // Start translation when done with this last step of setup! - temp_nexe_file_.reset(new TempFile(plugin_)); + if (!use_new_cache_) + // In the new cache case, the TempFile has already been created. + temp_nexe_file_.reset(new TempFile(plugin_)); + pp::CompletionCallback cb = callback_factory_.NewCallback(&PnaclCoordinator::RunTranslate); - temp_nexe_file_->Open(cb); + temp_nexe_file_->Open(cb, true); } void PnaclCoordinator::RunTranslate(int32_t pp_error) { diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h index 4e89b8170d..e33f426ffb 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h @@ -63,21 +63,17 @@ class TempFile; // The coordinator proceeds through several states. They are // LOAD_TRANSLATOR_BINARIES // Complete when ResourcesDidLoad is invoked. +// OPEN_BITCODE_STREAM +// Complete when BitcodeStreamDidOpen is invoked +// GET_NEXE_FD +// Get an FD which contains the cached nexe, or is writeable for +// translation output. Complete when NexeFdDidOpen is called. // -// If cache is enabled: -// OPEN_LOCAL_FILE_SYSTEM -// Complete when FileSystemDidOpen is invoked. -// CREATED_PNACL_TEMP_DIRECTORY -// Complete when DirectoryWasCreated is invoked. -// CACHED_FILE_OPEN -// Complete with success if cached version is available and jump to end. -// Otherwise, proceed with usual pipeline of translation. -// +// If there was a cache hit, go to OPEN_NEXE_FOR_SEL_LDR, otherwise, +// continue streaming the bitcode, and: // OPEN_TMP_FOR_LLC_TO_LD_COMMUNICATION // Complete when ObjectFileDidOpen is invoked. -// OPEN_TMP_FOR_LD_WRITING -// Complete when NexeWriteDidOpen is invoked. -// PREPARE_PEXE_FOR_STREAMING +// OPEN_NEXE_FD_FOR_WRITING // Complete when RunTranslate is invoked. // START_LD_AND_LLC_SUBPROCESS_AND_INITIATE_TRANSLATION // Complete when RunTranslate returns. @@ -85,12 +81,7 @@ class TempFile; // Complete when TranslateFinished is invoked. // // If cache is enabled: -// OPEN_CACHE_FOR_WRITE -// Complete when CachedNexeOpenedForWrite is invoked -// COPY_NEXE_TO_CACHE -// Complete when NexeWasCopiedToCache is invoked. -// RENAME_CACHE_FILE -// Complete when NexeFileWasRenamed is invoked. +// TODO: notify browser of finished translation (and re-open read-only?) // // OPEN_NEXE_FOR_SEL_LDR // Complete when NexeReadDidOpen is invoked. @@ -175,6 +166,9 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> { // Invoked when we've started an URL fetch for the pexe to check for // caching metadata. void BitcodeStreamDidOpen(int32_t pp_error); + // Invoked when we've gotten a temp FD for the nexe, either with the nexe + // data, or a writeable fd to save to. + void NexeFdDidOpen(int32_t pp_error); // Invoked after we have checked the PNaCl cache for a translated version. void CachedFileDidOpen(int32_t pp_error); // Invoked when a pexe data chunk arrives (when using streaming translation) @@ -250,6 +244,15 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> { // not have a writeable cache file. That is currently the case when // off_the_record_ is true. nacl::scoped_ptr<LocalTempFile> cached_nexe_file_; + // True if the new cache flow is enabled. Currently set by an environment + // variable on construction. TODO(dschuff): remove old cache stuff. + bool use_new_cache_; + // Passed to the browser, which sets it to true if there is a translation + // cache hit. + PP_Bool is_cache_hit_; + // Passed to the browser, which sets it to the handle for the nexe file + // (either the translated nexe from the cache, or a temp file to write to). + PP_FileHandle nexe_handle_; // Downloader for streaming translation nacl::scoped_ptr<FileDownloader> streaming_downloader_; diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc index 7b1a680dff..9dd26734e1 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc @@ -357,7 +357,8 @@ void PnaclTranslateThread::AbortSubprocesses() { PnaclTranslateThread::~PnaclTranslateThread() { PLUGIN_PRINTF(("~PnaclTranslateThread (translate_thread=%p)\n", this)); AbortSubprocesses(); - NaClThreadJoin(translate_thread_.get()); + if (translate_thread_ != NULL) + NaClThreadJoin(translate_thread_.get()); PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); NaClCondVarDtor(&buffer_cond_); NaClMutexDtor(&cond_mu_); diff --git a/ppapi/native_client/src/trusted/plugin/temporary_file.cc b/ppapi/native_client/src/trusted/plugin/temporary_file.cc index fe8b779b52..321616c416 100644 --- a/ppapi/native_client/src/trusted/plugin/temporary_file.cc +++ b/ppapi/native_client/src/trusted/plugin/temporary_file.cc @@ -24,7 +24,8 @@ namespace plugin { uint32_t TempFile::next_identifier = 0; -TempFile::TempFile(Plugin* plugin) : plugin_(plugin) { +TempFile::TempFile(Plugin* plugin) : plugin_(plugin), + existing_handle_(PP_kInvalidFileHandle) { PLUGIN_PRINTF(("TempFile::TempFile\n")); ++next_identifier; SNPRINTF(reinterpret_cast<char *>(identifier_), sizeof identifier_, @@ -35,10 +36,23 @@ TempFile::~TempFile() { PLUGIN_PRINTF(("TempFile::~TempFile\n")); } -void TempFile::Open(const pp::CompletionCallback& cb) { +bool TempFile::SetExistingFd(PP_FileHandle handle) { + // Check if we got a bad handle or if Open has already been called. + if (handle == PP_kInvalidFileHandle || read_wrapper_.get() != NULL) + return false; + existing_handle_ = handle; + return true; +} + +void TempFile::Open(const pp::CompletionCallback& cb, bool writeable) { PLUGIN_PRINTF(("TempFile::Open\n")); - PP_FileHandle file_handle = - plugin_->nacl_interface()->CreateTemporaryFile(plugin_->pp_instance()); + PP_FileHandle file_handle; + if (existing_handle_ == PP_kInvalidFileHandle) { + file_handle = + plugin_->nacl_interface()->CreateTemporaryFile(plugin_->pp_instance()); + } else { + file_handle = existing_handle_; + } pp::Core* core = pp::Module::Get()->core(); if (file_handle == PP_kInvalidFileHandle) { @@ -50,8 +64,9 @@ void TempFile::Open(const pp::CompletionCallback& cb) { HANDLE handle = file_handle; //////// Now try the posix view. + int rdwr_flag = writeable ? _O_RDWR : _O_RDONLY; int32_t posix_desc = _open_osfhandle(reinterpret_cast<intptr_t>(handle), - _O_RDWR | _O_BINARY + rdwr_flag | _O_BINARY | _O_TEMPORARY | _O_SHORT_LIVED ); if (posix_desc == -1) { PLUGIN_PRINTF(("TempFile::Open failed to convert HANDLE to posix\n")); @@ -81,8 +96,10 @@ void TempFile::Open(const pp::CompletionCallback& cb) { } // The descriptor for a writeable file needs to have quota management. - write_wrapper_.reset( - plugin_->wrapper_factory()->MakeFileDescQuota(fd, O_RDWR, identifier_)); + if (writeable) { + write_wrapper_.reset( + plugin_->wrapper_factory()->MakeFileDescQuota(fd, O_RDWR, identifier_)); + } read_wrapper_.reset( plugin_->wrapper_factory()->MakeFileDesc(read_fd, O_RDONLY)); core->CallOnMainThread(0, cb, PP_OK); @@ -90,10 +107,10 @@ void TempFile::Open(const pp::CompletionCallback& cb) { bool TempFile::Reset() { PLUGIN_PRINTF(("TempFile::Reset\n")); - // Use the write_wrapper_ to reset the file pos. The read_wrapper_ is also + // Use the read_wrapper_ to reset the file pos. The write_wrapper_ is also // backed by the same file, so it should also reset. - CHECK(write_wrapper_.get() != NULL); - nacl_off64_t newpos = write_wrapper_->Seek(0, SEEK_SET); + CHECK(read_wrapper_.get() != NULL); + nacl_off64_t newpos = read_wrapper_->Seek(0, SEEK_SET); return newpos >= 0; } diff --git a/ppapi/native_client/src/trusted/plugin/temporary_file.h b/ppapi/native_client/src/trusted/plugin/temporary_file.h index 0fe6d26db0..966945c8af 100644 --- a/ppapi/native_client/src/trusted/plugin/temporary_file.h +++ b/ppapi/native_client/src/trusted/plugin/temporary_file.h @@ -9,6 +9,7 @@ #include "native_client/src/include/nacl_string.h" #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" +#include "ppapi/c/private/pp_file_handle.h" #include "ppapi/cpp/completion_callback.h" namespace plugin { @@ -40,8 +41,13 @@ class TempFile { explicit TempFile(Plugin* plugin); ~TempFile(); - // Opens a writeable file IO object and descriptor referring to the file. - void Open(const pp::CompletionCallback& cb); + // Set an existing Fd instead of getting one from the nacl interface on open. + // Must be called before Open. + bool SetExistingFd(PP_FileHandle handle); + // Opens a temporary file object and descriptor wrapper referring to the file. + // If |writeable| is true, the descriptor will be opened for writing, and + // write_wrapper will return a valid pointer, otherwise it will return NULL. + void Open(const pp::CompletionCallback& cb, bool writeable); // Resets file position of the handle, for reuse. bool Reset(); @@ -64,6 +70,7 @@ class TempFile { Plugin* plugin_; nacl::scoped_ptr<nacl::DescWrapper> read_wrapper_; nacl::scoped_ptr<nacl::DescWrapper> write_wrapper_; + PP_FileHandle existing_handle_; // An identifier string used for quota request processing. The quota // interface needs a string that is unique per sel_ldr instance only, so 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 4363aaacf6..d85099d681 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 @@ -16,23 +16,17 @@ #include "ppapi/c/dev/ppb_find_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_graphics_2d_dev.h" -#include "ppapi/c/dev/ppb_host_resolver_dev.h" #include "ppapi/c/dev/ppb_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_keyboard_input_event_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" -#include "ppapi/c/dev/ppb_net_address_dev.h" #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" #include "ppapi/c/dev/ppb_truetype_font_dev.h" -#include "ppapi/c/dev/ppb_udp_socket_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" -#include "ppapi/c/dev/ppb_var_array_dev.h" -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" #include "ppapi/c/dev/ppb_video_capture_dev.h" #include "ppapi/c/dev/ppb_video_decoder_dev.h" #include "ppapi/c/dev/ppb_view_dev.h" @@ -61,6 +55,7 @@ #include "ppapi/c/ppb_gamepad.h" #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/c/ppb_graphics_3d.h" +#include "ppapi/c/ppb_host_resolver.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" @@ -68,11 +63,17 @@ #include "ppapi/c/ppb_messaging.h" #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_network_proxy.h" +#include "ppapi/c/ppb_tcp_socket.h" +#include "ppapi/c/ppb_udp_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" #include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_var_array.h" #include "ppapi/c/ppb_var_array_buffer.h" +#include "ppapi/c/ppb_var_dictionary.h" #include "ppapi/c/ppb_view.h" #include "ppapi/c/ppb_websocket.h" #include "ppapi/c/ppp_graphics_3d.h" @@ -132,9 +133,6 @@ static int mystrcmp(const char* s1, const char *s2) { /* BEGIN Declarations for all Wrapper Infos */ -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Audio_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioConfig_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioConfig_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Console_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Core_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_0; @@ -142,99 +140,51 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileSystem_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Fullscreen_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Gamepad_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics3D_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ImageData_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_InputEvent_1_0; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MessageLoop_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Messaging_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseCursor_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_NetworkProxy_1_0; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_1_0; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_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; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Var_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Var_1_1; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_1; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Graphics3D_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_InputEvent_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Instance_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Instance_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Messaging_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_MouseLock_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_CharSet_Trusted_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_5; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_6; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLLoaderTrusted_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Buffer_Dev_0_4; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Crypto_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_CursorControl_Dev_0_4; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Find_Dev_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Font_Dev_0_6; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_Dev_0_1; -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_KeyboardInputEvent_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Memory_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_7; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ResourceArray_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Scrollbar_Dev_0_5; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_7; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_8; 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; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TextInput_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TextInput_Dev_0_2; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Trace_Event_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Widget_Dev_0_3; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Widget_Dev_0_4; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Zoom_Dev_0_2; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_NetworkState_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Printing_Dev_0_6; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_2; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Selection_Dev_0_3; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_TextInput_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoCapture_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_9; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_10; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_11; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Widget_Dev_0_2; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Zoom_Dev_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_Private_0_1; @@ -247,13 +197,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DRM_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_FontFile_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Menu_0_2; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_MessageLoop_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Print_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_GpuBlacklist_Private_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NaCl_Private_1_0; @@ -261,7 +205,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetworkMonitor_Private_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Talk_Private_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Talk_Private_2_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1; @@ -277,9 +220,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDestination_Private_ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_2; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Instance_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1; @@ -732,6 +672,40 @@ static int32_t Pnacl_M15_PPB_Graphics3D_SwapBuffers(PP_Resource context, struct /* End wrapper methods for PPB_Graphics3D_1_0 */ +/* Begin wrapper methods for PPB_HostResolver_1_0 */ + +static PP_Resource Pnacl_M29_PPB_HostResolver_Create(PP_Instance instance) { + const struct PPB_HostResolver_1_0 *iface = Pnacl_WrapperInfo_PPB_HostResolver_1_0.real_iface; + return iface->Create(instance); +} + +static PP_Bool Pnacl_M29_PPB_HostResolver_IsHostResolver(PP_Resource resource) { + const struct PPB_HostResolver_1_0 *iface = Pnacl_WrapperInfo_PPB_HostResolver_1_0.real_iface; + return iface->IsHostResolver(resource); +} + +static int32_t Pnacl_M29_PPB_HostResolver_Resolve(PP_Resource host_resolver, const char* host, uint16_t port, const struct PP_HostResolver_Hint* hint, struct PP_CompletionCallback* callback) { + const struct PPB_HostResolver_1_0 *iface = Pnacl_WrapperInfo_PPB_HostResolver_1_0.real_iface; + return iface->Resolve(host_resolver, host, port, hint, *callback); +} + +static void Pnacl_M29_PPB_HostResolver_GetCanonicalName(struct PP_Var* _struct_result, PP_Resource host_resolver) { + const struct PPB_HostResolver_1_0 *iface = Pnacl_WrapperInfo_PPB_HostResolver_1_0.real_iface; + *_struct_result = iface->GetCanonicalName(host_resolver); +} + +static uint32_t Pnacl_M29_PPB_HostResolver_GetNetAddressCount(PP_Resource host_resolver) { + const struct PPB_HostResolver_1_0 *iface = Pnacl_WrapperInfo_PPB_HostResolver_1_0.real_iface; + return iface->GetNetAddressCount(host_resolver); +} + +static PP_Resource Pnacl_M29_PPB_HostResolver_GetNetAddress(PP_Resource host_resolver, uint32_t index) { + const struct PPB_HostResolver_1_0 *iface = Pnacl_WrapperInfo_PPB_HostResolver_1_0.real_iface; + return iface->GetNetAddress(host_resolver, index); +} + +/* End wrapper methods for PPB_HostResolver_1_0 */ + /* Not generating wrapper methods for PPB_ImageData_1_0 */ /* Not generating wrapper methods for PPB_InputEvent_1_0 */ @@ -952,6 +926,147 @@ static void Pnacl_M16_PPB_MouseLock_UnlockMouse(PP_Instance instance) { /* End wrapper methods for PPB_MouseLock_1_0 */ +/* Begin wrapper methods for PPB_NetAddress_1_0 */ + +static PP_Resource Pnacl_M29_PPB_NetAddress_CreateFromIPv4Address(PP_Instance instance, const struct PP_NetAddress_IPv4* ipv4_addr) { + const struct PPB_NetAddress_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_1_0.real_iface; + return iface->CreateFromIPv4Address(instance, ipv4_addr); +} + +static PP_Resource Pnacl_M29_PPB_NetAddress_CreateFromIPv6Address(PP_Instance instance, const struct PP_NetAddress_IPv6* ipv6_addr) { + const struct PPB_NetAddress_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_1_0.real_iface; + return iface->CreateFromIPv6Address(instance, ipv6_addr); +} + +static PP_Bool Pnacl_M29_PPB_NetAddress_IsNetAddress(PP_Resource resource) { + const struct PPB_NetAddress_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_1_0.real_iface; + return iface->IsNetAddress(resource); +} + +static PP_NetAddress_Family Pnacl_M29_PPB_NetAddress_GetFamily(PP_Resource addr) { + const struct PPB_NetAddress_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_1_0.real_iface; + return iface->GetFamily(addr); +} + +static void Pnacl_M29_PPB_NetAddress_DescribeAsString(struct PP_Var* _struct_result, PP_Resource addr, PP_Bool include_port) { + const struct PPB_NetAddress_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_1_0.real_iface; + *_struct_result = iface->DescribeAsString(addr, include_port); +} + +static PP_Bool Pnacl_M29_PPB_NetAddress_DescribeAsIPv4Address(PP_Resource addr, struct PP_NetAddress_IPv4* ipv4_addr) { + const struct PPB_NetAddress_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_1_0.real_iface; + return iface->DescribeAsIPv4Address(addr, ipv4_addr); +} + +static PP_Bool Pnacl_M29_PPB_NetAddress_DescribeAsIPv6Address(PP_Resource addr, struct PP_NetAddress_IPv6* ipv6_addr) { + const struct PPB_NetAddress_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_1_0.real_iface; + return iface->DescribeAsIPv6Address(addr, ipv6_addr); +} + +/* End wrapper methods for PPB_NetAddress_1_0 */ + +/* Begin wrapper methods for PPB_NetworkProxy_1_0 */ + +static int32_t Pnacl_M29_PPB_NetworkProxy_GetProxyForURL(PP_Instance instance, struct PP_Var* url, struct PP_Var* proxy_string, struct PP_CompletionCallback* callback) { + const struct PPB_NetworkProxy_1_0 *iface = Pnacl_WrapperInfo_PPB_NetworkProxy_1_0.real_iface; + return iface->GetProxyForURL(instance, *url, proxy_string, *callback); +} + +/* End wrapper methods for PPB_NetworkProxy_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_UDPSocket_1_0 */ + +static PP_Resource Pnacl_M29_PPB_UDPSocket_Create(PP_Instance instance) { + const struct PPB_UDPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_1_0.real_iface; + return iface->Create(instance); +} + +static PP_Bool Pnacl_M29_PPB_UDPSocket_IsUDPSocket(PP_Resource resource) { + const struct PPB_UDPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_1_0.real_iface; + return iface->IsUDPSocket(resource); +} + +static int32_t Pnacl_M29_PPB_UDPSocket_Bind(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback* callback) { + const struct PPB_UDPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_1_0.real_iface; + return iface->Bind(udp_socket, addr, *callback); +} + +static PP_Resource Pnacl_M29_PPB_UDPSocket_GetBoundAddress(PP_Resource udp_socket) { + const struct PPB_UDPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_1_0.real_iface; + return iface->GetBoundAddress(udp_socket); +} + +static int32_t Pnacl_M29_PPB_UDPSocket_RecvFrom(PP_Resource udp_socket, char* buffer, int32_t num_bytes, PP_Resource* addr, struct PP_CompletionCallback* callback) { + const struct PPB_UDPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_1_0.real_iface; + return iface->RecvFrom(udp_socket, buffer, num_bytes, addr, *callback); +} + +static int32_t Pnacl_M29_PPB_UDPSocket_SendTo(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback* callback) { + const struct PPB_UDPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_1_0.real_iface; + return iface->SendTo(udp_socket, buffer, num_bytes, addr, *callback); +} + +static void Pnacl_M29_PPB_UDPSocket_Close(PP_Resource udp_socket) { + const struct PPB_UDPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_1_0.real_iface; + iface->Close(udp_socket); +} + +static int32_t Pnacl_M29_PPB_UDPSocket_SetOption(PP_Resource udp_socket, PP_UDPSocket_Option name, struct PP_Var* value, struct PP_CompletionCallback* callback) { + const struct PPB_UDPSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_1_0.real_iface; + return iface->SetOption(udp_socket, name, *value, *callback); +} + +/* End wrapper methods for PPB_UDPSocket_1_0 */ + /* Begin wrapper methods for PPB_URLLoader_1_0 */ static PP_Resource Pnacl_M14_PPB_URLLoader_Create(PP_Instance instance) { @@ -1102,6 +1217,35 @@ static const char* Pnacl_M18_PPB_Var_VarToUtf8(struct PP_Var* var, uint32_t* len /* End wrapper methods for PPB_Var_1_1 */ +/* Begin wrapper methods for PPB_VarArray_1_0 */ + +static void Pnacl_M29_PPB_VarArray_Create(struct PP_Var* _struct_result) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + *_struct_result = iface->Create(); +} + +static void Pnacl_M29_PPB_VarArray_Get(struct PP_Var* _struct_result, struct PP_Var* array, uint32_t index) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + *_struct_result = iface->Get(*array, index); +} + +static PP_Bool Pnacl_M29_PPB_VarArray_Set(struct PP_Var* array, uint32_t index, struct PP_Var* value) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + return iface->Set(*array, index, *value); +} + +static uint32_t Pnacl_M29_PPB_VarArray_GetLength(struct PP_Var* array) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + return iface->GetLength(*array); +} + +static PP_Bool Pnacl_M29_PPB_VarArray_SetLength(struct PP_Var* array, uint32_t length) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + return iface->SetLength(*array, length); +} + +/* End wrapper methods for PPB_VarArray_1_0 */ + /* Begin wrapper methods for PPB_VarArrayBuffer_1_0 */ static void Pnacl_M18_PPB_VarArrayBuffer_Create(struct PP_Var* _struct_result, uint32_t size_in_bytes) { @@ -1126,6 +1270,40 @@ static void Pnacl_M18_PPB_VarArrayBuffer_Unmap(struct PP_Var* array) { /* End wrapper methods for PPB_VarArrayBuffer_1_0 */ +/* Begin wrapper methods for PPB_VarDictionary_1_0 */ + +static void Pnacl_M29_PPB_VarDictionary_Create(struct PP_Var* _struct_result) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + *_struct_result = iface->Create(); +} + +static void Pnacl_M29_PPB_VarDictionary_Get(struct PP_Var* _struct_result, struct PP_Var* dict, struct PP_Var* key) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + *_struct_result = iface->Get(*dict, *key); +} + +static PP_Bool Pnacl_M29_PPB_VarDictionary_Set(struct PP_Var* dict, struct PP_Var* key, struct PP_Var* value) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + return iface->Set(*dict, *key, *value); +} + +static void Pnacl_M29_PPB_VarDictionary_Delete(struct PP_Var* dict, struct PP_Var* key) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + iface->Delete(*dict, *key); +} + +static PP_Bool Pnacl_M29_PPB_VarDictionary_HasKey(struct PP_Var* dict, struct PP_Var* key) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + return iface->HasKey(*dict, *key); +} + +static void Pnacl_M29_PPB_VarDictionary_GetKeys(struct PP_Var* _struct_result, struct PP_Var* dict) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + *_struct_result = iface->GetKeys(*dict); +} + +/* End wrapper methods for PPB_VarDictionary_1_0 */ + /* Not generating wrapper methods for PPB_View_1_0 */ /* Not generating wrapper methods for PPB_View_1_1 */ @@ -1225,158 +1403,19 @@ static void Pnacl_M14_PPP_Messaging_HandleMessage(PP_Instance instance, struct P /* Not generating wrapper methods for PPP_MouseLock_1_0 */ -/* Begin wrapper methods for PPB_BrokerTrusted_0_2 */ - -static PP_Resource Pnacl_M14_PPB_BrokerTrusted_CreateTrusted(PP_Instance instance) { - const struct PPB_BrokerTrusted_0_2 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2.real_iface; - return iface->CreateTrusted(instance); -} - -static PP_Bool Pnacl_M14_PPB_BrokerTrusted_IsBrokerTrusted(PP_Resource resource) { - const struct PPB_BrokerTrusted_0_2 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2.real_iface; - return iface->IsBrokerTrusted(resource); -} - -static int32_t Pnacl_M14_PPB_BrokerTrusted_Connect(PP_Resource broker, struct PP_CompletionCallback* connect_callback) { - const struct PPB_BrokerTrusted_0_2 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2.real_iface; - return iface->Connect(broker, *connect_callback); -} - -static int32_t Pnacl_M14_PPB_BrokerTrusted_GetHandle(PP_Resource broker, int32_t* handle) { - const struct PPB_BrokerTrusted_0_2 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2.real_iface; - return iface->GetHandle(broker, handle); -} - -/* End wrapper methods for PPB_BrokerTrusted_0_2 */ - -/* Begin wrapper methods for PPB_BrokerTrusted_0_3 */ - -static PP_Resource Pnacl_M25_PPB_BrokerTrusted_CreateTrusted(PP_Instance instance) { - const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface; - return iface->CreateTrusted(instance); -} - -static PP_Bool Pnacl_M25_PPB_BrokerTrusted_IsBrokerTrusted(PP_Resource resource) { - const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface; - return iface->IsBrokerTrusted(resource); -} - -static int32_t Pnacl_M25_PPB_BrokerTrusted_Connect(PP_Resource broker, struct PP_CompletionCallback* connect_callback) { - const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface; - return iface->Connect(broker, *connect_callback); -} +/* Not generating wrapper methods for PPB_BrokerTrusted_0_2 */ -static int32_t Pnacl_M25_PPB_BrokerTrusted_GetHandle(PP_Resource broker, int32_t* handle) { - const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface; - return iface->GetHandle(broker, handle); -} +/* Not generating wrapper methods for PPB_BrokerTrusted_0_3 */ -static PP_Bool Pnacl_M25_PPB_BrokerTrusted_IsAllowed(PP_Resource broker) { - const struct PPB_BrokerTrusted_0_3 *iface = Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3.real_iface; - return iface->IsAllowed(broker); -} +/* Not generating wrapper methods for PPB_BrowserFont_Trusted_1_0 */ -/* End wrapper methods for PPB_BrokerTrusted_0_3 */ +/* Not generating wrapper methods for PPB_CharSet_Trusted_1_0 */ -/* Begin wrapper methods for PPB_BrowserFont_Trusted_1_0 */ +/* Not generating wrapper methods for PPB_FileChooserTrusted_0_5 */ -static void Pnacl_M19_PPB_BrowserFont_Trusted_GetFontFamilies(struct PP_Var* _struct_result, PP_Instance instance) { - const struct PPB_BrowserFont_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0.real_iface; - *_struct_result = iface->GetFontFamilies(instance); -} +/* Not generating wrapper methods for PPB_FileChooserTrusted_0_6 */ -static PP_Resource Pnacl_M19_PPB_BrowserFont_Trusted_Create(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description* description) { - const struct PPB_BrowserFont_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0.real_iface; - return iface->Create(instance, description); -} - -static PP_Bool Pnacl_M19_PPB_BrowserFont_Trusted_IsFont(PP_Resource resource) { - const struct PPB_BrowserFont_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0.real_iface; - return iface->IsFont(resource); -} - -static PP_Bool Pnacl_M19_PPB_BrowserFont_Trusted_Describe(PP_Resource font, struct PP_BrowserFont_Trusted_Description* description, struct PP_BrowserFont_Trusted_Metrics* metrics) { - const struct PPB_BrowserFont_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0.real_iface; - return iface->Describe(font, description, metrics); -} - -static PP_Bool Pnacl_M19_PPB_BrowserFont_Trusted_DrawTextAt(PP_Resource font, PP_Resource image_data, const struct PP_BrowserFont_Trusted_TextRun* text, const struct PP_Point* position, uint32_t color, const struct PP_Rect* clip, PP_Bool image_data_is_opaque) { - const struct PPB_BrowserFont_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0.real_iface; - return iface->DrawTextAt(font, image_data, text, position, color, clip, image_data_is_opaque); -} - -static int32_t Pnacl_M19_PPB_BrowserFont_Trusted_MeasureText(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text) { - const struct PPB_BrowserFont_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0.real_iface; - return iface->MeasureText(font, text); -} - -static uint32_t Pnacl_M19_PPB_BrowserFont_Trusted_CharacterOffsetForPixel(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text, int32_t pixel_position) { - const struct PPB_BrowserFont_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0.real_iface; - return iface->CharacterOffsetForPixel(font, text, pixel_position); -} - -static int32_t Pnacl_M19_PPB_BrowserFont_Trusted_PixelOffsetForCharacter(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text, uint32_t char_offset) { - const struct PPB_BrowserFont_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0.real_iface; - return iface->PixelOffsetForCharacter(font, text, char_offset); -} - -/* End wrapper methods for PPB_BrowserFont_Trusted_1_0 */ - -/* Begin wrapper methods for PPB_CharSet_Trusted_1_0 */ - -static PP_Bool Pnacl_M18_PPB_CharSet_Trusted_UTF16ToCharSet(const uint16_t utf16[], uint32_t utf16_len, const char* output_char_set, PP_CharSet_Trusted_ConversionError on_error, char* output_buffer, uint32_t* output_length) { - const struct PPB_CharSet_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_CharSet_Trusted_1_0.real_iface; - return iface->UTF16ToCharSet(utf16, utf16_len, output_char_set, on_error, output_buffer, output_length); -} - -static PP_Bool Pnacl_M18_PPB_CharSet_Trusted_CharSetToUTF16(const char* input, uint32_t input_len, const char* input_char_set, PP_CharSet_Trusted_ConversionError on_error, uint16_t* output_buffer, uint32_t* output_utf16_length) { - const struct PPB_CharSet_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_CharSet_Trusted_1_0.real_iface; - return iface->CharSetToUTF16(input, input_len, input_char_set, on_error, output_buffer, output_utf16_length); -} - -static void Pnacl_M18_PPB_CharSet_Trusted_GetDefaultCharSet(struct PP_Var* _struct_result, PP_Instance instance) { - const struct PPB_CharSet_Trusted_1_0 *iface = Pnacl_WrapperInfo_PPB_CharSet_Trusted_1_0.real_iface; - *_struct_result = iface->GetDefaultCharSet(instance); -} - -/* End wrapper methods for PPB_CharSet_Trusted_1_0 */ - -/* Begin wrapper methods for PPB_FileChooserTrusted_0_5 */ - -static int32_t Pnacl_M16_PPB_FileChooserTrusted_ShowWithoutUserGesture(PP_Resource chooser, PP_Bool save_as, struct PP_Var* suggested_file_name, struct PP_CompletionCallback* callback) { - const struct PPB_FileChooserTrusted_0_5 *iface = Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_5.real_iface; - return iface->ShowWithoutUserGesture(chooser, save_as, *suggested_file_name, *callback); -} - -/* End wrapper methods for PPB_FileChooserTrusted_0_5 */ - -/* Begin wrapper methods for PPB_FileChooserTrusted_0_6 */ - -static int32_t Pnacl_M20_PPB_FileChooserTrusted_ShowWithoutUserGesture(PP_Resource chooser, PP_Bool save_as, struct PP_Var* suggested_file_name, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) { - const struct PPB_FileChooserTrusted_0_6 *iface = Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_6.real_iface; - return iface->ShowWithoutUserGesture(chooser, save_as, *suggested_file_name, *output, *callback); -} - -/* End wrapper methods for PPB_FileChooserTrusted_0_6 */ - -/* Begin wrapper methods for PPB_FileIOTrusted_0_4 */ - -static int32_t Pnacl_M14_PPB_FileIOTrusted_GetOSFileDescriptor(PP_Resource file_io) { - const struct PPB_FileIOTrusted_0_4 *iface = Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4.real_iface; - return iface->GetOSFileDescriptor(file_io); -} - -static int32_t Pnacl_M14_PPB_FileIOTrusted_WillWrite(PP_Resource file_io, int64_t offset, int32_t bytes_to_write, struct PP_CompletionCallback* callback) { - const struct PPB_FileIOTrusted_0_4 *iface = Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4.real_iface; - return iface->WillWrite(file_io, offset, bytes_to_write, *callback); -} - -static int32_t Pnacl_M14_PPB_FileIOTrusted_WillSetLength(PP_Resource file_io, int64_t length, struct PP_CompletionCallback* callback) { - const struct PPB_FileIOTrusted_0_4 *iface = Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4.real_iface; - return iface->WillSetLength(file_io, length, *callback); -} - -/* End wrapper methods for PPB_FileIOTrusted_0_4 */ +/* Not generating wrapper methods for PPB_FileIOTrusted_0_4 */ /* Not generating wrapper methods for PPB_URLLoaderTrusted_0_3 */ @@ -1397,7 +1436,7 @@ static int32_t Pnacl_M19_PPB_AudioInput_Dev_EnumerateDevices(PP_Resource audio_i return iface->EnumerateDevices(audio_input, devices, *callback); } -static int32_t Pnacl_M19_PPB_AudioInput_Dev_Open(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, struct PP_CompletionCallback* callback) { +static int32_t Pnacl_M19_PPB_AudioInput_Dev_Open(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback_0_2 audio_input_callback, void* user_data, struct PP_CompletionCallback* callback) { const struct PPB_AudioInput_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2.real_iface; return iface->Open(audio_input, device_ref, config, audio_input_callback, user_data, *callback); } @@ -1446,7 +1485,7 @@ static int32_t Pnacl_M25_PPB_AudioInput_Dev_MonitorDeviceChange(PP_Resource audi return iface->MonitorDeviceChange(audio_input, callback, user_data); } -static int32_t Pnacl_M25_PPB_AudioInput_Dev_Open(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, struct PP_CompletionCallback* callback) { +static int32_t Pnacl_M25_PPB_AudioInput_Dev_Open(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback_0_2 audio_input_callback, void* user_data, struct PP_CompletionCallback* callback) { const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface; return iface->Open(audio_input, device_ref, config, audio_input_callback, user_data, *callback); } @@ -1473,6 +1512,55 @@ static void Pnacl_M25_PPB_AudioInput_Dev_Close(PP_Resource audio_input) { /* End wrapper methods for PPB_AudioInput_Dev_0_3 */ +/* Begin wrapper methods for PPB_AudioInput_Dev_0_4 */ + +static PP_Resource Pnacl_M29_PPB_AudioInput_Dev_Create(PP_Instance instance) { + const struct PPB_AudioInput_Dev_0_4 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4.real_iface; + return iface->Create(instance); +} + +static PP_Bool Pnacl_M29_PPB_AudioInput_Dev_IsAudioInput(PP_Resource resource) { + const struct PPB_AudioInput_Dev_0_4 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4.real_iface; + return iface->IsAudioInput(resource); +} + +static int32_t Pnacl_M29_PPB_AudioInput_Dev_EnumerateDevices(PP_Resource audio_input, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) { + const struct PPB_AudioInput_Dev_0_4 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4.real_iface; + return iface->EnumerateDevices(audio_input, *output, *callback); +} + +static int32_t Pnacl_M29_PPB_AudioInput_Dev_MonitorDeviceChange(PP_Resource audio_input, PP_MonitorDeviceChangeCallback callback, void* user_data) { + const struct PPB_AudioInput_Dev_0_4 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4.real_iface; + return iface->MonitorDeviceChange(audio_input, callback, user_data); +} + +static int32_t Pnacl_M29_PPB_AudioInput_Dev_Open(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, struct PP_CompletionCallback* callback) { + const struct PPB_AudioInput_Dev_0_4 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4.real_iface; + return iface->Open(audio_input, device_ref, config, audio_input_callback, user_data, *callback); +} + +static PP_Resource Pnacl_M29_PPB_AudioInput_Dev_GetCurrentConfig(PP_Resource audio_input) { + const struct PPB_AudioInput_Dev_0_4 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4.real_iface; + return iface->GetCurrentConfig(audio_input); +} + +static PP_Bool Pnacl_M29_PPB_AudioInput_Dev_StartCapture(PP_Resource audio_input) { + const struct PPB_AudioInput_Dev_0_4 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4.real_iface; + return iface->StartCapture(audio_input); +} + +static PP_Bool Pnacl_M29_PPB_AudioInput_Dev_StopCapture(PP_Resource audio_input) { + const struct PPB_AudioInput_Dev_0_4 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4.real_iface; + return iface->StopCapture(audio_input); +} + +static void Pnacl_M29_PPB_AudioInput_Dev_Close(PP_Resource audio_input) { + const struct PPB_AudioInput_Dev_0_4 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4.real_iface; + iface->Close(audio_input); +} + +/* End wrapper methods for PPB_AudioInput_Dev_0_4 */ + /* Not generating wrapper methods for PPB_Buffer_Dev_0_4 */ /* Not generating wrapper methods for PPB_Crypto_Dev_0_1 */ @@ -1589,40 +1677,6 @@ static int32_t Pnacl_M14_PPB_Font_Dev_PixelOffsetForCharacter(PP_Resource font, /* Not generating wrapper methods for PPB_Graphics2D_Dev_0_1 */ -/* Begin wrapper methods for PPB_HostResolver_Dev_0_1 */ - -static PP_Resource Pnacl_M29_PPB_HostResolver_Dev_Create(PP_Instance instance) { - const struct PPB_HostResolver_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Dev_0_1.real_iface; - return iface->Create(instance); -} - -static PP_Bool Pnacl_M29_PPB_HostResolver_Dev_IsHostResolver(PP_Resource resource) { - const struct PPB_HostResolver_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Dev_0_1.real_iface; - return iface->IsHostResolver(resource); -} - -static int32_t Pnacl_M29_PPB_HostResolver_Dev_Resolve(PP_Resource host_resolver, const char* host, uint16_t port, const struct PP_HostResolver_Hint_Dev* hint, struct PP_CompletionCallback* callback) { - const struct PPB_HostResolver_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Dev_0_1.real_iface; - return iface->Resolve(host_resolver, host, port, hint, *callback); -} - -static void Pnacl_M29_PPB_HostResolver_Dev_GetCanonicalName(struct PP_Var* _struct_result, PP_Resource host_resolver) { - const struct PPB_HostResolver_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Dev_0_1.real_iface; - *_struct_result = iface->GetCanonicalName(host_resolver); -} - -static uint32_t Pnacl_M29_PPB_HostResolver_Dev_GetNetAddressCount(PP_Resource host_resolver) { - const struct PPB_HostResolver_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Dev_0_1.real_iface; - return iface->GetNetAddressCount(host_resolver); -} - -static PP_Resource Pnacl_M29_PPB_HostResolver_Dev_GetNetAddress(PP_Resource host_resolver, uint32_t index) { - const struct PPB_HostResolver_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Dev_0_1.real_iface; - return iface->GetNetAddress(host_resolver, index); -} - -/* End wrapper methods for PPB_HostResolver_Dev_0_1 */ - /* Begin wrapper methods for PPB_IMEInputEvent_Dev_0_1 */ static PP_Bool Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent(PP_Resource resource) { @@ -1700,45 +1754,6 @@ static void Pnacl_M21_PPB_IMEInputEvent_Dev_GetSelection(PP_Resource ime_event, /* Not generating wrapper methods for PPB_Memory_Dev_0_1 */ -/* Begin wrapper methods for PPB_NetAddress_Dev_0_1 */ - -static PP_Resource Pnacl_M29_PPB_NetAddress_Dev_CreateFromIPv4Address(PP_Instance instance, const struct PP_NetAddress_IPv4_Dev* ipv4_addr) { - const struct PPB_NetAddress_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1.real_iface; - return iface->CreateFromIPv4Address(instance, ipv4_addr); -} - -static PP_Resource Pnacl_M29_PPB_NetAddress_Dev_CreateFromIPv6Address(PP_Instance instance, const struct PP_NetAddress_IPv6_Dev* ipv6_addr) { - const struct PPB_NetAddress_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1.real_iface; - return iface->CreateFromIPv6Address(instance, ipv6_addr); -} - -static PP_Bool Pnacl_M29_PPB_NetAddress_Dev_IsNetAddress(PP_Resource addr) { - const struct PPB_NetAddress_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1.real_iface; - return iface->IsNetAddress(addr); -} - -static PP_NetAddress_Family_Dev Pnacl_M29_PPB_NetAddress_Dev_GetFamily(PP_Resource addr) { - const struct PPB_NetAddress_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1.real_iface; - return iface->GetFamily(addr); -} - -static void Pnacl_M29_PPB_NetAddress_Dev_DescribeAsString(struct PP_Var* _struct_result, PP_Resource addr, PP_Bool include_port) { - const struct PPB_NetAddress_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1.real_iface; - *_struct_result = iface->DescribeAsString(addr, include_port); -} - -static PP_Bool Pnacl_M29_PPB_NetAddress_Dev_DescribeAsIPv4Address(PP_Resource addr, struct PP_NetAddress_IPv4_Dev* ipv4_addr) { - const struct PPB_NetAddress_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1.real_iface; - return iface->DescribeAsIPv4Address(addr, ipv4_addr); -} - -static PP_Bool Pnacl_M29_PPB_NetAddress_Dev_DescribeAsIPv6Address(PP_Resource addr, struct PP_NetAddress_IPv6_Dev* ipv6_addr) { - const struct PPB_NetAddress_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1.real_iface; - return iface->DescribeAsIPv6Address(addr, ipv6_addr); -} - -/* End wrapper methods for PPB_NetAddress_Dev_0_1 */ - /* Begin wrapper methods for PPB_Printing_Dev_0_7 */ static PP_Resource Pnacl_M23_PPB_Printing_Dev_Create(PP_Instance instance) { @@ -1757,55 +1772,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 */ @@ -1948,6 +1914,8 @@ static void Pnacl_M28_PPB_Testing_Dev_SetMinimumArrayBufferSizeForShmem(PP_Insta /* Not generating wrapper methods for PPB_Trace_Event_Dev_0_1 */ +/* Not generating wrapper methods for PPB_Trace_Event_Dev_0_2 */ + /* Begin wrapper methods for PPB_TrueTypeFont_Dev_0_1 */ static int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetFontFamilies(PP_Instance instance, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) { @@ -1987,50 +1955,6 @@ static int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetTable(PP_Resource font, uint32_ /* End wrapper methods for PPB_TrueTypeFont_Dev_0_1 */ -/* Begin wrapper methods for PPB_UDPSocket_Dev_0_1 */ - -static PP_Resource Pnacl_M29_PPB_UDPSocket_Dev_Create(PP_Instance instance) { - const struct PPB_UDPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1.real_iface; - return iface->Create(instance); -} - -static PP_Bool Pnacl_M29_PPB_UDPSocket_Dev_IsUDPSocket(PP_Resource resource) { - const struct PPB_UDPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1.real_iface; - return iface->IsUDPSocket(resource); -} - -static int32_t Pnacl_M29_PPB_UDPSocket_Dev_Bind(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback* callback) { - const struct PPB_UDPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1.real_iface; - return iface->Bind(udp_socket, addr, *callback); -} - -static PP_Resource Pnacl_M29_PPB_UDPSocket_Dev_GetBoundAddress(PP_Resource udp_socket) { - const struct PPB_UDPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1.real_iface; - return iface->GetBoundAddress(udp_socket); -} - -static int32_t Pnacl_M29_PPB_UDPSocket_Dev_RecvFrom(PP_Resource udp_socket, char* buffer, int32_t num_bytes, PP_Resource* addr, struct PP_CompletionCallback* callback) { - const struct PPB_UDPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1.real_iface; - return iface->RecvFrom(udp_socket, buffer, num_bytes, addr, *callback); -} - -static int32_t Pnacl_M29_PPB_UDPSocket_Dev_SendTo(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback* callback) { - const struct PPB_UDPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1.real_iface; - return iface->SendTo(udp_socket, buffer, num_bytes, addr, *callback); -} - -static void Pnacl_M29_PPB_UDPSocket_Dev_Close(PP_Resource udp_socket) { - const struct PPB_UDPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1.real_iface; - iface->Close(udp_socket); -} - -static int32_t Pnacl_M29_PPB_UDPSocket_Dev_SetOption(PP_Resource udp_socket, PP_UDPSocket_Option_Dev name, struct PP_Var* value, struct PP_CompletionCallback* callback) { - const struct PPB_UDPSocket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1.real_iface; - return iface->SetOption(udp_socket, name, *value, *callback); -} - -/* End wrapper methods for PPB_UDPSocket_Dev_0_1 */ - /* Begin wrapper methods for PPB_URLUtil_Dev_0_6 */ static void Pnacl_M17_PPB_URLUtil_Dev_Canonicalize(struct PP_Var* _struct_result, struct PP_Var* url, struct PP_URLComponents_Dev* components) { @@ -2075,69 +1999,6 @@ static void Pnacl_M17_PPB_URLUtil_Dev_GetPluginInstanceURL(struct PP_Var* _struc /* End wrapper methods for PPB_URLUtil_Dev_0_6 */ -/* Begin wrapper methods for PPB_VarArray_Dev_0_1 */ - -static void Pnacl_M27_PPB_VarArray_Dev_Create(struct PP_Var* _struct_result) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - *_struct_result = iface->Create(); -} - -static void Pnacl_M27_PPB_VarArray_Dev_Get(struct PP_Var* _struct_result, struct PP_Var* array, uint32_t index) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - *_struct_result = iface->Get(*array, index); -} - -static PP_Bool Pnacl_M27_PPB_VarArray_Dev_Set(struct PP_Var* array, uint32_t index, struct PP_Var* value) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - return iface->Set(*array, index, *value); -} - -static uint32_t Pnacl_M27_PPB_VarArray_Dev_GetLength(struct PP_Var* array) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - return iface->GetLength(*array); -} - -static PP_Bool Pnacl_M27_PPB_VarArray_Dev_SetLength(struct PP_Var* array, uint32_t length) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - return iface->SetLength(*array, length); -} - -/* End wrapper methods for PPB_VarArray_Dev_0_1 */ - -/* Begin wrapper methods for PPB_VarDictionary_Dev_0_1 */ - -static void Pnacl_M27_PPB_VarDictionary_Dev_Create(struct PP_Var* _struct_result) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - *_struct_result = iface->Create(); -} - -static void Pnacl_M27_PPB_VarDictionary_Dev_Get(struct PP_Var* _struct_result, struct PP_Var* dict, struct PP_Var* key) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - *_struct_result = iface->Get(*dict, *key); -} - -static PP_Bool Pnacl_M27_PPB_VarDictionary_Dev_Set(struct PP_Var* dict, struct PP_Var* key, struct PP_Var* value) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - return iface->Set(*dict, *key, *value); -} - -static void Pnacl_M27_PPB_VarDictionary_Dev_Delete(struct PP_Var* dict, struct PP_Var* key) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - iface->Delete(*dict, *key); -} - -static PP_Bool Pnacl_M27_PPB_VarDictionary_Dev_HasKey(struct PP_Var* dict, struct PP_Var* key) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - return iface->HasKey(*dict, *key); -} - -static void Pnacl_M27_PPB_VarDictionary_Dev_GetKeys(struct PP_Var* _struct_result, struct PP_Var* dict) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - *_struct_result = iface->GetKeys(*dict); -} - -/* End wrapper methods for PPB_VarDictionary_Dev_0_1 */ - /* Begin wrapper methods for PPB_VideoCapture_Dev_0_2 */ static PP_Resource Pnacl_M19_PPB_VideoCapture_Dev_Create(PP_Instance instance) { @@ -2880,7 +2741,79 @@ static void Pnacl_M13_PPB_Instance_Private_ExecuteScript(struct PP_Var* _struct_ /* End wrapper methods for PPB_Instance_Private_0_1 */ -/* Not generating wrapper methods for PPB_NaCl_Private_1_0 */ +/* Begin wrapper methods for PPB_NaCl_Private_1_0 */ + +static PP_NaClResult Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, void* imc_handle) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->LaunchSelLdr(instance, alleged_url, uses_irt, uses_ppapi, enable_ppapi_dev, enable_dyncode_syscalls, enable_exception_handling, imc_handle); +} + +static PP_NaClResult Pnacl_M13_PPB_NaCl_Private_StartPpapiProxy(PP_Instance instance) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->StartPpapiProxy(instance); +} + +static int32_t Pnacl_M13_PPB_NaCl_Private_UrandomFD(void) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->UrandomFD(); +} + +static PP_Bool Pnacl_M13_PPB_NaCl_Private_Are3DInterfacesDisabled(void) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->Are3DInterfacesDisabled(); +} + +static void Pnacl_M13_PPB_NaCl_Private_EnableBackgroundSelLdrLaunch(void) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + iface->EnableBackgroundSelLdrLaunch(); +} + +static int32_t Pnacl_M13_PPB_NaCl_Private_BrokerDuplicateHandle(PP_FileHandle source_handle, uint32_t process_id, PP_FileHandle* target_handle, uint32_t desired_access, uint32_t options) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->BrokerDuplicateHandle(source_handle, process_id, target_handle, desired_access, options); +} + +static PP_FileHandle Pnacl_M13_PPB_NaCl_Private_GetReadonlyPnaclFd(const char* filename) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->GetReadonlyPnaclFd(filename); +} + +static PP_FileHandle Pnacl_M13_PPB_NaCl_Private_CreateTemporaryFile(PP_Instance instance) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->CreateTemporaryFile(instance); +} + +static int32_t Pnacl_M13_PPB_NaCl_Private_GetNexeFd(PP_Instance instance, const char* cache_key, PP_Bool* is_hit, PP_FileHandle* nexe_handle, struct PP_CompletionCallback* callback) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->GetNexeFd(instance, cache_key, is_hit, nexe_handle, *callback); +} + +static void Pnacl_M13_PPB_NaCl_Private_ReportTranslationFinished(PP_Instance instance) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + iface->ReportTranslationFinished(instance); +} + +static PP_Bool Pnacl_M13_PPB_NaCl_Private_IsOffTheRecord(void) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->IsOffTheRecord(); +} + +static PP_Bool Pnacl_M13_PPB_NaCl_Private_IsPnaclEnabled(void) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->IsPnaclEnabled(); +} + +static PP_NaClResult Pnacl_M13_PPB_NaCl_Private_ReportNaClError(PP_Instance instance, PP_NaClError message_id) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->ReportNaClError(instance, message_id); +} + +static PP_FileHandle Pnacl_M13_PPB_NaCl_Private_OpenNaClExecutable(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->OpenNaClExecutable(instance, file_url, file_token_lo, file_token_hi); +} + +/* End wrapper methods for PPB_NaCl_Private_1_0 */ /* Begin wrapper methods for PPB_NetAddress_Private_0_1 */ @@ -4012,6 +3945,15 @@ struct PPB_Graphics3D_1_0 Pnacl_Wrappers_PPB_Graphics3D_1_0 = { .SwapBuffers = (int32_t (*)(PP_Resource context, struct PP_CompletionCallback callback))&Pnacl_M15_PPB_Graphics3D_SwapBuffers }; +struct PPB_HostResolver_1_0 Pnacl_Wrappers_PPB_HostResolver_1_0 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M29_PPB_HostResolver_Create, + .IsHostResolver = (PP_Bool (*)(PP_Resource resource))&Pnacl_M29_PPB_HostResolver_IsHostResolver, + .Resolve = (int32_t (*)(PP_Resource host_resolver, const char* host, uint16_t port, const struct PP_HostResolver_Hint* hint, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_HostResolver_Resolve, + .GetCanonicalName = (struct PP_Var (*)(PP_Resource host_resolver))&Pnacl_M29_PPB_HostResolver_GetCanonicalName, + .GetNetAddressCount = (uint32_t (*)(PP_Resource host_resolver))&Pnacl_M29_PPB_HostResolver_GetNetAddressCount, + .GetNetAddress = (PP_Resource (*)(PP_Resource host_resolver, uint32_t index))&Pnacl_M29_PPB_HostResolver_GetNetAddress +}; + /* Not generating wrapper interface for PPB_ImageData_1_0 */ /* Not generating wrapper interface for PPB_InputEvent_1_0 */ @@ -4080,6 +4022,43 @@ struct PPB_MouseLock_1_0 Pnacl_Wrappers_PPB_MouseLock_1_0 = { .UnlockMouse = (void (*)(PP_Instance instance))&Pnacl_M16_PPB_MouseLock_UnlockMouse }; +struct PPB_NetAddress_1_0 Pnacl_Wrappers_PPB_NetAddress_1_0 = { + .CreateFromIPv4Address = (PP_Resource (*)(PP_Instance instance, const struct PP_NetAddress_IPv4* ipv4_addr))&Pnacl_M29_PPB_NetAddress_CreateFromIPv4Address, + .CreateFromIPv6Address = (PP_Resource (*)(PP_Instance instance, const struct PP_NetAddress_IPv6* ipv6_addr))&Pnacl_M29_PPB_NetAddress_CreateFromIPv6Address, + .IsNetAddress = (PP_Bool (*)(PP_Resource resource))&Pnacl_M29_PPB_NetAddress_IsNetAddress, + .GetFamily = (PP_NetAddress_Family (*)(PP_Resource addr))&Pnacl_M29_PPB_NetAddress_GetFamily, + .DescribeAsString = (struct PP_Var (*)(PP_Resource addr, PP_Bool include_port))&Pnacl_M29_PPB_NetAddress_DescribeAsString, + .DescribeAsIPv4Address = (PP_Bool (*)(PP_Resource addr, struct PP_NetAddress_IPv4* ipv4_addr))&Pnacl_M29_PPB_NetAddress_DescribeAsIPv4Address, + .DescribeAsIPv6Address = (PP_Bool (*)(PP_Resource addr, struct PP_NetAddress_IPv6* ipv6_addr))&Pnacl_M29_PPB_NetAddress_DescribeAsIPv6Address +}; + +struct PPB_NetworkProxy_1_0 Pnacl_Wrappers_PPB_NetworkProxy_1_0 = { + .GetProxyForURL = (int32_t (*)(PP_Instance instance, struct PP_Var url, struct PP_Var* proxy_string, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_NetworkProxy_GetProxyForURL +}; + +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_UDPSocket_1_0 Pnacl_Wrappers_PPB_UDPSocket_1_0 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M29_PPB_UDPSocket_Create, + .IsUDPSocket = (PP_Bool (*)(PP_Resource resource))&Pnacl_M29_PPB_UDPSocket_IsUDPSocket, + .Bind = (int32_t (*)(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_UDPSocket_Bind, + .GetBoundAddress = (PP_Resource (*)(PP_Resource udp_socket))&Pnacl_M29_PPB_UDPSocket_GetBoundAddress, + .RecvFrom = (int32_t (*)(PP_Resource udp_socket, char* buffer, int32_t num_bytes, PP_Resource* addr, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_UDPSocket_RecvFrom, + .SendTo = (int32_t (*)(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_UDPSocket_SendTo, + .Close = (void (*)(PP_Resource udp_socket))&Pnacl_M29_PPB_UDPSocket_Close, + .SetOption = (int32_t (*)(PP_Resource udp_socket, PP_UDPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_UDPSocket_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, @@ -4121,6 +4100,14 @@ struct PPB_Var_1_1 Pnacl_Wrappers_PPB_Var_1_1 = { .VarToUtf8 = (const char* (*)(struct PP_Var var, uint32_t* len))&Pnacl_M18_PPB_Var_VarToUtf8 }; +struct PPB_VarArray_1_0 Pnacl_Wrappers_PPB_VarArray_1_0 = { + .Create = (struct PP_Var (*)(void))&Pnacl_M29_PPB_VarArray_Create, + .Get = (struct PP_Var (*)(struct PP_Var array, uint32_t index))&Pnacl_M29_PPB_VarArray_Get, + .Set = (PP_Bool (*)(struct PP_Var array, uint32_t index, struct PP_Var value))&Pnacl_M29_PPB_VarArray_Set, + .GetLength = (uint32_t (*)(struct PP_Var array))&Pnacl_M29_PPB_VarArray_GetLength, + .SetLength = (PP_Bool (*)(struct PP_Var array, uint32_t length))&Pnacl_M29_PPB_VarArray_SetLength +}; + struct PPB_VarArrayBuffer_1_0 Pnacl_Wrappers_PPB_VarArrayBuffer_1_0 = { .Create = (struct PP_Var (*)(uint32_t size_in_bytes))&Pnacl_M18_PPB_VarArrayBuffer_Create, .ByteLength = (PP_Bool (*)(struct PP_Var array, uint32_t* byte_length))&Pnacl_M18_PPB_VarArrayBuffer_ByteLength, @@ -4128,6 +4115,15 @@ struct PPB_VarArrayBuffer_1_0 Pnacl_Wrappers_PPB_VarArrayBuffer_1_0 = { .Unmap = (void (*)(struct PP_Var array))&Pnacl_M18_PPB_VarArrayBuffer_Unmap }; +struct PPB_VarDictionary_1_0 Pnacl_Wrappers_PPB_VarDictionary_1_0 = { + .Create = (struct PP_Var (*)(void))&Pnacl_M29_PPB_VarDictionary_Create, + .Get = (struct PP_Var (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M29_PPB_VarDictionary_Get, + .Set = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key, struct PP_Var value))&Pnacl_M29_PPB_VarDictionary_Set, + .Delete = (void (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M29_PPB_VarDictionary_Delete, + .HasKey = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M29_PPB_VarDictionary_HasKey, + .GetKeys = (struct PP_Var (*)(struct PP_Var dict))&Pnacl_M29_PPB_VarDictionary_GetKeys +}; + /* Not generating wrapper interface for PPB_View_1_0 */ /* Not generating wrapper interface for PPB_View_1_1 */ @@ -4163,51 +4159,19 @@ struct PPP_Messaging_1_0 Pnacl_Wrappers_PPP_Messaging_1_0 = { /* Not generating wrapper interface for PPP_MouseLock_1_0 */ -struct PPB_BrokerTrusted_0_2 Pnacl_Wrappers_PPB_BrokerTrusted_0_2 = { - .CreateTrusted = (PP_Resource (*)(PP_Instance instance))&Pnacl_M14_PPB_BrokerTrusted_CreateTrusted, - .IsBrokerTrusted = (PP_Bool (*)(PP_Resource resource))&Pnacl_M14_PPB_BrokerTrusted_IsBrokerTrusted, - .Connect = (int32_t (*)(PP_Resource broker, struct PP_CompletionCallback connect_callback))&Pnacl_M14_PPB_BrokerTrusted_Connect, - .GetHandle = (int32_t (*)(PP_Resource broker, int32_t* handle))&Pnacl_M14_PPB_BrokerTrusted_GetHandle -}; +/* Not generating wrapper interface for PPB_BrokerTrusted_0_2 */ -struct PPB_BrokerTrusted_0_3 Pnacl_Wrappers_PPB_BrokerTrusted_0_3 = { - .CreateTrusted = (PP_Resource (*)(PP_Instance instance))&Pnacl_M25_PPB_BrokerTrusted_CreateTrusted, - .IsBrokerTrusted = (PP_Bool (*)(PP_Resource resource))&Pnacl_M25_PPB_BrokerTrusted_IsBrokerTrusted, - .Connect = (int32_t (*)(PP_Resource broker, struct PP_CompletionCallback connect_callback))&Pnacl_M25_PPB_BrokerTrusted_Connect, - .GetHandle = (int32_t (*)(PP_Resource broker, int32_t* handle))&Pnacl_M25_PPB_BrokerTrusted_GetHandle, - .IsAllowed = (PP_Bool (*)(PP_Resource broker))&Pnacl_M25_PPB_BrokerTrusted_IsAllowed -}; +/* Not generating wrapper interface for PPB_BrokerTrusted_0_3 */ -struct PPB_BrowserFont_Trusted_1_0 Pnacl_Wrappers_PPB_BrowserFont_Trusted_1_0 = { - .GetFontFamilies = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M19_PPB_BrowserFont_Trusted_GetFontFamilies, - .Create = (PP_Resource (*)(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description* description))&Pnacl_M19_PPB_BrowserFont_Trusted_Create, - .IsFont = (PP_Bool (*)(PP_Resource resource))&Pnacl_M19_PPB_BrowserFont_Trusted_IsFont, - .Describe = (PP_Bool (*)(PP_Resource font, struct PP_BrowserFont_Trusted_Description* description, struct PP_BrowserFont_Trusted_Metrics* metrics))&Pnacl_M19_PPB_BrowserFont_Trusted_Describe, - .DrawTextAt = (PP_Bool (*)(PP_Resource font, PP_Resource image_data, const struct PP_BrowserFont_Trusted_TextRun* text, const struct PP_Point* position, uint32_t color, const struct PP_Rect* clip, PP_Bool image_data_is_opaque))&Pnacl_M19_PPB_BrowserFont_Trusted_DrawTextAt, - .MeasureText = (int32_t (*)(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text))&Pnacl_M19_PPB_BrowserFont_Trusted_MeasureText, - .CharacterOffsetForPixel = (uint32_t (*)(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text, int32_t pixel_position))&Pnacl_M19_PPB_BrowserFont_Trusted_CharacterOffsetForPixel, - .PixelOffsetForCharacter = (int32_t (*)(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text, uint32_t char_offset))&Pnacl_M19_PPB_BrowserFont_Trusted_PixelOffsetForCharacter -}; +/* Not generating wrapper interface for PPB_BrowserFont_Trusted_1_0 */ -struct PPB_CharSet_Trusted_1_0 Pnacl_Wrappers_PPB_CharSet_Trusted_1_0 = { - .UTF16ToCharSet = (PP_Bool (*)(const uint16_t utf16[], uint32_t utf16_len, const char* output_char_set, PP_CharSet_Trusted_ConversionError on_error, char* output_buffer, uint32_t* output_length))&Pnacl_M18_PPB_CharSet_Trusted_UTF16ToCharSet, - .CharSetToUTF16 = (PP_Bool (*)(const char* input, uint32_t input_len, const char* input_char_set, PP_CharSet_Trusted_ConversionError on_error, uint16_t* output_buffer, uint32_t* output_utf16_length))&Pnacl_M18_PPB_CharSet_Trusted_CharSetToUTF16, - .GetDefaultCharSet = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M18_PPB_CharSet_Trusted_GetDefaultCharSet -}; +/* Not generating wrapper interface for PPB_CharSet_Trusted_1_0 */ -struct PPB_FileChooserTrusted_0_5 Pnacl_Wrappers_PPB_FileChooserTrusted_0_5 = { - .ShowWithoutUserGesture = (int32_t (*)(PP_Resource chooser, PP_Bool save_as, struct PP_Var suggested_file_name, struct PP_CompletionCallback callback))&Pnacl_M16_PPB_FileChooserTrusted_ShowWithoutUserGesture -}; +/* Not generating wrapper interface for PPB_FileChooserTrusted_0_5 */ -struct PPB_FileChooserTrusted_0_6 Pnacl_Wrappers_PPB_FileChooserTrusted_0_6 = { - .ShowWithoutUserGesture = (int32_t (*)(PP_Resource chooser, PP_Bool save_as, struct PP_Var suggested_file_name, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M20_PPB_FileChooserTrusted_ShowWithoutUserGesture -}; +/* Not generating wrapper interface for PPB_FileChooserTrusted_0_6 */ -struct PPB_FileIOTrusted_0_4 Pnacl_Wrappers_PPB_FileIOTrusted_0_4 = { - .GetOSFileDescriptor = (int32_t (*)(PP_Resource file_io))&Pnacl_M14_PPB_FileIOTrusted_GetOSFileDescriptor, - .WillWrite = (int32_t (*)(PP_Resource file_io, int64_t offset, int32_t bytes_to_write, struct PP_CompletionCallback callback))&Pnacl_M14_PPB_FileIOTrusted_WillWrite, - .WillSetLength = (int32_t (*)(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback))&Pnacl_M14_PPB_FileIOTrusted_WillSetLength -}; +/* Not generating wrapper interface for PPB_FileIOTrusted_0_4 */ /* Not generating wrapper interface for PPB_URLLoaderTrusted_0_3 */ @@ -4215,7 +4179,7 @@ struct PPB_AudioInput_Dev_0_2 Pnacl_Wrappers_PPB_AudioInput_Dev_0_2 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_AudioInput_Dev_Create, .IsAudioInput = (PP_Bool (*)(PP_Resource resource))&Pnacl_M19_PPB_AudioInput_Dev_IsAudioInput, .EnumerateDevices = (int32_t (*)(PP_Resource audio_input, PP_Resource* devices, struct PP_CompletionCallback callback))&Pnacl_M19_PPB_AudioInput_Dev_EnumerateDevices, - .Open = (int32_t (*)(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, struct PP_CompletionCallback callback))&Pnacl_M19_PPB_AudioInput_Dev_Open, + .Open = (int32_t (*)(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback_0_2 audio_input_callback, void* user_data, struct PP_CompletionCallback callback))&Pnacl_M19_PPB_AudioInput_Dev_Open, .GetCurrentConfig = (PP_Resource (*)(PP_Resource audio_input))&Pnacl_M19_PPB_AudioInput_Dev_GetCurrentConfig, .StartCapture = (PP_Bool (*)(PP_Resource audio_input))&Pnacl_M19_PPB_AudioInput_Dev_StartCapture, .StopCapture = (PP_Bool (*)(PP_Resource audio_input))&Pnacl_M19_PPB_AudioInput_Dev_StopCapture, @@ -4227,13 +4191,25 @@ struct PPB_AudioInput_Dev_0_3 Pnacl_Wrappers_PPB_AudioInput_Dev_0_3 = { .IsAudioInput = (PP_Bool (*)(PP_Resource resource))&Pnacl_M25_PPB_AudioInput_Dev_IsAudioInput, .EnumerateDevices = (int32_t (*)(PP_Resource audio_input, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_AudioInput_Dev_EnumerateDevices, .MonitorDeviceChange = (int32_t (*)(PP_Resource audio_input, PP_MonitorDeviceChangeCallback callback, void* user_data))&Pnacl_M25_PPB_AudioInput_Dev_MonitorDeviceChange, - .Open = (int32_t (*)(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_AudioInput_Dev_Open, + .Open = (int32_t (*)(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback_0_2 audio_input_callback, void* user_data, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_AudioInput_Dev_Open, .GetCurrentConfig = (PP_Resource (*)(PP_Resource audio_input))&Pnacl_M25_PPB_AudioInput_Dev_GetCurrentConfig, .StartCapture = (PP_Bool (*)(PP_Resource audio_input))&Pnacl_M25_PPB_AudioInput_Dev_StartCapture, .StopCapture = (PP_Bool (*)(PP_Resource audio_input))&Pnacl_M25_PPB_AudioInput_Dev_StopCapture, .Close = (void (*)(PP_Resource audio_input))&Pnacl_M25_PPB_AudioInput_Dev_Close }; +struct PPB_AudioInput_Dev_0_4 Pnacl_Wrappers_PPB_AudioInput_Dev_0_4 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M29_PPB_AudioInput_Dev_Create, + .IsAudioInput = (PP_Bool (*)(PP_Resource resource))&Pnacl_M29_PPB_AudioInput_Dev_IsAudioInput, + .EnumerateDevices = (int32_t (*)(PP_Resource audio_input, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_AudioInput_Dev_EnumerateDevices, + .MonitorDeviceChange = (int32_t (*)(PP_Resource audio_input, PP_MonitorDeviceChangeCallback callback, void* user_data))&Pnacl_M29_PPB_AudioInput_Dev_MonitorDeviceChange, + .Open = (int32_t (*)(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_AudioInput_Dev_Open, + .GetCurrentConfig = (PP_Resource (*)(PP_Resource audio_input))&Pnacl_M29_PPB_AudioInput_Dev_GetCurrentConfig, + .StartCapture = (PP_Bool (*)(PP_Resource audio_input))&Pnacl_M29_PPB_AudioInput_Dev_StartCapture, + .StopCapture = (PP_Bool (*)(PP_Resource audio_input))&Pnacl_M29_PPB_AudioInput_Dev_StopCapture, + .Close = (void (*)(PP_Resource audio_input))&Pnacl_M29_PPB_AudioInput_Dev_Close +}; + /* Not generating wrapper interface for PPB_Buffer_Dev_0_4 */ /* Not generating wrapper interface for PPB_Crypto_Dev_0_1 */ @@ -4274,15 +4250,6 @@ struct PPB_Font_Dev_0_6 Pnacl_Wrappers_PPB_Font_Dev_0_6 = { /* Not generating wrapper interface for PPB_Graphics2D_Dev_0_1 */ -struct PPB_HostResolver_Dev_0_1 Pnacl_Wrappers_PPB_HostResolver_Dev_0_1 = { - .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M29_PPB_HostResolver_Dev_Create, - .IsHostResolver = (PP_Bool (*)(PP_Resource resource))&Pnacl_M29_PPB_HostResolver_Dev_IsHostResolver, - .Resolve = (int32_t (*)(PP_Resource host_resolver, const char* host, uint16_t port, const struct PP_HostResolver_Hint_Dev* hint, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_HostResolver_Dev_Resolve, - .GetCanonicalName = (struct PP_Var (*)(PP_Resource host_resolver))&Pnacl_M29_PPB_HostResolver_Dev_GetCanonicalName, - .GetNetAddressCount = (uint32_t (*)(PP_Resource host_resolver))&Pnacl_M29_PPB_HostResolver_Dev_GetNetAddressCount, - .GetNetAddress = (PP_Resource (*)(PP_Resource host_resolver, uint32_t index))&Pnacl_M29_PPB_HostResolver_Dev_GetNetAddress -}; - struct PPB_IMEInputEvent_Dev_0_1 Pnacl_Wrappers_PPB_IMEInputEvent_Dev_0_1 = { .IsIMEInputEvent = (PP_Bool (*)(PP_Resource resource))&Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent, .GetText = (struct PP_Var (*)(PP_Resource ime_event))&Pnacl_M16_PPB_IMEInputEvent_Dev_GetText, @@ -4306,16 +4273,6 @@ struct PPB_IMEInputEvent_Dev_0_2 Pnacl_Wrappers_PPB_IMEInputEvent_Dev_0_2 = { /* Not generating wrapper interface for PPB_Memory_Dev_0_1 */ -struct PPB_NetAddress_Dev_0_1 Pnacl_Wrappers_PPB_NetAddress_Dev_0_1 = { - .CreateFromIPv4Address = (PP_Resource (*)(PP_Instance instance, const struct PP_NetAddress_IPv4_Dev* ipv4_addr))&Pnacl_M29_PPB_NetAddress_Dev_CreateFromIPv4Address, - .CreateFromIPv6Address = (PP_Resource (*)(PP_Instance instance, const struct PP_NetAddress_IPv6_Dev* ipv6_addr))&Pnacl_M29_PPB_NetAddress_Dev_CreateFromIPv6Address, - .IsNetAddress = (PP_Bool (*)(PP_Resource addr))&Pnacl_M29_PPB_NetAddress_Dev_IsNetAddress, - .GetFamily = (PP_NetAddress_Family_Dev (*)(PP_Resource addr))&Pnacl_M29_PPB_NetAddress_Dev_GetFamily, - .DescribeAsString = (struct PP_Var (*)(PP_Resource addr, PP_Bool include_port))&Pnacl_M29_PPB_NetAddress_Dev_DescribeAsString, - .DescribeAsIPv4Address = (PP_Bool (*)(PP_Resource addr, struct PP_NetAddress_IPv4_Dev* ipv4_addr))&Pnacl_M29_PPB_NetAddress_Dev_DescribeAsIPv4Address, - .DescribeAsIPv6Address = (PP_Bool (*)(PP_Resource addr, struct PP_NetAddress_IPv6_Dev* ipv6_addr))&Pnacl_M29_PPB_NetAddress_Dev_DescribeAsIPv6Address -}; - struct PPB_Printing_Dev_0_7 Pnacl_Wrappers_PPB_Printing_Dev_0_7 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M23_PPB_Printing_Dev_Create, .GetDefaultPrintSettings = (int32_t (*)(PP_Resource resource, struct PP_PrintSettings_Dev* print_settings, struct PP_CompletionCallback callback))&Pnacl_M23_PPB_Printing_Dev_GetDefaultPrintSettings @@ -4325,18 +4282,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 */ @@ -4380,6 +4325,8 @@ struct PPB_Testing_Dev_0_92 Pnacl_Wrappers_PPB_Testing_Dev_0_92 = { /* Not generating wrapper interface for PPB_Trace_Event_Dev_0_1 */ +/* Not generating wrapper interface for PPB_Trace_Event_Dev_0_2 */ + struct PPB_TrueTypeFont_Dev_0_1 Pnacl_Wrappers_PPB_TrueTypeFont_Dev_0_1 = { .GetFontFamilies = (int32_t (*)(PP_Instance instance, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M26_PPB_TrueTypeFont_Dev_GetFontFamilies, .GetFontsInFamily = (int32_t (*)(PP_Instance instance, struct PP_Var family, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M26_PPB_TrueTypeFont_Dev_GetFontsInFamily, @@ -4390,17 +4337,6 @@ struct PPB_TrueTypeFont_Dev_0_1 Pnacl_Wrappers_PPB_TrueTypeFont_Dev_0_1 = { .GetTable = (int32_t (*)(PP_Resource font, uint32_t table, int32_t offset, int32_t max_data_length, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M26_PPB_TrueTypeFont_Dev_GetTable }; -struct PPB_UDPSocket_Dev_0_1 Pnacl_Wrappers_PPB_UDPSocket_Dev_0_1 = { - .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M29_PPB_UDPSocket_Dev_Create, - .IsUDPSocket = (PP_Bool (*)(PP_Resource resource))&Pnacl_M29_PPB_UDPSocket_Dev_IsUDPSocket, - .Bind = (int32_t (*)(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_UDPSocket_Dev_Bind, - .GetBoundAddress = (PP_Resource (*)(PP_Resource udp_socket))&Pnacl_M29_PPB_UDPSocket_Dev_GetBoundAddress, - .RecvFrom = (int32_t (*)(PP_Resource udp_socket, char* buffer, int32_t num_bytes, PP_Resource* addr, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_UDPSocket_Dev_RecvFrom, - .SendTo = (int32_t (*)(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_UDPSocket_Dev_SendTo, - .Close = (void (*)(PP_Resource udp_socket))&Pnacl_M29_PPB_UDPSocket_Dev_Close, - .SetOption = (int32_t (*)(PP_Resource udp_socket, PP_UDPSocket_Option_Dev name, struct PP_Var value, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_UDPSocket_Dev_SetOption -}; - struct PPB_URLUtil_Dev_0_6 Pnacl_Wrappers_PPB_URLUtil_Dev_0_6 = { .Canonicalize = (struct PP_Var (*)(struct PP_Var url, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_URLUtil_Dev_Canonicalize, .ResolveRelativeToURL = (struct PP_Var (*)(struct PP_Var base_url, struct PP_Var relative_string, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_URLUtil_Dev_ResolveRelativeToURL, @@ -4412,23 +4348,6 @@ struct PPB_URLUtil_Dev_0_6 Pnacl_Wrappers_PPB_URLUtil_Dev_0_6 = { .GetPluginInstanceURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_URLUtil_Dev_GetPluginInstanceURL }; -struct PPB_VarArray_Dev_0_1 Pnacl_Wrappers_PPB_VarArray_Dev_0_1 = { - .Create = (struct PP_Var (*)(void))&Pnacl_M27_PPB_VarArray_Dev_Create, - .Get = (struct PP_Var (*)(struct PP_Var array, uint32_t index))&Pnacl_M27_PPB_VarArray_Dev_Get, - .Set = (PP_Bool (*)(struct PP_Var array, uint32_t index, struct PP_Var value))&Pnacl_M27_PPB_VarArray_Dev_Set, - .GetLength = (uint32_t (*)(struct PP_Var array))&Pnacl_M27_PPB_VarArray_Dev_GetLength, - .SetLength = (PP_Bool (*)(struct PP_Var array, uint32_t length))&Pnacl_M27_PPB_VarArray_Dev_SetLength -}; - -struct PPB_VarDictionary_Dev_0_1 Pnacl_Wrappers_PPB_VarDictionary_Dev_0_1 = { - .Create = (struct PP_Var (*)(void))&Pnacl_M27_PPB_VarDictionary_Dev_Create, - .Get = (struct PP_Var (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M27_PPB_VarDictionary_Dev_Get, - .Set = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key, struct PP_Var value))&Pnacl_M27_PPB_VarDictionary_Dev_Set, - .Delete = (void (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M27_PPB_VarDictionary_Dev_Delete, - .HasKey = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M27_PPB_VarDictionary_Dev_HasKey, - .GetKeys = (struct PP_Var (*)(struct PP_Var dict))&Pnacl_M27_PPB_VarDictionary_Dev_GetKeys -}; - struct PPB_VideoCapture_Dev_0_2 Pnacl_Wrappers_PPB_VideoCapture_Dev_0_2 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_VideoCapture_Dev_Create, .IsVideoCapture = (PP_Bool (*)(PP_Resource video_capture))&Pnacl_M19_PPB_VideoCapture_Dev_IsVideoCapture, @@ -4652,7 +4571,22 @@ struct PPB_Instance_Private_0_1 Pnacl_Wrappers_PPB_Instance_Private_0_1 = { .ExecuteScript = (struct PP_Var (*)(PP_Instance instance, struct PP_Var script, struct PP_Var* exception))&Pnacl_M13_PPB_Instance_Private_ExecuteScript }; -/* Not generating wrapper interface for PPB_NaCl_Private_1_0 */ +struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = { + .LaunchSelLdr = (PP_NaClResult (*)(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, void* imc_handle))&Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr, + .StartPpapiProxy = (PP_NaClResult (*)(PP_Instance instance))&Pnacl_M13_PPB_NaCl_Private_StartPpapiProxy, + .UrandomFD = (int32_t (*)(void))&Pnacl_M13_PPB_NaCl_Private_UrandomFD, + .Are3DInterfacesDisabled = (PP_Bool (*)(void))&Pnacl_M13_PPB_NaCl_Private_Are3DInterfacesDisabled, + .EnableBackgroundSelLdrLaunch = (void (*)(void))&Pnacl_M13_PPB_NaCl_Private_EnableBackgroundSelLdrLaunch, + .BrokerDuplicateHandle = (int32_t (*)(PP_FileHandle source_handle, uint32_t process_id, PP_FileHandle* target_handle, uint32_t desired_access, uint32_t options))&Pnacl_M13_PPB_NaCl_Private_BrokerDuplicateHandle, + .GetReadonlyPnaclFd = (PP_FileHandle (*)(const char* filename))&Pnacl_M13_PPB_NaCl_Private_GetReadonlyPnaclFd, + .CreateTemporaryFile = (PP_FileHandle (*)(PP_Instance instance))&Pnacl_M13_PPB_NaCl_Private_CreateTemporaryFile, + .GetNexeFd = (int32_t (*)(PP_Instance instance, const char* cache_key, PP_Bool* is_hit, PP_FileHandle* nexe_handle, struct PP_CompletionCallback callback))&Pnacl_M13_PPB_NaCl_Private_GetNexeFd, + .ReportTranslationFinished = (void (*)(PP_Instance instance))&Pnacl_M13_PPB_NaCl_Private_ReportTranslationFinished, + .IsOffTheRecord = (PP_Bool (*)(void))&Pnacl_M13_PPB_NaCl_Private_IsOffTheRecord, + .IsPnaclEnabled = (PP_Bool (*)(void))&Pnacl_M13_PPB_NaCl_Private_IsPnaclEnabled, + .ReportNaClError = (PP_NaClResult (*)(PP_Instance instance, PP_NaClError message_id))&Pnacl_M13_PPB_NaCl_Private_ReportNaClError, + .OpenNaClExecutable = (PP_FileHandle (*)(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi))&Pnacl_M13_PPB_NaCl_Private_OpenNaClExecutable +}; struct PPB_NetAddress_Private_0_1 Pnacl_Wrappers_PPB_NetAddress_Private_0_1 = { .AreEqual = (PP_Bool (*)(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2))&Pnacl_M17_PPB_NetAddress_Private_AreEqual, @@ -4911,24 +4845,6 @@ struct PPB_Ext_Socket_Dev_0_2 Pnacl_Wrappers_PPB_Ext_Socket_Dev_0_2 = { .GetJoinedGroups = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var* groups, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_Ext_Socket_Dev_GetJoinedGroups }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Audio_1_0 = { - .iface_macro = PPB_AUDIO_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioConfig_1_0 = { - .iface_macro = PPB_AUDIO_CONFIG_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioConfig_1_1 = { - .iface_macro = PPB_AUDIO_CONFIG_INTERFACE_1_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Console_1_0 = { .iface_macro = PPB_CONSOLE_INTERFACE_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Console_1_0, @@ -4971,18 +4887,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileSystem_1_0 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Fullscreen_1_0 = { - .iface_macro = PPB_FULLSCREEN_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Gamepad_1_0 = { - .iface_macro = PPB_GAMEPAD_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_0 = { .iface_macro = PPB_GRAPHICS_2D_INTERFACE_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Graphics2D_1_0, @@ -5001,15 +4905,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics3D_1_0 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ImageData_1_0 = { - .iface_macro = PPB_IMAGEDATA_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_InputEvent_1_0 = { - .iface_macro = PPB_INPUT_EVENT_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_1_0 = { + .iface_macro = PPB_HOSTRESOLVER_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_HostResolver_1_0, .real_iface = NULL }; @@ -5043,12 +4941,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_1_0 = { - .iface_macro = PPB_INSTANCE_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MessageLoop_1_0 = { .iface_macro = PPB_MESSAGELOOP_INTERFACE_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_MessageLoop_1_0, @@ -5061,18 +4953,36 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Messaging_1_0 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseCursor_1_0 = { - .iface_macro = PPB_MOUSECURSOR_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseLock_1_0 = { .iface_macro = PPB_MOUSELOCK_INTERFACE_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_MouseLock_1_0, .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_1_0 = { + .iface_macro = PPB_NETADDRESS_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_NetAddress_1_0, + .real_iface = NULL +}; + +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetworkProxy_1_0 = { + .iface_macro = PPB_NETWORKPROXY_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_NetworkProxy_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_UDPSocket_1_0 = { + .iface_macro = PPB_UDPSOCKET_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_UDPSocket_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, @@ -5103,21 +5013,21 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Var_1_1 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0 = { - .iface_macro = PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarArrayBuffer_1_0, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_1_0 = { + .iface_macro = PPB_VAR_ARRAY_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarArray_1_0, .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_0 = { - .iface_macro = PPB_VIEW_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0 = { + .iface_macro = PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarArrayBuffer_1_0, .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_1 = { - .iface_macro = PPB_VIEW_INTERFACE_1_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_1_0 = { + .iface_macro = PPB_VAR_DICTIONARY_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarDictionary_1_0, .real_iface = NULL }; @@ -5127,90 +5037,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Graphics3D_1_0 = { - .iface_macro = PPP_GRAPHICS_3D_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_InputEvent_0_1 = { - .iface_macro = PPP_INPUT_EVENT_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Instance_1_0 = { - .iface_macro = PPP_INSTANCE_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Instance_1_1 = { - .iface_macro = PPP_INSTANCE_INTERFACE_1_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Messaging_1_0 = { .iface_macro = PPP_MESSAGING_INTERFACE_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPP_Messaging_1_0, .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_MouseLock_1_0 = { - .iface_macro = PPP_MOUSELOCK_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2 = { - .iface_macro = PPB_BROKER_TRUSTED_INTERFACE_0_2, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_BrokerTrusted_0_2, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3 = { - .iface_macro = PPB_BROKER_TRUSTED_INTERFACE_0_3, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_BrokerTrusted_0_3, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0 = { - .iface_macro = PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_BrowserFont_Trusted_1_0, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_CharSet_Trusted_1_0 = { - .iface_macro = PPB_CHARSET_TRUSTED_INTERFACE_1_0, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_CharSet_Trusted_1_0, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_5 = { - .iface_macro = PPB_FILECHOOSER_TRUSTED_INTERFACE_0_5, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileChooserTrusted_0_5, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_6 = { - .iface_macro = PPB_FILECHOOSER_TRUSTED_INTERFACE_0_6, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileChooserTrusted_0_6, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4 = { - .iface_macro = PPB_FILEIOTRUSTED_INTERFACE_0_4, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileIOTrusted_0_4, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLLoaderTrusted_0_3 = { - .iface_macro = PPB_URLLOADERTRUSTED_INTERFACE_0_3, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2 = { .iface_macro = PPB_AUDIO_INPUT_DEV_INTERFACE_0_2, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_AudioInput_Dev_0_2, @@ -5223,21 +5055,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Buffer_Dev_0_4 = { - .iface_macro = PPB_BUFFER_DEV_INTERFACE_0_4, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Crypto_Dev_0_1 = { - .iface_macro = PPB_CRYPTO_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_CursorControl_Dev_0_4 = { - .iface_macro = PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4, - .wrapped_iface = NULL /* Still need slot for real_iface */, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4 = { + .iface_macro = PPB_AUDIO_INPUT_DEV_INTERFACE_0_4, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_AudioInput_Dev_0_4, .real_iface = NULL }; @@ -5259,30 +5079,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Find_Dev_0_3 = { - .iface_macro = PPB_FIND_DEV_INTERFACE_0_3, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Font_Dev_0_6 = { .iface_macro = PPB_FONT_DEV_INTERFACE_0_6, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Font_Dev_0_6, .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_Dev_0_1 = { - .iface_macro = PPB_GRAPHICS2D_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_Dev_0_1 = { - .iface_macro = PPB_HOSTRESOLVER_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_HostResolver_Dev_0_1, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1 = { .iface_macro = PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_IMEInputEvent_Dev_0_1, @@ -5295,60 +5097,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_1 = { - .iface_macro = PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Memory_Dev_0_1 = { - .iface_macro = PPB_MEMORY_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1 = { - .iface_macro = PPB_NETADDRESS_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_NetAddress_Dev_0_1, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_7 = { .iface_macro = PPB_PRINTING_DEV_INTERFACE_0_7, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Printing_Dev_0_7, .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ResourceArray_Dev_0_1 = { - .iface_macro = PPB_RESOURCEARRAY_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Scrollbar_Dev_0_5 = { - .iface_macro = PPB_SCROLLBAR_DEV_INTERFACE_0_5, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .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_7 = { - .iface_macro = PPB_TESTING_DEV_INTERFACE_0_7, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_8 = { - .iface_macro = PPB_TESTING_DEV_INTERFACE_0_8, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .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, @@ -5367,54 +5121,18 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_92 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TextInput_Dev_0_1 = { - .iface_macro = PPB_TEXTINPUT_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TextInput_Dev_0_2 = { - .iface_macro = PPB_TEXTINPUT_DEV_INTERFACE_0_2, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Trace_Event_Dev_0_1 = { - .iface_macro = PPB_TRACE_EVENT_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1 = { .iface_macro = PPB_TRUETYPEFONT_DEV_INTERFACE_0_1, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_TrueTypeFont_Dev_0_1, .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1 = { - .iface_macro = PPB_UDPSOCKET_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_UDPSocket_Dev_0_1, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6 = { .iface_macro = PPB_URLUTIL_DEV_INTERFACE_0_6, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_URLUtil_Dev_0_6, .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1 = { - .iface_macro = PPB_VAR_ARRAY_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarArray_Dev_0_1, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1 = { - .iface_macro = PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarDictionary_Dev_0_1, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2 = { .iface_macro = PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoCapture_Dev_0_2, @@ -5433,102 +5151,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_Dev_0_1 = { - .iface_macro = PPB_VIEW_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Widget_Dev_0_3 = { - .iface_macro = PPB_WIDGET_DEV_INTERFACE_0_3, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Widget_Dev_0_4 = { - .iface_macro = PPB_WIDGET_DEV_INTERFACE_0_4, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Zoom_Dev_0_2 = { - .iface_macro = PPB_ZOOM_DEV_INTERFACE_0_2, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_NetworkState_Dev_0_1 = { - .iface_macro = PPP_NETWORK_STATE_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Printing_Dev_0_6 = { - .iface_macro = PPP_PRINTING_DEV_INTERFACE_0_6, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_2 = { - .iface_macro = PPP_SCROLLBAR_DEV_INTERFACE_0_2, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_3 = { - .iface_macro = PPP_SCROLLBAR_DEV_INTERFACE_0_3, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Selection_Dev_0_3 = { .iface_macro = PPP_SELECTION_DEV_INTERFACE_0_3, .wrapped_iface = (void *) &Pnacl_Wrappers_PPP_Selection_Dev_0_3, .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_TextInput_Dev_0_1 = { - .iface_macro = PPP_TEXTINPUT_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoCapture_Dev_0_1 = { - .iface_macro = PPP_VIDEO_CAPTURE_DEV_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_9 = { - .iface_macro = PPP_VIDEODECODER_DEV_INTERFACE_0_9, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_10 = { - .iface_macro = PPP_VIDEODECODER_DEV_INTERFACE_0_10, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_11 = { - .iface_macro = PPP_VIDEODECODER_DEV_INTERFACE_0_11, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Widget_Dev_0_2 = { - .iface_macro = PPP_WIDGET_DEV_INTERFACE_0_2, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Zoom_Dev_0_3 = { - .iface_macro = PPP_ZOOM_DEV_INTERFACE_0_3, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6 = { .iface_macro = PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_6, @@ -5601,48 +5229,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DRM_1_0 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_FontFile_0_1 = { - .iface_macro = PPB_FLASH_FONTFILE_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_0_1 = { - .iface_macro = PPB_FLASHFULLSCREEN_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_1_0 = { - .iface_macro = PPB_FLASHFULLSCREEN_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Menu_0_2 = { .iface_macro = PPB_FLASH_MENU_INTERFACE_0_2, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_Menu_0_2, .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_MessageLoop_0_1 = { - .iface_macro = PPB_FLASH_MESSAGELOOP_INTERFACE_0_1, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Print_1_0 = { - .iface_macro = PPB_FLASH_PRINT_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_GpuBlacklist_Private_0_2 = { - .iface_macro = PPB_GPUBLACKLIST_PRIVATE_INTERFACE_0_2, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1 = { .iface_macro = PPB_HOSTRESOLVER_PRIVATE_INTERFACE_0_1, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_HostResolver_Private_0_1, @@ -5657,7 +5249,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_Private_0_1 = { static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NaCl_Private_1_0 = { .iface_macro = PPB_NACL_PRIVATE_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_NaCl_Private_1_0, .real_iface = NULL }; @@ -5685,12 +5277,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2 = .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetworkMonitor_Private_0_2 = { - .iface_macro = PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Talk_Private_1_0 = { .iface_macro = PPB_TALK_PRIVATE_INTERFACE_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Talk_Private_1_0, @@ -5781,24 +5367,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_ .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_0 = { - .iface_macro = PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_2 = { - .iface_macro = PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_2, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_3 = { - .iface_macro = PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_3, - .wrapped_iface = NULL /* Still need slot for real_iface */, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Instance_Private_0_1 = { .iface_macro = PPP_INSTANCE_PRIVATE_INTERFACE_0_1, .wrapped_iface = (void *) &Pnacl_Wrappers_PPP_Instance_Private_0_1, @@ -5830,9 +5398,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_2 = { }; static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { - &Pnacl_WrapperInfo_PPB_Audio_1_0, - &Pnacl_WrapperInfo_PPB_AudioConfig_1_0, - &Pnacl_WrapperInfo_PPB_AudioConfig_1_1, &Pnacl_WrapperInfo_PPB_Console_1_0, &Pnacl_WrapperInfo_PPB_Core_1_0, &Pnacl_WrapperInfo_PPB_FileIO_1_0, @@ -5840,81 +5405,49 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_FileRef_1_0, &Pnacl_WrapperInfo_PPB_FileRef_1_1, &Pnacl_WrapperInfo_PPB_FileSystem_1_0, - &Pnacl_WrapperInfo_PPB_Fullscreen_1_0, - &Pnacl_WrapperInfo_PPB_Gamepad_1_0, &Pnacl_WrapperInfo_PPB_Graphics2D_1_0, &Pnacl_WrapperInfo_PPB_Graphics2D_1_1, &Pnacl_WrapperInfo_PPB_Graphics3D_1_0, - &Pnacl_WrapperInfo_PPB_ImageData_1_0, - &Pnacl_WrapperInfo_PPB_InputEvent_1_0, + &Pnacl_WrapperInfo_PPB_HostResolver_1_0, &Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0, &Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1, &Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0, &Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0, &Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0, - &Pnacl_WrapperInfo_PPB_Instance_1_0, &Pnacl_WrapperInfo_PPB_MessageLoop_1_0, &Pnacl_WrapperInfo_PPB_Messaging_1_0, - &Pnacl_WrapperInfo_PPB_MouseCursor_1_0, &Pnacl_WrapperInfo_PPB_MouseLock_1_0, + &Pnacl_WrapperInfo_PPB_NetAddress_1_0, + &Pnacl_WrapperInfo_PPB_NetworkProxy_1_0, + &Pnacl_WrapperInfo_PPB_TCPSocket_1_0, + &Pnacl_WrapperInfo_PPB_UDPSocket_1_0, &Pnacl_WrapperInfo_PPB_URLLoader_1_0, &Pnacl_WrapperInfo_PPB_URLRequestInfo_1_0, &Pnacl_WrapperInfo_PPB_URLResponseInfo_1_0, &Pnacl_WrapperInfo_PPB_Var_1_0, &Pnacl_WrapperInfo_PPB_Var_1_1, + &Pnacl_WrapperInfo_PPB_VarArray_1_0, &Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0, - &Pnacl_WrapperInfo_PPB_View_1_0, - &Pnacl_WrapperInfo_PPB_View_1_1, + &Pnacl_WrapperInfo_PPB_VarDictionary_1_0, &Pnacl_WrapperInfo_PPB_WebSocket_1_0, - &Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2, - &Pnacl_WrapperInfo_PPB_BrokerTrusted_0_3, - &Pnacl_WrapperInfo_PPB_BrowserFont_Trusted_1_0, - &Pnacl_WrapperInfo_PPB_CharSet_Trusted_1_0, - &Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_5, - &Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_6, - &Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4, - &Pnacl_WrapperInfo_PPB_URLLoaderTrusted_0_3, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3, - &Pnacl_WrapperInfo_PPB_Buffer_Dev_0_4, - &Pnacl_WrapperInfo_PPB_Crypto_Dev_0_1, - &Pnacl_WrapperInfo_PPB_CursorControl_Dev_0_4, + &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4, &Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1, &Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5, &Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6, - &Pnacl_WrapperInfo_PPB_Find_Dev_0_3, &Pnacl_WrapperInfo_PPB_Font_Dev_0_6, - &Pnacl_WrapperInfo_PPB_Graphics2D_Dev_0_1, - &Pnacl_WrapperInfo_PPB_HostResolver_Dev_0_1, &Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1, &Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2, - &Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_1, - &Pnacl_WrapperInfo_PPB_Memory_Dev_0_1, - &Pnacl_WrapperInfo_PPB_NetAddress_Dev_0_1, &Pnacl_WrapperInfo_PPB_Printing_Dev_0_7, - &Pnacl_WrapperInfo_PPB_ResourceArray_Dev_0_1, - &Pnacl_WrapperInfo_PPB_Scrollbar_Dev_0_5, - &Pnacl_WrapperInfo_PPB_TCPSocket_Dev_0_1, - &Pnacl_WrapperInfo_PPB_Testing_Dev_0_7, - &Pnacl_WrapperInfo_PPB_Testing_Dev_0_8, &Pnacl_WrapperInfo_PPB_Testing_Dev_0_9, &Pnacl_WrapperInfo_PPB_Testing_Dev_0_91, &Pnacl_WrapperInfo_PPB_Testing_Dev_0_92, - &Pnacl_WrapperInfo_PPB_TextInput_Dev_0_1, - &Pnacl_WrapperInfo_PPB_TextInput_Dev_0_2, - &Pnacl_WrapperInfo_PPB_Trace_Event_Dev_0_1, &Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1, - &Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1, &Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6, - &Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1, - &Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1, &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2, &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3, &Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16, - &Pnacl_WrapperInfo_PPB_View_Dev_0_1, - &Pnacl_WrapperInfo_PPB_Widget_Dev_0_3, - &Pnacl_WrapperInfo_PPB_Widget_Dev_0_4, - &Pnacl_WrapperInfo_PPB_Zoom_Dev_0_2, &Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6, &Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1, &Pnacl_WrapperInfo_PPB_FileIO_Private_0_1, @@ -5927,13 +5460,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0, &Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0, &Pnacl_WrapperInfo_PPB_Flash_DRM_1_0, - &Pnacl_WrapperInfo_PPB_Flash_FontFile_0_1, - &Pnacl_WrapperInfo_PPB_FlashFullscreen_0_1, - &Pnacl_WrapperInfo_PPB_FlashFullscreen_1_0, &Pnacl_WrapperInfo_PPB_Flash_Menu_0_2, - &Pnacl_WrapperInfo_PPB_Flash_MessageLoop_0_1, - &Pnacl_WrapperInfo_PPB_Flash_Print_1_0, - &Pnacl_WrapperInfo_PPB_GpuBlacklist_Private_0_2, &Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1, &Pnacl_WrapperInfo_PPB_Instance_Private_0_1, &Pnacl_WrapperInfo_PPB_NaCl_Private_1_0, @@ -5941,7 +5468,6 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0, &Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1, &Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2, - &Pnacl_WrapperInfo_PPB_NetworkMonitor_Private_0_2, &Pnacl_WrapperInfo_PPB_Talk_Private_1_0, &Pnacl_WrapperInfo_PPB_Talk_Private_2_0, &Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1, @@ -5964,28 +5490,9 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { }; static struct __PnaclWrapperInfo *s_ppp_wrappers[] = { - &Pnacl_WrapperInfo_PPP_Graphics3D_1_0, - &Pnacl_WrapperInfo_PPP_InputEvent_0_1, - &Pnacl_WrapperInfo_PPP_Instance_1_0, - &Pnacl_WrapperInfo_PPP_Instance_1_1, &Pnacl_WrapperInfo_PPP_Messaging_1_0, - &Pnacl_WrapperInfo_PPP_MouseLock_1_0, - &Pnacl_WrapperInfo_PPP_NetworkState_Dev_0_1, - &Pnacl_WrapperInfo_PPP_Printing_Dev_0_6, - &Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_2, - &Pnacl_WrapperInfo_PPP_Scrollbar_Dev_0_3, &Pnacl_WrapperInfo_PPP_Selection_Dev_0_3, - &Pnacl_WrapperInfo_PPP_TextInput_Dev_0_1, - &Pnacl_WrapperInfo_PPP_VideoCapture_Dev_0_1, - &Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_9, - &Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_10, - &Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_11, - &Pnacl_WrapperInfo_PPP_Widget_Dev_0_2, - &Pnacl_WrapperInfo_PPP_Zoom_Dev_0_3, &Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6, - &Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_0, - &Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_2, - &Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_3, &Pnacl_WrapperInfo_PPP_Instance_Private_0_1, NULL }; @@ -6028,7 +5535,7 @@ static struct __PnaclWrapperInfo *PnaclPPPShimIface( const void *__Pnacl_PPBGetInterface(const char *name) { struct __PnaclWrapperInfo *wrapper = PnaclPPBShimIface(name); if (wrapper == NULL) { - /* We don't have an IDL for this, for some reason. Take our chances. */ + /* We did not generate a wrapper for this, so return the real interface. */ return (*__real_PPBGetInterface)(name); } @@ -6049,7 +5556,7 @@ const void *__Pnacl_PPBGetInterface(const char *name) { const void *__Pnacl_PPPGetInterface(const char *name) { struct __PnaclWrapperInfo *wrapper = PnaclPPPShimIface(name); if (wrapper == NULL) { - /* We don't have an IDL for this, for some reason. Take our chances. */ + /* We did not generate a wrapper for this, so return the real interface. */ return (*__real_PPPGetInterface)(name); } diff --git a/ppapi/native_client/tests/breakpad_crash_test/nacl.scons b/ppapi/native_client/tests/breakpad_crash_test/nacl.scons index 00360b6ea7..4089c06ba1 100644 --- a/ppapi/native_client/tests/breakpad_crash_test/nacl.scons +++ b/ppapi/native_client/tests/breakpad_crash_test/nacl.scons @@ -83,8 +83,11 @@ node = env.PPAPIBrowserTester( args=platform_args + ['--expected_crash_dumps=%i' % expected_crash_dumps]) env.AddNodeToTestSuite( node, ['chrome_browser_tests'], 'run_breakpad_crash_in_syscall_test', + # This test is currently flaky on Win 32 bit on x86, disabling there. + # See bug: https://code.google.com/p/chromium/issues/detail?id=254583 is_broken=env.PPAPIBrowserTesterIsBroken() or - env.Bit('running_on_valgrind')) + env.Bit('running_on_valgrind') or + (env.Bit('host_windows') and env.Bit('build_x86_32'))) # Crashes in untrusted code should not produce crash dumps. node = env.PPAPIBrowserTester( diff --git a/ppapi/native_client/tools/browser_tester/browser_tester.py b/ppapi/native_client/tools/browser_tester/browser_tester.py index 061a13817c..2bf3614f7e 100755 --- a/ppapi/native_client/tools/browser_tester/browser_tester.py +++ b/ppapi/native_client/tools/browser_tester/browser_tester.py @@ -16,6 +16,7 @@ import urllib script_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(script_dir, '../../../../third_party/')) sys.path.append(os.path.join(script_dir, '../../../../tools/valgrind/')) +sys.path.append(os.path.join(script_dir, '../../../../testing/')) import browsertester.browserlauncher import browsertester.rpclistener @@ -24,6 +25,8 @@ import browsertester.server import memcheck_analyze import tsan_analyze +import test_env + def BuildArgParser(): usage = 'usage: %prog [options]' parser = optparse.OptionParser(usage) @@ -197,6 +200,9 @@ def RunTestsOnce(url, options): options.files.append(os.path.join(script_dir, 'browserdata', 'nacltest.js')) + # Setup the environment with the setuid sandbox path. + test_env.enable_sandbox_if_required(os.environ) + # Create server host = GetHostName() try: diff --git a/ppapi/ppapi_c.target.darwin-arm.mk b/ppapi/ppapi_c.target.darwin-arm.mk index 66aec57844..2824b5158a 100644 --- a/ppapi/ppapi_c.target.darwin-arm.mk +++ b/ppapi/ppapi_c.target.darwin-arm.mk @@ -26,7 +26,7 @@ LOCAL_SRC_FILES := # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -Werror \ @@ -58,9 +58,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DUSE_LINUX_BREAKPAD' \ @@ -84,18 +82,94 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -Werror \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -105,6 +179,10 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. # Add target alias to "gyp_all_modules" target. .PHONY: gyp_all_modules diff --git a/ppapi/ppapi_c.target.darwin-mips.mk b/ppapi/ppapi_c.target.darwin-mips.mk index 6770397602..781f6bf393 100644 --- a/ppapi/ppapi_c.target.darwin-mips.mk +++ b/ppapi/ppapi_c.target.darwin-mips.mk @@ -26,7 +26,7 @@ LOCAL_SRC_FILES := # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -57,9 +57,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ @@ -82,18 +80,92 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -103,6 +175,10 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. # Add target alias to "gyp_all_modules" target. .PHONY: gyp_all_modules diff --git a/ppapi/ppapi_c.target.darwin-x86.mk b/ppapi/ppapi_c.target.darwin-x86.mk index 0cd95e0bdb..b751596dce 100644 --- a/ppapi/ppapi_c.target.darwin-x86.mk +++ b/ppapi/ppapi_c.target.darwin-x86.mk @@ -26,7 +26,7 @@ LOCAL_SRC_FILES := # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -Werror \ -fno-exceptions \ @@ -60,9 +60,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DUSE_LINUX_BREAKPAD' \ @@ -86,18 +84,97 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -Werror \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -106,6 +183,10 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. # Add target alias to "gyp_all_modules" target. .PHONY: gyp_all_modules diff --git a/ppapi/ppapi_c.target.linux-arm.mk b/ppapi/ppapi_c.target.linux-arm.mk index 66aec57844..2824b5158a 100644 --- a/ppapi/ppapi_c.target.linux-arm.mk +++ b/ppapi/ppapi_c.target.linux-arm.mk @@ -26,7 +26,7 @@ LOCAL_SRC_FILES := # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -Werror \ @@ -58,9 +58,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DUSE_LINUX_BREAKPAD' \ @@ -84,18 +82,94 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -Werror \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -105,6 +179,10 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. # Add target alias to "gyp_all_modules" target. .PHONY: gyp_all_modules diff --git a/ppapi/ppapi_c.target.linux-mips.mk b/ppapi/ppapi_c.target.linux-mips.mk index 6770397602..781f6bf393 100644 --- a/ppapi/ppapi_c.target.linux-mips.mk +++ b/ppapi/ppapi_c.target.linux-mips.mk @@ -26,7 +26,7 @@ LOCAL_SRC_FILES := # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -57,9 +57,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ @@ -82,18 +80,92 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -103,6 +175,10 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. # Add target alias to "gyp_all_modules" target. .PHONY: gyp_all_modules diff --git a/ppapi/ppapi_c.target.linux-x86.mk b/ppapi/ppapi_c.target.linux-x86.mk index 0cd95e0bdb..b751596dce 100644 --- a/ppapi/ppapi_c.target.linux-x86.mk +++ b/ppapi/ppapi_c.target.linux-x86.mk @@ -26,7 +26,7 @@ LOCAL_SRC_FILES := # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -Werror \ -fno-exceptions \ @@ -60,9 +60,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DUSE_LINUX_BREAKPAD' \ @@ -86,18 +84,97 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -Werror \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -106,6 +183,10 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. # Add target alias to "gyp_all_modules" target. .PHONY: gyp_all_modules diff --git a/ppapi/ppapi_gl.gypi b/ppapi/ppapi_gl.gypi index 6830e721d8..cdbc40bad3 100644 --- a/ppapi/ppapi_gl.gypi +++ b/ppapi/ppapi_gl.gypi @@ -3,51 +3,8 @@ # found in the LICENSE file. { - 'includes': [ - '../third_party/mesa/mesa.gypi', - ], 'targets': [ { - 'target_name': 'ppapi_egl', - 'type': 'static_library', - 'dependencies': [ - '<(DEPTH)/ppapi/ppapi.gyp:ppapi_c', - ], - 'include_dirs': [ - 'lib/gl/include', - ], - 'defines': [ - # Do not export internal Mesa funcations. Exporting them is not - # required because we are compiling both - API dispatcher and driver - # into a single library. - 'PUBLIC=', - # Define a new PPAPI platform. - '_EGL_PLATFORM_PPAPI=_EGL_NUM_PLATFORMS', - '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_PPAPI', - ], - 'conditions': [ - ['OS=="win"', { - 'defines': [ - '_EGL_OS_WINDOWS', - ], - }], - ['OS=="mac"', { - 'suppress_wildcard': 1, - 'xcode_settings': { - # Suppress warnings in third party mesa_egl code. - 'WARNING_CFLAGS': ['-Wno-sign-compare'] - } - }], - ], - 'sources': [ - # Mesa EGL API dispatcher sources. - '<@(mesa_egl_sources)', - # PPAPI EGL driver sources. - 'lib/gl/egl/egldriver.c', - 'lib/gl/egl/egldriver_ppapi.c', - ], - }, - { 'target_name': 'ppapi_gles2', 'type': 'static_library', 'dependencies': [ diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi index 88a2861c65..50bb01e041 100644 --- a/ppapi/ppapi_proxy.gypi +++ b/ppapi/ppapi_proxy.gypi @@ -41,6 +41,8 @@ 'proxy/ext_crx_file_system_private_resource.h', 'proxy/file_chooser_resource.cc', 'proxy/file_chooser_resource.h', + 'proxy/file_ref_resource.cc', + 'proxy/file_ref_resource.h', 'proxy/flash_clipboard_resource.cc', 'proxy/flash_clipboard_resource.h', 'proxy/flash_drm_resource.cc', @@ -80,6 +82,8 @@ 'proxy/locking_resource_releaser.h', 'proxy/net_address_resource.cc', 'proxy/net_address_resource.h', + 'proxy/network_proxy_resource.cc', + 'proxy/network_proxy_resource.h', 'proxy/pdf_resource.cc', 'proxy/pdf_resource.h', 'proxy/plugin_array_buffer_var.cc', @@ -240,8 +244,6 @@ 'proxy/serialized_flash_menu.cc', 'proxy/talk_resource.cc', 'proxy/video_capture_resource.cc', - 'proxy/video_destination_resource.cc', - 'proxy/video_source_resource.cc', ], }], ], diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index 7a26be882f..b5d75d218f 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -97,6 +97,8 @@ 'shared_impl/scoped_pp_resource.h', 'shared_impl/scoped_pp_var.cc', 'shared_impl/scoped_pp_var.h', + 'shared_impl/socket_option_data.cc', + 'shared_impl/socket_option_data.h', 'shared_impl/tcp_socket_shared.cc', 'shared_impl/tcp_socket_shared.h', 'shared_impl/thread_aware_callback.cc', @@ -194,7 +196,7 @@ 'thunk/ppb_graphics_3d_api.h', 'thunk/ppb_graphics_3d_thunk.cc', 'thunk/ppb_host_resolver_api.h', - 'thunk/ppb_host_resolver_dev_thunk.cc', + 'thunk/ppb_host_resolver_thunk.cc', 'thunk/ppb_host_resolver_private_api.h', 'thunk/ppb_host_resolver_private_thunk.cc', 'thunk/ppb_image_data_api.h', @@ -209,11 +211,13 @@ 'thunk/ppb_mouse_cursor_thunk.cc', 'thunk/ppb_mouse_lock_thunk.cc', 'thunk/ppb_net_address_api.h', - 'thunk/ppb_net_address_dev_thunk.cc', + 'thunk/ppb_net_address_thunk.cc', 'thunk/ppb_network_list_api.h', 'thunk/ppb_network_list_private_thunk.cc', 'thunk/ppb_network_monitor_private_api.h', 'thunk/ppb_network_monitor_private_thunk.cc', + 'thunk/ppb_network_proxy_api.h', + 'thunk/ppb_network_proxy_thunk.cc', 'thunk/ppb_pdf_api.h', 'thunk/ppb_pdf_thunk.cc', 'thunk/ppb_printing_api.h', @@ -227,15 +231,15 @@ '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', 'thunk/ppb_truetype_font_dev_thunk.cc', 'thunk/ppb_udp_socket_api.h', - 'thunk/ppb_udp_socket_dev_thunk.cc', + 'thunk/ppb_udp_socket_thunk.cc', 'thunk/ppb_udp_socket_private_api.h', 'thunk/ppb_udp_socket_private_thunk.cc', 'thunk/ppb_url_loader_api.h', @@ -310,8 +314,6 @@ 'thunk/ppb_url_util_thunk.cc', 'thunk/ppb_video_capture_thunk.cc', 'thunk/ppb_video_decoder_thunk.cc', - 'thunk/ppb_video_destination_private_thunk.cc', - 'thunk/ppb_video_source_private_thunk.cc', ], }], # We exclude a few more things for nacl_win64, to avoid pulling in diff --git a/ppapi/ppapi_shared.target.darwin-arm.mk b/ppapi/ppapi_shared.target.darwin-arm.mk index c3bf541ffb..90406f3f65 100644 --- a/ppapi/ppapi_shared.target.darwin-arm.mk +++ b/ppapi/ppapi_shared.target.darwin-arm.mk @@ -70,6 +70,7 @@ LOCAL_SRC_FILES := \ ppapi/shared_impl/resource_tracker.cc \ ppapi/shared_impl/scoped_pp_resource.cc \ ppapi/shared_impl/scoped_pp_var.cc \ + ppapi/shared_impl/socket_option_data.cc \ ppapi/shared_impl/tcp_socket_shared.cc \ ppapi/shared_impl/thread_aware_callback.cc \ ppapi/shared_impl/time_conversion.cc \ @@ -125,7 +126,7 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_graphics_2d_dev_thunk.cc \ ppapi/thunk/ppb_graphics_2d_thunk.cc \ ppapi/thunk/ppb_graphics_3d_thunk.cc \ - ppapi/thunk/ppb_host_resolver_dev_thunk.cc \ + ppapi/thunk/ppb_host_resolver_thunk.cc \ ppapi/thunk/ppb_host_resolver_private_thunk.cc \ ppapi/thunk/ppb_image_data_thunk.cc \ ppapi/thunk/ppb_input_event_thunk.cc \ @@ -134,20 +135,21 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_messaging_thunk.cc \ ppapi/thunk/ppb_mouse_cursor_thunk.cc \ ppapi/thunk/ppb_mouse_lock_thunk.cc \ - ppapi/thunk/ppb_net_address_dev_thunk.cc \ + ppapi/thunk/ppb_net_address_thunk.cc \ ppapi/thunk/ppb_network_list_private_thunk.cc \ ppapi/thunk/ppb_network_monitor_private_thunk.cc \ + ppapi/thunk/ppb_network_proxy_thunk.cc \ ppapi/thunk/ppb_pdf_thunk.cc \ ppapi/thunk/ppb_printing_dev_thunk.cc \ ppapi/thunk/ppb_resource_array_dev_thunk.cc \ ppapi/thunk/ppb_scrollbar_thunk.cc \ ppapi/thunk/ppb_talk_private_thunk.cc \ ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc \ - ppapi/thunk/ppb_tcp_socket_dev_thunk.cc \ ppapi/thunk/ppb_tcp_socket_private_thunk.cc \ + ppapi/thunk/ppb_tcp_socket_thunk.cc \ ppapi/thunk/ppb_text_input_thunk.cc \ ppapi/thunk/ppb_truetype_font_dev_thunk.cc \ - ppapi/thunk/ppb_udp_socket_dev_thunk.cc \ + ppapi/thunk/ppb_udp_socket_thunk.cc \ ppapi/thunk/ppb_udp_socket_private_thunk.cc \ ppapi/thunk/ppb_url_loader_thunk.cc \ ppapi/thunk/ppb_url_loader_trusted_thunk.cc \ @@ -169,7 +171,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -Werror \ @@ -201,9 +203,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DUSE_LINUX_BREAKPAD' \ @@ -237,10 +237,123 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ + $(LOCAL_PATH)/third_party/khronos \ + $(LOCAL_PATH)/gpu \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/skia/config \ + $(LOCAL_PATH)/third_party/skia/src/core \ + $(LOCAL_PATH)/third_party/skia/include/config \ + $(LOCAL_PATH)/third_party/skia/include/core \ + $(LOCAL_PATH)/third_party/skia/include/effects \ + $(LOCAL_PATH)/third_party/skia/include/pdf \ + $(LOCAL_PATH)/third_party/skia/include/gpu \ + $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ + $(LOCAL_PATH)/third_party/skia/include/pathops \ + $(LOCAL_PATH)/third_party/skia/include/pipe \ + $(LOCAL_PATH)/third_party/skia/include/ports \ + $(LOCAL_PATH)/third_party/skia/include/utils \ + $(LOCAL_PATH)/skia/ext \ + $(LOCAL_PATH)/third_party/WebKit \ + $(LOCAL_PATH)/third_party/npapi \ + $(LOCAL_PATH)/third_party/npapi/bindings \ + $(LOCAL_PATH)/v8/include \ + $(PWD)/external/icu4c/common \ + $(PWD)/external/icu4c/i18n \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -Werror \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DSK_BUILD_NO_IMAGE_ENCODE' \ + '-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \ + '-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \ + '-DGR_AGGRESSIVE_SHADER_OPTS=1' \ + '-DSK_ENABLE_INST_COUNT=0' \ + '-DSK_USE_POSIX_THREADS' \ + '-DSK_BUILD_FOR_ANDROID' \ + '-DU_USING_ICU_NAMESPACE=0' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DPPAPI_SHARED_IMPLEMENTATION' \ + '-DPPAPI_THUNK_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ @@ -255,6 +368,7 @@ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/third_party/skia/include/pdf \ $(LOCAL_PATH)/third_party/skia/include/gpu \ $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ $(LOCAL_PATH)/third_party/skia/include/pathops \ $(LOCAL_PATH)/third_party/skia/include/pipe \ $(LOCAL_PATH)/third_party/skia/include/ports \ @@ -270,10 +384,9 @@ LOCAL_C_INCLUDES := \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -283,9 +396,13 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -302,6 +419,25 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -Wl,-z,relro \ + -Wl,-z,now \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,--icf=safe \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := \ skia_skia_gyp diff --git a/ppapi/ppapi_shared.target.darwin-mips.mk b/ppapi/ppapi_shared.target.darwin-mips.mk index 002995791b..eda0c4d2f8 100644 --- a/ppapi/ppapi_shared.target.darwin-mips.mk +++ b/ppapi/ppapi_shared.target.darwin-mips.mk @@ -70,6 +70,7 @@ LOCAL_SRC_FILES := \ ppapi/shared_impl/resource_tracker.cc \ ppapi/shared_impl/scoped_pp_resource.cc \ ppapi/shared_impl/scoped_pp_var.cc \ + ppapi/shared_impl/socket_option_data.cc \ ppapi/shared_impl/tcp_socket_shared.cc \ ppapi/shared_impl/thread_aware_callback.cc \ ppapi/shared_impl/time_conversion.cc \ @@ -125,7 +126,7 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_graphics_2d_dev_thunk.cc \ ppapi/thunk/ppb_graphics_2d_thunk.cc \ ppapi/thunk/ppb_graphics_3d_thunk.cc \ - ppapi/thunk/ppb_host_resolver_dev_thunk.cc \ + ppapi/thunk/ppb_host_resolver_thunk.cc \ ppapi/thunk/ppb_host_resolver_private_thunk.cc \ ppapi/thunk/ppb_image_data_thunk.cc \ ppapi/thunk/ppb_input_event_thunk.cc \ @@ -134,20 +135,21 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_messaging_thunk.cc \ ppapi/thunk/ppb_mouse_cursor_thunk.cc \ ppapi/thunk/ppb_mouse_lock_thunk.cc \ - ppapi/thunk/ppb_net_address_dev_thunk.cc \ + ppapi/thunk/ppb_net_address_thunk.cc \ ppapi/thunk/ppb_network_list_private_thunk.cc \ ppapi/thunk/ppb_network_monitor_private_thunk.cc \ + ppapi/thunk/ppb_network_proxy_thunk.cc \ ppapi/thunk/ppb_pdf_thunk.cc \ ppapi/thunk/ppb_printing_dev_thunk.cc \ ppapi/thunk/ppb_resource_array_dev_thunk.cc \ ppapi/thunk/ppb_scrollbar_thunk.cc \ ppapi/thunk/ppb_talk_private_thunk.cc \ ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc \ - ppapi/thunk/ppb_tcp_socket_dev_thunk.cc \ ppapi/thunk/ppb_tcp_socket_private_thunk.cc \ + ppapi/thunk/ppb_tcp_socket_thunk.cc \ ppapi/thunk/ppb_text_input_thunk.cc \ ppapi/thunk/ppb_truetype_font_dev_thunk.cc \ - ppapi/thunk/ppb_udp_socket_dev_thunk.cc \ + ppapi/thunk/ppb_udp_socket_thunk.cc \ ppapi/thunk/ppb_udp_socket_private_thunk.cc \ ppapi/thunk/ppb_url_loader_thunk.cc \ ppapi/thunk/ppb_url_loader_trusted_thunk.cc \ @@ -169,7 +171,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -200,9 +202,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ @@ -235,10 +235,121 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ + $(LOCAL_PATH)/third_party/khronos \ + $(LOCAL_PATH)/gpu \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/skia/config \ + $(LOCAL_PATH)/third_party/skia/src/core \ + $(LOCAL_PATH)/third_party/skia/include/config \ + $(LOCAL_PATH)/third_party/skia/include/core \ + $(LOCAL_PATH)/third_party/skia/include/effects \ + $(LOCAL_PATH)/third_party/skia/include/pdf \ + $(LOCAL_PATH)/third_party/skia/include/gpu \ + $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ + $(LOCAL_PATH)/third_party/skia/include/pathops \ + $(LOCAL_PATH)/third_party/skia/include/pipe \ + $(LOCAL_PATH)/third_party/skia/include/ports \ + $(LOCAL_PATH)/third_party/skia/include/utils \ + $(LOCAL_PATH)/skia/ext \ + $(LOCAL_PATH)/third_party/WebKit \ + $(LOCAL_PATH)/third_party/npapi \ + $(LOCAL_PATH)/third_party/npapi/bindings \ + $(LOCAL_PATH)/v8/include \ + $(PWD)/external/icu4c/common \ + $(PWD)/external/icu4c/i18n \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DSK_BUILD_NO_IMAGE_ENCODE' \ + '-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \ + '-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \ + '-DGR_AGGRESSIVE_SHADER_OPTS=1' \ + '-DSK_ENABLE_INST_COUNT=0' \ + '-DSK_USE_POSIX_THREADS' \ + '-DSK_BUILD_FOR_ANDROID' \ + '-DU_USING_ICU_NAMESPACE=0' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DPPAPI_SHARED_IMPLEMENTATION' \ + '-DPPAPI_THUNK_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ @@ -253,6 +364,7 @@ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/third_party/skia/include/pdf \ $(LOCAL_PATH)/third_party/skia/include/gpu \ $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ $(LOCAL_PATH)/third_party/skia/include/pathops \ $(LOCAL_PATH)/third_party/skia/include/pipe \ $(LOCAL_PATH)/third_party/skia/include/ports \ @@ -268,10 +380,9 @@ LOCAL_C_INCLUDES := \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -281,9 +392,13 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -298,6 +413,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -EL \ + -Wl,--no-keep-memory \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := \ skia_skia_gyp diff --git a/ppapi/ppapi_shared.target.darwin-x86.mk b/ppapi/ppapi_shared.target.darwin-x86.mk index 5164d0d78e..ada3fb4f1d 100644 --- a/ppapi/ppapi_shared.target.darwin-x86.mk +++ b/ppapi/ppapi_shared.target.darwin-x86.mk @@ -70,6 +70,7 @@ LOCAL_SRC_FILES := \ ppapi/shared_impl/resource_tracker.cc \ ppapi/shared_impl/scoped_pp_resource.cc \ ppapi/shared_impl/scoped_pp_var.cc \ + ppapi/shared_impl/socket_option_data.cc \ ppapi/shared_impl/tcp_socket_shared.cc \ ppapi/shared_impl/thread_aware_callback.cc \ ppapi/shared_impl/time_conversion.cc \ @@ -125,7 +126,7 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_graphics_2d_dev_thunk.cc \ ppapi/thunk/ppb_graphics_2d_thunk.cc \ ppapi/thunk/ppb_graphics_3d_thunk.cc \ - ppapi/thunk/ppb_host_resolver_dev_thunk.cc \ + ppapi/thunk/ppb_host_resolver_thunk.cc \ ppapi/thunk/ppb_host_resolver_private_thunk.cc \ ppapi/thunk/ppb_image_data_thunk.cc \ ppapi/thunk/ppb_input_event_thunk.cc \ @@ -134,20 +135,21 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_messaging_thunk.cc \ ppapi/thunk/ppb_mouse_cursor_thunk.cc \ ppapi/thunk/ppb_mouse_lock_thunk.cc \ - ppapi/thunk/ppb_net_address_dev_thunk.cc \ + ppapi/thunk/ppb_net_address_thunk.cc \ ppapi/thunk/ppb_network_list_private_thunk.cc \ ppapi/thunk/ppb_network_monitor_private_thunk.cc \ + ppapi/thunk/ppb_network_proxy_thunk.cc \ ppapi/thunk/ppb_pdf_thunk.cc \ ppapi/thunk/ppb_printing_dev_thunk.cc \ ppapi/thunk/ppb_resource_array_dev_thunk.cc \ ppapi/thunk/ppb_scrollbar_thunk.cc \ ppapi/thunk/ppb_talk_private_thunk.cc \ ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc \ - ppapi/thunk/ppb_tcp_socket_dev_thunk.cc \ ppapi/thunk/ppb_tcp_socket_private_thunk.cc \ + ppapi/thunk/ppb_tcp_socket_thunk.cc \ ppapi/thunk/ppb_text_input_thunk.cc \ ppapi/thunk/ppb_truetype_font_dev_thunk.cc \ - ppapi/thunk/ppb_udp_socket_dev_thunk.cc \ + ppapi/thunk/ppb_udp_socket_thunk.cc \ ppapi/thunk/ppb_udp_socket_private_thunk.cc \ ppapi/thunk/ppb_url_loader_thunk.cc \ ppapi/thunk/ppb_url_loader_trusted_thunk.cc \ @@ -169,7 +171,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -Werror \ -fno-exceptions \ @@ -203,9 +205,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DUSE_LINUX_BREAKPAD' \ @@ -239,10 +239,126 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ + $(LOCAL_PATH)/third_party/khronos \ + $(LOCAL_PATH)/gpu \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/skia/config \ + $(LOCAL_PATH)/third_party/skia/src/core \ + $(LOCAL_PATH)/third_party/skia/include/config \ + $(LOCAL_PATH)/third_party/skia/include/core \ + $(LOCAL_PATH)/third_party/skia/include/effects \ + $(LOCAL_PATH)/third_party/skia/include/pdf \ + $(LOCAL_PATH)/third_party/skia/include/gpu \ + $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ + $(LOCAL_PATH)/third_party/skia/include/pathops \ + $(LOCAL_PATH)/third_party/skia/include/pipe \ + $(LOCAL_PATH)/third_party/skia/include/ports \ + $(LOCAL_PATH)/third_party/skia/include/utils \ + $(LOCAL_PATH)/skia/ext \ + $(LOCAL_PATH)/third_party/WebKit \ + $(LOCAL_PATH)/third_party/npapi \ + $(LOCAL_PATH)/third_party/npapi/bindings \ + $(LOCAL_PATH)/v8/include \ + $(PWD)/external/icu4c/common \ + $(PWD)/external/icu4c/i18n \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -Werror \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DSK_BUILD_NO_IMAGE_ENCODE' \ + '-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \ + '-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \ + '-DGR_AGGRESSIVE_SHADER_OPTS=1' \ + '-DSK_ENABLE_INST_COUNT=0' \ + '-DSK_USE_POSIX_THREADS' \ + '-DSK_BUILD_FOR_ANDROID' \ + '-DU_USING_ICU_NAMESPACE=0' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DPPAPI_SHARED_IMPLEMENTATION' \ + '-DPPAPI_THUNK_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ @@ -257,6 +373,7 @@ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/third_party/skia/include/pdf \ $(LOCAL_PATH)/third_party/skia/include/gpu \ $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ $(LOCAL_PATH)/third_party/skia/include/pathops \ $(LOCAL_PATH)/third_party/skia/include/pipe \ $(LOCAL_PATH)/third_party/skia/include/ports \ @@ -272,10 +389,9 @@ LOCAL_C_INCLUDES := \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -284,9 +400,13 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -301,6 +421,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -m32 \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := \ skia_skia_gyp diff --git a/ppapi/ppapi_shared.target.linux-arm.mk b/ppapi/ppapi_shared.target.linux-arm.mk index c3bf541ffb..90406f3f65 100644 --- a/ppapi/ppapi_shared.target.linux-arm.mk +++ b/ppapi/ppapi_shared.target.linux-arm.mk @@ -70,6 +70,7 @@ LOCAL_SRC_FILES := \ ppapi/shared_impl/resource_tracker.cc \ ppapi/shared_impl/scoped_pp_resource.cc \ ppapi/shared_impl/scoped_pp_var.cc \ + ppapi/shared_impl/socket_option_data.cc \ ppapi/shared_impl/tcp_socket_shared.cc \ ppapi/shared_impl/thread_aware_callback.cc \ ppapi/shared_impl/time_conversion.cc \ @@ -125,7 +126,7 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_graphics_2d_dev_thunk.cc \ ppapi/thunk/ppb_graphics_2d_thunk.cc \ ppapi/thunk/ppb_graphics_3d_thunk.cc \ - ppapi/thunk/ppb_host_resolver_dev_thunk.cc \ + ppapi/thunk/ppb_host_resolver_thunk.cc \ ppapi/thunk/ppb_host_resolver_private_thunk.cc \ ppapi/thunk/ppb_image_data_thunk.cc \ ppapi/thunk/ppb_input_event_thunk.cc \ @@ -134,20 +135,21 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_messaging_thunk.cc \ ppapi/thunk/ppb_mouse_cursor_thunk.cc \ ppapi/thunk/ppb_mouse_lock_thunk.cc \ - ppapi/thunk/ppb_net_address_dev_thunk.cc \ + ppapi/thunk/ppb_net_address_thunk.cc \ ppapi/thunk/ppb_network_list_private_thunk.cc \ ppapi/thunk/ppb_network_monitor_private_thunk.cc \ + ppapi/thunk/ppb_network_proxy_thunk.cc \ ppapi/thunk/ppb_pdf_thunk.cc \ ppapi/thunk/ppb_printing_dev_thunk.cc \ ppapi/thunk/ppb_resource_array_dev_thunk.cc \ ppapi/thunk/ppb_scrollbar_thunk.cc \ ppapi/thunk/ppb_talk_private_thunk.cc \ ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc \ - ppapi/thunk/ppb_tcp_socket_dev_thunk.cc \ ppapi/thunk/ppb_tcp_socket_private_thunk.cc \ + ppapi/thunk/ppb_tcp_socket_thunk.cc \ ppapi/thunk/ppb_text_input_thunk.cc \ ppapi/thunk/ppb_truetype_font_dev_thunk.cc \ - ppapi/thunk/ppb_udp_socket_dev_thunk.cc \ + ppapi/thunk/ppb_udp_socket_thunk.cc \ ppapi/thunk/ppb_udp_socket_private_thunk.cc \ ppapi/thunk/ppb_url_loader_thunk.cc \ ppapi/thunk/ppb_url_loader_trusted_thunk.cc \ @@ -169,7 +171,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -Werror \ @@ -201,9 +203,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DUSE_LINUX_BREAKPAD' \ @@ -237,10 +237,123 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ + $(LOCAL_PATH)/third_party/khronos \ + $(LOCAL_PATH)/gpu \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/skia/config \ + $(LOCAL_PATH)/third_party/skia/src/core \ + $(LOCAL_PATH)/third_party/skia/include/config \ + $(LOCAL_PATH)/third_party/skia/include/core \ + $(LOCAL_PATH)/third_party/skia/include/effects \ + $(LOCAL_PATH)/third_party/skia/include/pdf \ + $(LOCAL_PATH)/third_party/skia/include/gpu \ + $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ + $(LOCAL_PATH)/third_party/skia/include/pathops \ + $(LOCAL_PATH)/third_party/skia/include/pipe \ + $(LOCAL_PATH)/third_party/skia/include/ports \ + $(LOCAL_PATH)/third_party/skia/include/utils \ + $(LOCAL_PATH)/skia/ext \ + $(LOCAL_PATH)/third_party/WebKit \ + $(LOCAL_PATH)/third_party/npapi \ + $(LOCAL_PATH)/third_party/npapi/bindings \ + $(LOCAL_PATH)/v8/include \ + $(PWD)/external/icu4c/common \ + $(PWD)/external/icu4c/i18n \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -Werror \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DSK_BUILD_NO_IMAGE_ENCODE' \ + '-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \ + '-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \ + '-DGR_AGGRESSIVE_SHADER_OPTS=1' \ + '-DSK_ENABLE_INST_COUNT=0' \ + '-DSK_USE_POSIX_THREADS' \ + '-DSK_BUILD_FOR_ANDROID' \ + '-DU_USING_ICU_NAMESPACE=0' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DPPAPI_SHARED_IMPLEMENTATION' \ + '-DPPAPI_THUNK_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ @@ -255,6 +368,7 @@ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/third_party/skia/include/pdf \ $(LOCAL_PATH)/third_party/skia/include/gpu \ $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ $(LOCAL_PATH)/third_party/skia/include/pathops \ $(LOCAL_PATH)/third_party/skia/include/pipe \ $(LOCAL_PATH)/third_party/skia/include/ports \ @@ -270,10 +384,9 @@ LOCAL_C_INCLUDES := \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -283,9 +396,13 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -302,6 +419,25 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -Wl,-z,relro \ + -Wl,-z,now \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,--icf=safe \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := \ skia_skia_gyp diff --git a/ppapi/ppapi_shared.target.linux-mips.mk b/ppapi/ppapi_shared.target.linux-mips.mk index 002995791b..eda0c4d2f8 100644 --- a/ppapi/ppapi_shared.target.linux-mips.mk +++ b/ppapi/ppapi_shared.target.linux-mips.mk @@ -70,6 +70,7 @@ LOCAL_SRC_FILES := \ ppapi/shared_impl/resource_tracker.cc \ ppapi/shared_impl/scoped_pp_resource.cc \ ppapi/shared_impl/scoped_pp_var.cc \ + ppapi/shared_impl/socket_option_data.cc \ ppapi/shared_impl/tcp_socket_shared.cc \ ppapi/shared_impl/thread_aware_callback.cc \ ppapi/shared_impl/time_conversion.cc \ @@ -125,7 +126,7 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_graphics_2d_dev_thunk.cc \ ppapi/thunk/ppb_graphics_2d_thunk.cc \ ppapi/thunk/ppb_graphics_3d_thunk.cc \ - ppapi/thunk/ppb_host_resolver_dev_thunk.cc \ + ppapi/thunk/ppb_host_resolver_thunk.cc \ ppapi/thunk/ppb_host_resolver_private_thunk.cc \ ppapi/thunk/ppb_image_data_thunk.cc \ ppapi/thunk/ppb_input_event_thunk.cc \ @@ -134,20 +135,21 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_messaging_thunk.cc \ ppapi/thunk/ppb_mouse_cursor_thunk.cc \ ppapi/thunk/ppb_mouse_lock_thunk.cc \ - ppapi/thunk/ppb_net_address_dev_thunk.cc \ + ppapi/thunk/ppb_net_address_thunk.cc \ ppapi/thunk/ppb_network_list_private_thunk.cc \ ppapi/thunk/ppb_network_monitor_private_thunk.cc \ + ppapi/thunk/ppb_network_proxy_thunk.cc \ ppapi/thunk/ppb_pdf_thunk.cc \ ppapi/thunk/ppb_printing_dev_thunk.cc \ ppapi/thunk/ppb_resource_array_dev_thunk.cc \ ppapi/thunk/ppb_scrollbar_thunk.cc \ ppapi/thunk/ppb_talk_private_thunk.cc \ ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc \ - ppapi/thunk/ppb_tcp_socket_dev_thunk.cc \ ppapi/thunk/ppb_tcp_socket_private_thunk.cc \ + ppapi/thunk/ppb_tcp_socket_thunk.cc \ ppapi/thunk/ppb_text_input_thunk.cc \ ppapi/thunk/ppb_truetype_font_dev_thunk.cc \ - ppapi/thunk/ppb_udp_socket_dev_thunk.cc \ + ppapi/thunk/ppb_udp_socket_thunk.cc \ ppapi/thunk/ppb_udp_socket_private_thunk.cc \ ppapi/thunk/ppb_url_loader_thunk.cc \ ppapi/thunk/ppb_url_loader_trusted_thunk.cc \ @@ -169,7 +171,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -200,9 +202,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ @@ -235,10 +235,121 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ + $(LOCAL_PATH)/third_party/khronos \ + $(LOCAL_PATH)/gpu \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/skia/config \ + $(LOCAL_PATH)/third_party/skia/src/core \ + $(LOCAL_PATH)/third_party/skia/include/config \ + $(LOCAL_PATH)/third_party/skia/include/core \ + $(LOCAL_PATH)/third_party/skia/include/effects \ + $(LOCAL_PATH)/third_party/skia/include/pdf \ + $(LOCAL_PATH)/third_party/skia/include/gpu \ + $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ + $(LOCAL_PATH)/third_party/skia/include/pathops \ + $(LOCAL_PATH)/third_party/skia/include/pipe \ + $(LOCAL_PATH)/third_party/skia/include/ports \ + $(LOCAL_PATH)/third_party/skia/include/utils \ + $(LOCAL_PATH)/skia/ext \ + $(LOCAL_PATH)/third_party/WebKit \ + $(LOCAL_PATH)/third_party/npapi \ + $(LOCAL_PATH)/third_party/npapi/bindings \ + $(LOCAL_PATH)/v8/include \ + $(PWD)/external/icu4c/common \ + $(PWD)/external/icu4c/i18n \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DSK_BUILD_NO_IMAGE_ENCODE' \ + '-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \ + '-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \ + '-DGR_AGGRESSIVE_SHADER_OPTS=1' \ + '-DSK_ENABLE_INST_COUNT=0' \ + '-DSK_USE_POSIX_THREADS' \ + '-DSK_BUILD_FOR_ANDROID' \ + '-DU_USING_ICU_NAMESPACE=0' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DPPAPI_SHARED_IMPLEMENTATION' \ + '-DPPAPI_THUNK_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ @@ -253,6 +364,7 @@ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/third_party/skia/include/pdf \ $(LOCAL_PATH)/third_party/skia/include/gpu \ $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ $(LOCAL_PATH)/third_party/skia/include/pathops \ $(LOCAL_PATH)/third_party/skia/include/pipe \ $(LOCAL_PATH)/third_party/skia/include/ports \ @@ -268,10 +380,9 @@ LOCAL_C_INCLUDES := \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -281,9 +392,13 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -298,6 +413,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -EL \ + -Wl,--no-keep-memory \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := \ skia_skia_gyp diff --git a/ppapi/ppapi_shared.target.linux-x86.mk b/ppapi/ppapi_shared.target.linux-x86.mk index 5164d0d78e..ada3fb4f1d 100644 --- a/ppapi/ppapi_shared.target.linux-x86.mk +++ b/ppapi/ppapi_shared.target.linux-x86.mk @@ -70,6 +70,7 @@ LOCAL_SRC_FILES := \ ppapi/shared_impl/resource_tracker.cc \ ppapi/shared_impl/scoped_pp_resource.cc \ ppapi/shared_impl/scoped_pp_var.cc \ + ppapi/shared_impl/socket_option_data.cc \ ppapi/shared_impl/tcp_socket_shared.cc \ ppapi/shared_impl/thread_aware_callback.cc \ ppapi/shared_impl/time_conversion.cc \ @@ -125,7 +126,7 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_graphics_2d_dev_thunk.cc \ ppapi/thunk/ppb_graphics_2d_thunk.cc \ ppapi/thunk/ppb_graphics_3d_thunk.cc \ - ppapi/thunk/ppb_host_resolver_dev_thunk.cc \ + ppapi/thunk/ppb_host_resolver_thunk.cc \ ppapi/thunk/ppb_host_resolver_private_thunk.cc \ ppapi/thunk/ppb_image_data_thunk.cc \ ppapi/thunk/ppb_input_event_thunk.cc \ @@ -134,20 +135,21 @@ LOCAL_SRC_FILES := \ ppapi/thunk/ppb_messaging_thunk.cc \ ppapi/thunk/ppb_mouse_cursor_thunk.cc \ ppapi/thunk/ppb_mouse_lock_thunk.cc \ - ppapi/thunk/ppb_net_address_dev_thunk.cc \ + ppapi/thunk/ppb_net_address_thunk.cc \ ppapi/thunk/ppb_network_list_private_thunk.cc \ ppapi/thunk/ppb_network_monitor_private_thunk.cc \ + ppapi/thunk/ppb_network_proxy_thunk.cc \ ppapi/thunk/ppb_pdf_thunk.cc \ ppapi/thunk/ppb_printing_dev_thunk.cc \ ppapi/thunk/ppb_resource_array_dev_thunk.cc \ ppapi/thunk/ppb_scrollbar_thunk.cc \ ppapi/thunk/ppb_talk_private_thunk.cc \ ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc \ - ppapi/thunk/ppb_tcp_socket_dev_thunk.cc \ ppapi/thunk/ppb_tcp_socket_private_thunk.cc \ + ppapi/thunk/ppb_tcp_socket_thunk.cc \ ppapi/thunk/ppb_text_input_thunk.cc \ ppapi/thunk/ppb_truetype_font_dev_thunk.cc \ - ppapi/thunk/ppb_udp_socket_dev_thunk.cc \ + ppapi/thunk/ppb_udp_socket_thunk.cc \ ppapi/thunk/ppb_udp_socket_private_thunk.cc \ ppapi/thunk/ppb_url_loader_thunk.cc \ ppapi/thunk/ppb_url_loader_trusted_thunk.cc \ @@ -169,7 +171,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -Werror \ -fno-exceptions \ @@ -203,9 +205,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-D_FILE_OFFSET_BITS=64' \ '-DUSE_LINUX_BREAKPAD' \ @@ -239,10 +239,126 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ + $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ + $(LOCAL_PATH)/third_party/khronos \ + $(LOCAL_PATH)/gpu \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/skia/config \ + $(LOCAL_PATH)/third_party/skia/src/core \ + $(LOCAL_PATH)/third_party/skia/include/config \ + $(LOCAL_PATH)/third_party/skia/include/core \ + $(LOCAL_PATH)/third_party/skia/include/effects \ + $(LOCAL_PATH)/third_party/skia/include/pdf \ + $(LOCAL_PATH)/third_party/skia/include/gpu \ + $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ + $(LOCAL_PATH)/third_party/skia/include/pathops \ + $(LOCAL_PATH)/third_party/skia/include/pipe \ + $(LOCAL_PATH)/third_party/skia/include/ports \ + $(LOCAL_PATH)/third_party/skia/include/utils \ + $(LOCAL_PATH)/skia/ext \ + $(LOCAL_PATH)/third_party/WebKit \ + $(LOCAL_PATH)/third_party/npapi \ + $(LOCAL_PATH)/third_party/npapi/bindings \ + $(LOCAL_PATH)/v8/include \ + $(PWD)/external/icu4c/common \ + $(PWD)/external/icu4c/i18n \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wsign-compare \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -Werror \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wall \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DSK_BUILD_NO_IMAGE_ENCODE' \ + '-DSK_DEFERRED_CANVAS_USES_GPIPE=1' \ + '-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' \ + '-DGR_AGGRESSIVE_SHADER_OPTS=1' \ + '-DSK_ENABLE_INST_COUNT=0' \ + '-DSK_USE_POSIX_THREADS' \ + '-DSK_BUILD_FOR_ANDROID' \ + '-DU_USING_ICU_NAMESPACE=0' \ + '-D__STDC_CONSTANT_MACROS' \ + '-D__STDC_FORMAT_MACROS' \ + '-DPPAPI_SHARED_IMPLEMENTATION' \ + '-DPPAPI_THUNK_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ + '-D_FORTIFY_SOURCE=2' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \ $(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \ $(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \ @@ -257,6 +373,7 @@ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/third_party/skia/include/pdf \ $(LOCAL_PATH)/third_party/skia/include/gpu \ $(LOCAL_PATH)/third_party/skia/include/gpu/gl \ + $(LOCAL_PATH)/third_party/skia/include/lazy \ $(LOCAL_PATH)/third_party/skia/include/pathops \ $(LOCAL_PATH)/third_party/skia/include/pipe \ $(LOCAL_PATH)/third_party/skia/include/ports \ @@ -272,10 +389,9 @@ LOCAL_C_INCLUDES := \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -284,9 +400,13 @@ LOCAL_CPPFLAGS := \ -Wno-non-virtual-dtor \ -Wno-sign-promo + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -301,6 +421,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -m32 \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := \ skia_skia_gyp diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index a93bbcefce..9183de2b44 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -34,6 +34,7 @@ 'c/ppb_gamepad.h', 'c/ppb_graphics_2d.h', 'c/ppb_graphics_3d.h', + 'c/ppb_host_resolver.h', 'c/ppb_image_data.h', 'c/ppb_input_event.h', 'c/ppb_instance.h', @@ -41,13 +42,20 @@ 'c/ppb_messaging.h', 'c/ppb_mouse_cursor.h', 'c/ppb_mouse_lock.h', + 'c/ppb_network_proxy.h', + 'c/ppb_net_address.h', + 'c/ppb_network_proxy.h', 'c/ppb_opengles2.h', + 'c/ppb_tcp_socket.h', 'c/pp_touch_point.h', + 'c/ppb_udp_socket.h', 'c/ppb_url_loader.h', 'c/ppb_url_request_info.h', 'c/ppb_url_response_info.h', 'c/ppb_var.h', + 'c/ppb_var_array.h', 'c/ppb_var_array_buffer.h', + 'c/ppb_var_dictionary.h', 'c/ppb_view.h', 'c/ppb_websocket.h', 'c/ppp.h', @@ -67,21 +75,15 @@ 'c/dev/ppb_file_chooser_dev.h', 'c/dev/ppb_find_dev.h', 'c/dev/ppb_font_dev.h', - 'c/dev/ppb_host_resolver_dev.h', 'c/dev/ppb_ime_input_event_dev.h', 'c/dev/ppb_memory_dev.h', - 'c/dev/ppb_net_address_dev.h', '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', - 'c/dev/ppb_udp_socket_dev.h', 'c/dev/ppb_url_util_dev.h', - 'c/dev/ppb_var_array_dev.h', - 'c/dev/ppb_var_dictionary_dev.h', 'c/dev/ppb_video_decoder_dev.h', 'c/dev/ppb_widget_dev.h', 'c/dev/ppb_zoom_dev.h', @@ -169,6 +171,8 @@ 'cpp/graphics_3d.h', 'cpp/graphics_3d_client.cc', 'cpp/graphics_3d_client.h', + 'cpp/host_resolver.cc', + 'cpp/host_resolver.h', 'cpp/image_data.cc', 'cpp/image_data.h', 'cpp/input_event.cc', @@ -187,6 +191,10 @@ 'cpp/mouse_cursor.h', 'cpp/mouse_lock.cc', 'cpp/mouse_lock.h', + 'cpp/net_address.cc', + 'cpp/net_address.h', + 'cpp/network_proxy.cc', + 'cpp/network_proxy.h', 'cpp/output_traits.h', 'cpp/point.h', 'cpp/rect.cc', @@ -194,7 +202,11 @@ 'cpp/resource.cc', 'cpp/resource.h', 'cpp/size.h', + 'cpp/tcp_socket.cc', + 'cpp/tcp_socket.h', 'cpp/touch_point.h', + 'cpp/udp_socket.cc', + 'cpp/udp_socket.h', 'cpp/url_loader.cc', 'cpp/url_loader.h', 'cpp/url_request_info.cc', @@ -203,8 +215,12 @@ 'cpp/url_response_info.h', 'cpp/var.cc', 'cpp/var.h', + 'cpp/var_array.cc', + 'cpp/var_array.h', 'cpp/var_array_buffer.cc', 'cpp/var_array_buffer.h', + 'cpp/var_dictionary.cc', + 'cpp/var_dictionary.h', 'cpp/view.cc', 'cpp/view.h', 'cpp/websocket.cc', @@ -229,14 +245,10 @@ 'cpp/dev/font_dev.h', 'cpp/dev/graphics_2d_dev.cc', 'cpp/dev/graphics_2d_dev.h', - 'cpp/dev/host_resolver_dev.cc', - 'cpp/dev/host_resolver_dev.h', 'cpp/dev/ime_input_event_dev.cc', 'cpp/dev/ime_input_event_dev.h', 'cpp/dev/memory_dev.cc', 'cpp/dev/memory_dev.h', - 'cpp/dev/net_address_dev.cc', - 'cpp/dev/net_address_dev.h', 'cpp/dev/printing_dev.cc', 'cpp/dev/printing_dev.h', 'cpp/dev/resource_array_dev.cc', @@ -245,20 +257,12 @@ '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', 'cpp/dev/truetype_font_dev.h', - 'cpp/dev/udp_socket_dev.cc', - 'cpp/dev/udp_socket_dev.h', 'cpp/dev/url_util_dev.cc', 'cpp/dev/url_util_dev.h', - 'cpp/dev/var_array_dev.cc', - 'cpp/dev/var_array_dev.h', - 'cpp/dev/var_dictionary_dev.cc', - 'cpp/dev/var_dictionary_dev.h', 'cpp/dev/video_capture_client_dev.cc', 'cpp/dev/video_capture_client_dev.h', 'cpp/dev/video_capture_dev.cc', @@ -442,6 +446,8 @@ 'tests/test_net_address_private_untrusted.h', 'tests/test_network_monitor_private.cc', 'tests/test_network_monitor_private.h', + 'tests/test_network_proxy.cc', + 'tests/test_network_proxy.h', 'tests/test_paint_aggregator.cc', 'tests/test_paint_aggregator.h', 'tests/test_post_message.cc', @@ -456,6 +462,8 @@ 'tests/test_tcp_socket.h', 'tests/test_tcp_socket_private.cc', 'tests/test_tcp_socket_private.h', + 'tests/test_trace_event.cc', + 'tests/test_trace_event.h', 'tests/test_truetype_font.cc', 'tests/test_truetype_font.h', 'tests/test_udp_socket.cc', diff --git a/ppapi/ppapi_tests.gypi b/ppapi/ppapi_tests.gypi index d434f8a37e..dab82944a2 100644 --- a/ppapi/ppapi_tests.gypi +++ b/ppapi/ppapi_tests.gypi @@ -442,7 +442,6 @@ 'ppapi_example_skeleton', 'ppapi.gyp:ppapi_cpp', 'ppapi.gyp:ppapi_gles2', - 'ppapi.gyp:ppapi_egl', ], 'include_dirs': [ 'lib/gl/include', @@ -457,7 +456,6 @@ 'ppapi_example_skeleton', 'ppapi.gyp:ppapi_cpp', 'ppapi.gyp:ppapi_gles2', - 'ppapi.gyp:ppapi_egl', ], 'include_dirs': [ 'lib/gl/include', @@ -475,7 +473,6 @@ 'ppapi_example_skeleton', 'ppapi.gyp:ppapi_cpp', 'ppapi.gyp:ppapi_gles2', - 'ppapi.gyp:ppapi_egl', ], 'include_dirs': [ 'lib/gl/include', diff --git a/ppapi/proxy/audio_input_resource.cc b/ppapi/proxy/audio_input_resource.cc index 487df29663..4a7afff1a2 100644 --- a/ppapi/proxy/audio_input_resource.cc +++ b/ppapi/proxy/audio_input_resource.cc @@ -14,6 +14,7 @@ #include "ppapi/proxy/resource_message_params.h" #include "ppapi/proxy/serialized_handle.h" #include "ppapi/shared_impl/ppapi_globals.h" +#include "ppapi/shared_impl/ppb_audio_config_shared.h" #include "ppapi/shared_impl/resource_tracker.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/enter.h" @@ -29,9 +30,11 @@ AudioInputResource::AudioInputResource( open_state_(BEFORE_OPEN), capturing_(false), shared_memory_size_(0), + audio_input_callback_0_2_(NULL), audio_input_callback_(NULL), user_data_(NULL), - enumeration_helper_(this) { + enumeration_helper_(this), + bytes_per_second_(0) { SendCreate(RENDERER, PpapiHostMsg_AudioInput_Create()); } @@ -68,47 +71,23 @@ int32_t AudioInputResource::MonitorDeviceChange( return enumeration_helper_.MonitorDeviceChange(callback, user_data); } +int32_t AudioInputResource::Open0_2( + PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback_0_2 audio_input_callback_0_2, + void* user_data, + scoped_refptr<TrackedCallback> callback) { + return CommonOpen(device_ref, config, audio_input_callback_0_2, NULL, + user_data, callback); +} + int32_t AudioInputResource::Open(PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, scoped_refptr<TrackedCallback> callback) { - std::string device_id; - // |device_id| remains empty if |device_ref| is 0, which means the default - // device. - if (device_ref != 0) { - thunk::EnterResourceNoLock<thunk::PPB_DeviceRef_API> enter_device_ref( - device_ref, true); - if (enter_device_ref.failed()) - return PP_ERROR_BADRESOURCE; - device_id = enter_device_ref.object()->GetDeviceRefData().id; - } - - if (TrackedCallback::IsPending(open_callback_)) - return PP_ERROR_INPROGRESS; - if (open_state_ != BEFORE_OPEN) - return PP_ERROR_FAILED; - - if (!audio_input_callback) - return PP_ERROR_BADARGUMENT; - thunk::EnterResourceNoLock<thunk::PPB_AudioConfig_API> enter_config(config, - true); - if (enter_config.failed()) - return PP_ERROR_BADARGUMENT; - - config_ = config; - audio_input_callback_ = audio_input_callback; - user_data_ = user_data; - open_callback_ = callback; - - PpapiHostMsg_AudioInput_Open msg( - device_id, enter_config.object()->GetSampleRate(), - enter_config.object()->GetSampleFrameCount()); - Call<PpapiPluginMsg_AudioInput_OpenReply>( - RENDERER, msg, - base::Bind(&AudioInputResource::OnPluginMsgOpenReply, - base::Unretained(this))); - return PP_OK_COMPLETIONPENDING; + return CommonOpen(device_ref, config, NULL, audio_input_callback, user_data, + callback); } PP_Resource AudioInputResource::GetCurrentConfig() { @@ -235,8 +214,8 @@ void AudioInputResource::SetStreamInfo( void AudioInputResource::StartThread() { // Don't start the thread unless all our state is set up correctly. - if (!audio_input_callback_ || !socket_.get() || !capturing_ || - !shared_memory_->memory()) { + if ((!audio_input_callback_0_2_ && !audio_input_callback_) || + !socket_.get() || !capturing_ || !shared_memory_->memory()) { return; } DCHECK(!audio_input_thread_.get()); @@ -270,10 +249,66 @@ void AudioInputResource::Run() { // While closing the stream, we may receive buffers whose size is different // from |data_buffer_size|. CHECK_LE(buffer->params.size, data_buffer_size); - if (buffer->params.size > 0) - audio_input_callback_(&buffer->audio[0], buffer->params.size, user_data_); + if (buffer->params.size > 0) { + if (audio_input_callback_) { + PP_TimeDelta latency = + static_cast<double>(pending_data) / bytes_per_second_; + audio_input_callback_(&buffer->audio[0], buffer->params.size, latency, + user_data_); + } else { + audio_input_callback_0_2_(&buffer->audio[0], buffer->params.size, + user_data_); + } + } } } +int32_t AudioInputResource::CommonOpen( + PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback_0_2 audio_input_callback_0_2, + PPB_AudioInput_Callback audio_input_callback, + void* user_data, + scoped_refptr<TrackedCallback> callback) { + std::string device_id; + // |device_id| remains empty if |device_ref| is 0, which means the default + // device. + if (device_ref != 0) { + thunk::EnterResourceNoLock<thunk::PPB_DeviceRef_API> enter_device_ref( + device_ref, true); + if (enter_device_ref.failed()) + return PP_ERROR_BADRESOURCE; + device_id = enter_device_ref.object()->GetDeviceRefData().id; + } + + if (TrackedCallback::IsPending(open_callback_)) + return PP_ERROR_INPROGRESS; + if (open_state_ != BEFORE_OPEN) + return PP_ERROR_FAILED; + + if (!audio_input_callback_0_2 && !audio_input_callback) + return PP_ERROR_BADARGUMENT; + thunk::EnterResourceNoLock<thunk::PPB_AudioConfig_API> enter_config(config, + true); + if (enter_config.failed()) + return PP_ERROR_BADARGUMENT; + + config_ = config; + audio_input_callback_0_2_ = audio_input_callback_0_2; + audio_input_callback_ = audio_input_callback; + user_data_ = user_data; + open_callback_ = callback; + bytes_per_second_ = kAudioInputChannels * (kBitsPerAudioInputSample / 8) * + enter_config.object()->GetSampleRate(); + + PpapiHostMsg_AudioInput_Open msg( + device_id, enter_config.object()->GetSampleRate(), + enter_config.object()->GetSampleFrameCount()); + Call<PpapiPluginMsg_AudioInput_OpenReply>( + RENDERER, msg, + base::Bind(&AudioInputResource::OnPluginMsgOpenReply, + base::Unretained(this))); + return PP_OK_COMPLETIONPENDING; +} } // namespace proxy } // namespace ppapi diff --git a/ppapi/proxy/audio_input_resource.h b/ppapi/proxy/audio_input_resource.h index abe18db29e..d2e4890c66 100644 --- a/ppapi/proxy/audio_input_resource.h +++ b/ppapi/proxy/audio_input_resource.h @@ -44,6 +44,11 @@ class AudioInputResource : public PluginResource, virtual int32_t MonitorDeviceChange( PP_MonitorDeviceChangeCallback callback, void* user_data) OVERRIDE; + virtual int32_t Open0_2(PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback_0_2 audio_input_callback_0_2, + void* user_data, + scoped_refptr<TrackedCallback> callback) OVERRIDE; virtual int32_t Open(PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, @@ -83,6 +88,13 @@ class AudioInputResource : public PluginResource, // Run on the audio input thread. virtual void Run() OVERRIDE; + int32_t CommonOpen(PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback_0_2 audio_input_callback_0_2, + PPB_AudioInput_Callback audio_input_callback, + void* user_data, + scoped_refptr<TrackedCallback> callback); + OpenState open_state_; // True if capturing the stream. @@ -104,6 +116,7 @@ class AudioInputResource : public PluginResource, scoped_ptr<base::DelegateSimpleThread> audio_input_thread_; // Callback to call when new samples are available. + PPB_AudioInput_Callback_0_2 audio_input_callback_0_2_; PPB_AudioInput_Callback audio_input_callback_; // User data pointer passed verbatim to the callback function. @@ -119,6 +132,10 @@ class AudioInputResource : public PluginResource, DeviceEnumerationResourceHelper enumeration_helper_; + // The data size (in bytes) of one second of audio input. Used to calculate + // latency. + size_t bytes_per_second_; + DISALLOW_COPY_AND_ASSIGN(AudioInputResource); }; diff --git a/ppapi/proxy/file_ref_resource.cc b/ppapi/proxy/file_ref_resource.cc new file mode 100644 index 0000000000..38379bde74 --- /dev/null +++ b/ppapi/proxy/file_ref_resource.cc @@ -0,0 +1,278 @@ +// 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/proxy/file_ref_resource.h" + +#include "ppapi/c/pp_directory_entry.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/shared_impl/array_writer.h" +#include "ppapi/shared_impl/file_ref_util.h" +#include "ppapi/shared_impl/resource.h" +#include "ppapi/shared_impl/resource_tracker.h" +#include "ppapi/shared_impl/var.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_file_system_api.h" + +namespace ppapi { +namespace proxy { + +FileRefResource::FileRefResource( + Connection connection, + PP_Instance instance, + const FileRef_CreateInfo& create_info) + : PluginResource(connection, instance), + create_info_(create_info) { + if (create_info_.file_system_type != PP_FILESYSTEMTYPE_EXTERNAL) { + // If path ends with a slash, then normalize it away unless path is + // the root path. + int path_size = create_info_.internal_path.size(); + if (path_size > 1 && create_info_.internal_path.at(path_size - 1) == '/') + create_info_.internal_path.erase(path_size - 1, 1); + + path_var_ = new StringVar(create_info_.internal_path); + + create_info_.display_name = GetNameForInternalFilePath( + create_info_.internal_path); + } + name_var_ = new StringVar(create_info_.display_name); + + if (create_info_.pending_host_resource_id != 0) { + AttachToPendingHost(BROWSER, create_info_.pending_host_resource_id); + } else { + CHECK(create_info_.file_system_type != PP_FILESYSTEMTYPE_EXTERNAL); + SendCreate(BROWSER, PpapiHostMsg_FileRef_CreateInternal( + create_info.file_system_plugin_resource, + create_info.internal_path)); + } +} + +FileRefResource::~FileRefResource() { +} + +//static +PP_Resource FileRefResource::CreateFileRef( + Connection connection, + PP_Instance instance, + const FileRef_CreateInfo& create_info) { + // If we have a valid file_system resource, ensure that its type matches that + // of the fs_type parameter. + if (create_info.pending_host_resource_id != 0) { + thunk::EnterResourceNoLock<thunk::PPB_FileSystem_API> enter( + create_info.pending_host_resource_id, true); + if (enter.failed()) + return 0; + if (enter.object()->GetType() != create_info.file_system_type) { + NOTREACHED() << "file system type mismatch with resource"; + return 0; + } + } + + if (create_info.file_system_type == PP_FILESYSTEMTYPE_LOCALPERSISTENT || + create_info.file_system_type == PP_FILESYSTEMTYPE_LOCALTEMPORARY) { + if (!IsValidInternalPath(create_info.internal_path)) + return 0; + } + return (new FileRefResource(connection, + instance, + create_info))->GetReference(); +} + +thunk::PPB_FileRef_API* FileRefResource::AsPPB_FileRef_API() { + // TODO: return "this" once we update PPB_FileRef_API. + NOTREACHED(); + return NULL; +} + +PP_FileSystemType FileRefResource::GetFileSystemType() const { + return create_info_.file_system_type; +} + +PP_Var FileRefResource::GetName() const { + return name_var_->GetPPVar(); +} + +PP_Var FileRefResource::GetPath() const { + if (create_info_.file_system_type == PP_FILESYSTEMTYPE_EXTERNAL) + return PP_MakeUndefined(); + return path_var_->GetPPVar(); +} + +PP_Resource FileRefResource::GetParent() { + if (create_info_.file_system_type == PP_FILESYSTEMTYPE_EXTERNAL) + return 0; + + size_t pos = create_info_.internal_path.rfind('/'); + CHECK(pos != std::string::npos); + if (pos == 0) + pos++; + std::string parent_path = create_info_.internal_path.substr(0, pos); + + ppapi::FileRef_CreateInfo parent_info; + parent_info.file_system_type = create_info_.file_system_type; + parent_info.internal_path = parent_path; + parent_info.display_name = GetNameForInternalFilePath(parent_path); + parent_info.file_system_plugin_resource = + create_info_.file_system_plugin_resource; + + return (new FileRefResource(connection(), + pp_instance(), + parent_info))->GetReference(); +} + +int32_t FileRefResource::MakeDirectory( + PP_Bool make_ancestors, + scoped_refptr<TrackedCallback> callback) { + Call<PpapiPluginMsg_FileRef_MakeDirectoryReply>( + BROWSER, + PpapiHostMsg_FileRef_MakeDirectory(PP_TRUE == make_ancestors), + base::Bind(&FileRefResource::RunTrackedCallback, this, callback)); + return PP_OK_COMPLETIONPENDING; +} + +int32_t FileRefResource::Touch(PP_Time last_access_time, + PP_Time last_modified_time, + scoped_refptr<TrackedCallback> callback) { + Call<PpapiPluginMsg_FileRef_TouchReply>( + BROWSER, + PpapiHostMsg_FileRef_Touch(last_access_time, + last_modified_time), + base::Bind(&FileRefResource::RunTrackedCallback, this, callback)); + return PP_OK_COMPLETIONPENDING; +} + +int32_t FileRefResource::Delete(scoped_refptr<TrackedCallback> callback) { + Call<PpapiPluginMsg_FileRef_DeleteReply>( + BROWSER, + PpapiHostMsg_FileRef_Delete(), + base::Bind(&FileRefResource::RunTrackedCallback, this, callback)); + return PP_OK_COMPLETIONPENDING; +} + +int32_t FileRefResource::Rename(PP_Resource new_file_ref, + scoped_refptr<TrackedCallback> callback) { + Call<PpapiPluginMsg_FileRef_RenameReply>( + BROWSER, + PpapiHostMsg_FileRef_Rename(new_file_ref), + base::Bind(&FileRefResource::RunTrackedCallback, this, callback)); + return PP_OK_COMPLETIONPENDING; +} + +int32_t FileRefResource::Query(PP_FileInfo* info, + scoped_refptr<TrackedCallback> callback) { + if (info == NULL) + return PP_ERROR_BADARGUMENT; + + Call<PpapiPluginMsg_FileRef_QueryReply>( + BROWSER, + PpapiHostMsg_FileRef_Query(), + base::Bind(&FileRefResource::OnQueryReply, this, info, callback)); + return PP_OK_COMPLETIONPENDING; +} + +int32_t FileRefResource::ReadDirectoryEntries( + const PP_ArrayOutput& output, + scoped_refptr<TrackedCallback> callback) { + Call<PpapiPluginMsg_FileRef_ReadDirectoryEntriesReply>( + BROWSER, + PpapiHostMsg_FileRef_ReadDirectoryEntries(), + base::Bind(&FileRefResource::OnDirectoryEntriesReply, + this, output, callback)); + return PP_OK_COMPLETIONPENDING; +} + +/* +const FileRef_CreateInfo& FileRefResource::GetCreateInfo() const { + return create_info_; +} +*/ +const PPB_FileRef_CreateInfo& FileRefResource::GetCreateInfo() const { + // FIXME + NOTREACHED(); + PPB_FileRef_CreateInfo *info = new PPB_FileRef_CreateInfo(); + return *info; +} + +// TODO(teravest): Remove this when we are finished moving to the new proxy. +int32_t FileRefResource::QueryInHost(linked_ptr<PP_FileInfo> info, + scoped_refptr<TrackedCallback> callback) { + NOTREACHED(); + return PP_ERROR_FAILED; +} + +// TODO(teravest): Remove this when we are finished moving to the new proxy. +int32_t FileRefResource::ReadDirectoryEntriesInHost( + linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files, + linked_ptr<std::vector<PP_FileType> > file_types, + scoped_refptr<TrackedCallback> callback) { + NOTREACHED(); + return PP_ERROR_FAILED; +} + +PP_Var FileRefResource::GetAbsolutePath() { + if (!absolute_path_var_.get()) { + std::string absolute_path; + int32_t result = SyncCall<PpapiPluginMsg_FileRef_GetAbsolutePathReply>( + BROWSER, PpapiHostMsg_FileRef_GetAbsolutePath(), &absolute_path); + if (result != PP_OK) + return PP_MakeUndefined(); + absolute_path_var_ = new StringVar(absolute_path); + } + return absolute_path_var_->GetPPVar(); +} + +void FileRefResource::RunTrackedCallback( + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params) { + if (TrackedCallback::IsPending(callback)) + callback->Run(params.result()); +} + +void FileRefResource::OnQueryReply( + PP_FileInfo* out_info, + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params, + const PP_FileInfo& info) { + if (!TrackedCallback::IsPending(callback)) + return; + + if (params.result() == PP_OK) + *out_info = info; + callback->Run(params.result()); +} + +void FileRefResource::OnDirectoryEntriesReply( + const PP_ArrayOutput& output, + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params, + const std::vector<ppapi::FileRef_CreateInfo>& infos, + const std::vector<PP_FileType>& file_types) { + if (!TrackedCallback::IsPending(callback)) + return; + + if (params.result() == PP_OK) { + ArrayWriter writer(output); + if (!writer.is_valid()) { + callback->Run(PP_ERROR_BADARGUMENT); + return; + } + + std::vector<PP_DirectoryEntry> entries; + for (size_t i = 0; i < infos.size(); ++i) { + PP_DirectoryEntry entry; + entry.file_ref = FileRefResource::CreateFileRef(connection(), + pp_instance(), + infos[i]); + entry.file_type = file_types[i]; + entries.push_back(entry); + } + + writer.StoreVector(entries); + } + callback->Run(params.result()); +} + +} // namespace proxy +} // namespace ppapi diff --git a/ppapi/proxy/file_ref_resource.h b/ppapi/proxy/file_ref_resource.h new file mode 100644 index 0000000000..4e4d1b6451 --- /dev/null +++ b/ppapi/proxy/file_ref_resource.h @@ -0,0 +1,101 @@ +// 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. + +#ifndef PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ +#define PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ + +#include <string> + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/proxy/plugin_resource.h" +#include "ppapi/proxy/ppapi_proxy_export.h" +#include "ppapi/shared_impl/file_ref_create_info.h" +#include "ppapi/thunk/ppb_file_ref_api.h" + +namespace ppapi { +class StringVar; + +namespace proxy { + +class PPAPI_PROXY_EXPORT FileRefResource + : public PluginResource, + public thunk::PPB_FileRef_API { + public: + static PP_Resource CreateFileRef(Connection connection, + PP_Instance instance, + const FileRef_CreateInfo& info); + + virtual ~FileRefResource(); + + // Resource implementation. + virtual thunk::PPB_FileRef_API* AsPPB_FileRef_API() OVERRIDE; + + // PPB_FileRef_API implementation. + virtual PP_FileSystemType GetFileSystemType() const OVERRIDE; + virtual PP_Var GetName() const OVERRIDE; + virtual PP_Var GetPath() const OVERRIDE; + virtual PP_Resource GetParent() OVERRIDE; + virtual int32_t MakeDirectory( + PP_Bool make_ancestors, + scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual int32_t Touch(PP_Time last_access_time, + PP_Time last_modified_time, + scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual int32_t Delete(scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual int32_t Rename(PP_Resource new_file_ref, + scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual int32_t Query(PP_FileInfo* info, + scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual int32_t ReadDirectoryEntries( + const PP_ArrayOutput& output, + scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual const PPB_FileRef_CreateInfo& GetCreateInfo() const OVERRIDE; + virtual int32_t QueryInHost(linked_ptr<PP_FileInfo> info, + scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual int32_t ReadDirectoryEntriesInHost( + linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files, + linked_ptr<std::vector<PP_FileType> > file_types, + scoped_refptr<TrackedCallback> callback) OVERRIDE; + + // Private API + virtual PP_Var GetAbsolutePath() OVERRIDE; + + private: + FileRefResource(Connection connection, + PP_Instance instance, + const FileRef_CreateInfo& info); + + void RunTrackedCallback(scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params); + + void OnQueryReply(PP_FileInfo* out_info, + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params, + const PP_FileInfo& info); + + void OnDirectoryEntriesReply( + const PP_ArrayOutput& output, + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params, + const std::vector<ppapi::FileRef_CreateInfo>& infos, + const std::vector<PP_FileType>& file_types); + + // Populated after creation. + FileRef_CreateInfo create_info_; + + scoped_refptr<StringVar> name_var_; + scoped_refptr<StringVar> path_var_; + scoped_refptr<StringVar> absolute_path_var_; + + DISALLOW_COPY_AND_ASSIGN(FileRefResource); +}; + +} // namespace proxy +} // namespace ppapi + +#endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ diff --git a/ppapi/proxy/flash_resource.cc b/ppapi/proxy/flash_resource.cc index 23b3f20166..26a80ae822 100644 --- a/ppapi/proxy/flash_resource.cc +++ b/ppapi/proxy/flash_resource.cc @@ -9,7 +9,7 @@ #include "base/containers/mru_cache.h" #include "base/debug/crash_logging.h" #include "base/lazy_instance.h" -#include "base/time.h" +#include "base/time/time.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/private/ppb_flash.h" #include "ppapi/c/trusted/ppb_browser_font_trusted.h" diff --git a/ppapi/proxy/host_resolver_private_resource.cc b/ppapi/proxy/host_resolver_private_resource.cc index 87839c97e8..10ff06a938 100644 --- a/ppapi/proxy/host_resolver_private_resource.cc +++ b/ppapi/proxy/host_resolver_private_resource.cc @@ -12,7 +12,7 @@ namespace proxy { HostResolverPrivateResource::HostResolverPrivateResource(Connection connection, PP_Instance instance) - : HostResolverResourceBase(connection, instance) { + : HostResolverResourceBase(connection, instance, true) { } HostResolverPrivateResource::~HostResolverPrivateResource() { diff --git a/ppapi/proxy/host_resolver_resource.cc b/ppapi/proxy/host_resolver_resource.cc index f41d751cb2..a2898566f7 100644 --- a/ppapi/proxy/host_resolver_resource.cc +++ b/ppapi/proxy/host_resolver_resource.cc @@ -15,28 +15,26 @@ namespace proxy { namespace { PP_HostResolver_Private_Hint ConvertToHostResolverPrivateHint( - const PP_HostResolver_Hint_Dev& hint) { + const PP_HostResolver_Hint& hint) { PP_HostResolver_Private_Hint private_hint; switch (hint.family) { case PP_NETADDRESS_FAMILY_UNSPECIFIED: - private_hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED; + private_hint.family = PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED; break; case PP_NETADDRESS_FAMILY_IPV4: - private_hint.family = PP_NETADDRESSFAMILY_IPV4; + private_hint.family = PP_NETADDRESSFAMILY_PRIVATE_IPV4; break; case PP_NETADDRESS_FAMILY_IPV6: - private_hint.family = PP_NETADDRESSFAMILY_IPV6; + private_hint.family = PP_NETADDRESSFAMILY_PRIVATE_IPV6; break; default: NOTREACHED(); - private_hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED; + private_hint.family = PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED; } private_hint.flags = 0; - if (hint.flags & PP_HOSTRESOLVER_FLAGS_CANONNAME) - private_hint.flags |= PP_HOST_RESOLVER_FLAGS_CANONNAME; - if (hint.flags & PP_HOSTRESOLVER_FLAGS_LOOPBACK_ONLY) - private_hint.flags |= PP_HOST_RESOLVER_FLAGS_LOOPBACK_ONLY; + if (hint.flags & PP_HOSTRESOLVER_FLAG_CANONNAME) + private_hint.flags |= PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME; return private_hint; } @@ -45,7 +43,7 @@ PP_HostResolver_Private_Hint ConvertToHostResolverPrivateHint( HostResolverResource::HostResolverResource(Connection connection, PP_Instance instance) - : HostResolverResourceBase(connection, instance) { + : HostResolverResourceBase(connection, instance, false) { } HostResolverResource::~HostResolverResource() { @@ -57,7 +55,7 @@ thunk::PPB_HostResolver_API* HostResolverResource::AsPPB_HostResolver_API() { int32_t HostResolverResource::Resolve(const char* host, uint16_t port, - const PP_HostResolver_Hint_Dev* hint, + const PP_HostResolver_Hint* hint, scoped_refptr<TrackedCallback> callback) { if (!hint) return PP_ERROR_BADARGUMENT; diff --git a/ppapi/proxy/host_resolver_resource.h b/ppapi/proxy/host_resolver_resource.h index b39722b142..055dfb8107 100644 --- a/ppapi/proxy/host_resolver_resource.h +++ b/ppapi/proxy/host_resolver_resource.h @@ -27,7 +27,7 @@ class PPAPI_PROXY_EXPORT HostResolverResource // thunk::PPB_HostResolver_API implementation. virtual int32_t Resolve(const char* host, uint16_t port, - const PP_HostResolver_Hint_Dev* hint, + const PP_HostResolver_Hint* hint, scoped_refptr<TrackedCallback> callback) OVERRIDE; virtual PP_Var GetCanonicalName() OVERRIDE; virtual uint32_t GetNetAddressCount() OVERRIDE; diff --git a/ppapi/proxy/host_resolver_resource_base.cc b/ppapi/proxy/host_resolver_resource_base.cc index c4055a73ee..08877e14a6 100644 --- a/ppapi/proxy/host_resolver_resource_base.cc +++ b/ppapi/proxy/host_resolver_resource_base.cc @@ -13,11 +13,35 @@ namespace ppapi { namespace proxy { +namespace { + +int32_t ConvertPPError(int32_t pp_error, bool private_api) { + // The private API doesn't return network-specific error codes or + // PP_ERROR_NOACCESS. In order to preserve the behavior, we convert those to + // PP_ERROR_FAILED. + // TODO(yzshen): Consider defining ranges for different kinds of PP_Error + // codes, so that we can detect network-specific error codes in a better way. + if (private_api && + (pp_error <= PP_ERROR_CONNECTION_CLOSED || + pp_error == PP_ERROR_NOACCESS)) { + return PP_ERROR_FAILED; + } + + return pp_error; +} + +} // namespace + HostResolverResourceBase::HostResolverResourceBase(Connection connection, - PP_Instance instance) + PP_Instance instance, + bool private_api) : PluginResource(connection, instance), + private_api_(private_api), allow_get_results_(false) { - SendCreate(BROWSER, PpapiHostMsg_HostResolverPrivate_Create()); + if (private_api) + SendCreate(BROWSER, PpapiHostMsg_HostResolver_CreatePrivate()); + else + SendCreate(BROWSER, PpapiHostMsg_HostResolver_Create()); } HostResolverResourceBase::~HostResolverResourceBase() { @@ -85,14 +109,14 @@ void HostResolverResourceBase::OnPluginMsgResolveReply( canonical_name_.clear(); net_address_list_.clear(); } - resolve_callback_->Run(params.result()); + resolve_callback_->Run(ConvertPPError(params.result(), private_api_)); } void HostResolverResourceBase::SendResolve( const HostPortPair& host_port, const PP_HostResolver_Private_Hint* hint) { - PpapiHostMsg_HostResolverPrivate_Resolve msg(host_port, *hint); - Call<PpapiPluginMsg_HostResolverPrivate_ResolveReply>( + PpapiHostMsg_HostResolver_Resolve msg(host_port, *hint); + Call<PpapiPluginMsg_HostResolver_ResolveReply>( BROWSER, msg, base::Bind(&HostResolverResourceBase::OnPluginMsgResolveReply, diff --git a/ppapi/proxy/host_resolver_resource_base.h b/ppapi/proxy/host_resolver_resource_base.h index 850ef0754a..d27d988817 100644 --- a/ppapi/proxy/host_resolver_resource_base.h +++ b/ppapi/proxy/host_resolver_resource_base.h @@ -30,7 +30,9 @@ class NetAddressResource; class PPAPI_PROXY_EXPORT HostResolverResourceBase: public PluginResource { public: - HostResolverResourceBase(Connection connection, PP_Instance instance); + HostResolverResourceBase(Connection connection, + PP_Instance instance, + bool private_api); virtual ~HostResolverResourceBase(); int32_t ResolveImpl(const char* host, @@ -53,6 +55,8 @@ class PPAPI_PROXY_EXPORT HostResolverResourceBase: public PluginResource { bool ResolveInProgress() const; + bool private_api_; + scoped_refptr<TrackedCallback> resolve_callback_; // Set to false if there is a pending resolve request or the previous request diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index 122e96a9ad..0c84ae88e5 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -15,24 +15,18 @@ #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h" #include "ppapi/c/dev/ppb_graphics_2d_dev.h" -#include "ppapi/c/dev/ppb_host_resolver_dev.h" #include "ppapi/c/dev/ppb_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_keyboard_input_event_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" -#include "ppapi/c/dev/ppb_net_address_dev.h" #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" #include "ppapi/c/dev/ppb_truetype_font_dev.h" -#include "ppapi/c/dev/ppb_udp_socket_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" -#include "ppapi/c/dev/ppb_var_array_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" #include "ppapi/c/dev/ppb_video_capture_dev.h" #include "ppapi/c/dev/ppb_view_dev.h" #include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h" @@ -46,18 +40,25 @@ #include "ppapi/c/ppb_file_system.h" #include "ppapi/c/ppb_fullscreen.h" #include "ppapi/c/ppb_graphics_2d.h" +#include "ppapi/c/ppb_host_resolver.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_message_loop.h" #include "ppapi/c/ppb_messaging.h" #include "ppapi/c/ppb_mouse_lock.h" +#include "ppapi/c/ppb_net_address.h" +#include "ppapi/c/ppb_network_proxy.h" #include "ppapi/c/ppb_opengles2.h" +#include "ppapi/c/ppb_tcp_socket.h" +#include "ppapi/c/ppb_udp_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" #include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_var_array.h" #include "ppapi/c/ppb_var_array_buffer.h" +#include "ppapi/c/ppb_var_dictionary.h" #include "ppapi/c/ppb_view.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppp_instance.h" diff --git a/ppapi/proxy/net_address_resource.cc b/ppapi/proxy/net_address_resource.cc index 8bda8dde39..9d906a5e06 100644 --- a/ppapi/proxy/net_address_resource.cc +++ b/ppapi/proxy/net_address_resource.cc @@ -16,7 +16,7 @@ namespace proxy { NetAddressResource::NetAddressResource( Connection connection, PP_Instance instance, - const PP_NetAddress_IPv4_Dev& ipv4_addr) + const PP_NetAddress_IPv4& ipv4_addr) : PluginResource(connection, instance) { NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv4Address(ipv4_addr, &address_); @@ -25,7 +25,7 @@ NetAddressResource::NetAddressResource( NetAddressResource::NetAddressResource( Connection connection, PP_Instance instance, - const PP_NetAddress_IPv6_Dev& ipv6_addr) + const PP_NetAddress_IPv6& ipv6_addr) : PluginResource(connection, instance) { NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv6Address(ipv6_addr, &address_); @@ -46,7 +46,7 @@ thunk::PPB_NetAddress_API* NetAddressResource::AsPPB_NetAddress_API() { return this; } -PP_NetAddress_Family_Dev NetAddressResource::GetFamily() { +PP_NetAddress_Family NetAddressResource::GetFamily() { return NetAddressPrivateImpl::GetFamilyFromNetAddressPrivate(address_); } @@ -60,14 +60,14 @@ PP_Var NetAddressResource::DescribeAsString(PP_Bool include_port) { } PP_Bool NetAddressResource::DescribeAsIPv4Address( - PP_NetAddress_IPv4_Dev* ipv4_addr) { + PP_NetAddress_IPv4* ipv4_addr) { return PP_FromBool( NetAddressPrivateImpl::DescribeNetAddressPrivateAsIPv4Address( address_, ipv4_addr)); } PP_Bool NetAddressResource::DescribeAsIPv6Address( - PP_NetAddress_IPv6_Dev* ipv6_addr) { + PP_NetAddress_IPv6* ipv6_addr) { return PP_FromBool( NetAddressPrivateImpl::DescribeNetAddressPrivateAsIPv6Address( address_, ipv6_addr)); diff --git a/ppapi/proxy/net_address_resource.h b/ppapi/proxy/net_address_resource.h index 9c50492442..4d236049f9 100644 --- a/ppapi/proxy/net_address_resource.h +++ b/ppapi/proxy/net_address_resource.h @@ -20,10 +20,10 @@ class PPAPI_PROXY_EXPORT NetAddressResource : public PluginResource, public: NetAddressResource(Connection connection, PP_Instance instance, - const PP_NetAddress_IPv4_Dev& ipv4_addr); + const PP_NetAddress_IPv4& ipv4_addr); NetAddressResource(Connection connection, PP_Instance instance, - const PP_NetAddress_IPv6_Dev& ipv6_addr); + const PP_NetAddress_IPv6& ipv6_addr); NetAddressResource(Connection connection, PP_Instance instance, const PP_NetAddress_Private& private_addr); @@ -34,16 +34,16 @@ class PPAPI_PROXY_EXPORT NetAddressResource : public PluginResource, virtual thunk::PPB_NetAddress_API* AsPPB_NetAddress_API() OVERRIDE; // PPB_NetAddress_API implementation. - virtual PP_NetAddress_Family_Dev GetFamily() OVERRIDE; + virtual PP_NetAddress_Family GetFamily() OVERRIDE; virtual PP_Var DescribeAsString(PP_Bool include_port) OVERRIDE; virtual PP_Bool DescribeAsIPv4Address( - PP_NetAddress_IPv4_Dev* ipv4_addr) OVERRIDE; + PP_NetAddress_IPv4* ipv4_addr) OVERRIDE; virtual PP_Bool DescribeAsIPv6Address( - PP_NetAddress_IPv6_Dev* ipv6_addr) OVERRIDE; + PP_NetAddress_IPv6* ipv6_addr) OVERRIDE; virtual const PP_NetAddress_Private& GetNetAddressPrivate() OVERRIDE; private: - // TODO(yzshen): Refactor the code so that PPB_NetAddress_Dev resource doesn't + // TODO(yzshen): Refactor the code so that PPB_NetAddress resource doesn't // use PP_NetAddress_Private as storage type. PP_NetAddress_Private address_; diff --git a/ppapi/proxy/network_proxy_resource.cc b/ppapi/proxy/network_proxy_resource.cc new file mode 100644 index 0000000000..b004130f01 --- /dev/null +++ b/ppapi/proxy/network_proxy_resource.cc @@ -0,0 +1,66 @@ +// Copyright (c) 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/proxy/network_proxy_resource.h" + +#include "base/bind.h" +#include "ppapi/proxy/dispatch_reply_message.h" +#include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/shared_impl/var.h" + +namespace ppapi { +namespace proxy { + +NetworkProxyResource::NetworkProxyResource(Connection connection, + PP_Instance instance) + : PluginResource(connection, instance) { + SendCreate(BROWSER, PpapiHostMsg_NetworkProxy_Create()); +} + +NetworkProxyResource::~NetworkProxyResource() { +} + +thunk::PPB_NetworkProxy_API* NetworkProxyResource::AsPPB_NetworkProxy_API() { + return this; +} + +int32_t NetworkProxyResource::GetProxyForURL( + PP_Instance /* instance */, + PP_Var url, + PP_Var* proxy_string, + scoped_refptr<TrackedCallback> callback) { + StringVar* string_url = StringVar::FromPPVar(url); + if (!string_url) + return PP_ERROR_BADARGUMENT; + Call<PpapiPluginMsg_NetworkProxy_GetProxyForURLReply>( + BROWSER, + PpapiHostMsg_NetworkProxy_GetProxyForURL(string_url->value()), + base::Bind(&NetworkProxyResource::OnPluginMsgGetProxyForURLReply, + base::Unretained(this), + base::Unretained(proxy_string), + callback)); + return PP_OK_COMPLETIONPENDING; +} + +void NetworkProxyResource::OnPluginMsgGetProxyForURLReply( + PP_Var* proxy_string_out_param, + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params, + const std::string& proxy_string) { + if (!TrackedCallback::IsPending(callback)) { + // The callback should not have already been run. If this resource is + // deleted, LastPluginRefWasReleased in PluginResource should abort the + // callback and should not run this callback. + NOTREACHED(); + return; + } + if (params.result() == PP_OK) { + *proxy_string_out_param = (new StringVar(proxy_string))->GetPPVar(); + } + callback->Run(params.result()); +} + +} // namespace proxy +} // namespace ppapi diff --git a/ppapi/proxy/network_proxy_resource.h b/ppapi/proxy/network_proxy_resource.h new file mode 100644 index 0000000000..f2084ab3fd --- /dev/null +++ b/ppapi/proxy/network_proxy_resource.h @@ -0,0 +1,45 @@ +// Copyright (c) 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. + +#ifndef PPAPI_PROXY_NETWORK_PROXY_RESOURCE_H_ +#define PPAPI_PROXY_NETWORK_PROXY_RESOURCE_H_ + +#include "ppapi/proxy/plugin_resource.h" +#include "ppapi/proxy/ppapi_proxy_export.h" +#include "ppapi/thunk/ppb_network_proxy_api.h" + +namespace ppapi { +namespace proxy { + +// The proxy-side resource for PPB_NetworkProxy. +class PPAPI_PROXY_EXPORT NetworkProxyResource + : public PluginResource, + public thunk::PPB_NetworkProxy_API { + public: + NetworkProxyResource(Connection connection, PP_Instance instance); + virtual ~NetworkProxyResource(); + + private: + // Resource implementation. + virtual thunk::PPB_NetworkProxy_API* AsPPB_NetworkProxy_API() OVERRIDE; + + // PPB_NetworkProxy_API implementation. + virtual int32_t GetProxyForURL( + PP_Instance instance, + PP_Var url, + PP_Var* proxy_string, + scoped_refptr<TrackedCallback> callback) OVERRIDE; + + void OnPluginMsgGetProxyForURLReply(PP_Var* proxy_string_out_param, + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params, + const std::string& proxy_string); + + DISALLOW_COPY_AND_ASSIGN(NetworkProxyResource); +}; + +} // namespace proxy +} // namespace ppapi + +#endif // PPAPI_PROXY_NETWORK_PROXY_RESOURCE_H_ diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc index 770ebd209d..df59af9ee4 100644 --- a/ppapi/proxy/plugin_main_nacl.cc +++ b/ppapi/proxy/plugin_main_nacl.cc @@ -108,7 +108,8 @@ PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop) // NaCl sandbox. InitWithChannel(this, base::kNullProcessId, channel_handle, false); // Channel is server. - channel()->AddFilter(new tracing::ChildTraceMessageFilter(message_loop_)); + channel()->AddFilter( + new tracing::ChildTraceMessageFilter(message_loop_.get())); } base::MessageLoopProxy* PpapiDispatcher::GetIPCMessageLoop() { @@ -190,12 +191,9 @@ void PpapiDispatcher::OnMsgCreateNaClChannel( CommandLine::ForCurrentProcess()->AppendSwitchASCII( args.switch_names[i], args.switch_values[i]); } - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::LoggingSettings settings; + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + logging::InitLogging(settings); command_line_and_logging_initialized = true; } // Tell the process-global GetInterface which interfaces it can return to the diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 99691f0e64..83176bc7a3 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -36,14 +36,14 @@ #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/ppb_udp_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" #include "ppapi/c/private/ppb_host_resolver_private.h" #include "ppapi/c/private/ppb_net_address_private.h" #include "ppapi/c/private/ppb_pdf.h" -#include "ppapi/c/private/ppb_tcp_socket_private.h" -#include "ppapi/c/private/ppb_udp_socket_private.h" #include "ppapi/c/private/ppp_flash_browser_operations.h" #include "ppapi/c/private/ppb_talk_private.h" #include "ppapi/proxy/host_resolver_private_resource.h" @@ -56,6 +56,7 @@ #include "ppapi/proxy/serialized_var.h" #include "ppapi/shared_impl/dir_contents.h" #include "ppapi/shared_impl/file_path.h" +#include "ppapi/shared_impl/file_ref_create_info.h" #include "ppapi/shared_impl/ppapi_nacl_channel_args.h" #include "ppapi/shared_impl/ppapi_preferences.h" #include "ppapi/shared_impl/ppb_device_ref_shared.h" @@ -64,6 +65,7 @@ #include "ppapi/shared_impl/ppb_view_shared.h" #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h" #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h" +#include "ppapi/shared_impl/socket_option_data.h" #include "ppapi/shared_impl/url_request_info_data.h" #include "ppapi/shared_impl/url_response_info_data.h" @@ -83,7 +85,8 @@ IPC_ENUM_TRAITS(PP_FlashSetting) IPC_ENUM_TRAITS(PP_ImageDataFormat) IPC_ENUM_TRAITS(PP_InputEvent_MouseButton) IPC_ENUM_TRAITS(PP_InputEvent_Type) -IPC_ENUM_TRAITS(PP_NetAddressFamily_Private) +IPC_ENUM_TRAITS_MAX_VALUE(PP_NetAddressFamily_Private, + PP_NETADDRESSFAMILY_PRIVATE_IPV6) IPC_ENUM_TRAITS(PP_NetworkListState_Private) IPC_ENUM_TRAITS(PP_NetworkListType_Private) IPC_ENUM_TRAITS(PP_PrintOrientation_Dev) @@ -95,12 +98,16 @@ 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, + PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE) IPC_ENUM_TRAITS(PP_TextInput_Type) IPC_ENUM_TRAITS(PP_TrueTypeFontFamily_Dev) IPC_ENUM_TRAITS(PP_TrueTypeFontStyle_Dev) IPC_ENUM_TRAITS(PP_TrueTypeFontWeight_Dev) IPC_ENUM_TRAITS(PP_TrueTypeFontWidth_Dev) IPC_ENUM_TRAITS(PP_TrueTypeFontCharset_Dev) +IPC_ENUM_TRAITS_MAX_VALUE(PP_UDPSocket_Option, + PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE) IPC_ENUM_TRAITS(PP_VideoDecodeError_Dev) IPC_ENUM_TRAITS(PP_VideoDecoder_Profile) @@ -198,7 +205,6 @@ IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(ppapi::FileRef_CreateInfo) IPC_STRUCT_TRAITS_MEMBER(file_system_type) IPC_STRUCT_TRAITS_MEMBER(internal_path) - IPC_STRUCT_TRAITS_MEMBER(external_path) IPC_STRUCT_TRAITS_MEMBER(display_name) IPC_STRUCT_TRAITS_MEMBER(pending_host_resource_id) IPC_STRUCT_TRAITS_MEMBER(file_system_plugin_resource) @@ -697,11 +703,11 @@ IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_DecryptAndDecode, std::string /* serialized_block_info */) #endif // !defined(OS_NACL) && !defined(NACL_WIN64) -// PPB_TCPSocket_Private. +// PPB_TCPSocket and PPB_TCPSocket_Private. IPC_MESSAGE_ROUTED5(PpapiMsg_PPBTCPSocket_ConnectACK, uint32 /* plugin_dispatcher_id */, uint32 /* socket_id */, - bool /* succeeded */, + int32_t /* result */, PP_NetAddress_Private /* local_addr */, PP_NetAddress_Private /* remote_addr */) IPC_MESSAGE_ROUTED4(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, @@ -712,17 +718,16 @@ IPC_MESSAGE_ROUTED4(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, IPC_MESSAGE_ROUTED4(PpapiMsg_PPBTCPSocket_ReadACK, uint32 /* plugin_dispatcher_id */, uint32 /* socket_id */, - bool /* succeeded */, + int32_t /* result */, std::string /* data */) -IPC_MESSAGE_ROUTED4(PpapiMsg_PPBTCPSocket_WriteACK, +IPC_MESSAGE_ROUTED3(PpapiMsg_PPBTCPSocket_WriteACK, uint32 /* plugin_dispatcher_id */, uint32 /* socket_id */, - bool /* succeeded */, - int32_t /* bytes_written */) -IPC_MESSAGE_ROUTED3(PpapiMsg_PPBTCPSocket_SetBoolOptionACK, + int32_t /* result */) +IPC_MESSAGE_ROUTED3(PpapiMsg_PPBTCPSocket_SetOptionACK, uint32 /* plugin_dispatcher_id */, uint32 /* socket_id */, - bool /* succeeded */) + int32_t /* result */) // PPB_TCPServerSocket_Private. @@ -1182,11 +1187,17 @@ IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBFlashMessageLoop_Quit, ppapi::HostResource /* flash_message_loop */) #endif // !defined(OS_NACL) && !defined(NACL_WIN64) -// PPB_TCPSocket_Private. +// PPB_TCPSocket and PPB_TCPSocket_Private. +// Creates a PPB_TCPSocket resource. IPC_SYNC_MESSAGE_CONTROL2_1(PpapiHostMsg_PPBTCPSocket_Create, int32 /* routing_id */, uint32 /* plugin_dispatcher_id */, uint32 /* socket_id */) +// Creates a PPB_TCPSocket_Private resource. +IPC_SYNC_MESSAGE_CONTROL2_1(PpapiHostMsg_PPBTCPSocket_CreatePrivate, + int32 /* routing_id */, + uint32 /* plugin_dispatcher_id */, + uint32 /* socket_id */) IPC_MESSAGE_CONTROL4(PpapiHostMsg_PPBTCPSocket_Connect, int32 /* routing_id */, uint32 /* socket_id */, @@ -1210,31 +1221,10 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_PPBTCPSocket_Write, std::string /* data */) IPC_MESSAGE_CONTROL1(PpapiHostMsg_PPBTCPSocket_Disconnect, uint32 /* socket_id */) -IPC_MESSAGE_CONTROL3(PpapiHostMsg_PPBTCPSocket_SetBoolOption, +IPC_MESSAGE_CONTROL3(PpapiHostMsg_PPBTCPSocket_SetOption, uint32 /* socket_id */, - uint32 /* name */, - bool /* value */) - -// UDPSocketPrivate. -IPC_MESSAGE_CONTROL0(PpapiHostMsg_UDPSocketPrivate_Create) -IPC_MESSAGE_CONTROL2(PpapiHostMsg_UDPSocketPrivate_SetBoolSocketFeature, - int32_t /* name */, - bool /* value */) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_UDPSocketPrivate_Bind, - PP_NetAddress_Private /* net_addr */) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_UDPSocketPrivate_RecvFrom, - int32_t /* num_bytes */) -IPC_MESSAGE_CONTROL2(PpapiHostMsg_UDPSocketPrivate_SendTo, - std::string /* data */, - PP_NetAddress_Private /* net_addr */) -IPC_MESSAGE_CONTROL0(PpapiHostMsg_UDPSocketPrivate_Close) -IPC_MESSAGE_CONTROL1(PpapiPluginMsg_UDPSocketPrivate_BindReply, - PP_NetAddress_Private /* bound_addr */) -IPC_MESSAGE_CONTROL2(PpapiPluginMsg_UDPSocketPrivate_RecvFromReply, - std::string /* data */, - PP_NetAddress_Private /* remote_addr */) -IPC_MESSAGE_CONTROL1(PpapiPluginMsg_UDPSocketPrivate_SendToReply, - int32_t /* bytes_written */) + PP_TCPSocket_Option /* name */, + ppapi::SocketOptionData /* value */) // PPB_TCPServerSocket_Private. IPC_MESSAGE_CONTROL5(PpapiHostMsg_PPBTCPServerSocket_Listen, @@ -1536,6 +1526,17 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_ReadImageData, PP_Point /* top_left */) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Graphics2D_ReadImageDataAck) +// NetworkProxy ---------------------------------------------------------------- +IPC_MESSAGE_CONTROL0(PpapiHostMsg_NetworkProxy_Create) + +// Query the browser for the proxy server to use for the given URL. +IPC_MESSAGE_CONTROL1(PpapiHostMsg_NetworkProxy_GetProxyForURL, + std::string /* url */) + +// Reply message for GetProxyForURL containing the proxy server. +IPC_MESSAGE_CONTROL1(PpapiPluginMsg_NetworkProxy_GetProxyForURLReply, + std::string /* proxy */) + // TrueTypeFont. IPC_MESSAGE_CONTROL0(PpapiHostMsg_TrueTypeFontSingleton_Create) IPC_MESSAGE_CONTROL0(PpapiHostMsg_TrueTypeFontSingleton_GetFontFamilies) @@ -1561,12 +1562,22 @@ IPC_MESSAGE_CONTROL3(PpapiHostMsg_TrueTypeFont_GetTable, IPC_MESSAGE_CONTROL1(PpapiPluginMsg_TrueTypeFont_GetTableReply, std::string /* data */) -// HostResolverPrivate, plugin -> host -> plugin -IPC_MESSAGE_CONTROL0(PpapiHostMsg_HostResolverPrivate_Create) -IPC_MESSAGE_CONTROL2(PpapiHostMsg_HostResolverPrivate_Resolve, +// Host Resolver --------------------------------------------------------------- +// Creates a PPB_HostResolver resource. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_HostResolver_Create) + +// Creates a PPB_HostResolver_Private resource. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_HostResolver_CreatePrivate) + +// Resolves the given hostname. +IPC_MESSAGE_CONTROL2(PpapiHostMsg_HostResolver_Resolve, ppapi::HostPortPair /* host_port */, PP_HostResolver_Private_Hint /* hint */) -IPC_MESSAGE_CONTROL2(PpapiPluginMsg_HostResolverPrivate_ResolveReply, + +// This message is a reply to HostResolver_Resolve. On success, +// |canonical_name| contains the canonical name of the host; |net_address_list| +// is a list of network addresses. On failure, both fields are set to empty. +IPC_MESSAGE_CONTROL2(PpapiPluginMsg_HostResolver_ResolveReply, std::string /* canonical_name */, std::vector<PP_NetAddress_Private> /* net_address_list */) @@ -1576,6 +1587,33 @@ IPC_MESSAGE_CONTROL0(PpapiHostMsg_Printing_GetDefaultPrintSettings) IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply, PP_PrintSettings_Dev /* print_settings */) +// UDP Socket ------------------------------------------------------------------ +// Creates a PPB_UDPSocket resource. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_UDPSocket_Create) + +// Creates a PPB_UDPSocket_Private resource. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_UDPSocket_CreatePrivate) + +IPC_MESSAGE_CONTROL2(PpapiHostMsg_UDPSocket_SetOption, + PP_UDPSocket_Option /* name */, + ppapi::SocketOptionData /* value */) +IPC_MESSAGE_CONTROL0(PpapiPluginMsg_UDPSocket_SetOptionReply) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_UDPSocket_Bind, + PP_NetAddress_Private /* net_addr */) +IPC_MESSAGE_CONTROL1(PpapiPluginMsg_UDPSocket_BindReply, + PP_NetAddress_Private /* bound_addr */) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_UDPSocket_RecvFrom, + int32_t /* num_bytes */) +IPC_MESSAGE_CONTROL2(PpapiPluginMsg_UDPSocket_RecvFromReply, + std::string /* data */, + PP_NetAddress_Private /* remote_addr */) +IPC_MESSAGE_CONTROL2(PpapiHostMsg_UDPSocket_SendTo, + std::string /* data */, + PP_NetAddress_Private /* net_addr */) +IPC_MESSAGE_CONTROL1(PpapiPluginMsg_UDPSocket_SendToReply, + int32_t /* bytes_written */) +IPC_MESSAGE_CONTROL0(PpapiHostMsg_UDPSocket_Close) + // URLLoader ------------------------------------------------------------------ IPC_MESSAGE_CONTROL0(PpapiHostMsg_URLLoader_Create) @@ -1643,6 +1681,30 @@ IPC_SYNC_MESSAGE_CONTROL2_2(PpapiHostMsg_SharedMemory_CreateSharedMemory, int /* host_handle_id */, ppapi::proxy::SerializedHandle /* plugin_handle */) +// MediaStream ----------------------------------------------------------------- + +// VideoDestination Private. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoDestination_Create) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_VideoDestination_Open, + std::string /* stream_url */) +IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoDestination_OpenReply) +IPC_MESSAGE_CONTROL2(PpapiHostMsg_VideoDestination_PutFrame, + ppapi::HostResource /* image_data */, + PP_TimeTicks /* timestamp */) +IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoDestination_Close) + +// VideoSource Private. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_Create) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_VideoSource_Open, + std::string /* stream_url */) +IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoSource_OpenReply) +IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_GetFrame) +IPC_MESSAGE_CONTROL3(PpapiPluginMsg_VideoSource_GetFrameReply, + ppapi::HostResource /* resource_id */, + PP_ImageDataDesc /* image_data_desc */, + PP_TimeTicks /* timestamp */) +IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_Close) + // WebSocket ------------------------------------------------------------------- IPC_MESSAGE_CONTROL0(PpapiHostMsg_WebSocket_Create) @@ -1979,29 +2041,4 @@ IPC_MESSAGE_CONTROL0(PpapiHostMsg_Talk_StopRemoting) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Talk_StopRemotingReply) IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Talk_NotifyEvent, PP_TalkEvent /* event */) -// MediaStream ----------------------------------------------------------------- - -// VideoDestination Private. -IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoDestination_Create) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_VideoDestination_Open, - std::string /* stream_url */) -IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoDestination_OpenReply) -IPC_MESSAGE_CONTROL2(PpapiHostMsg_VideoDestination_PutFrame, - ppapi::HostResource /* image_data */, - PP_TimeTicks /* timestamp */) -IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoDestination_Close) - -// VideoSource Private. -IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_Create) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_VideoSource_Open, - std::string /* stream_url */) -IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoSource_OpenReply) -IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_GetFrame) -IPC_MESSAGE_CONTROL4(PpapiPluginMsg_VideoSource_GetFrameReply, - ppapi::HostResource /* resource_id */, - PP_ImageDataDesc /* image_data_desc */, - int /* fd */, - PP_TimeTicks /* timestamp */) -IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_Close) - #endif // !defined(OS_NACL) && !defined(NACL_WIN64) diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc index 564eaccef5..ca25f82f25 100644 --- a/ppapi/proxy/ppapi_param_traits.cc +++ b/ppapi/proxy/ppapi_param_traits.cc @@ -646,14 +646,14 @@ void ParamTraits<ppapi::proxy::SerializedFlashMenu>::Log(const param_type& p, void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Write( Message* m, const param_type& p) { - ParamTraits<ListValue>::Write(m, p.values_); + ParamTraits<base::ListValue>::Write(m, p.values_); } // static bool ParamTraits<ppapi::PPB_X509Certificate_Fields>::Read(const Message* m, PickleIterator* iter, param_type* r) { - return ParamTraits<ListValue>::Read(m, iter, &(r->values_)); + return ParamTraits<base::ListValue>::Read(m, iter, &(r->values_)); } // static @@ -661,4 +661,80 @@ void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Log(const param_type& p, std::string* l) { } +// ppapi::SocketOptionData ----------------------------------------------------- + +// static +void ParamTraits<ppapi::SocketOptionData>::Write(Message* m, + const param_type& p) { + ppapi::SocketOptionData::Type type = p.GetType(); + ParamTraits<int32_t>::Write(m, static_cast<int32_t>(type)); + switch (type) { + case ppapi::SocketOptionData::TYPE_INVALID: { + break; + } + case ppapi::SocketOptionData::TYPE_BOOL: { + bool out_value = false; + bool result = p.GetBool(&out_value); + // Suppress unused variable warnings. + static_cast<void>(result); + DCHECK(result); + + ParamTraits<bool>::Write(m, out_value); + break; + } + case ppapi::SocketOptionData::TYPE_INT32: { + int32_t out_value = 0; + bool result = p.GetInt32(&out_value); + // Suppress unused variable warnings. + static_cast<void>(result); + DCHECK(result); + + ParamTraits<int32_t>::Write(m, out_value); + break; + } + // No default so the compiler will warn on new types. + } +} + +// static +bool ParamTraits<ppapi::SocketOptionData>::Read(const Message* m, + PickleIterator* iter, + param_type* r) { + *r = ppapi::SocketOptionData(); + int32_t type = 0; + if (!ParamTraits<int32_t>::Read(m, iter, &type)) + return false; + if (type != ppapi::SocketOptionData::TYPE_INVALID && + type != ppapi::SocketOptionData::TYPE_BOOL && + type != ppapi::SocketOptionData::TYPE_INT32) { + return false; + } + switch (static_cast<ppapi::SocketOptionData::Type>(type)) { + case ppapi::SocketOptionData::TYPE_INVALID: { + return true; + } + case ppapi::SocketOptionData::TYPE_BOOL: { + bool value = false; + if (!ParamTraits<bool>::Read(m, iter, &value)) + return false; + r->SetBool(value); + return true; + } + case ppapi::SocketOptionData::TYPE_INT32: { + int32_t value = 0; + if (!ParamTraits<int32_t>::Read(m, iter, &value)) + return false; + r->SetInt32(value); + return true; + } + // No default so the compiler will warn on new types. + } + return false; +} + +// static +void ParamTraits<ppapi::SocketOptionData>::Log(const param_type& p, + std::string* l) { +} + } // namespace IPC diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h index 95a64f18a9..f56415a869 100644 --- a/ppapi/proxy/ppapi_param_traits.h +++ b/ppapi/proxy/ppapi_param_traits.h @@ -18,6 +18,7 @@ #include "ppapi/shared_impl/file_ref_create_info.h" #include "ppapi/shared_impl/ppapi_permissions.h" #include "ppapi/shared_impl/ppb_file_ref_shared.h" +#include "ppapi/shared_impl/socket_option_data.h" struct PP_FileInfo; struct PP_NetAddress_Private; @@ -195,6 +196,13 @@ struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PPB_X509Certificate_Fields> { static void Log(const param_type& p, std::string* l); }; +template<> +struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::SocketOptionData> { + typedef ppapi::SocketOptionData param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, PickleIterator* iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; } // namespace IPC diff --git a/ppapi/proxy/ppb_core_proxy.cc b/ppapi/proxy/ppb_core_proxy.cc index 0c5f87ecec..1cc9671c4f 100644 --- a/ppapi/proxy/ppb_core_proxy.cc +++ b/ppapi/proxy/ppb_core_proxy.cc @@ -9,7 +9,7 @@ #include "base/bind.h" #include "base/debug/trace_event.h" #include "base/logging.h" -#include "base/time.h" +#include "base/time/time.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/ppb_core.h" diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc index ce7d548f9a..ab61c7befb 100644 --- a/ppapi/proxy/ppb_image_data_proxy.cc +++ b/ppapi/proxy/ppb_image_data_proxy.cc @@ -570,13 +570,26 @@ PP_Resource PPB_ImageData_Proxy::CreateImageData( return 0; PP_Bool pp_init_to_zero = init_to_zero ? PP_TRUE : PP_FALSE; - ppapi::ScopedPPResource resource( - ppapi::ScopedPPResource::PassRef(), - enter.functions()->CreateImageData(instance, type, - format, &size, pp_init_to_zero)); - if (!resource.get()) + PP_Resource pp_resource = 0; + switch (type) { + case PPB_ImageData_Shared::SIMPLE: { + pp_resource = enter.functions()->CreateImageDataSimple( + instance, format, &size, pp_init_to_zero); + break; + } + case PPB_ImageData_Shared::PLATFORM: { + pp_resource = enter.functions()->CreateImageData( + instance, format, &size, pp_init_to_zero); + break; + } + } + + if (!pp_resource) return 0; + ppapi::ScopedPPResource resource(ppapi::ScopedPPResource::PassRef(), + pp_resource); + thunk::EnterResourceNoLock<PPB_ImageData_API> enter_resource(resource.get(), false); if (enter_resource.object()->Describe(desc) != PP_TRUE) { diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index e3948f06aa..20b93649ec 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -26,6 +26,7 @@ #include "ppapi/proxy/flash_resource.h" #include "ppapi/proxy/gamepad_resource.h" #include "ppapi/proxy/host_dispatcher.h" +#include "ppapi/proxy/network_proxy_resource.h" #include "ppapi/proxy/pdf_resource.h" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/ppapi_messages.h" @@ -370,18 +371,21 @@ Resource* PPB_Instance_Proxy::GetSingletonResource(PP_Instance instance, case BROKER_SINGLETON_ID: new_singleton = new BrokerResource(connection, instance); break; + case CRX_FILESYSTEM_SINGLETON_ID: + new_singleton = new ExtCrxFileSystemPrivateResource(connection, instance); + break; case EXTENSIONS_COMMON_SINGLETON_ID: new_singleton = new ExtensionsCommonResource(connection, instance); break; case GAMEPAD_SINGLETON_ID: new_singleton = new GamepadResource(connection, instance); break; + case NETWORK_PROXY_SINGLETON_ID: + new_singleton = new NetworkProxyResource(connection, instance); + break; case TRUETYPE_FONT_SINGLETON_ID: new_singleton = new TrueTypeFontSingletonResource(connection, instance); break; - case CRX_FILESYSTEM_SINGLETON_ID: - new_singleton = new ExtCrxFileSystemPrivateResource(connection, instance); - break; // Flash/trusted resources aren't needed for NaCl. #if !defined(OS_NACL) && !defined(NACL_WIN64) case BROWSER_FONT_SINGLETON_ID: diff --git a/ppapi/proxy/ppb_tcp_socket_private_proxy.cc b/ppapi/proxy/ppb_tcp_socket_private_proxy.cc index 7f7fb7896a..58199fd140 100644 --- a/ppapi/proxy/ppb_tcp_socket_private_proxy.cc +++ b/ppapi/proxy/ppb_tcp_socket_private_proxy.cc @@ -14,6 +14,7 @@ #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h" #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" #include "ppapi/shared_impl/resource.h" +#include "ppapi/shared_impl/socket_option_data.h" #include "ppapi/thunk/thunk.h" namespace ppapi { @@ -46,8 +47,8 @@ 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 SendSetBoolOption(PP_TCPSocketOption_Private name, - bool value) OVERRIDE; + virtual void SendSetOption(PP_TCPSocket_Option name, + const SocketOptionData& value) OVERRIDE; private: void SendToBrowser(IPC::Message* msg); @@ -118,9 +119,10 @@ void TCPSocket::SendDisconnect() { SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id_)); } -void TCPSocket::SendSetBoolOption(PP_TCPSocketOption_Private name, bool value) { +void TCPSocket::SendSetOption(PP_TCPSocket_Option name, + const SocketOptionData& value) { SendToBrowser( - new PpapiHostMsg_PPBTCPSocket_SetBoolOption(socket_id_, name, value)); + new PpapiHostMsg_PPBTCPSocket_SetOption(socket_id_, name, value)); } void TCPSocket::SendToBrowser(IPC::Message* msg) { @@ -147,7 +149,7 @@ PP_Resource PPB_TCPSocket_Private_Proxy::CreateProxyResource( uint32 socket_id = 0; PluginGlobals::Get()->GetBrowserSender()->Send( - new PpapiHostMsg_PPBTCPSocket_Create( + new PpapiHostMsg_PPBTCPSocket_CreatePrivate( API_ID_PPB_TCPSOCKET_PRIVATE, dispatcher->plugin_dispatcher_id(), &socket_id)); if (socket_id == 0) @@ -177,8 +179,7 @@ bool PPB_TCPSocket_Private_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgSSLHandshakeACK) IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnMsgReadACK) IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnMsgWriteACK) - IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetBoolOptionACK, - OnMsgSetBoolOptionACK) + IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetOptionACK, OnMsgSetOptionACK) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -187,7 +188,7 @@ bool PPB_TCPSocket_Private_Proxy::OnMessageReceived(const IPC::Message& msg) { void PPB_TCPSocket_Private_Proxy::OnMsgConnectACK( uint32 /* plugin_dispatcher_id */, uint32 socket_id, - bool succeeded, + int32_t result, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr) { if (!g_id_to_socket) { @@ -197,7 +198,7 @@ void PPB_TCPSocket_Private_Proxy::OnMsgConnectACK( IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); if (iter == g_id_to_socket->end()) return; - iter->second->OnConnectCompleted(succeeded, local_addr, remote_addr); + iter->second->OnConnectCompleted(result, local_addr, remote_addr); } void PPB_TCPSocket_Private_Proxy::OnMsgSSLHandshakeACK( @@ -218,7 +219,7 @@ void PPB_TCPSocket_Private_Proxy::OnMsgSSLHandshakeACK( void PPB_TCPSocket_Private_Proxy::OnMsgReadACK( uint32 /* plugin_dispatcher_id */, uint32 socket_id, - bool succeeded, + int32_t result, const std::string& data) { if (!g_id_to_socket) { NOTREACHED(); @@ -227,14 +228,13 @@ void PPB_TCPSocket_Private_Proxy::OnMsgReadACK( IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); if (iter == g_id_to_socket->end()) return; - iter->second->OnReadCompleted(succeeded, data); + iter->second->OnReadCompleted(result, data); } void PPB_TCPSocket_Private_Proxy::OnMsgWriteACK( uint32 /* plugin_dispatcher_id */, uint32 socket_id, - bool succeeded, - int32_t bytes_written) { + int32_t result) { if (!g_id_to_socket) { NOTREACHED(); return; @@ -242,13 +242,13 @@ void PPB_TCPSocket_Private_Proxy::OnMsgWriteACK( IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); if (iter == g_id_to_socket->end()) return; - iter->second->OnWriteCompleted(succeeded, bytes_written); + iter->second->OnWriteCompleted(result); } -void PPB_TCPSocket_Private_Proxy::OnMsgSetBoolOptionACK( +void PPB_TCPSocket_Private_Proxy::OnMsgSetOptionACK( uint32 /* plugin_dispatcher_id */, uint32 socket_id, - bool succeeded) { + int32_t result) { if (!g_id_to_socket) { NOTREACHED(); return; @@ -256,7 +256,7 @@ void PPB_TCPSocket_Private_Proxy::OnMsgSetBoolOptionACK( IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); if (iter == g_id_to_socket->end()) return; - iter->second->OnSetOptionCompleted(succeeded); + iter->second->OnSetOptionCompleted(result); } } // namespace proxy diff --git a/ppapi/proxy/ppb_tcp_socket_private_proxy.h b/ppapi/proxy/ppb_tcp_socket_private_proxy.h index 6f0f0f42be..0813531a00 100644 --- a/ppapi/proxy/ppb_tcp_socket_private_proxy.h +++ b/ppapi/proxy/ppb_tcp_socket_private_proxy.h @@ -41,7 +41,7 @@ class PPB_TCPSocket_Private_Proxy : public InterfaceProxy { // Browser->plugin message handlers. void OnMsgConnectACK(uint32 plugin_dispatcher_id, uint32 socket_id, - bool succeeded, + int32_t result, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr); void OnMsgSSLHandshakeACK( @@ -51,15 +51,14 @@ class PPB_TCPSocket_Private_Proxy : public InterfaceProxy { const PPB_X509Certificate_Fields& certificate_fields); void OnMsgReadACK(uint32 plugin_dispatcher_id, uint32 socket_id, - bool succeeded, + int32_t result, const std::string& data); void OnMsgWriteACK(uint32 plugin_dispatcher_id, uint32 socket_id, - bool succeeded, - int32_t bytes_written); - void OnMsgSetBoolOptionACK(uint32 plugin_dispatcher_id, - uint32 socket_id, - bool succeeded); + int32_t result); + void OnMsgSetOptionACK(uint32 plugin_dispatcher_id, + uint32 socket_id, + int32_t result); DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Private_Proxy); }; diff --git a/ppapi/proxy/ppb_tcp_socket_proxy.cc b/ppapi/proxy/ppb_tcp_socket_proxy.cc index 1b6bd8a8e4..2ec1660330 100644 --- a/ppapi/proxy/ppb_tcp_socket_proxy.cc +++ b/ppapi/proxy/ppb_tcp_socket_proxy.cc @@ -11,6 +11,7 @@ #include "ppapi/proxy/plugin_globals.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/shared_impl/resource.h" +#include "ppapi/shared_impl/socket_option_data.h" #include "ppapi/shared_impl/tcp_socket_shared.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_net_address_api.h" @@ -50,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; @@ -66,8 +67,8 @@ 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 SendSetBoolOption(PP_TCPSocketOption_Private name, - bool value) OVERRIDE; + virtual void SendSetOption(PP_TCPSocket_Option name, + const SocketOptionData& value) OVERRIDE; virtual Resource* GetOwnerResource() OVERRIDE; private: @@ -143,14 +144,10 @@ 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) { - // TODO(yzshen): Add support for other options. - if (name == PP_TCPSOCKET_OPTION_NO_DELAY) - return SetOptionImpl(PP_TCPSOCKETOPTION_NO_DELAY, value, callback); - - return PP_ERROR_NOTSUPPORTED; + return SetOptionImpl(name, value, callback); } void TCPSocket::SendConnect(const std::string& host, uint16_t port) { @@ -186,9 +183,10 @@ void TCPSocket::SendDisconnect() { SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id_)); } -void TCPSocket::SendSetBoolOption(PP_TCPSocketOption_Private name, bool value) { +void TCPSocket::SendSetOption(PP_TCPSocket_Option name, + const SocketOptionData& value) { SendToBrowser( - new PpapiHostMsg_PPBTCPSocket_SetBoolOption(socket_id_, name, value)); + new PpapiHostMsg_PPBTCPSocket_SetOption(socket_id_, name, value)); } Resource* TCPSocket::GetOwnerResource() { @@ -234,8 +232,8 @@ bool PPB_TCPSocket_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgConnectACK) IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnMsgReadACK) IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnMsgWriteACK) - IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetBoolOptionACK, - OnMsgSetBoolOptionACK) + IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetOptionACK, + OnMsgSetOptionACK) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -244,7 +242,7 @@ bool PPB_TCPSocket_Proxy::OnMessageReceived(const IPC::Message& msg) { void PPB_TCPSocket_Proxy::OnMsgConnectACK( uint32 /* plugin_dispatcher_id */, uint32 socket_id, - bool succeeded, + int32_t result, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr) { if (!g_id_to_socket) { @@ -254,12 +252,12 @@ void PPB_TCPSocket_Proxy::OnMsgConnectACK( IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); if (iter == g_id_to_socket->end()) return; - iter->second->OnConnectCompleted(succeeded, local_addr, remote_addr); + iter->second->OnConnectCompleted(result, local_addr, remote_addr); } void PPB_TCPSocket_Proxy::OnMsgReadACK(uint32 /* plugin_dispatcher_id */, uint32 socket_id, - bool succeeded, + int32_t result, const std::string& data) { if (!g_id_to_socket) { NOTREACHED(); @@ -268,13 +266,12 @@ void PPB_TCPSocket_Proxy::OnMsgReadACK(uint32 /* plugin_dispatcher_id */, IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); if (iter == g_id_to_socket->end()) return; - iter->second->OnReadCompleted(succeeded, data); + iter->second->OnReadCompleted(result, data); } void PPB_TCPSocket_Proxy::OnMsgWriteACK(uint32 /* plugin_dispatcher_id */, uint32 socket_id, - bool succeeded, - int32_t bytes_written) { + int32_t result) { if (!g_id_to_socket) { NOTREACHED(); return; @@ -282,13 +279,12 @@ void PPB_TCPSocket_Proxy::OnMsgWriteACK(uint32 /* plugin_dispatcher_id */, IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); if (iter == g_id_to_socket->end()) return; - iter->second->OnWriteCompleted(succeeded, bytes_written); + iter->second->OnWriteCompleted(result); } -void PPB_TCPSocket_Proxy::OnMsgSetBoolOptionACK( - uint32 /* plugin_dispatcher_id */, - uint32 socket_id, - bool succeeded) { +void PPB_TCPSocket_Proxy::OnMsgSetOptionACK(uint32 /* plugin_dispatcher_id */, + uint32 socket_id, + int32_t result) { if (!g_id_to_socket) { NOTREACHED(); return; @@ -296,7 +292,7 @@ void PPB_TCPSocket_Proxy::OnMsgSetBoolOptionACK( IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); if (iter == g_id_to_socket->end()) return; - iter->second->OnSetOptionCompleted(succeeded); + iter->second->OnSetOptionCompleted(result); } } // namespace proxy diff --git a/ppapi/proxy/ppb_tcp_socket_proxy.h b/ppapi/proxy/ppb_tcp_socket_proxy.h index 35314a3085..c5a3de8c72 100644 --- a/ppapi/proxy/ppb_tcp_socket_proxy.h +++ b/ppapi/proxy/ppb_tcp_socket_proxy.h @@ -34,20 +34,19 @@ class PPB_TCPSocket_Proxy : public InterfaceProxy { // Browser->plugin message handlers. void OnMsgConnectACK(uint32 plugin_dispatcher_id, uint32 socket_id, - bool succeeded, + int32_t result, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr); void OnMsgReadACK(uint32 plugin_dispatcher_id, uint32 socket_id, - bool succeeded, + int32_t result, const std::string& data); void OnMsgWriteACK(uint32 plugin_dispatcher_id, uint32 socket_id, - bool succeeded, - int32_t bytes_written); - void OnMsgSetBoolOptionACK(uint32 plugin_dispatcher_id, - uint32 socket_id, - bool succeeded); + int32_t result); + void OnMsgSetOptionACK(uint32 plugin_dispatcher_id, + uint32 socket_id, + int32_t result); DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Proxy); }; diff --git a/ppapi/proxy/ppp_instance_private_proxy_unittest.cc b/ppapi/proxy/ppp_instance_private_proxy_unittest.cc index 317f4d4b7f..04aa6abd47 100644 --- a/ppapi/proxy/ppp_instance_private_proxy_unittest.cc +++ b/ppapi/proxy/ppp_instance_private_proxy_unittest.cc @@ -5,7 +5,7 @@ #include "base/bind.h" #include "base/message_loop.h" #include "base/test/test_timeouts.h" -#include "base/time.h" +#include "base/time/time.h" #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/dev/ppp_class_deprecated.h" #include "ppapi/c/pp_var.h" diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index d91f30db33..337d620e9b 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -263,24 +263,43 @@ PP_Resource ResourceCreationProxy::CreateHostResolverPrivate( PP_Resource ResourceCreationProxy::CreateImageData( PP_Instance instance, - PPB_ImageData_Shared::ImageDataType type, PP_ImageDataFormat format, const PP_Size* size, PP_Bool init_to_zero) { - return PPB_ImageData_Proxy::CreateProxyResource(instance, type, - format, *size, init_to_zero); + // On the plugin side, we create PlatformImageData resources for trusted + // plugins and SimpleImageData resources for untrusted ones. + PPB_ImageData_Shared::ImageDataType type = +#if !defined(OS_NACL) + PPB_ImageData_Shared::PLATFORM; +#else + PPB_ImageData_Shared::SIMPLE; +#endif + return PPB_ImageData_Proxy::CreateProxyResource( + instance, type, + format, *size, init_to_zero); +} + +PP_Resource ResourceCreationProxy::CreateImageDataSimple( + PP_Instance instance, + PP_ImageDataFormat format, + const PP_Size* size, + PP_Bool init_to_zero) { + return PPB_ImageData_Proxy::CreateProxyResource( + instance, + PPB_ImageData_Shared::SIMPLE, + format, *size, init_to_zero); } PP_Resource ResourceCreationProxy::CreateNetAddressFromIPv4Address( PP_Instance instance, - const PP_NetAddress_IPv4_Dev* ipv4_addr) { + const PP_NetAddress_IPv4* ipv4_addr) { return (new NetAddressResource(GetConnection(), instance, *ipv4_addr))->GetReference(); } PP_Resource ResourceCreationProxy::CreateNetAddressFromIPv6Address( PP_Instance instance, - const PP_NetAddress_IPv6_Dev* ipv6_addr) { + const PP_NetAddress_IPv6* ipv6_addr) { return (new NetAddressResource(GetConnection(), instance, *ipv6_addr))->GetReference(); } @@ -329,6 +348,17 @@ PP_Resource ResourceCreationProxy::CreateUDPSocketPrivate( GetConnection(), instance))->GetReference(); } +PP_Resource ResourceCreationProxy::CreateVideoDestination( + PP_Instance instance) { + return (new VideoDestinationResource(GetConnection(), + instance))->GetReference(); +} + +PP_Resource ResourceCreationProxy::CreateVideoSource( + PP_Instance instance) { + return (new VideoSourceResource(GetConnection(), instance))->GetReference(); +} + PP_Resource ResourceCreationProxy::CreateWebSocket(PP_Instance instance) { return (new WebSocketResource(GetConnection(), instance))->GetReference(); } @@ -418,17 +448,6 @@ PP_Resource ResourceCreationProxy::CreateVideoDecoder( instance, context3d_id, profile); } -PP_Resource ResourceCreationProxy::CreateVideoDestination( - PP_Instance instance) { - return (new VideoDestinationResource(GetConnection(), - instance))->GetReference(); -} - -PP_Resource ResourceCreationProxy::CreateVideoSource( - PP_Instance instance) { - return (new VideoSourceResource(GetConnection(), instance))->GetReference(); -} - #endif // !defined(OS_NACL) bool ResourceCreationProxy::Send(IPC::Message* msg) { diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h index 0ac2468a64..47b40a8392 100644 --- a/ppapi/proxy/resource_creation_proxy.h +++ b/ppapi/proxy/resource_creation_proxy.h @@ -119,16 +119,19 @@ class ResourceCreationProxy : public InterfaceProxy, virtual PP_Resource CreateHostResolver(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateHostResolverPrivate(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateImageData(PP_Instance instance, - PPB_ImageData_Shared::ImageDataType type, PP_ImageDataFormat format, const PP_Size* size, PP_Bool init_to_zero) OVERRIDE; + virtual PP_Resource CreateImageDataSimple(PP_Instance instance, + PP_ImageDataFormat format, + const PP_Size* size, + PP_Bool init_to_zero) OVERRIDE; virtual PP_Resource CreateNetAddressFromIPv4Address( PP_Instance instance, - const PP_NetAddress_IPv4_Dev* ipv4_addr) OVERRIDE; + const PP_NetAddress_IPv4* ipv4_addr) OVERRIDE; virtual PP_Resource CreateNetAddressFromIPv6Address( PP_Instance instance, - const PP_NetAddress_IPv6_Dev* ipv6_addr) OVERRIDE; + const PP_NetAddress_IPv6* ipv6_addr) OVERRIDE; virtual PP_Resource CreateNetAddressFromNetAddressPrivate( PP_Instance instance, const PP_NetAddress_Private& private_addr) OVERRIDE; @@ -143,6 +146,8 @@ class ResourceCreationProxy : public InterfaceProxy, virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateUDPSocket(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateUDPSocketPrivate(PP_Instance instance) OVERRIDE; + virtual PP_Resource CreateVideoDestination(PP_Instance instance) OVERRIDE; + virtual PP_Resource CreateVideoSource(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateWebSocket(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateX509CertificatePrivate( PP_Instance instance) OVERRIDE; @@ -170,8 +175,6 @@ class ResourceCreationProxy : public InterfaceProxy, PP_Instance instance, PP_Resource context3d_id, PP_VideoDecoder_Profile profile) OVERRIDE; - virtual PP_Resource CreateVideoDestination(PP_Instance instance) OVERRIDE; - virtual PP_Resource CreateVideoSource(PP_Instance instance) OVERRIDE; #endif // !defined(OS_NACL) virtual bool Send(IPC::Message* msg) OVERRIDE; diff --git a/ppapi/proxy/udp_socket_private_resource.cc b/ppapi/proxy/udp_socket_private_resource.cc index cd2333c9df..af43c10fb0 100644 --- a/ppapi/proxy/udp_socket_private_resource.cc +++ b/ppapi/proxy/udp_socket_private_resource.cc @@ -4,6 +4,8 @@ #include "ppapi/proxy/udp_socket_private_resource.h" +#include "base/logging.h" +#include "ppapi/c/ppb_udp_socket.h" #include "ppapi/shared_impl/tracked_callback.h" namespace ppapi { @@ -11,7 +13,7 @@ namespace proxy { UDPSocketPrivateResource::UDPSocketPrivateResource(Connection connection, PP_Instance instance) - : UDPSocketResourceBase(connection, instance) { + : UDPSocketResourceBase(connection, instance, true) { } UDPSocketPrivateResource::~UDPSocketPrivateResource() { @@ -25,7 +27,22 @@ UDPSocketPrivateResource::AsPPB_UDPSocket_Private_API() { int32_t UDPSocketPrivateResource::SetSocketFeature( PP_UDPSocketFeature_Private name, PP_Var value) { - return SetSocketFeatureImpl(name, value); + PP_UDPSocket_Option public_name = PP_UDPSOCKET_OPTION_ADDRESS_REUSE; + switch (name) { + case PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE: + // |public_name| has been initialized above. + break; + case PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST: + public_name = PP_UDPSOCKET_OPTION_BROADCAST; + break; + case PP_UDPSOCKETFEATURE_PRIVATE_COUNT: + return PP_ERROR_BADARGUMENT; + default: + NOTREACHED(); + return PP_ERROR_BADARGUMENT; + } + int32_t result = SetOptionImpl(public_name, value, NULL); + return result == PP_OK_COMPLETIONPENDING ? PP_OK : result; } int32_t UDPSocketPrivateResource::Bind( diff --git a/ppapi/proxy/udp_socket_resource.cc b/ppapi/proxy/udp_socket_resource.cc index 9a1dbd6c9b..9ce7c91f13 100644 --- a/ppapi/proxy/udp_socket_resource.cc +++ b/ppapi/proxy/udp_socket_resource.cc @@ -21,7 +21,7 @@ typedef thunk::EnterResourceNoLock<thunk::PPB_NetAddress_API> UDPSocketResource::UDPSocketResource(Connection connection, PP_Instance instance) - : UDPSocketResourceBase(connection, instance) { + : UDPSocketResourceBase(connection, instance, false) { } UDPSocketResource::~UDPSocketResource() { @@ -76,23 +76,10 @@ void UDPSocketResource::Close() { } int32_t UDPSocketResource::SetOption( - PP_UDPSocket_Option_Dev name, + PP_UDPSocket_Option name, const PP_Var& value, - scoped_refptr<TrackedCallback> /* callback */) { - // TODO(yzshen): Add support for other options. - PP_UDPSocketFeature_Private feature; - switch (name) { - case PP_UDPSOCKET_OPTION_ADDRESS_REUSE: - feature = PP_UDPSOCKETFEATURE_ADDRESS_REUSE; - break; - case PP_UDPSOCKET_OPTION_BROADCAST: - feature = PP_UDPSOCKETFEATURE_BROADCAST; - break; - default: - return PP_ERROR_NOTSUPPORTED; - } - - return SetSocketFeatureImpl(feature, value); + scoped_refptr<TrackedCallback> callback) { + return SetOptionImpl(name, value, callback); } } // namespace proxy diff --git a/ppapi/proxy/udp_socket_resource.h b/ppapi/proxy/udp_socket_resource.h index ac24187d85..7df9797fb0 100644 --- a/ppapi/proxy/udp_socket_resource.h +++ b/ppapi/proxy/udp_socket_resource.h @@ -36,7 +36,7 @@ class PPAPI_PROXY_EXPORT UDPSocketResource : public UDPSocketResourceBase, PP_Resource addr, scoped_refptr<TrackedCallback> callback) OVERRIDE; virtual void Close() OVERRIDE; - virtual int32_t SetOption(PP_UDPSocket_Option_Dev name, + virtual int32_t SetOption(PP_UDPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback) OVERRIDE; diff --git a/ppapi/proxy/udp_socket_resource_base.cc b/ppapi/proxy/udp_socket_resource_base.cc index 5d318902f3..166f2e3085 100644 --- a/ppapi/proxy/udp_socket_resource_base.cc +++ b/ppapi/proxy/udp_socket_resource_base.cc @@ -12,18 +12,43 @@ #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" #include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/shared_impl/socket_option_data.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/resource_creation_api.h" namespace ppapi { namespace proxy { +namespace { + +int32_t ConvertPPError(int32_t pp_error, bool private_api) { + // The private API doesn't return network-specific error codes or + // PP_ERROR_NOACCESS. In order to preserve the behavior, we convert those to + // PP_ERROR_FAILED. + if (private_api && + (pp_error <= PP_ERROR_CONNECTION_CLOSED || + pp_error == PP_ERROR_NOACCESS)) { + return PP_ERROR_FAILED; + } + + return pp_error; +} + +} // namespace + const int32_t UDPSocketResourceBase::kMaxReadSize = 1024 * 1024; const int32_t UDPSocketResourceBase::kMaxWriteSize = 1024 * 1024; +const int32_t UDPSocketResourceBase::kMaxSendBufferSize = + 1024 * UDPSocketResourceBase::kMaxWriteSize; +const int32_t UDPSocketResourceBase::kMaxReceiveBufferSize = + 1024 * UDPSocketResourceBase::kMaxReadSize; + UDPSocketResourceBase::UDPSocketResourceBase(Connection connection, - PP_Instance instance) + PP_Instance instance, + bool private_api) : PluginResource(connection, instance), + private_api_(private_api), bound_(false), closed_(false), read_buffer_(NULL), @@ -35,33 +60,55 @@ UDPSocketResourceBase::UDPSocketResourceBase(Connection connection, memset(bound_addr_.data, 0, arraysize(bound_addr_.data) * sizeof(*bound_addr_.data)); - SendCreate(BROWSER, PpapiHostMsg_UDPSocketPrivate_Create()); + if (private_api) + SendCreate(BROWSER, PpapiHostMsg_UDPSocket_CreatePrivate()); + else + SendCreate(BROWSER, PpapiHostMsg_UDPSocket_Create()); } UDPSocketResourceBase::~UDPSocketResourceBase() { } -int32_t UDPSocketResourceBase::SetSocketFeatureImpl( - PP_UDPSocketFeature_Private name, - const PP_Var& value) { - if (bound_ || closed_) +int32_t UDPSocketResourceBase::SetOptionImpl( + PP_UDPSocket_Option name, + const PP_Var& value, + scoped_refptr<TrackedCallback> callback) { + if (closed_) return PP_ERROR_FAILED; + SocketOptionData option_data; switch (name) { - case PP_UDPSOCKETFEATURE_ADDRESS_REUSE: - case PP_UDPSOCKETFEATURE_BROADCAST: { + case PP_UDPSOCKET_OPTION_ADDRESS_REUSE: + case PP_UDPSOCKET_OPTION_BROADCAST: { + if (bound_) + return PP_ERROR_FAILED; if (value.type != PP_VARTYPE_BOOL) return PP_ERROR_BADARGUMENT; - Post(BROWSER, - PpapiHostMsg_UDPSocketPrivate_SetBoolSocketFeature( - static_cast<int32_t>(name), PP_ToBool(value.value.as_bool))); + option_data.SetBool(PP_ToBool(value.value.as_bool)); + break; + } + case PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE: + case PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE: { + if (!bound_) + return PP_ERROR_FAILED; + if (value.type != PP_VARTYPE_INT32) + return PP_ERROR_BADARGUMENT; + option_data.SetInt32(value.value.as_int); break; } default: { + NOTREACHED(); return PP_ERROR_BADARGUMENT; } } - return PP_OK; + + Call<PpapiPluginMsg_UDPSocket_SetOptionReply>( + BROWSER, + PpapiHostMsg_UDPSocket_SetOption(name, option_data), + base::Bind(&UDPSocketResourceBase::OnPluginMsgSetOptionReply, + base::Unretained(this), + callback)); + return PP_OK_COMPLETIONPENDING; } int32_t UDPSocketResourceBase::BindImpl( @@ -77,9 +124,9 @@ int32_t UDPSocketResourceBase::BindImpl( bind_callback_ = callback; // Send the request, the browser will call us back via BindReply. - Call<PpapiPluginMsg_UDPSocketPrivate_BindReply>( + Call<PpapiPluginMsg_UDPSocket_BindReply>( BROWSER, - PpapiHostMsg_UDPSocketPrivate_Bind(*addr), + PpapiHostMsg_UDPSocket_Bind(*addr), base::Bind(&UDPSocketResourceBase::OnPluginMsgBindReply, base::Unretained(this))); return PP_OK_COMPLETIONPENDING; @@ -111,9 +158,9 @@ int32_t UDPSocketResourceBase::RecvFromImpl( recvfrom_callback_ = callback; // Send the request, the browser will call us back via RecvFromReply. - Call<PpapiPluginMsg_UDPSocketPrivate_RecvFromReply>( + Call<PpapiPluginMsg_UDPSocket_RecvFromReply>( BROWSER, - PpapiHostMsg_UDPSocketPrivate_RecvFrom(bytes_to_read_), + PpapiHostMsg_UDPSocket_RecvFrom(bytes_to_read_), base::Bind(&UDPSocketResourceBase::OnPluginMsgRecvFromReply, base::Unretained(this), addr)); return PP_OK_COMPLETIONPENDING; @@ -145,10 +192,9 @@ int32_t UDPSocketResourceBase::SendToImpl( sendto_callback_ = callback; // Send the request, the browser will call us back via SendToReply. - Call<PpapiPluginMsg_UDPSocketPrivate_SendToReply>( + Call<PpapiPluginMsg_UDPSocket_SendToReply>( BROWSER, - PpapiHostMsg_UDPSocketPrivate_SendTo( - std::string(buffer, num_bytes), *addr), + PpapiHostMsg_UDPSocket_SendTo(std::string(buffer, num_bytes), *addr), base::Bind(&UDPSocketResourceBase::OnPluginMsgSendToReply, base::Unretained(this))); return PP_OK_COMPLETIONPENDING; @@ -161,11 +207,14 @@ void UDPSocketResourceBase::CloseImpl() { bound_ = false; closed_ = true; - Post(BROWSER, PpapiHostMsg_UDPSocketPrivate_Close()); + Post(BROWSER, PpapiHostMsg_UDPSocket_Close()); PostAbortIfNecessary(&bind_callback_); PostAbortIfNecessary(&recvfrom_callback_); PostAbortIfNecessary(&sendto_callback_); + + read_buffer_ = NULL; + bytes_to_read_ = -1; } void UDPSocketResourceBase::PostAbortIfNecessary( @@ -174,17 +223,27 @@ void UDPSocketResourceBase::PostAbortIfNecessary( (*callback)->PostAbort(); } +void UDPSocketResourceBase::OnPluginMsgSetOptionReply( + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params) { + if (TrackedCallback::IsPending(callback)) + callback->Run(ConvertPPError(params.result(), private_api_)); +} + void UDPSocketResourceBase::OnPluginMsgBindReply( const ResourceMessageReplyParams& params, const PP_NetAddress_Private& bound_addr) { - if (!TrackedCallback::IsPending(bind_callback_)) { - NOTREACHED(); + // It is possible that |bind_callback_| is pending while |closed_| is true: + // CloseImpl() has been called, but a BindReply came earlier than the task to + // abort |bind_callback_|. We don't want to update |bound_| or |bound_addr_| + // in that case. + if (!TrackedCallback::IsPending(bind_callback_) || closed_) return; - } + if (params.result() == PP_OK) bound_ = true; bound_addr_ = bound_addr; - bind_callback_->Run(params.result()); + bind_callback_->Run(ConvertPPError(params.result(), private_api_)); } void UDPSocketResourceBase::OnPluginMsgRecvFromReply( @@ -192,22 +251,25 @@ void UDPSocketResourceBase::OnPluginMsgRecvFromReply( const ResourceMessageReplyParams& params, const std::string& data, const PP_NetAddress_Private& addr) { - if (!TrackedCallback::IsPending(recvfrom_callback_)) { - NOTREACHED(); + // It is possible that |recvfrom_callback_| is pending while |read_buffer_| is + // NULL: CloseImpl() has been called, but a RecvFromReply came earlier than + // the task to abort |recvfrom_callback_|. We shouldn't access the buffer in + // that case. The user may have released it. + if (!TrackedCallback::IsPending(recvfrom_callback_) || !read_buffer_) return; - } - bool succeeded = (params.result() == PP_OK); - if (succeeded && output_addr) { + + int32_t result = params.result(); + if (result == PP_OK && output_addr) { thunk::EnterResourceCreationNoLock enter(pp_instance()); if (enter.succeeded()) { *output_addr = enter.functions()->CreateNetAddressFromNetAddressPrivate( pp_instance(), addr); } else { - succeeded = false; + result = PP_ERROR_FAILED; } } - if (succeeded) { + if (result == PP_OK) { CHECK_LE(static_cast<int32_t>(data.size()), bytes_to_read_); if (!data.empty()) memcpy(read_buffer_, data.c_str(), data.size()); @@ -217,23 +279,22 @@ void UDPSocketResourceBase::OnPluginMsgRecvFromReply( bytes_to_read_ = -1; recvfrom_addr_ = addr; - if (succeeded) + if (result == PP_OK) recvfrom_callback_->Run(static_cast<int32_t>(data.size())); else - recvfrom_callback_->Run(params.result()); + recvfrom_callback_->Run(ConvertPPError(result, private_api_)); } void UDPSocketResourceBase::OnPluginMsgSendToReply( const ResourceMessageReplyParams& params, int32_t bytes_written) { - if (!TrackedCallback::IsPending(sendto_callback_)) { - NOTREACHED(); + if (!TrackedCallback::IsPending(sendto_callback_)) return; - } + if (params.result() == PP_OK) sendto_callback_->Run(bytes_written); else - sendto_callback_->Run(params.result()); + sendto_callback_->Run(ConvertPPError(params.result(), private_api_)); } } // namespace proxy diff --git a/ppapi/proxy/udp_socket_resource_base.h b/ppapi/proxy/udp_socket_resource_base.h index b3a66693ed..925475e0e1 100644 --- a/ppapi/proxy/udp_socket_resource_base.h +++ b/ppapi/proxy/udp_socket_resource_base.h @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef PPAPI_PROXY_UDP_SOCKET_SHARED_H_ -#define PPAPI_PROXY_UDP_SOCKET_SHARED_H_ +#ifndef PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ +#define PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ #include <string> #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" +#include "ppapi/c/ppb_udp_socket.h" #include "ppapi/c/private/ppb_net_address_private.h" -#include "ppapi/c/private/ppb_udp_socket_private.h" #include "ppapi/proxy/plugin_resource.h" #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/shared_impl/tracked_callback.h" @@ -30,12 +30,26 @@ class PPAPI_PROXY_EXPORT UDPSocketResourceBase: public PluginResource { // message is allowed to carry. static const int32_t kMaxWriteSize; + // The maximum number that we allow for setting + // PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE. This number is only for input + // argument sanity check, it doesn't mean the browser guarantees to support + // such a buffer size. + static const int32_t kMaxSendBufferSize; + // The maximum number that we allow for setting + // PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE. This number is only for input + // argument sanity check, it doesn't mean the browser guarantees to support + // such a buffer size. + static const int32_t kMaxReceiveBufferSize; + protected: - UDPSocketResourceBase(Connection connection, PP_Instance instance); + UDPSocketResourceBase(Connection connection, + PP_Instance instance, + bool private_api); virtual ~UDPSocketResourceBase(); - int32_t SetSocketFeatureImpl(PP_UDPSocketFeature_Private name, - const PP_Var& value); + int32_t SetOptionImpl(PP_UDPSocket_Option name, + const PP_Var& value, + scoped_refptr<TrackedCallback> callback); int32_t BindImpl(const PP_NetAddress_Private* addr, scoped_refptr<TrackedCallback> callback); PP_Bool GetBoundAddressImpl(PP_NetAddress_Private* addr); @@ -55,6 +69,8 @@ class PPAPI_PROXY_EXPORT UDPSocketResourceBase: public PluginResource { void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback); // IPC message handlers. + void OnPluginMsgSetOptionReply(scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params); void OnPluginMsgBindReply(const ResourceMessageReplyParams& params, const PP_NetAddress_Private& bound_addr); void OnPluginMsgRecvFromReply(PP_Resource* output_addr, @@ -64,6 +80,7 @@ class PPAPI_PROXY_EXPORT UDPSocketResourceBase: public PluginResource { void OnPluginMsgSendToReply(const ResourceMessageReplyParams& params, int32_t bytes_written); + bool private_api_; bool bound_; bool closed_; @@ -83,4 +100,4 @@ class PPAPI_PROXY_EXPORT UDPSocketResourceBase: public PluginResource { } // namespace proxy } // namespace ppapi -#endif // PPAPI_PROXY_UDP_SOCKET_SHARED_H_ +#endif // PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ diff --git a/ppapi/proxy/video_source_resource.cc b/ppapi/proxy/video_source_resource.cc index f6c5fdc41d..c294903188 100644 --- a/ppapi/proxy/video_source_resource.cc +++ b/ppapi/proxy/video_source_resource.cc @@ -66,7 +66,6 @@ int32_t VideoSourceResource::GetFrame( return PP_ERROR_INPROGRESS; get_frame_callback_ = callback; - Call<PpapiPluginMsg_VideoSource_GetFrameReply>(RENDERER, PpapiHostMsg_VideoSource_GetFrame(), base::Bind(&VideoSourceResource::OnPluginMsgGetFrameComplete, this, @@ -98,7 +97,6 @@ void VideoSourceResource::OnPluginMsgGetFrameComplete( const ResourceMessageReplyParams& reply_params, const HostResource& image_data, const PP_ImageDataDesc& image_desc, - int fd, PP_TimeTicks timestamp) { // The callback may have been aborted by Close(). if (TrackedCallback::IsPending(get_frame_callback_)) { @@ -107,21 +105,12 @@ void VideoSourceResource::OnPluginMsgGetFrameComplete( PPB_ImageData_Shared::IsImageDataDescValid(image_desc)) { frame->timestamp = timestamp; -#if defined(OS_ANDROID) - frame->image_data = 0; -#elif defined(TOOLKIT_GTK) - frame->image_data = - (new PlatformImageData(image_data, image_desc, fd))->GetReference(); -#elif defined(OS_LINUX) || defined(OS_WIN) || defined(OS_MACOSX) base::SharedMemoryHandle handle; if (!reply_params.TakeSharedMemoryHandleAtIndex(0, &handle)) frame->image_data = 0; frame->image_data = - (new PlatformImageData( + (new SimpleImageData( image_data, image_desc, handle))->GetReference(); -#else -#error Not implemented. -#endif } get_frame_callback_->Run(result); } diff --git a/ppapi/proxy/video_source_resource.h b/ppapi/proxy/video_source_resource.h index 23d7240706..cdd4638a21 100644 --- a/ppapi/proxy/video_source_resource.h +++ b/ppapi/proxy/video_source_resource.h @@ -52,7 +52,6 @@ class PPAPI_PROXY_EXPORT VideoSourceResource const ResourceMessageReplyParams& reply_params, const HostResource& image_data, const PP_ImageDataDesc& image_desc_data, - int fd, PP_TimeTicks timestamp); scoped_refptr<TrackedCallback> open_callback_; diff --git a/ppapi/shared_impl/file_ref_create_info.h b/ppapi/shared_impl/file_ref_create_info.h index edf6eef8af..a3599f7183 100644 --- a/ppapi/shared_impl/file_ref_create_info.h +++ b/ppapi/shared_impl/file_ref_create_info.h @@ -18,7 +18,6 @@ namespace ppapi { struct FileRef_CreateInfo { PP_FileSystemType file_system_type; std::string internal_path; - base::FilePath external_path; std::string display_name; // Used when a FileRef is created in the Renderer. diff --git a/ppapi/shared_impl/file_ref_util.cc b/ppapi/shared_impl/file_ref_util.cc index ff2e36209a..3d2deff50e 100644 --- a/ppapi/shared_impl/file_ref_util.cc +++ b/ppapi/shared_impl/file_ref_util.cc @@ -4,6 +4,7 @@ #include "ppapi/shared_impl/file_ref_util.h" +#include "base/files/file_path.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -43,6 +44,10 @@ bool IsValidInternalPath(const std::string& path) { return true; } +bool IsValidExternalPath(const base::FilePath& path) { + return !path.empty() && !path.ReferencesParent(); +} + void NormalizeInternalPath(std::string* path) { if (path->size() > 1 && path->at(path->size() - 1) == '/') path->erase(path->size() - 1, 1); diff --git a/ppapi/shared_impl/file_ref_util.h b/ppapi/shared_impl/file_ref_util.h index 11f03ad17f..f85527daef 100644 --- a/ppapi/shared_impl/file_ref_util.h +++ b/ppapi/shared_impl/file_ref_util.h @@ -7,9 +7,12 @@ #include <string> -#include "base/files/file_path.h" #include "ppapi/shared_impl/ppapi_shared_export.h" +namespace base { +class FilePath; +} + namespace ppapi { // Routines to generate display names for internal and external file paths. @@ -21,6 +24,9 @@ PPAPI_SHARED_EXPORT std::string GetNameForExternalFilePath( // Determines whether an internal file path is valid. PPAPI_SHARED_EXPORT bool IsValidInternalPath(const std::string& path); +// Determines whether an external file path is valid. +PPAPI_SHARED_EXPORT bool IsValidExternalPath(const base::FilePath& path); + // If path ends with a slash, normalize it away unless it's the root path. PPAPI_SHARED_EXPORT void NormalizeInternalPath(std::string* path); diff --git a/ppapi/shared_impl/ppb_audio_config_shared.h b/ppapi/shared_impl/ppb_audio_config_shared.h index 77826be75b..b77a112480 100644 --- a/ppapi/shared_impl/ppb_audio_config_shared.h +++ b/ppapi/shared_impl/ppb_audio_config_shared.h @@ -12,6 +12,12 @@ namespace ppapi { +const int kBitsPerAudioInputSample = 16; +const int kAudioInputChannels = 1; + +const int kBitsPerAudioOutputSample = 16; +const int kAudioOutputChannels = 2; + class PPAPI_SHARED_EXPORT PPB_AudioConfig_Shared : public Resource, public thunk::PPB_AudioConfig_API { diff --git a/ppapi/shared_impl/ppb_trace_event_impl.cc b/ppapi/shared_impl/ppb_trace_event_impl.cc index 6803fc6d36..1433d4af14 100644 --- a/ppapi/shared_impl/ppb_trace_event_impl.cc +++ b/ppapi/shared_impl/ppb_trace_event_impl.cc @@ -4,6 +4,7 @@ #include "ppapi/shared_impl/ppb_trace_event_impl.h" +#include "base/basictypes.h" #include "base/debug/trace_event.h" #include "ppapi/thunk/thunk.h" @@ -28,15 +29,19 @@ void* TraceEventImpl::GetCategoryEnabled(const char* category_name) { } // static -void TraceEventImpl::AddTraceEvent(int8_t phase, - const void* category_enabled, - const char* name, - uint64_t id, - uint32_t num_args, - const char* arg_names[], - const uint8_t arg_types[], - const uint64_t arg_values[], - uint8_t flags) { +void TraceEventImpl::AddTraceEvent( + int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags) { + + COMPILE_ASSERT(sizeof(unsigned long long) == sizeof(uint64_t), msg); + base::debug::TraceLog::GetInstance()->AddTraceEvent(phase, static_cast<const unsigned char*>(category_enabled), name, id, num_args, arg_names, arg_types, @@ -48,15 +53,54 @@ void TraceEventImpl::AddTraceEvent(int8_t phase, } // static +void TraceEventImpl::AddTraceEventWithThreadIdAndTimestamp( + int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + int32_t thread_id, + int64_t timestamp, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags) { + base::debug::TraceLog::GetInstance()->AddTraceEventWithThreadIdAndTimestamp( + phase, + static_cast<const unsigned char*>(category_enabled), name, id, + thread_id, + base::TimeTicks::FromInternalValue(timestamp), + num_args, arg_names, arg_types, + // This cast is necessary for LP64 systems, where uint64_t is defined as + // an unsigned long int, but trace_event internals are hermetic and + // accepts an |unsigned long long*|. The pointer types are compatible but + // the compiler throws an error without an explicit cast. + reinterpret_cast<const unsigned long long*>(arg_values), NULL, flags); +} + +// static +int64_t TraceEventImpl::Now() { + return base::TimeTicks::NowFromSystemTraceTime().ToInternalValue(); +} + +// static void TraceEventImpl::SetThreadName(const char* thread_name) { base::PlatformThread::SetName(thread_name); } namespace { -const PPB_Trace_Event_Dev g_ppb_trace_event_thunk = { +const PPB_Trace_Event_Dev_0_1 g_ppb_trace_event_thunk_0_1 = { + &TraceEventImpl::GetCategoryEnabled, + &TraceEventImpl::AddTraceEvent, + &TraceEventImpl::SetThreadName, +}; + +const PPB_Trace_Event_Dev_0_2 g_ppb_trace_event_thunk_0_2 = { &TraceEventImpl::GetCategoryEnabled, &TraceEventImpl::AddTraceEvent, + &TraceEventImpl::AddTraceEventWithThreadIdAndTimestamp, + &TraceEventImpl::Now, &TraceEventImpl::SetThreadName, }; @@ -68,7 +112,11 @@ namespace ppapi { namespace thunk { const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() { - return &g_ppb_trace_event_thunk; + return &g_ppb_trace_event_thunk_0_1; +} + +const PPB_Trace_Event_Dev_0_2* GetPPB_Trace_Event_Dev_0_2_Thunk() { + return &g_ppb_trace_event_thunk_0_2; } } // namespace thunk diff --git a/ppapi/shared_impl/ppb_trace_event_impl.h b/ppapi/shared_impl/ppb_trace_event_impl.h index 21a77acd68..6df7cc8c15 100644 --- a/ppapi/shared_impl/ppb_trace_event_impl.h +++ b/ppapi/shared_impl/ppb_trace_event_impl.h @@ -18,15 +18,29 @@ namespace ppapi { class PPAPI_SHARED_EXPORT TraceEventImpl { public: static void* GetCategoryEnabled(const char* category_name); - static void AddTraceEvent(int8_t phase, - const void* category_enabled, - const char* name, - uint64_t id, - uint32_t num_args, - const char* arg_names[], - const uint8_t arg_types[], - const uint64_t arg_values[], - uint8_t flags); + static void AddTraceEvent( + int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + static void AddTraceEventWithThreadIdAndTimestamp( + int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + int32_t thread_id, + int64_t timestamp, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + static int64_t Now(); static void SetThreadName(const char* thread_name); }; diff --git a/ppapi/shared_impl/private/net_address_private_impl.cc b/ppapi/shared_impl/private/net_address_private_impl.cc index b8ca4340d0..19dae3c8b1 100644 --- a/ppapi/shared_impl/private/net_address_private_impl.cc +++ b/ppapi/shared_impl/private/net_address_private_impl.cc @@ -133,9 +133,9 @@ bool IsValid(const NetAddress* net_addr) { PP_NetAddressFamily_Private GetFamily(const PP_NetAddress_Private* addr) { const NetAddress* net_addr = ToNetAddress(addr); if (!IsValid(net_addr)) - return PP_NETADDRESSFAMILY_UNSPECIFIED; + return PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED; return net_addr->is_ipv6 ? - PP_NETADDRESSFAMILY_IPV6 : PP_NETADDRESSFAMILY_IPV4; + PP_NETADDRESSFAMILY_PRIVATE_IPV6 : PP_NETADDRESSFAMILY_PRIVATE_IPV4; } uint16_t GetPort(const PP_NetAddress_Private* addr) { @@ -519,7 +519,7 @@ std::string NetAddressPrivateImpl::DescribeNetAddress( // static void NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv4Address( - const PP_NetAddress_IPv4_Dev& ipv4_addr, + const PP_NetAddress_IPv4& ipv4_addr, PP_NetAddress_Private* addr) { CreateFromIPv4Address(ipv4_addr.addr, ConvertFromNetEndian16(ipv4_addr.port), addr); @@ -527,14 +527,14 @@ void NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv4Address( // static void NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv6Address( - const PP_NetAddress_IPv6_Dev& ipv6_addr, + const PP_NetAddress_IPv6& ipv6_addr, PP_NetAddress_Private* addr) { CreateFromIPv6Address(ipv6_addr.addr, 0, ConvertFromNetEndian16(ipv6_addr.port), addr); } // static -PP_NetAddress_Family_Dev NetAddressPrivateImpl::GetFamilyFromNetAddressPrivate( +PP_NetAddress_Family NetAddressPrivateImpl::GetFamilyFromNetAddressPrivate( const PP_NetAddress_Private& addr) { const NetAddress* net_addr = ToNetAddress(&addr); if (!IsValid(net_addr)) @@ -546,7 +546,7 @@ PP_NetAddress_Family_Dev NetAddressPrivateImpl::GetFamilyFromNetAddressPrivate( // static bool NetAddressPrivateImpl::DescribeNetAddressPrivateAsIPv4Address( const PP_NetAddress_Private& addr, - PP_NetAddress_IPv4_Dev* ipv4_addr) { + PP_NetAddress_IPv4* ipv4_addr) { if (!ipv4_addr) return false; @@ -566,7 +566,7 @@ bool NetAddressPrivateImpl::DescribeNetAddressPrivateAsIPv4Address( // static bool NetAddressPrivateImpl::DescribeNetAddressPrivateAsIPv6Address( const PP_NetAddress_Private& addr, - PP_NetAddress_IPv6_Dev* ipv6_addr) { + PP_NetAddress_IPv6* ipv6_addr) { if (!ipv6_addr) return false; diff --git a/ppapi/shared_impl/private/net_address_private_impl.h b/ppapi/shared_impl/private/net_address_private_impl.h index fdc9577e6e..a8ba059295 100644 --- a/ppapi/shared_impl/private/net_address_private_impl.h +++ b/ppapi/shared_impl/private/net_address_private_impl.h @@ -9,8 +9,8 @@ #include <vector> #include "base/basictypes.h" -#include "ppapi/c/dev/ppb_net_address_dev.h" #include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb_net_address.h" #include "ppapi/shared_impl/ppapi_shared_export.h" struct PP_NetAddress_Private; @@ -37,24 +37,24 @@ class PPAPI_SHARED_EXPORT NetAddressPrivateImpl { static std::string DescribeNetAddress(const PP_NetAddress_Private& addr, bool include_port); - // Conversion methods to make PPB_NetAddress_Dev resource work with + // Conversion methods to make PPB_NetAddress resource work with // PP_NetAddress_Private. - // TODO(yzshen): Remove them once PPB_NetAddress_Dev resource doesn't use + // TODO(yzshen): Remove them once PPB_NetAddress resource doesn't use // PP_NetAddress_Private as storage type. static void CreateNetAddressPrivateFromIPv4Address( - const PP_NetAddress_IPv4_Dev& ipv4_addr, + const PP_NetAddress_IPv4& ipv4_addr, PP_NetAddress_Private* addr); static void CreateNetAddressPrivateFromIPv6Address( - const PP_NetAddress_IPv6_Dev& ipv6_addr, + const PP_NetAddress_IPv6& ipv6_addr, PP_NetAddress_Private* addr); - static PP_NetAddress_Family_Dev GetFamilyFromNetAddressPrivate( + static PP_NetAddress_Family GetFamilyFromNetAddressPrivate( const PP_NetAddress_Private& addr); static bool DescribeNetAddressPrivateAsIPv4Address( const PP_NetAddress_Private& addr, - PP_NetAddress_IPv4_Dev* ipv4_addr); + PP_NetAddress_IPv4* ipv4_addr); static bool DescribeNetAddressPrivateAsIPv6Address( const PP_NetAddress_Private& addr, - PP_NetAddress_IPv6_Dev* ipv6_addr); + PP_NetAddress_IPv6* ipv6_addr); static const PP_NetAddress_Private kInvalidNetAddress; diff --git a/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc b/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc index b151d13625..57ae502a09 100644 --- a/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc +++ b/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc @@ -15,7 +15,7 @@ PPB_X509Certificate_Fields::PPB_X509Certificate_Fields() {} PPB_X509Certificate_Fields::PPB_X509Certificate_Fields( const PPB_X509Certificate_Fields& fields) { - scoped_ptr<ListValue> new_values(fields.values_.DeepCopy()); + scoped_ptr<base::ListValue> new_values(fields.values_.DeepCopy()); values_.Swap(new_values.get()); } @@ -39,29 +39,29 @@ PP_Var PPB_X509Certificate_Fields::GetFieldAsPPVar( } switch (value->GetType()) { - case Value::TYPE_NULL: + case base::Value::TYPE_NULL: return PP_MakeNull(); - case Value::TYPE_BOOLEAN: { + case base::Value::TYPE_BOOLEAN: { bool val; value->GetAsBoolean(&val); return PP_MakeBool(PP_FromBool(val)); } - case Value::TYPE_INTEGER: { + case base::Value::TYPE_INTEGER: { int val; value->GetAsInteger(&val); return PP_MakeInt32(val); } - case Value::TYPE_DOUBLE: { + case base::Value::TYPE_DOUBLE: { double val; value->GetAsDouble(&val); return PP_MakeDouble(val); } - case Value::TYPE_STRING: { + case base::Value::TYPE_STRING: { std::string val; value->GetAsString(&val); return StringVar::StringToPPVar(val); } - case Value::TYPE_BINARY: { + case base::Value::TYPE_BINARY: { const base::BinaryValue* binary = static_cast<const base::BinaryValue*>(value); uint32_t size = static_cast<uint32_t>(binary->GetSize()); @@ -71,8 +71,8 @@ PP_Var PPB_X509Certificate_Fields::GetFieldAsPPVar( buffer); return array_buffer; } - case Value::TYPE_DICTIONARY: - case Value::TYPE_LIST: + case base::Value::TYPE_DICTIONARY: + case base::Value::TYPE_LIST: // Not handled. break; } diff --git a/ppapi/shared_impl/private/tcp_socket_private_impl.cc b/ppapi/shared_impl/private/tcp_socket_private_impl.cc index 832603cd65..56a3585bd9 100644 --- a/ppapi/shared_impl/private/tcp_socket_private_impl.cc +++ b/ppapi/shared_impl/private/tcp_socket_private_impl.cc @@ -4,6 +4,9 @@ #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" +#include "base/logging.h" +#include "ppapi/c/pp_errors.h" + namespace ppapi { TCPSocketPrivateImpl::TCPSocketPrivateImpl(PP_Instance instance, @@ -85,11 +88,28 @@ int32_t TCPSocketPrivateImpl::SetOption( PP_TCPSocketOption_Private name, const PP_Var& value, scoped_refptr<TrackedCallback> callback) { - return SetOptionImpl(name, value, callback); + switch (name) { + case PP_TCPSOCKETOPTION_PRIVATE_INVALID: + return PP_ERROR_BADARGUMENT; + case PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY: + return SetOptionImpl(PP_TCPSOCKET_OPTION_NO_DELAY, value, callback); + default: + NOTREACHED(); + return PP_ERROR_BADARGUMENT; + } } Resource* TCPSocketPrivateImpl::GetOwnerResource() { return this; } +int32_t TCPSocketPrivateImpl::OverridePPError(int32_t pp_error) { + // PPB_TCPSocket_Private treats all errors from the browser process as + // PP_ERROR_FAILED. + if (pp_error < 0) + return PP_ERROR_FAILED; + + return pp_error; +} + } // namespace ppapi diff --git a/ppapi/shared_impl/private/tcp_socket_private_impl.h b/ppapi/shared_impl/private/tcp_socket_private_impl.h index 62fba8e11f..36303fa769 100644 --- a/ppapi/shared_impl/private/tcp_socket_private_impl.h +++ b/ppapi/shared_impl/private/tcp_socket_private_impl.h @@ -62,6 +62,9 @@ class PPAPI_SHARED_EXPORT TCPSocketPrivateImpl // TCPSocketShared implementation. virtual Resource* GetOwnerResource() OVERRIDE; + // TCPSocketShared overrides. + virtual int32_t OverridePPError(int32_t pp_error) OVERRIDE; + private: DISALLOW_COPY_AND_ASSIGN(TCPSocketPrivateImpl); }; diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h index eac6c95f07..3fb09315c7 100644 --- a/ppapi/shared_impl/resource.h +++ b/ppapi/shared_impl/resource.h @@ -56,6 +56,7 @@ F(PPB_NetAddress_API) \ F(PPB_NetworkList_API) \ F(PPB_NetworkMonitor_Private_API) \ + F(PPB_NetworkProxy_API) \ F(PPB_PDF_API) \ F(PPB_Printing_API) \ F(PPB_ResourceArray_API) \ @@ -194,8 +195,11 @@ class PPAPI_SHARED_EXPORT Resource : public base::RefCounted<Resource> { FOR_ALL_PPAPI_RESOURCE_APIS(DEFINE_TYPE_GETTER) #undef DEFINE_TYPE_GETTER - // Template-based dynamic casting. See specializations below. - template <typename T> T* GetAs() { return NULL; } + // Template-based dynamic casting. See specializations below. This is + // unimplemented for the default case. This way, for anything that's not a + // resource (or if a developer forgets to add the resource to the list in + // this file), the result is a linker error. + template <typename T> T* GetAs(); // Called when a PpapiPluginMsg_ResourceReply reply is received for a // previous CallRenderer. The message is the nested reply message, which may diff --git a/ppapi/shared_impl/singleton_resource_id.h b/ppapi/shared_impl/singleton_resource_id.h index 95d387c59f..2d89de6807 100644 --- a/ppapi/shared_impl/singleton_resource_id.h +++ b/ppapi/shared_impl/singleton_resource_id.h @@ -22,6 +22,7 @@ enum SingletonResourceID { FLASH_FULLSCREEN_SINGLETON_ID, FLASH_SINGLETON_ID, GAMEPAD_SINGLETON_ID, + NETWORK_PROXY_SINGLETON_ID, PDF_SINGLETON_ID, TRUETYPE_FONT_SINGLETON_ID, }; diff --git a/ppapi/shared_impl/socket_option_data.cc b/ppapi/shared_impl/socket_option_data.cc new file mode 100644 index 0000000000..e45bb2534b --- /dev/null +++ b/ppapi/shared_impl/socket_option_data.cc @@ -0,0 +1,43 @@ +// 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/shared_impl/socket_option_data.h" + +namespace ppapi { + +SocketOptionData::SocketOptionData() : type_(TYPE_INVALID), value_(0) { +} + +SocketOptionData::~SocketOptionData() { +} + +SocketOptionData::Type SocketOptionData::GetType() const { + return type_; +} + +bool SocketOptionData::GetBool(bool* out_value) const { + if (!out_value || type_ != TYPE_BOOL) + return false; + *out_value = value_ != 0; + return true; +} + +bool SocketOptionData::GetInt32(int32_t* out_value) const { + if (!out_value || type_ != TYPE_INT32) + return false; + *out_value = value_; + return true; +} + +void SocketOptionData::SetBool(bool value) { + type_ = TYPE_BOOL; + value_ = value ? 1 : 0; +} + +void SocketOptionData::SetInt32(int32_t value) { + type_ = TYPE_INT32; + value_ = value; +} + +} // namespace ppapi diff --git a/ppapi/shared_impl/socket_option_data.h b/ppapi/shared_impl/socket_option_data.h new file mode 100644 index 0000000000..ec754a9b9a --- /dev/null +++ b/ppapi/shared_impl/socket_option_data.h @@ -0,0 +1,39 @@ +// 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. + +#ifndef PPAPI_SHARED_IMPL_SOCKET_OPTION_DATA_H_ +#define PPAPI_SHARED_IMPL_SOCKET_OPTION_DATA_H_ + +#include "ppapi/c/pp_stdint.h" +#include "ppapi/shared_impl/ppapi_shared_export.h" + +namespace ppapi { + +class PPAPI_SHARED_EXPORT SocketOptionData { + public: + enum Type { + TYPE_INVALID = 0, + TYPE_BOOL = 1, + TYPE_INT32 = 2 + }; + + SocketOptionData(); + ~SocketOptionData(); + + Type GetType() const; + + bool GetBool(bool* out_value) const; + bool GetInt32(int32_t* out_value) const; + + void SetBool(bool value); + void SetInt32(int32_t value); + + private: + Type type_; + int32_t value_; +}; + +} // namespace ppapi + +#endif // PPAPI_SHARED_IMPL_SOCKET_OPTION_DATA_H_ diff --git a/ppapi/shared_impl/tcp_socket_shared.cc b/ppapi/shared_impl/tcp_socket_shared.cc index 8799c49f0d..ae23b28f42 100644 --- a/ppapi/shared_impl/tcp_socket_shared.cc +++ b/ppapi/shared_impl/tcp_socket_shared.cc @@ -11,10 +11,12 @@ #include "base/basictypes.h" #include "base/bind.h" #include "base/logging.h" +#include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h" +#include "ppapi/shared_impl/socket_option_data.h" #include "ppapi/shared_impl/var_tracker.h" #include "ppapi/shared_impl/var.h" #include "ppapi/thunk/enter.h" @@ -24,6 +26,10 @@ namespace ppapi { const int32_t TCPSocketShared::kMaxReadSize = 1024 * 1024; const int32_t TCPSocketShared::kMaxWriteSize = 1024 * 1024; +const int32_t TCPSocketShared::kMaxSendBufferSize = + 1024 * TCPSocketShared::kMaxWriteSize; +const int32_t TCPSocketShared::kMaxReceiveBufferSize = + 1024 * TCPSocketShared::kMaxReadSize; TCPSocketShared::TCPSocketShared(ResourceObjectType resource_type, uint32 socket_id) @@ -35,29 +41,38 @@ TCPSocketShared::~TCPSocketShared() { } void TCPSocketShared::OnConnectCompleted( - bool succeeded, + int32_t result, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr) { + // It is possible that |connect_callback_| is pending while + // |connection_state_| is not BEFORE_CONNECT: DisconnectImpl() has been + // called, but a ConnectCompleted notification came earlier than the task to + // abort |connect_callback_|. We don't want to update |connection_state_| or + // other members in that case. if (connection_state_ != BEFORE_CONNECT || !TrackedCallback::IsPending(connect_callback_)) { - NOTREACHED(); return; } - if (succeeded) { + result = OverridePPError(result); + if (result == PP_OK) { local_addr_ = local_addr; remote_addr_ = remote_addr; connection_state_ = CONNECTED; } - connect_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED); + connect_callback_->Run(result); } void TCPSocketShared::OnSSLHandshakeCompleted( bool succeeded, const PPB_X509Certificate_Fields& certificate_fields) { + // It is possible that |ssl_handshake_callback_| is pending while + // |connection_state_| is not CONNECT: DisconnectImpl() has been + // called, but a SSLHandshakeCompleted notification came earlier than the task + // to abort |ssl_handshake_callback_|. We don't want to update + // |connection_state_| or other members in that case. if (connection_state_ != CONNECTED || !TrackedCallback::IsPending(ssl_handshake_callback_)) { - NOTREACHED(); return; } @@ -78,13 +93,17 @@ void TCPSocketShared::OnSSLHandshakeCompleted( } } -void TCPSocketShared::OnReadCompleted(bool succeeded, +void TCPSocketShared::OnReadCompleted(int32_t result, const std::string& data) { - if (!TrackedCallback::IsPending(read_callback_) || !read_buffer_) { - NOTREACHED(); + // It is possible that |read_callback_| is pending while |read_buffer_| is + // NULL: DisconnectImpl() has been called, but a ReadCompleted notification + // came earlier than the task to abort |read_callback_|. We shouldn't access + // the buffer in that case. The user may have released it. + if (!TrackedCallback::IsPending(read_callback_) || !read_buffer_) return; - } + result = OverridePPError(result); + bool succeeded = result == PP_OK; if (succeeded) { CHECK_LE(static_cast<int32_t>(data.size()), bytes_to_read_); if (!data.empty()) @@ -94,29 +113,33 @@ void TCPSocketShared::OnReadCompleted(bool succeeded, bytes_to_read_ = -1; read_callback_->Run( - succeeded ? static_cast<int32_t>(data.size()) : - static_cast<int32_t>(PP_ERROR_FAILED)); + succeeded ? static_cast<int32_t>(data.size()) : result); } -void TCPSocketShared::OnWriteCompleted(bool succeeded, - int32_t bytes_written) { - if (!TrackedCallback::IsPending(write_callback_) || - (succeeded && bytes_written < 0)) { - NOTREACHED(); +void TCPSocketShared::OnWriteCompleted(int32_t result) { + if (!TrackedCallback::IsPending(write_callback_)) return; - } - write_callback_->Run( - succeeded ? bytes_written : static_cast<int32_t>(PP_ERROR_FAILED)); + result = OverridePPError(result); + write_callback_->Run(result); } -void TCPSocketShared::OnSetOptionCompleted(bool succeeded) { - if (!TrackedCallback::IsPending(set_option_callback_)) { +void TCPSocketShared::OnSetOptionCompleted(int32_t result) { + if (set_option_callbacks_.empty()) { NOTREACHED(); return; } - set_option_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED); + result = OverridePPError(result); + scoped_refptr<TrackedCallback> callback = set_option_callbacks_.front(); + set_option_callbacks_.pop(); + + if (TrackedCallback::IsPending(callback)) + callback->Run(result); +} + +int32_t TCPSocketShared::OverridePPError(int32_t pp_error) { + return pp_error; } int32_t TCPSocketShared::ConnectImpl(const char* host, @@ -283,32 +306,42 @@ void TCPSocketShared::DisconnectImpl() { PostAbortIfNecessary(&ssl_handshake_callback_); PostAbortIfNecessary(&read_callback_); PostAbortIfNecessary(&write_callback_); - PostAbortIfNecessary(&set_option_callback_); read_buffer_ = NULL; bytes_to_read_ = -1; server_certificate_ = NULL; } int32_t TCPSocketShared::SetOptionImpl( - PP_TCPSocketOption_Private name, + PP_TCPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback) { if (!IsConnected()) return PP_ERROR_FAILED; - if (TrackedCallback::IsPending(set_option_callback_)) - return PP_ERROR_INPROGRESS; - - set_option_callback_ = callback; + SocketOptionData option_data; switch (name) { - case PP_TCPSOCKETOPTION_NO_DELAY: + case PP_TCPSOCKET_OPTION_NO_DELAY: { if (value.type != PP_VARTYPE_BOOL) return PP_ERROR_BADARGUMENT; - SendSetBoolOption(name, PP_ToBool(value.value.as_bool)); - return PP_OK_COMPLETIONPENDING; - default: + option_data.SetBool(PP_ToBool(value.value.as_bool)); + break; + } + case PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE: + case PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE: { + if (value.type != PP_VARTYPE_INT32) + return PP_ERROR_BADARGUMENT; + option_data.SetInt32(value.value.as_int); + break; + } + default: { + NOTREACHED(); return PP_ERROR_BADARGUMENT; + } } + + set_option_callbacks_.push(callback); + SendSetOption(name, option_data); + return PP_OK_COMPLETIONPENDING; } void TCPSocketShared::Init(uint32 socket_id) { diff --git a/ppapi/shared_impl/tcp_socket_shared.h b/ppapi/shared_impl/tcp_socket_shared.h index bd5e56b781..20e8e51513 100644 --- a/ppapi/shared_impl/tcp_socket_shared.h +++ b/ppapi/shared_impl/tcp_socket_shared.h @@ -5,11 +5,13 @@ #ifndef PPAPI_SHARED_IMPL_TCP_SOCKET_SHARED_H_ #define PPAPI_SHARED_IMPL_TCP_SOCKET_SHARED_H_ +#include <queue> #include <string> #include <vector> #include "base/compiler_specific.h" -#include "ppapi/c/private/ppb_tcp_socket_private.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" @@ -17,6 +19,7 @@ namespace ppapi { class PPB_X509Certificate_Fields; class PPB_X509Certificate_Private_Shared; +class SocketOptionData; // This class provides the shared implementation for both PPB_TCPSocket and // PPB_TCPSocket_Private. @@ -29,16 +32,27 @@ class PPAPI_SHARED_EXPORT TCPSocketShared { // message is allowed to carry. static const int32_t kMaxWriteSize; + // The maximum number that we allow for setting + // PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE. This number is only for input + // argument sanity check, it doesn't mean the browser guarantees to support + // such a buffer size. + static const int32_t kMaxSendBufferSize; + // The maximum number that we allow for setting + // PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE. This number is only for input + // argument sanity check, it doesn't mean the browser guarantees to support + // such a buffer size. + static const int32_t kMaxReceiveBufferSize; + // Notifications on operations completion. - void OnConnectCompleted(bool succeeded, + void OnConnectCompleted(int32_t result, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr); void OnSSLHandshakeCompleted( bool succeeded, const PPB_X509Certificate_Fields& certificate_fields); - void OnReadCompleted(bool succeeded, const std::string& data); - void OnWriteCompleted(bool succeeded, int32_t bytes_written); - void OnSetOptionCompleted(bool succeeded); + void OnReadCompleted(int32_t result, const std::string& data); + void OnWriteCompleted(int32_t result); + void OnSetOptionCompleted(int32_t result); // Send functions that need to be implemented differently for the // proxied and non-proxied derived classes. @@ -52,11 +66,14 @@ 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 SendSetBoolOption(PP_TCPSocketOption_Private name, - bool value) = 0; + virtual void SendSetOption(PP_TCPSocket_Option name, + const SocketOptionData& value) = 0; virtual Resource* GetOwnerResource() = 0; + // Used to override PP_Error codes received from the browser side. + virtual int32_t OverridePPError(int32_t pp_error); + protected: enum ConnectionState { // Before a connection is successfully established (including a connect @@ -94,7 +111,7 @@ class PPAPI_SHARED_EXPORT TCPSocketShared { int32_t bytes_to_write, scoped_refptr<TrackedCallback> callback); void DisconnectImpl(); - int32_t SetOptionImpl(PP_TCPSocketOption_Private name, + int32_t SetOptionImpl(PP_TCPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback); @@ -111,7 +128,7 @@ class PPAPI_SHARED_EXPORT TCPSocketShared { scoped_refptr<TrackedCallback> ssl_handshake_callback_; scoped_refptr<TrackedCallback> read_callback_; scoped_refptr<TrackedCallback> write_callback_; - scoped_refptr<TrackedCallback> set_option_callback_; + std::queue<scoped_refptr<TrackedCallback> > set_option_callbacks_; char* read_buffer_; int32_t bytes_to_read_; diff --git a/ppapi/shared_impl/time_conversion.h b/ppapi/shared_impl/time_conversion.h index e20d80910f..bbc08657a1 100644 --- a/ppapi/shared_impl/time_conversion.h +++ b/ppapi/shared_impl/time_conversion.h @@ -5,7 +5,7 @@ #ifndef PPAPI_SHARED_IMPL_TIME_CONVERSION_H_ #define PPAPI_SHARED_IMPL_TIME_CONVERSION_H_ -#include "base/time.h" +#include "base/time/time.h" #include "ppapi/c/pp_time.h" #include "ppapi/shared_impl/ppapi_shared_export.h" diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index da9bf577cd..11b432e058 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -20,23 +20,17 @@ #include "ppapi/c/dev/ppb_find_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_graphics_2d_dev.h" -#include "ppapi/c/dev/ppb_host_resolver_dev.h" #include "ppapi/c/dev/ppb_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" -#include "ppapi/c/dev/ppb_net_address_dev.h" #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" #include "ppapi/c/dev/ppb_truetype_font_dev.h" -#include "ppapi/c/dev/ppb_udp_socket_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" -#include "ppapi/c/dev/ppb_var_array_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" #include "ppapi/c/dev/ppb_video_decoder_dev.h" #include "ppapi/c/dev/ppb_view_dev.h" #include "ppapi/c/dev/ppb_widget_dev.h" @@ -82,16 +76,23 @@ #include "ppapi/c/ppb_gamepad.h" #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/c/ppb_graphics_3d.h" +#include "ppapi/c/ppb_host_resolver.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" #include "ppapi/c/ppb_mouse_lock.h" +#include "ppapi/c/ppb_net_address.h" +#include "ppapi/c/ppb_network_proxy.h" #include "ppapi/c/ppb_opengles2.h" +#include "ppapi/c/ppb_tcp_socket.h" +#include "ppapi/c/ppb_udp_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" +#include "ppapi/c/ppb_var_array.h" #include "ppapi/c/ppb_var_array_buffer.h" +#include "ppapi/c/ppb_var_dictionary.h" #include "ppapi/c/ppb_websocket.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_graphics_3d.h" diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h index f41b1b5e2c..d85cae7309 100644 --- a/ppapi/tests/all_cpp_includes.h +++ b/ppapi/tests/all_cpp_includes.h @@ -18,21 +18,15 @@ #include "ppapi/cpp/dev/find_dev.h" #include "ppapi/cpp/dev/font_dev.h" #include "ppapi/cpp/dev/graphics_2d_dev.h" -#include "ppapi/cpp/dev/host_resolver_dev.h" #include "ppapi/cpp/dev/ime_input_event_dev.h" #include "ppapi/cpp/dev/memory_dev.h" -#include "ppapi/cpp/dev/net_address_dev.h" #include "ppapi/cpp/dev/printing_dev.h" #include "ppapi/cpp/dev/resource_array_dev.h" #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" -#include "ppapi/cpp/dev/var_array_dev.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/dev/video_decoder_dev.h" #include "ppapi/cpp/dev/view_dev.h" #include "ppapi/cpp/dev/widget_client_dev.h" @@ -48,12 +42,15 @@ #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/graphics_3d.h" #include "ppapi/cpp/graphics_3d_client.h" +#include "ppapi/cpp/host_resolver.h" #include "ppapi/cpp/image_data.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/module_impl.h" #include "ppapi/cpp/mouse_lock.h" +#include "ppapi/cpp/net_address.h" +#include "ppapi/cpp/network_proxy.h" #include "ppapi/cpp/point.h" #include "ppapi/cpp/private/content_decryptor_private.h" #include "ppapi/cpp/private/flash_font_file.h" @@ -70,12 +67,16 @@ #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/udp_socket.h" #include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/url_request_info.h" #include "ppapi/cpp/url_response_info.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" #include "ppapi/cpp/websocket.h" #include "ppapi/utility/completion_callback_factory.h" #include "ppapi/utility/completion_callback_factory_thread_traits.h" diff --git a/ppapi/tests/test_console.cc b/ppapi/tests/test_console.cc index f39defe955..aa7636f545 100644 --- a/ppapi/tests/test_console.cc +++ b/ppapi/tests/test_console.cc @@ -5,6 +5,9 @@ #include "ppapi/tests/test_console.h" #include "ppapi/cpp/module.h" +#include "ppapi/cpp/var_array.h" +#include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" #include "ppapi/tests/testing_instance.h" REGISTER_TEST_CASE(Console); @@ -24,15 +27,37 @@ void TestConsole::RunTests(const std::string& filter) { RUN_TEST(Smoke, filter); } +namespace { + +void TestConsoleSub(const PPB_Console* console_interface_, + PP_Instance instance, + pp::Var source, + pp::Var message) { + + console_interface_->Log(instance, PP_LOGLEVEL_ERROR, + message.pp_var()); + console_interface_->LogWithSource(instance, PP_LOGLEVEL_LOG, + source.pp_var(), message.pp_var()); +} + +} // anonymous namespace + std::string TestConsole::TestSmoke() { // This test does not verify the log message actually reaches the console, but // it does test that the interface exists and that it can be called without // crashing. pp::Var source(std::string("somewhere")); - pp::Var message(std::string("hello, world.")); - console_interface_->Log(instance()->pp_instance(), PP_LOGLEVEL_ERROR, - message.pp_var()); - console_interface_->LogWithSource(instance()->pp_instance(), PP_LOGLEVEL_LOG, - source.pp_var(), message.pp_var()); + const PPB_Console* interface = console_interface_; + PP_Instance pp_instance = instance()->pp_instance(); + + TestConsoleSub(interface, pp_instance, source, pp::Var()); + TestConsoleSub(interface, pp_instance, source, pp::Var(pp::Var::Null())); + TestConsoleSub(interface, pp_instance, source, pp::Var(false)); + TestConsoleSub(interface, pp_instance, source, pp::Var(12345678)); + TestConsoleSub(interface, pp_instance, source, pp::Var(-0.0)); + TestConsoleSub(interface, pp_instance, source, pp::Var("Hello World!")); + TestConsoleSub(interface, pp_instance, source, pp::VarArray()); + TestConsoleSub(interface, pp_instance, source, pp::VarArrayBuffer()); + TestConsoleSub(interface, pp_instance, source, pp::VarDictionary()); PASS(); } diff --git a/ppapi/tests/test_host_resolver.cc b/ppapi/tests/test_host_resolver.cc index 7be4700771..2bb5012454 100644 --- a/ppapi/tests/test_host_resolver.cc +++ b/ppapi/tests/test_host_resolver.cc @@ -4,9 +4,9 @@ #include "ppapi/tests/test_host_resolver.h" -#include "ppapi/cpp/dev/host_resolver_dev.h" -#include "ppapi/cpp/dev/net_address_dev.h" -#include "ppapi/cpp/dev/tcp_socket_dev.h" +#include "ppapi/cpp/host_resolver.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" @@ -18,11 +18,11 @@ TestHostResolver::TestHostResolver(TestingInstance* instance) } bool TestHostResolver::Init() { - bool host_resolver_is_available = pp::HostResolver_Dev::IsAvailable(); + bool host_resolver_is_available = pp::HostResolver::IsAvailable(); 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,8 +45,8 @@ void TestHostResolver::RunTests(const std::string& filter) { } std::string TestHostResolver::SyncConnect( - pp::TCPSocket_Dev* socket, - const pp::NetAddress_Dev& address) { + pp::TCPSocket* socket, + const pp::NetAddress& address) { TestCompletionCallback callback(instance_->pp_instance(), callback_type()); callback.WaitForResult(socket->Connect(address, callback.GetCallback())); CHECK_CALLBACK_BEHAVIOR(callback); @@ -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; @@ -98,10 +98,10 @@ std::string TestHostResolver::CheckHTTPResponse(pp::TCPSocket_Dev* socket, } std::string TestHostResolver::SyncResolve( - pp::HostResolver_Dev* host_resolver, + pp::HostResolver* host_resolver, const std::string& host, uint16_t port, - const PP_HostResolver_Hint_Dev& hint) { + const PP_HostResolver_Hint& hint) { TestCompletionCallback callback(instance_->pp_instance(), callback_type()); callback.WaitForResult( host_resolver->Resolve(host.c_str(), port, hint, callback.GetCallback())); @@ -111,20 +111,20 @@ std::string TestHostResolver::SyncResolve( } std::string TestHostResolver::ParameterizedTestResolve( - const PP_HostResolver_Hint_Dev& hint) { - pp::HostResolver_Dev host_resolver(instance_); + const PP_HostResolver_Hint& hint) { + pp::HostResolver host_resolver(instance_); ASSERT_SUBTEST_SUCCESS(SyncResolve(&host_resolver, host_, port_, hint)); size_t size = host_resolver.GetNetAddressCount(); ASSERT_TRUE(size >= 1); - pp::NetAddress_Dev address; + pp::NetAddress address; for (size_t i = 0; i < size; ++i) { 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", @@ -146,24 +146,24 @@ std::string TestHostResolver::ParameterizedTestResolve( } std::string TestHostResolver::TestEmpty() { - pp::HostResolver_Dev host_resolver(instance_); + pp::HostResolver host_resolver(instance_); ASSERT_EQ(0, host_resolver.GetNetAddressCount()); - pp::NetAddress_Dev address = host_resolver.GetNetAddress(0); + pp::NetAddress address = host_resolver.GetNetAddress(0); ASSERT_EQ(0, address.pp_resource()); PASS(); } std::string TestHostResolver::TestResolve() { - PP_HostResolver_Hint_Dev hint; + PP_HostResolver_Hint hint; hint.family = PP_NETADDRESS_FAMILY_UNSPECIFIED; - hint.flags = PP_HOSTRESOLVER_FLAGS_CANONNAME; + hint.flags = PP_HOSTRESOLVER_FLAG_CANONNAME; return ParameterizedTestResolve(hint); } std::string TestHostResolver::TestResolveIPv4() { - PP_HostResolver_Hint_Dev hint; + PP_HostResolver_Hint hint; hint.family = PP_NETADDRESS_FAMILY_IPV4; - hint.flags = PP_HOSTRESOLVER_FLAGS_CANONNAME; + hint.flags = PP_HOSTRESOLVER_FLAG_CANONNAME; return ParameterizedTestResolve(hint); } diff --git a/ppapi/tests/test_host_resolver.h b/ppapi/tests/test_host_resolver.h index a67ed1f897..5587c20794 100644 --- a/ppapi/tests/test_host_resolver.h +++ b/ppapi/tests/test_host_resolver.h @@ -7,13 +7,13 @@ #include <string> -#include "ppapi/c/dev/ppb_host_resolver_dev.h" +#include "ppapi/c/ppb_host_resolver.h" #include "ppapi/tests/test_case.h" namespace pp { -class HostResolver_Dev; -class NetAddress_Dev; -class TCPSocket_Dev; +class HostResolver; +class NetAddress; +class TCPSocket; } // namespace pp class TestHostResolver : public TestCase { @@ -25,24 +25,24 @@ class TestHostResolver : public TestCase { virtual void RunTests(const std::string& filter); private: - std::string SyncConnect(pp::TCPSocket_Dev* socket, - const pp::NetAddress_Dev& address); - std::string SyncRead(pp::TCPSocket_Dev* socket, + std::string SyncConnect(pp::TCPSocket* socket, + const pp::NetAddress& address); + 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, + std::string SyncResolve(pp::HostResolver* host_resolver, const std::string& host, uint16_t port, - const PP_HostResolver_Hint_Dev& hint); - std::string ParameterizedTestResolve(const PP_HostResolver_Hint_Dev& hint); + const PP_HostResolver_Hint& hint); + std::string ParameterizedTestResolve(const PP_HostResolver_Hint& hint); std::string TestEmpty(); std::string TestResolve(); diff --git a/ppapi/tests/test_host_resolver_private.cc b/ppapi/tests/test_host_resolver_private.cc index 72153afbc0..88429eddf2 100644 --- a/ppapi/tests/test_host_resolver_private.cc +++ b/ppapi/tests/test_host_resolver_private.cc @@ -171,14 +171,14 @@ std::string TestHostResolverPrivate::ParametrizedTestResolve( std::string TestHostResolverPrivate::TestResolve() { PP_HostResolver_Private_Hint hint; - hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED; - hint.flags = PP_HOST_RESOLVER_FLAGS_CANONNAME; + hint.family = PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED; + hint.flags = PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME; return ParametrizedTestResolve(hint); } std::string TestHostResolverPrivate::TestResolveIPv4() { PP_HostResolver_Private_Hint hint; - hint.family = PP_NETADDRESSFAMILY_IPV4; - hint.flags = PP_HOST_RESOLVER_FLAGS_CANONNAME; + hint.family = PP_NETADDRESSFAMILY_PRIVATE_IPV4; + hint.flags = PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME; return ParametrizedTestResolve(hint); } diff --git a/ppapi/tests/test_host_resolver_private_disallowed.cc b/ppapi/tests/test_host_resolver_private_disallowed.cc index 3c0e0d59f7..0e28dcee98 100644 --- a/ppapi/tests/test_host_resolver_private_disallowed.cc +++ b/ppapi/tests/test_host_resolver_private_disallowed.cc @@ -39,8 +39,8 @@ void TestHostResolverPrivateDisallowed::RunTests(const std::string& filter) { std::string TestHostResolverPrivateDisallowed::TestResolve() { pp::HostResolverPrivate host_resolver(instance_); PP_HostResolver_Private_Hint hint; - hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED; - hint.flags = PP_HOST_RESOLVER_FLAGS_CANONNAME; + hint.family = PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED; + hint.flags = PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME; TestCompletionCallback callback(instance_->pp_instance(), callback_type()); callback.WaitForResult( host_resolver.Resolve(host_, port_, hint, callback.GetCallback())); diff --git a/ppapi/tests/test_net_address.cc b/ppapi/tests/test_net_address.cc index b6dff7bc01..f719ba5b02 100644 --- a/ppapi/tests/test_net_address.cc +++ b/ppapi/tests/test_net_address.cc @@ -6,40 +6,40 @@ #include <cstring> -#include "ppapi/cpp/dev/net_address_dev.h" +#include "ppapi/cpp/net_address.h" #include "ppapi/tests/test_utils.h" #include "ppapi/tests/testing_instance.h" -using pp::NetAddress_Dev; +using pp::NetAddress; REGISTER_TEST_CASE(NetAddress); namespace { -bool EqualIPv4Address(const PP_NetAddress_IPv4_Dev& addr1, - const PP_NetAddress_IPv4_Dev& addr2) { +bool EqualIPv4Address(const PP_NetAddress_IPv4& addr1, + const PP_NetAddress_IPv4& addr2) { return addr1.port == addr2.port && !memcmp(addr1.addr, addr2.addr, sizeof(addr1.addr)); } -bool EqualIPv6Address(const PP_NetAddress_IPv6_Dev& addr1, - const PP_NetAddress_IPv6_Dev& addr2) { +bool EqualIPv6Address(const PP_NetAddress_IPv6& addr1, + const PP_NetAddress_IPv6& addr2) { return addr1.port == addr2.port && !memcmp(addr1.addr, addr2.addr, sizeof(addr1.addr)); } -NetAddress_Dev CreateFromHostOrderIPv6Address( +NetAddress CreateFromHostOrderIPv6Address( const pp::InstanceHandle& instance, const uint16_t host_order_addr[8], uint16_t host_order_port) { - PP_NetAddress_IPv6_Dev ipv6_addr; + PP_NetAddress_IPv6 ipv6_addr; ipv6_addr.port = ConvertToNetEndian16(host_order_port); for (size_t i = 0; i < 8; ++i) { uint16_t net_order_addr = ConvertToNetEndian16(host_order_addr[i]); memcpy(&ipv6_addr.addr[2 * i], &net_order_addr, 2); } - return NetAddress_Dev(instance, ipv6_addr); + return NetAddress(instance, ipv6_addr); } } // namespace @@ -48,7 +48,7 @@ TestNetAddress::TestNetAddress(TestingInstance* instance) : TestCase(instance) { } bool TestNetAddress::Init() { - return NetAddress_Dev::IsAvailable(); + return NetAddress::IsAvailable(); } void TestNetAddress::RunTests(const std::string& filter) { @@ -58,39 +58,38 @@ void TestNetAddress::RunTests(const std::string& filter) { } std::string TestNetAddress::TestIPv4Address() { - PP_NetAddress_IPv4_Dev ipv4_addr = { ConvertToNetEndian16(80), - { 127, 0, 0, 1 } }; - NetAddress_Dev net_addr(instance_, ipv4_addr); + PP_NetAddress_IPv4 ipv4_addr = { ConvertToNetEndian16(80), { 127, 0, 0, 1 } }; + NetAddress net_addr(instance_, ipv4_addr); ASSERT_NE(0, net_addr.pp_resource()); ASSERT_EQ(PP_NETADDRESS_FAMILY_IPV4, net_addr.GetFamily()); - PP_NetAddress_IPv4_Dev out_ipv4_addr; + PP_NetAddress_IPv4 out_ipv4_addr; ASSERT_TRUE(net_addr.DescribeAsIPv4Address(&out_ipv4_addr)); ASSERT_TRUE(EqualIPv4Address(ipv4_addr, out_ipv4_addr)); - PP_NetAddress_IPv6_Dev out_ipv6_addr; + PP_NetAddress_IPv6 out_ipv6_addr; ASSERT_FALSE(net_addr.DescribeAsIPv6Address(&out_ipv6_addr)); PASS(); } std::string TestNetAddress::TestIPv6Address() { - PP_NetAddress_IPv6_Dev ipv6_addr = { + PP_NetAddress_IPv6 ipv6_addr = { ConvertToNetEndian16(1024), { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } }; - NetAddress_Dev net_addr(instance_, ipv6_addr); + NetAddress net_addr(instance_, ipv6_addr); ASSERT_NE(0, net_addr.pp_resource()); ASSERT_EQ(PP_NETADDRESS_FAMILY_IPV6, net_addr.GetFamily()); - PP_NetAddress_IPv6_Dev out_ipv6_addr; + PP_NetAddress_IPv6 out_ipv6_addr; ASSERT_TRUE(net_addr.DescribeAsIPv6Address(&out_ipv6_addr)); ASSERT_TRUE(EqualIPv6Address(ipv6_addr, out_ipv6_addr)); - PP_NetAddress_IPv4_Dev out_ipv4_addr; + PP_NetAddress_IPv4 out_ipv4_addr; ASSERT_FALSE(net_addr.DescribeAsIPv4Address(&out_ipv4_addr)); PASS(); @@ -99,15 +98,15 @@ std::string TestNetAddress::TestIPv6Address() { std::string TestNetAddress::TestDescribeAsString() { { // Test describing IPv4 addresses. - PP_NetAddress_IPv4_Dev ipv4_addr1 = { ConvertToNetEndian16(1234), - { 127, 0, 0, 1 } }; - NetAddress_Dev addr1(instance_, ipv4_addr1); + PP_NetAddress_IPv4 ipv4_addr1 = { ConvertToNetEndian16(1234), + { 127, 0, 0, 1 } }; + NetAddress addr1(instance_, ipv4_addr1); ASSERT_EQ("127.0.0.1", addr1.DescribeAsString(false).AsString()); ASSERT_EQ("127.0.0.1:1234", addr1.DescribeAsString(true).AsString()); - PP_NetAddress_IPv4_Dev ipv4_addr2 = { ConvertToNetEndian16(80), - { 192, 168, 0, 2 } }; - NetAddress_Dev addr2(instance_, ipv4_addr2); + PP_NetAddress_IPv4 ipv4_addr2 = { ConvertToNetEndian16(80), + { 192, 168, 0, 2 } }; + NetAddress addr2(instance_, ipv4_addr2); ASSERT_EQ("192.168.0.2", addr2.DescribeAsString(false).AsString()); ASSERT_EQ("192.168.0.2:80", addr2.DescribeAsString(true).AsString()); } @@ -160,7 +159,7 @@ std::string TestNetAddress::TestDescribeAsString() { for (size_t i = 0; i < sizeof(ipv6_test_cases) / sizeof(ipv6_test_cases[0]); ++i) { - NetAddress_Dev addr = CreateFromHostOrderIPv6Address( + NetAddress addr = CreateFromHostOrderIPv6Address( instance_, ipv6_test_cases[i].host_order_addr, ipv6_test_cases[i].host_order_port); ASSERT_EQ(ipv6_test_cases[i].expected_without_port, diff --git a/ppapi/tests/test_net_address_private.cc b/ppapi/tests/test_net_address_private.cc index 7b35e6663e..a3474c2f35 100644 --- a/ppapi/tests/test_net_address_private.cc +++ b/ppapi/tests/test_net_address_private.cc @@ -231,11 +231,13 @@ std::string TestNetAddressPrivate::TestDescribeIPv6() { std::string TestNetAddressPrivate::TestGetFamily() { uint8_t localhost_ip[4] = { 127, 0, 0, 1 }; PP_NetAddress_Private ipv4 = MakeIPv4NetAddress(localhost_ip, 80); - ASSERT_EQ(NetAddressPrivate::GetFamily(ipv4), PP_NETADDRESSFAMILY_IPV4); + ASSERT_EQ(NetAddressPrivate::GetFamily(ipv4), + PP_NETADDRESSFAMILY_PRIVATE_IPV4); uint16_t ipv6_address[8] = { 0x1234, 0xabcd, 0, 0, 0xff, 0, 0, 0xcdef }; PP_NetAddress_Private ipv6 = MakeIPv6NetAddress(ipv6_address, 123, 0); - ASSERT_EQ(NetAddressPrivate::GetFamily(ipv6), PP_NETADDRESSFAMILY_IPV6); + ASSERT_EQ(NetAddressPrivate::GetFamily(ipv6), + PP_NETADDRESSFAMILY_PRIVATE_IPV6); PASS(); } diff --git a/ppapi/tests/test_network_monitor_private.cc b/ppapi/tests/test_network_monitor_private.cc index dbe8683199..b2114dab68 100644 --- a/ppapi/tests/test_network_monitor_private.cc +++ b/ppapi/tests/test_network_monitor_private.cc @@ -100,8 +100,8 @@ std::string TestNetworkMonitorPrivate::VerifyNetworkList( PP_NetAddressFamily_Private family = pp::NetAddressPrivate::GetFamily(addresses[i]); - ASSERT_TRUE(family == PP_NETADDRESSFAMILY_IPV4 || - family == PP_NETADDRESSFAMILY_IPV6); + ASSERT_TRUE(family == PP_NETADDRESSFAMILY_PRIVATE_IPV4 || + family == PP_NETADDRESSFAMILY_PRIVATE_IPV6); char ip[16] = { 0 }; ASSERT_TRUE(pp::NetAddressPrivate::GetAddress( diff --git a/ppapi/tests/test_network_proxy.cc b/ppapi/tests/test_network_proxy.cc new file mode 100644 index 0000000000..62a4872b1d --- /dev/null +++ b/ppapi/tests/test_network_proxy.cc @@ -0,0 +1,76 @@ +// Copyright (c) 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/tests/test_network_proxy.h" + +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/network_proxy.h" +#include "ppapi/cpp/var.h" +#include "ppapi/tests/testing_instance.h" + +REGISTER_TEST_CASE(NetworkProxy); + +TestNetworkProxy::TestNetworkProxy(TestingInstance* instance) + : TestCase(instance) { +} + +void TestNetworkProxy::RunTests(const std::string& filter) { + RUN_CALLBACK_TEST(TestNetworkProxy, GetProxyForURL, filter); +} + +std::string TestNetworkProxy::TestGetProxyForURL() { + TestCompletionCallbackWithOutput<pp::Var> callback(instance_->pp_instance(), + callback_type()); + callback.WaitForResult( + pp::NetworkProxy::GetProxyForURL(instance_, + pp::Var("http://127.0.0.1/foobar/"), + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_OK, callback.result()); + pp::Var output = callback.output(); + ASSERT_TRUE(output.is_string()); + // Assume no one configures a proxy for localhost. + ASSERT_EQ("DIRECT", callback.output().AsString()); + + callback.WaitForResult( + pp::NetworkProxy::GetProxyForURL(instance_, + pp::Var("http://www.google.com"), + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_OK, callback.result()); + output = callback.output(); + // Don't know what the proxy might be, but it should be a valid result. + ASSERT_TRUE(output.is_string()); + + callback.WaitForResult( + pp::NetworkProxy::GetProxyForURL(instance_, + pp::Var("file:///tmp"), + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_OK, callback.result()); + output = callback.output(); + ASSERT_TRUE(output.is_string()); + // Should get "DIRECT" for file:// URLs. + ASSERT_EQ("DIRECT", output.AsString()); + + callback.WaitForResult( + pp::NetworkProxy::GetProxyForURL(instance_, + pp::Var("this isn't a url"), + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result()); + // TODO(dmichael): Add this check below when crbug.com/250046 is fixed. + // ASSERT_TRUE(callback.output().is_undefined()); + + callback.WaitForResult( + pp::NetworkProxy::GetProxyForURL(instance_, + pp::Var(42), // non-string Var + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result()); + // TODO(dmichael): Add this check below when crbug.com/250046 is fixed. + // ASSERT_TRUE(callback.output().is_undefined()); + + PASS(); +} diff --git a/ppapi/tests/test_network_proxy.h b/ppapi/tests/test_network_proxy.h new file mode 100644 index 0000000000..4c072de0a7 --- /dev/null +++ b/ppapi/tests/test_network_proxy.h @@ -0,0 +1,23 @@ +// Copyright (c) 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. + +#ifndef PAPPI_TESTS_TEST_NETWORK_PROXY_H_ +#define PAPPI_TESTS_TEST_NETWORK_PROXY_H_ + +#include <string> + +#include "ppapi/tests/test_case.h" + +class TestNetworkProxy : public TestCase { + public: + explicit TestNetworkProxy(TestingInstance* instance); + + private: + // TestCase implementation. + virtual void RunTests(const std::string& filter); + + std::string TestGetProxyForURL(); +}; + +#endif // PAPPI_TESTS_TEST_NETWORK_PROXY_H_ diff --git a/ppapi/tests/test_post_message.cc b/ppapi/tests/test_post_message.cc index 944b561462..36101fb0c8 100644 --- a/ppapi/tests/test_post_message.cc +++ b/ppapi/tests/test_post_message.cc @@ -12,7 +12,9 @@ #include "ppapi/c/pp_var.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" #include "ppapi/tests/pp_thread.h" #include "ppapi/tests/test_utils.h" #include "ppapi/tests/testing_instance.h" @@ -82,8 +84,8 @@ bool VarsEqual(const pp::Var& expected, if (expected.is_number()) { return fabs(expected.AsDouble() - actual.AsDouble()) < 1.0e-4; } else if (expected.is_array()) { - pp::VarArray_Dev expected_array(expected); - pp::VarArray_Dev actual_array(actual); + pp::VarArray expected_array(expected); + pp::VarArray actual_array(actual); if (expected_array.GetLength() != actual_array.GetLength()) return false; for (uint32_t i = 0; i < expected_array.GetLength(); ++i) { @@ -92,15 +94,15 @@ bool VarsEqual(const pp::Var& expected, } return true; } else if (expected.is_dictionary()) { - pp::VarDictionary_Dev expected_dict(expected); - pp::VarDictionary_Dev actual_dict(actual); + pp::VarDictionary expected_dict(expected); + pp::VarDictionary actual_dict(actual); if (expected_dict.GetKeys().GetLength() != actual_dict.GetKeys().GetLength()) { return false; } for (uint32_t i = 0; i < expected_dict.GetKeys().GetLength(); ++i) { pp::Var key = expected_dict.GetKeys().Get(i); - if (actual_dict.HasKey(key) == PP_FALSE) + if (!actual_dict.HasKey(key)) return false; if (!VarsEqual(expected_dict.Get(key), actual_dict.Get(key), visited_ids)) return false; @@ -448,7 +450,7 @@ std::string TestPostMessage::TestSendingArray() { WaitForMessages(); ASSERT_TRUE(ClearListeners()); - pp::VarArray_Dev array; + pp::VarArray array; array.Set(0, pp::Var(kTestBool)); array.Set(1, pp::Var(kTestString)); // Purposely leave index 2 empty. @@ -491,7 +493,7 @@ std::string TestPostMessage::TestSendingDictionary() { WaitForMessages(); ASSERT_TRUE(ClearListeners()); - pp::VarDictionary_Dev dictionary; + pp::VarDictionary dictionary; dictionary.Set(pp::Var("foo"), pp::Var(kTestBool)); dictionary.Set(pp::Var("bar"), pp::Var(kTestString)); dictionary.Set(pp::Var("abc"), pp::Var(kTestInt)); @@ -537,14 +539,14 @@ std::string TestPostMessage::TestSendingComplexVar() { ASSERT_TRUE(ClearListeners()); pp::Var string(kTestString); - pp::VarDictionary_Dev dictionary; + pp::VarDictionary dictionary; dictionary.Set(pp::Var("foo"), pp::Var(kTestBool)); dictionary.Set(pp::Var("bar"), string); dictionary.Set(pp::Var("abc"), pp::Var(kTestInt)); dictionary.Set(pp::Var("def"), pp::Var()); // Reference to array. - pp::VarArray_Dev array; + pp::VarArray array; array.Set(0, pp::Var(kTestBool)); array.Set(1, string); // Purposely leave index 2 empty (which will place an undefined var there). @@ -562,7 +564,7 @@ std::string TestPostMessage::TestSendingComplexVar() { ASSERT_EQ(message_data_.size(), 0); ASSERT_EQ(WaitForMessages(), 1); ASSERT_TRUE(message_data_.back().is_dictionary()); - pp::VarDictionary_Dev result(message_data_.back()); + pp::VarDictionary result(message_data_.back()); ASSERT_TRUE(VarsEqual(dictionary, message_data_.back())); WaitForMessages(); @@ -571,7 +573,7 @@ std::string TestPostMessage::TestSendingComplexVar() { // Set up a (dictionary -> array -> dictionary) cycle. Cycles shouldn't be // transmitted. - pp::VarArray_Dev array2; + pp::VarArray array2; array2.Set(0, dictionary); dictionary.Set(pp::Var("array2"), array2); diff --git a/ppapi/tests/test_tcp_socket.cc b/ppapi/tests/test_tcp_socket.cc index 7a14fe7f67..a4c56eb7b5 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,14 +52,14 @@ 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())); CHECK_CALLBACK_BEHAVIOR(cb); ASSERT_EQ(PP_OK, cb.result()); - pp::NetAddress_Dev local_addr, remote_addr; + pp::NetAddress local_addr, remote_addr; local_addr = socket.GetLocalAddress(); remote_addr = socket.GetRemoteAddress(); @@ -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,27 +91,58 @@ std::string TestTCPSocket::TestReadWrite() { } std::string TestTCPSocket::TestSetOption() { - pp::TCPSocket_Dev socket(instance_); - TestCompletionCallback cb(instance_->pp_instance(), callback_type()); - - cb.WaitForResult( - socket.SetOption(PP_TCPSOCKET_OPTION_NO_DELAY, true, cb.GetCallback())); - CHECK_CALLBACK_BEHAVIOR(cb); - ASSERT_EQ(PP_ERROR_FAILED, cb.result()); - - cb.WaitForResult(socket.Connect(addr_, cb.GetCallback())); - CHECK_CALLBACK_BEHAVIOR(cb); - ASSERT_EQ(PP_OK, cb.result()); - - cb.WaitForResult( - socket.SetOption(PP_TCPSOCKET_OPTION_NO_DELAY, true, cb.GetCallback())); - CHECK_CALLBACK_BEHAVIOR(cb); - ASSERT_EQ(PP_OK, cb.result()); + 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()); + + // These options cannot be set before the socket is connected. + int32_t result_1 = socket.SetOption(PP_TCPSOCKET_OPTION_NO_DELAY, + true, cb_1.GetCallback()); + int32_t result_2 = socket.SetOption(PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE, + 256, cb_2.GetCallback()); + int32_t result_3 = socket.SetOption(PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE, + 512, cb_3.GetCallback()); + + cb_1.WaitForResult(result_1); + CHECK_CALLBACK_BEHAVIOR(cb_1); + ASSERT_EQ(PP_ERROR_FAILED, cb_1.result()); + + cb_2.WaitForResult(result_2); + CHECK_CALLBACK_BEHAVIOR(cb_2); + ASSERT_EQ(PP_ERROR_FAILED, cb_2.result()); + + cb_3.WaitForResult(result_3); + CHECK_CALLBACK_BEHAVIOR(cb_3); + ASSERT_EQ(PP_ERROR_FAILED, cb_3.result()); + + cb_1.WaitForResult(socket.Connect(addr_, cb_1.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(cb_1); + ASSERT_EQ(PP_OK, cb_1.result()); + + result_1 = socket.SetOption(PP_TCPSOCKET_OPTION_NO_DELAY, + false, cb_1.GetCallback()); + result_2 = socket.SetOption(PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE, + 512, cb_2.GetCallback()); + result_3 = socket.SetOption(PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE, + 1024, cb_3.GetCallback()); + + cb_1.WaitForResult(result_1); + CHECK_CALLBACK_BEHAVIOR(cb_1); + ASSERT_EQ(PP_OK, cb_1.result()); + + cb_2.WaitForResult(result_2); + CHECK_CALLBACK_BEHAVIOR(cb_2); + ASSERT_EQ(PP_OK, cb_2.result()); + + cb_3.WaitForResult(result_3); + CHECK_CALLBACK_BEHAVIOR(cb_3); + ASSERT_EQ(PP_OK, cb_3.result()); PASS(); } -int32_t TestTCPSocket::ReadFirstLineFromSocket(pp::TCPSocket_Dev* socket, +int32_t TestTCPSocket::ReadFirstLineFromSocket(pp::TCPSocket* socket, std::string* s) { char buffer[1000]; @@ -137,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 0ff7e338ef..44c73214f6 100644 --- a/ppapi/tests/test_tcp_socket.h +++ b/ppapi/tests/test_tcp_socket.h @@ -8,11 +8,11 @@ #include <string> #include "ppapi/c/pp_stdint.h" -#include "ppapi/cpp/dev/net_address_dev.h" +#include "ppapi/cpp/net_address.h" #include "ppapi/tests/test_case.h" namespace pp { -class TCPSocket_Dev; +class TCPSocket; } class TestTCPSocket: public TestCase { @@ -28,10 +28,10 @@ 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_Dev addr_; + pp::NetAddress addr_; }; #endif // PAPPI_TESTS_TEST_TCP_SOCKET_H_ diff --git a/ppapi/tests/test_tcp_socket_private.cc b/ppapi/tests/test_tcp_socket_private.cc index b6f158f426..ba1c8f1ebd 100644 --- a/ppapi/tests/test_tcp_socket_private.cc +++ b/ppapi/tests/test_tcp_socket_private.cc @@ -155,7 +155,8 @@ std::string TestTCPSocketPrivate::TestSetOption() { TestCompletionCallback cb(instance_->pp_instance(), callback_type()); cb.WaitForResult( - socket.SetOption(PP_TCPSOCKETOPTION_NO_DELAY, true, cb.GetCallback())); + socket.SetOption(PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY, true, + cb.GetCallback())); CHECK_CALLBACK_BEHAVIOR(cb); ASSERT_EQ(PP_ERROR_FAILED, cb.result()); @@ -164,12 +165,14 @@ std::string TestTCPSocketPrivate::TestSetOption() { ASSERT_EQ(PP_OK, cb.result()); cb.WaitForResult( - socket.SetOption(PP_TCPSOCKETOPTION_NO_DELAY, true, cb.GetCallback())); + socket.SetOption(PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY, true, + cb.GetCallback())); CHECK_CALLBACK_BEHAVIOR(cb); ASSERT_EQ(PP_OK, cb.result()); cb.WaitForResult( - socket.SetOption(PP_TCPSOCKETOPTION_INVALID, true, cb.GetCallback())); + socket.SetOption(PP_TCPSOCKETOPTION_PRIVATE_INVALID, true, + cb.GetCallback())); CHECK_CALLBACK_BEHAVIOR(cb); ASSERT_EQ(PP_ERROR_BADARGUMENT, cb.result()); diff --git a/ppapi/tests/test_tcp_socket_private_trusted.cc b/ppapi/tests/test_tcp_socket_private_trusted.cc index 1b0e7e7c24..cf541c493f 100644 --- a/ppapi/tests/test_tcp_socket_private_trusted.cc +++ b/ppapi/tests/test_tcp_socket_private_trusted.cc @@ -55,7 +55,7 @@ std::string TestTCPSocketPrivateTrusted::TestGetServerCertificate() { const pp::X509CertificatePrivate& cert = socket.GetServerCertificate(); ASSERT_EQ( cert.GetField(PP_X509CERTIFICATE_PRIVATE_ISSUER_COMMON_NAME).AsString(), - "Test CA"); + "Test Root CA"); ASSERT_EQ( cert.GetField(PP_X509CERTIFICATE_PRIVATE_SUBJECT_COMMON_NAME).AsString(), "127.0.0.1"); diff --git a/ppapi/tests/test_trace_event.cc b/ppapi/tests/test_trace_event.cc new file mode 100644 index 0000000000..b58bf9b726 --- /dev/null +++ b/ppapi/tests/test_trace_event.cc @@ -0,0 +1,65 @@ +// 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/tests/test_trace_event.h" + +#include "ppapi/cpp/module.h" +#include "ppapi/tests/testing_instance.h" + +REGISTER_TEST_CASE(TraceEvent); + +TestTraceEvent::TestTraceEvent(TestingInstance* instance) + : TestCase(instance), + interface_(NULL) { +} + +bool TestTraceEvent::Init() { + interface_ = static_cast<const PPB_Trace_Event_Dev*>( + pp::Module::Get()->GetBrowserInterface(PPB_TRACE_EVENT_DEV_INTERFACE)); + return !!interface_; +} + +void TestTraceEvent::RunTests(const std::string& filter) { + RUN_TEST(Smoke, filter); + RUN_TEST(SmokeWithTimestamps, filter); + RUN_TEST(Clock, filter); +} + +std::string TestTraceEvent::TestSmoke() { + // This test does not verify the log message actually reaches dev tracing, but + // it does test that the interface exists and that it can be called without + // crashing. + const void* cat_enabled = interface_->GetCategoryEnabled("bar"); + interface_->AddTraceEvent('B', cat_enabled, "foo", 0, 0, NULL, NULL, NULL, 0); + interface_->AddTraceEvent('E', cat_enabled, "foo", 0, 0, NULL, NULL, NULL, 0); + PASS(); +} + +std::string TestTraceEvent::TestSmokeWithTimestamps() { + // This test does not verify the log message actually reaches dev tracing, but + // it does test that the interface exists and that it can be called without + // crashing. + const void* cat_enabled = interface_->GetCategoryEnabled("bar"); + interface_->AddTraceEventWithThreadIdAndTimestamp( + 'B', cat_enabled, "foo", 0, 0, 42, 0, NULL, NULL, NULL, 0); + interface_->AddTraceEventWithThreadIdAndTimestamp( + 'B', cat_enabled, "foo", 0, 1, 43, 0, NULL, NULL, NULL, 0); + interface_->AddTraceEventWithThreadIdAndTimestamp( + 'E', cat_enabled, "foo", 0, 0, 44, 0, NULL, NULL, NULL, 0); + interface_->AddTraceEventWithThreadIdAndTimestamp( + 'E', cat_enabled, "foo", 0, 1, 45, 0, NULL, NULL, NULL, 0); + PASS(); +} + +std::string TestTraceEvent::TestClock() { + int64_t last = interface_->Now(); + + for(int i=0; i<5; ++i){ + int64_t next = interface_->Now(); + ASSERT_LE(last, next); + last = next; + } + + PASS(); +}
\ No newline at end of file diff --git a/ppapi/tests/test_trace_event.h b/ppapi/tests/test_trace_event.h new file mode 100644 index 0000000000..c3278a35d9 --- /dev/null +++ b/ppapi/tests/test_trace_event.h @@ -0,0 +1,29 @@ +// 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. + +#ifndef PPAPI_TESTS_TEST_TRACE_EVENT_H_ +#define PPAPI_TESTS_TEST_TRACE_EVENT_H_ + +#include <string> + +#include "ppapi/c/dev/ppb_trace_event_dev.h" +#include "ppapi/tests/test_case.h" + +class TestTraceEvent : public TestCase { + public: + explicit TestTraceEvent(TestingInstance* instance); + + private: + // TestCase implementation. + virtual bool Init(); + virtual void RunTests(const std::string& filter); + + std::string TestSmoke(); + std::string TestSmokeWithTimestamps(); + std::string TestClock(); + + const PPB_Trace_Event_Dev* interface_; +}; + +#endif // PPAPI_TESTS_TEST_TRACE_EVENT_H_ diff --git a/ppapi/tests/test_udp_socket.cc b/ppapi/tests/test_udp_socket.cc index d3bb27ceab..e0b76f4772 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/udp_socket.h" #include "ppapi/cpp/var.h" #include "ppapi/tests/test_utils.h" #include "ppapi/tests/testing_instance.h" @@ -20,29 +20,29 @@ namespace { const uint16_t kPortScanFrom = 1024; const uint16_t kPortScanTo = 4096; -pp::NetAddress_Dev ReplacePort(const pp::InstanceHandle& instance, - const pp::NetAddress_Dev& addr, - uint16_t port) { +pp::NetAddress ReplacePort(const pp::InstanceHandle& instance, + const pp::NetAddress& addr, + uint16_t port) { switch (addr.GetFamily()) { case PP_NETADDRESS_FAMILY_IPV4: { - PP_NetAddress_IPv4_Dev ipv4_addr; + PP_NetAddress_IPv4 ipv4_addr; if (!addr.DescribeAsIPv4Address(&ipv4_addr)) break; ipv4_addr.port = ConvertToNetEndian16(port); - return pp::NetAddress_Dev(instance, ipv4_addr); + return pp::NetAddress(instance, ipv4_addr); } case PP_NETADDRESS_FAMILY_IPV6: { - PP_NetAddress_IPv6_Dev ipv6_addr; + PP_NetAddress_IPv6 ipv6_addr; if (!addr.DescribeAsIPv6Address(&ipv6_addr)) break; ipv6_addr.port = ConvertToNetEndian16(port); - return pp::NetAddress_Dev(instance, ipv6_addr); + return pp::NetAddress(instance, ipv6_addr); } default: { PP_NOTREACHED(); } } - return pp::NetAddress_Dev(); + return pp::NetAddress(); } } // namespace @@ -51,15 +51,15 @@ 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"); - bool udp_socket_is_available = pp::UDPSocket_Dev::IsAvailable(); + bool udp_socket_is_available = pp::UDPSocket::IsAvailable(); if (!udp_socket_is_available) instance_->AppendError("PPB_UDPSocket interface not available"); - bool net_address_is_available = pp::NetAddress_Dev::IsAvailable(); + bool net_address_is_available = pp::NetAddress::IsAvailable(); if (!net_address_is_available) instance_->AppendError("PPB_NetAddress interface not available"); @@ -85,8 +85,8 @@ void TestUDPSocket::RunTests(const std::string& filter) { RUN_CALLBACK_TEST(TestUDPSocket, SetOption, filter); } -std::string TestUDPSocket::GetLocalAddress(pp::NetAddress_Dev* address) { - pp::TCPSocket_Dev socket(instance_); +std::string TestUDPSocket::GetLocalAddress(pp::NetAddress* address) { + pp::TCPSocket socket(instance_); TestCompletionCallback callback(instance_->pp_instance(), callback_type()); callback.WaitForResult(socket.Connect(address_, callback.GetCallback())); CHECK_CALLBACK_BEHAVIOR(callback); @@ -97,7 +97,7 @@ std::string TestUDPSocket::GetLocalAddress(pp::NetAddress_Dev* address) { PASS(); } -std::string TestUDPSocket::SetBroadcastOptions(pp::UDPSocket_Dev* socket) { +std::string TestUDPSocket::SetBroadcastOptions(pp::UDPSocket* socket) { TestCompletionCallback callback_1(instance_->pp_instance(), callback_type()); callback_1.WaitForResult(socket->SetOption( PP_UDPSOCKET_OPTION_ADDRESS_REUSE, pp::Var(true), @@ -114,8 +114,8 @@ std::string TestUDPSocket::SetBroadcastOptions(pp::UDPSocket_Dev* socket) { PASS(); } -std::string TestUDPSocket::BindUDPSocket(pp::UDPSocket_Dev* socket, - const pp::NetAddress_Dev& address) { +std::string TestUDPSocket::BindUDPSocket(pp::UDPSocket* socket, + const pp::NetAddress& address) { TestCompletionCallback callback(instance_->pp_instance(), callback_type()); callback.WaitForResult(socket->Bind(address, callback.GetCallback())); CHECK_CALLBACK_BEHAVIOR(callback); @@ -124,14 +124,14 @@ std::string TestUDPSocket::BindUDPSocket(pp::UDPSocket_Dev* socket, } std::string TestUDPSocket::LookupPortAndBindUDPSocket( - pp::UDPSocket_Dev* socket, - pp::NetAddress_Dev* address) { - pp::NetAddress_Dev base_address; + pp::UDPSocket* socket, + pp::NetAddress* address) { + pp::NetAddress base_address; ASSERT_SUBTEST_SUCCESS(GetLocalAddress(&base_address)); bool is_free_port_found = false; for (uint16_t port = kPortScanFrom; port < kPortScanTo; ++port) { - pp::NetAddress_Dev new_address = ReplacePort(instance_, base_address, port); + pp::NetAddress new_address = ReplacePort(instance_, base_address, port); ASSERT_NE(0, new_address.pp_resource()); if (BindUDPSocket(socket, new_address).empty()) { is_free_port_found = true; @@ -147,12 +147,12 @@ std::string TestUDPSocket::LookupPortAndBindUDPSocket( PASS(); } -std::string TestUDPSocket::ReadSocket(pp::UDPSocket_Dev* socket, - pp::NetAddress_Dev* address, +std::string TestUDPSocket::ReadSocket(pp::UDPSocket* socket, + pp::NetAddress* address, size_t size, std::string* message) { std::vector<char> buffer(size); - TestCompletionCallbackWithOutput<pp::NetAddress_Dev> callback( + TestCompletionCallbackWithOutput<pp::NetAddress> callback( instance_->pp_instance(), callback_type()); callback.WaitForResult( socket->RecvFrom(&buffer[0], size, callback.GetCallback())); @@ -164,11 +164,11 @@ std::string TestUDPSocket::ReadSocket(pp::UDPSocket_Dev* socket, PASS(); } -std::string TestUDPSocket::PassMessage(pp::UDPSocket_Dev* target, - pp::UDPSocket_Dev* source, - const pp::NetAddress_Dev& target_address, +std::string TestUDPSocket::PassMessage(pp::UDPSocket* target, + pp::UDPSocket* source, + const pp::NetAddress& target_address, const std::string& message, - pp::NetAddress_Dev* recvfrom_address) { + pp::NetAddress* recvfrom_address) { TestCompletionCallback callback(instance_->pp_instance(), callback_type()); int32_t rv = source->SendTo(message.c_str(), message.size(), target_address, @@ -186,15 +186,15 @@ std::string TestUDPSocket::PassMessage(pp::UDPSocket_Dev* target, } std::string TestUDPSocket::TestReadWrite() { - pp::UDPSocket_Dev server_socket(instance_), client_socket(instance_); - pp::NetAddress_Dev server_address, client_address; + pp::UDPSocket server_socket(instance_), client_socket(instance_); + pp::NetAddress server_address, client_address; ASSERT_SUBTEST_SUCCESS(LookupPortAndBindUDPSocket(&server_socket, &server_address)); ASSERT_SUBTEST_SUCCESS(LookupPortAndBindUDPSocket(&client_socket, &client_address)); const std::string message = "Simple message that will be sent via UDP"; - pp::NetAddress_Dev recvfrom_address; + pp::NetAddress recvfrom_address; ASSERT_SUBTEST_SUCCESS(PassMessage(&server_socket, &client_socket, server_address, message, &recvfrom_address)); @@ -210,32 +210,32 @@ std::string TestUDPSocket::TestReadWrite() { } std::string TestUDPSocket::TestBroadcast() { - pp::UDPSocket_Dev server1(instance_), server2(instance_); + pp::UDPSocket server1(instance_), server2(instance_); ASSERT_SUBTEST_SUCCESS(SetBroadcastOptions(&server1)); ASSERT_SUBTEST_SUCCESS(SetBroadcastOptions(&server2)); - PP_NetAddress_IPv4_Dev any_ipv4_address = { 0, { 0, 0, 0, 0 } }; - pp::NetAddress_Dev any_address(instance_, any_ipv4_address); + PP_NetAddress_IPv4 any_ipv4_address = { 0, { 0, 0, 0, 0 } }; + pp::NetAddress any_address(instance_, any_ipv4_address); ASSERT_SUBTEST_SUCCESS(BindUDPSocket(&server1, any_address)); // Fill port field of |server_address|. - pp::NetAddress_Dev server_address = server1.GetBoundAddress(); + pp::NetAddress server_address = server1.GetBoundAddress(); ASSERT_NE(0, server_address.pp_resource()); ASSERT_SUBTEST_SUCCESS(BindUDPSocket(&server2, server_address)); - PP_NetAddress_IPv4_Dev server_ipv4_address; + PP_NetAddress_IPv4 server_ipv4_address; ASSERT_TRUE(server_address.DescribeAsIPv4Address(&server_ipv4_address)); - PP_NetAddress_IPv4_Dev broadcast_ipv4_address = { + PP_NetAddress_IPv4 broadcast_ipv4_address = { server_ipv4_address.port, { 0xff, 0xff, 0xff, 0xff } }; - pp::NetAddress_Dev broadcast_address(instance_, broadcast_ipv4_address); + pp::NetAddress broadcast_address(instance_, broadcast_ipv4_address); std::string message; const std::string first_message = "first message"; const std::string second_message = "second_message"; - pp::NetAddress_Dev recvfrom_address; + pp::NetAddress recvfrom_address; ASSERT_SUBTEST_SUCCESS(PassMessage(&server1, &server2, broadcast_address, first_message, &recvfrom_address)); // |first_message| was also received by |server2|. @@ -256,7 +256,7 @@ std::string TestUDPSocket::TestBroadcast() { } std::string TestUDPSocket::TestSetOption() { - pp::UDPSocket_Dev socket(instance_); + pp::UDPSocket socket(instance_); ASSERT_SUBTEST_SUCCESS(SetBroadcastOptions(&socket)); @@ -267,5 +267,52 @@ std::string TestUDPSocket::TestSetOption() { CHECK_CALLBACK_BEHAVIOR(callback); ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result()); + callback.WaitForResult(socket.SetOption( + PP_UDPSOCKET_OPTION_BROADCAST, pp::Var(false), callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_OK, callback.result()); + + // SEND_BUFFER_SIZE and RECV_BUFFER_SIZE shouldn't be set before the socket is + // bound. + callback.WaitForResult(socket.SetOption( + PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE, pp::Var(4096), + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_ERROR_FAILED, callback.result()); + + callback.WaitForResult(socket.SetOption( + PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE, pp::Var(512), + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_ERROR_FAILED, callback.result()); + + pp::NetAddress address; + ASSERT_SUBTEST_SUCCESS(LookupPortAndBindUDPSocket(&socket, &address)); + + // ADDRESS_REUSE and BROADCAST won't take effect after the socket is bound. + callback.WaitForResult(socket.SetOption( + PP_UDPSOCKET_OPTION_ADDRESS_REUSE, pp::Var(true), + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_ERROR_FAILED, callback.result()); + + callback.WaitForResult(socket.SetOption( + PP_UDPSOCKET_OPTION_BROADCAST, pp::Var(true), callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_ERROR_FAILED, callback.result()); + + // SEND_BUFFER_SIZE and RECV_BUFFER_SIZE can be set after the socket is bound. + callback.WaitForResult(socket.SetOption( + PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE, pp::Var(2048), + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_OK, callback.result()); + + callback.WaitForResult(socket.SetOption( + PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE, pp::Var(1024), + callback.GetCallback())); + CHECK_CALLBACK_BEHAVIOR(callback); + ASSERT_EQ(PP_OK, callback.result()); + PASS(); } diff --git a/ppapi/tests/test_udp_socket.h b/ppapi/tests/test_udp_socket.h index 986806c6fc..7c8721ee20 100644 --- a/ppapi/tests/test_udp_socket.h +++ b/ppapi/tests/test_udp_socket.h @@ -8,11 +8,11 @@ #include <string> #include "ppapi/c/pp_stdint.h" -#include "ppapi/cpp/dev/net_address_dev.h" +#include "ppapi/cpp/net_address.h" #include "ppapi/tests/test_case.h" namespace pp { -class UDPSocket_Dev; +class UDPSocket; } class TestUDPSocket: public TestCase { @@ -24,27 +24,27 @@ class TestUDPSocket: public TestCase { virtual void RunTests(const std::string& filter); private: - std::string GetLocalAddress(pp::NetAddress_Dev* address); - std::string SetBroadcastOptions(pp::UDPSocket_Dev* socket); - std::string BindUDPSocket(pp::UDPSocket_Dev* socket, - const pp::NetAddress_Dev& address); - std::string LookupPortAndBindUDPSocket(pp::UDPSocket_Dev* socket, - pp::NetAddress_Dev* address); - std::string ReadSocket(pp::UDPSocket_Dev* socket, - pp::NetAddress_Dev* address, + std::string GetLocalAddress(pp::NetAddress* address); + std::string SetBroadcastOptions(pp::UDPSocket* socket); + std::string BindUDPSocket(pp::UDPSocket* socket, + const pp::NetAddress& address); + std::string LookupPortAndBindUDPSocket(pp::UDPSocket* socket, + pp::NetAddress* address); + std::string ReadSocket(pp::UDPSocket* socket, + pp::NetAddress* address, size_t size, std::string* message); - std::string PassMessage(pp::UDPSocket_Dev* target, - pp::UDPSocket_Dev* source, - const pp::NetAddress_Dev& target_address, + std::string PassMessage(pp::UDPSocket* target, + pp::UDPSocket* source, + const pp::NetAddress& target_address, const std::string& message, - pp::NetAddress_Dev* recvfrom_address); + pp::NetAddress* recvfrom_address); std::string TestReadWrite(); std::string TestBroadcast(); std::string TestSetOption(); - pp::NetAddress_Dev address_; + pp::NetAddress address_; }; #endif // PPAPI_TESTS_TEST_UDP_SOCKET_H_ diff --git a/ppapi/tests/test_udp_socket_private.cc b/ppapi/tests/test_udp_socket_private.cc index 1380135944..ae1b978c29 100644 --- a/ppapi/tests/test_udp_socket_private.cc +++ b/ppapi/tests/test_udp_socket_private.cc @@ -75,12 +75,13 @@ std::string TestUDPSocketPrivate::GetLocalAddress( std::string TestUDPSocketPrivate::SetBroadcastOptions( pp::UDPSocketPrivate* socket) { - int32_t rv = socket->SetSocketFeature(PP_UDPSOCKETFEATURE_ADDRESS_REUSE, - pp::Var(true)); + int32_t rv = socket->SetSocketFeature( + PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE, pp::Var(true)); if (rv != PP_OK) return ReportError("PPB_UDPSocket_Private::SetSocketFeature", rv); - rv = socket->SetSocketFeature(PP_UDPSOCKETFEATURE_BROADCAST, pp::Var(true)); + rv = socket->SetSocketFeature(PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST, + pp::Var(true)); if (rv != PP_OK) return ReportError("PPB_UDPSocket_Private::SetSocketFeature", rv); @@ -246,12 +247,13 @@ std::string TestUDPSocketPrivate::TestBroadcast() { std::string TestUDPSocketPrivate::TestSetSocketFeatureErrors() { pp::UDPSocketPrivate socket(instance_); // Try to pass incorrect feature name. - int32_t rv = socket.SetSocketFeature(PP_UDPSOCKETFEATURE_COUNT, + int32_t rv = socket.SetSocketFeature(PP_UDPSOCKETFEATURE_PRIVATE_COUNT, pp::Var(true)); ASSERT_EQ(PP_ERROR_BADARGUMENT, rv); // Try to pass incorrect feature value's type. - rv = socket.SetSocketFeature(PP_UDPSOCKETFEATURE_ADDRESS_REUSE, pp::Var(1)); + rv = socket.SetSocketFeature(PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE, + pp::Var(1)); ASSERT_EQ(PP_ERROR_BADARGUMENT, rv); PASS(); } diff --git a/ppapi/tests/test_utils.cc b/ppapi/tests/test_utils.cc index 509d6ff8b0..f9fd7b699f 100644 --- a/ppapi/tests/test_utils.cc +++ b/ppapi/tests/test_utils.cc @@ -14,9 +14,9 @@ #endif #include "ppapi/c/pp_errors.h" -#include "ppapi/cpp/dev/net_address_dev.h" #include "ppapi/cpp/instance_handle.h" #include "ppapi/cpp/module.h" +#include "ppapi/cpp/net_address.h" #include "ppapi/cpp/private/host_resolver_private.h" #include "ppapi/cpp/private/net_address_private.h" #include "ppapi/cpp/var.h" @@ -103,15 +103,14 @@ uint16_t ConvertToNetEndian16(uint16_t x) { return (x << 8) | (x >> 8); } -bool EqualNetAddress(const pp::NetAddress_Dev& addr1, - const pp::NetAddress_Dev& addr2) { +bool EqualNetAddress(const pp::NetAddress& addr1, const pp::NetAddress& addr2) { if (addr1.GetFamily() == PP_NETADDRESS_FAMILY_UNSPECIFIED || addr2.GetFamily() == PP_NETADDRESS_FAMILY_UNSPECIFIED) { return false; } if (addr1.GetFamily() == PP_NETADDRESS_FAMILY_IPV4) { - PP_NetAddress_IPv4_Dev ipv4_addr1, ipv4_addr2; + PP_NetAddress_IPv4 ipv4_addr1, ipv4_addr2; if (!addr1.DescribeAsIPv4Address(&ipv4_addr1) || !addr2.DescribeAsIPv4Address(&ipv4_addr2)) { return false; @@ -120,7 +119,7 @@ bool EqualNetAddress(const pp::NetAddress_Dev& addr1, return ipv4_addr1.port == ipv4_addr2.port && !memcmp(ipv4_addr1.addr, ipv4_addr2.addr, sizeof(ipv4_addr1.addr)); } else { - PP_NetAddress_IPv6_Dev ipv6_addr1, ipv6_addr2; + PP_NetAddress_IPv6 ipv6_addr1, ipv6_addr2; if (!addr1.DescribeAsIPv6Address(&ipv6_addr1) || !addr2.DescribeAsIPv6Address(&ipv6_addr2)) { return false; @@ -134,11 +133,12 @@ bool EqualNetAddress(const pp::NetAddress_Dev& addr1, bool ResolveHost(PP_Instance instance, const std::string& host, uint16_t port, - pp::NetAddress_Dev* addr) { + pp::NetAddress* addr) { // TODO(yzshen): Change to use the public host resolver once it is supported. pp::InstanceHandle instance_handle(instance); pp::HostResolverPrivate host_resolver(instance_handle); - PP_HostResolver_Private_Hint hint = { PP_NETADDRESSFAMILY_UNSPECIFIED, 0 }; + PP_HostResolver_Private_Hint hint = + { PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED, 0 }; TestCompletionCallback callback(instance); callback.WaitForResult( @@ -151,26 +151,26 @@ bool ResolveHost(PP_Instance instance, } switch (pp::NetAddressPrivate::GetFamily(addr_private)) { - case PP_NETADDRESSFAMILY_IPV4: { - PP_NetAddress_IPv4_Dev ipv4_addr; + case PP_NETADDRESSFAMILY_PRIVATE_IPV4: { + PP_NetAddress_IPv4 ipv4_addr; ipv4_addr.port = ConvertToNetEndian16( pp::NetAddressPrivate::GetPort(addr_private)); if (!pp::NetAddressPrivate::GetAddress(addr_private, ipv4_addr.addr, sizeof(ipv4_addr.addr))) { return false; } - *addr = pp::NetAddress_Dev(instance_handle, ipv4_addr); + *addr = pp::NetAddress(instance_handle, ipv4_addr); return true; } - case PP_NETADDRESSFAMILY_IPV6: { - PP_NetAddress_IPv6_Dev ipv6_addr; + case PP_NETADDRESSFAMILY_PRIVATE_IPV6: { + PP_NetAddress_IPv6 ipv6_addr; ipv6_addr.port = ConvertToNetEndian16( pp::NetAddressPrivate::GetPort(addr_private)); if (!pp::NetAddressPrivate::GetAddress(addr_private, ipv6_addr.addr, sizeof(ipv6_addr.addr))) { return false; } - *addr = pp::NetAddress_Dev(instance_handle, ipv6_addr); + *addr = pp::NetAddress(instance_handle, ipv6_addr); return true; } default: { diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h index 04aa452499..8cd32d55c5 100644 --- a/ppapi/tests/test_utils.h +++ b/ppapi/tests/test_utils.h @@ -15,7 +15,7 @@ #include "ppapi/utility/completion_callback_factory.h" namespace pp { -class NetAddress_Dev; +class NetAddress; } // Timeout to wait for some action to complete. @@ -28,13 +28,12 @@ bool GetLocalHostPort(PP_Instance instance, std::string* host, uint16_t* port); uint16_t ConvertFromNetEndian16(uint16_t x); uint16_t ConvertToNetEndian16(uint16_t x); -bool EqualNetAddress(const pp::NetAddress_Dev& addr1, - const pp::NetAddress_Dev& addr2); +bool EqualNetAddress(const pp::NetAddress& addr1, const pp::NetAddress& addr2); // Only returns the first address if there are more than one available. bool ResolveHost(PP_Instance instance, const std::string& host, uint16_t port, - pp::NetAddress_Dev* addr); + pp::NetAddress* addr); // NestedEvent allows you to run a nested MessageLoop and wait for a particular // event to complete. For example, you can use it to wait for a callback on a diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h index fcba53c53e..52fcb775da 100644 --- a/ppapi/thunk/interfaces_ppb_private.h +++ b/ppapi/thunk/interfaces_ppb_private.h @@ -52,11 +52,6 @@ PROXIED_IFACE(NoAPIName, PPB_FILEIOTRUSTED_INTERFACE_0_4, PPB_FileIOTrusted_0_4) PROXIED_IFACE(NoAPIName, PPB_URLLOADERTRUSTED_INTERFACE_0_3, PPB_URLLoaderTrusted_0_3) -PROXIED_IFACE(NoAPIName, PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1, - PPB_VideoDestination_Private_0_1) -PROXIED_IFACE(NoAPIName, PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1, - PPB_VideoSource_Private_0_1) - // Hack to keep font working. The Font 0.6 API is binary compatible with // BrowserFont 1.0, so just map the string to the same thing. // TODO(brettw) remove support for the old Font API. diff --git a/ppapi/thunk/interfaces_ppb_private_no_permissions.h b/ppapi/thunk/interfaces_ppb_private_no_permissions.h index dca6289779..a76665a712 100644 --- a/ppapi/thunk/interfaces_ppb_private_no_permissions.h +++ b/ppapi/thunk/interfaces_ppb_private_no_permissions.h @@ -52,4 +52,9 @@ PROXIED_IFACE(NoAPIName, PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1, PROXIED_IFACE(NoAPIName, PPB_FILEIO_PRIVATE_INTERFACE_0_1, PPB_FileIO_Private_0_1) +PROXIED_IFACE(NoAPIName, PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1, + PPB_VideoDestination_Private_0_1) +PROXIED_IFACE(NoAPIName, PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1, + PPB_VideoSource_Private_0_1) + #include "ppapi/thunk/interfaces_postamble.h" diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index 344e2ba4f2..ca487aac25 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) @@ -25,35 +23,26 @@ PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_5, PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_6, PPB_FileChooser_Dev_0_6) UNPROXIED_IFACE(PPB_Find, PPB_FIND_DEV_INTERFACE_0_3, PPB_Find_Dev_0_3) -PROXIED_IFACE(NoAPIName, PPB_HOSTRESOLVER_DEV_INTERFACE_0_1, - PPB_HostResolver_Dev_0_1) PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_2, PPB_IMEInputEvent_Dev_0_2) PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_1, PPB_KeyboardInputEvent_Dev_0_1) PROXIED_IFACE(NoAPIName, PPB_MEMORY_DEV_INTERFACE_0_1, PPB_Memory_Dev_0_1) -PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_DEV_INTERFACE_0_1, - PPB_NetAddress_Dev_0_1) 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, PPB_TrueTypeFont_Dev_0_1) -PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_DEV_INTERFACE_0_1, - PPB_UDPSocket_Dev_0_1) -PROXIED_IFACE(NoAPIName, PPB_VAR_ARRAY_DEV_INTERFACE_0_1, PPB_VarArray_Dev_0_1) -PROXIED_IFACE(NoAPIName, PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1, - PPB_VarDictionary_Dev_0_1) PROXIED_IFACE(NoAPIName, PPB_VIEW_DEV_INTERFACE_0_1, PPB_View_Dev_0_1) UNPROXIED_IFACE(PPB_Instance, PPB_ZOOM_DEV_INTERFACE_0_2, PPB_Zoom_Dev_0_2) PROXIED_IFACE(PPB_Instance, PPB_TRACE_EVENT_DEV_INTERFACE_0_1, PPB_Trace_Event_Dev_0_1) +PROXIED_IFACE(PPB_Instance, PPB_TRACE_EVENT_DEV_INTERFACE_0_2, + PPB_Trace_Event_Dev_0_2) #if !defined(OS_NACL) PROXIED_API(PPB_Buffer) @@ -65,6 +54,8 @@ PROXIED_IFACE(NoAPIName, PPB_AUDIO_INPUT_DEV_INTERFACE_0_2, PPB_AudioInput_Dev_0_2) PROXIED_IFACE(NoAPIName, PPB_AUDIO_INPUT_DEV_INTERFACE_0_3, PPB_AudioInput_Dev_0_3) +PROXIED_IFACE(NoAPIName, PPB_AUDIO_INPUT_DEV_INTERFACE_0_4, + PPB_AudioInput_Dev_0_4) PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1, PPB_IMEInputEvent_Dev_0_1) PROXIED_IFACE(PPB_Buffer, PPB_BUFFER_DEV_INTERFACE_0_4, PPB_Buffer_Dev_0_4) diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h index ddfe2ca0f3..d3addcb446 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. @@ -57,6 +58,7 @@ PROXIED_IFACE(NoAPIName, PPB_FILEIO_INTERFACE_1_0, PPB_FileIO_1_0) PROXIED_IFACE(NoAPIName, PPB_FILEIO_INTERFACE_1_1, PPB_FileIO_1_1) PROXIED_IFACE(NoAPIName, PPB_GRAPHICS_2D_INTERFACE_1_0, PPB_Graphics2D_1_0) PROXIED_IFACE(NoAPIName, PPB_GRAPHICS_2D_INTERFACE_1_1, PPB_Graphics2D_1_1) +PROXIED_IFACE(NoAPIName, PPB_HOSTRESOLVER_INTERFACE_1_0, PPB_HostResolver_1_0) PROXIED_IFACE(NoAPIName, PPB_INPUT_EVENT_INTERFACE_1_0, PPB_InputEvent_1_0) PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0, PPB_KeyboardInputEvent_1_0) @@ -72,11 +74,18 @@ PROXIED_IFACE(PPB_Instance, PPB_FULLSCREEN_INTERFACE_1_0, PPB_Fullscreen_1_0) 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(NoAPIName, PPB_NETWORKPROXY_INTERFACE_1_0, PPB_NetworkProxy_1_0) +PROXIED_IFACE(PPB_TCPSocket, PPB_TCPSOCKET_INTERFACE_1_0, PPB_TCPSocket_1_0) +PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_INTERFACE_1_0, PPB_UDPSocket_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) PROXIED_IFACE(NoAPIName, PPB_URLRESPONSEINFO_INTERFACE_1_0, PPB_URLResponseInfo_1_0) +PROXIED_IFACE(NoAPIName, PPB_VAR_ARRAY_INTERFACE_1_0, PPB_VarArray_1_0) +PROXIED_IFACE(NoAPIName, PPB_VAR_DICTIONARY_INTERFACE_1_0, + PPB_VarDictionary_1_0) PROXIED_IFACE(NoAPIName, PPB_WEBSOCKET_INTERFACE_1_0, PPB_WebSocket_1_0) // Note: PPB_Var and PPB_VarArrayBuffer are special and registered manually. diff --git a/ppapi/thunk/ppb_audio_input_api.h b/ppapi/thunk/ppb_audio_input_api.h index ebae557330..60fc881d8a 100644 --- a/ppapi/thunk/ppb_audio_input_api.h +++ b/ppapi/thunk/ppb_audio_input_api.h @@ -27,6 +27,11 @@ class PPB_AudioInput_API { scoped_refptr<TrackedCallback> callback) = 0; virtual int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback, void* user_data) = 0; + virtual int32_t Open0_2(PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback_0_2 audio_input_callback_0_2, + void* user_data, + scoped_refptr<TrackedCallback> callback) = 0; virtual int32_t Open(PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, diff --git a/ppapi/thunk/ppb_audio_input_dev_thunk.cc b/ppapi/thunk/ppb_audio_input_dev_thunk.cc index 2a787370a3..ee38c7ad9f 100644 --- a/ppapi/thunk/ppb_audio_input_dev_thunk.cc +++ b/ppapi/thunk/ppb_audio_input_dev_thunk.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From dev/ppb_audio_input_dev.idl modified Tue Apr 16 11:25:44 2013. - #include "ppapi/c/dev/ppb_audio_input_dev.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" @@ -66,6 +64,23 @@ int32_t MonitorDeviceChange(PP_Resource audio_input, return enter.object()->MonitorDeviceChange(callback, user_data); } +int32_t Open_0_2(PP_Resource audio_input, + PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback_0_2 audio_input_callback, + void* user_data, + struct PP_CompletionCallback callback) { + VLOG(4) << "PPB_AudioInput_Dev::Open()"; + EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->Open0_2(device_ref, + config, + audio_input_callback, + user_data, + enter.callback())); +} + int32_t Open(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, @@ -119,7 +134,7 @@ const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_dev_thunk_0_2 = { &Create, &IsAudioInput, &EnumerateDevices_0_2, - &Open, + &Open_0_2, &GetCurrentConfig, &StartCapture, &StopCapture, @@ -131,6 +146,18 @@ const PPB_AudioInput_Dev_0_3 g_ppb_audioinput_dev_thunk_0_3 = { &IsAudioInput, &EnumerateDevices, &MonitorDeviceChange, + &Open_0_2, + &GetCurrentConfig, + &StartCapture, + &StopCapture, + &Close +}; + +const PPB_AudioInput_Dev_0_4 g_ppb_audioinput_dev_thunk_0_4 = { + &Create, + &IsAudioInput, + &EnumerateDevices, + &MonitorDeviceChange, &Open, &GetCurrentConfig, &StartCapture, @@ -148,5 +175,9 @@ const PPB_AudioInput_Dev_0_3* GetPPB_AudioInput_Dev_0_3_Thunk() { return &g_ppb_audioinput_dev_thunk_0_3; } +const PPB_AudioInput_Dev_0_4* GetPPB_AudioInput_Dev_0_4_Thunk() { + return &g_ppb_audioinput_dev_thunk_0_4; +} + } // namespace thunk } // namespace ppapi diff --git a/ppapi/thunk/ppb_host_resolver_api.h b/ppapi/thunk/ppb_host_resolver_api.h index 0c4c8ef1f3..f2acde20df 100644 --- a/ppapi/thunk/ppb_host_resolver_api.h +++ b/ppapi/thunk/ppb_host_resolver_api.h @@ -6,7 +6,7 @@ #define PPAPI_THUNK_PPB_HOST_RESOLVER_API_H_ #include "base/memory/ref_counted.h" -#include "ppapi/c/dev/ppb_host_resolver_dev.h" +#include "ppapi/c/ppb_host_resolver.h" #include "ppapi/thunk/ppapi_thunk_export.h" namespace ppapi { @@ -21,7 +21,7 @@ class PPAPI_THUNK_EXPORT PPB_HostResolver_API { virtual int32_t Resolve(const char* host, uint16_t port, - const PP_HostResolver_Hint_Dev* hint, + const PP_HostResolver_Hint* hint, scoped_refptr<TrackedCallback> callback) = 0; virtual PP_Var GetCanonicalName() = 0; virtual uint32_t GetNetAddressCount() = 0; diff --git a/ppapi/thunk/ppb_host_resolver_dev_thunk.cc b/ppapi/thunk/ppb_host_resolver_thunk.cc index 332478b145..03b8d01be4 100644 --- a/ppapi/thunk/ppb_host_resolver_dev_thunk.cc +++ b/ppapi/thunk/ppb_host_resolver_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_host_resolver_dev.idl modified Sun Jun 09 11:17:35 2013. +// From ppb_host_resolver.idl modified Thu Jun 20 15:36:07 2013. -#include "ppapi/c/dev/ppb_host_resolver_dev.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_host_resolver.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_host_resolver_api.h" @@ -20,7 +20,7 @@ namespace thunk { namespace { PP_Resource Create(PP_Instance instance) { - VLOG(4) << "PPB_HostResolver_Dev::Create()"; + VLOG(4) << "PPB_HostResolver::Create()"; EnterResourceCreation enter(instance); if (enter.failed()) return 0; @@ -28,7 +28,7 @@ PP_Resource Create(PP_Instance instance) { } PP_Bool IsHostResolver(PP_Resource resource) { - VLOG(4) << "PPB_HostResolver_Dev::IsHostResolver()"; + VLOG(4) << "PPB_HostResolver::IsHostResolver()"; EnterResource<PPB_HostResolver_API> enter(resource, false); return PP_FromBool(enter.succeeded()); } @@ -36,9 +36,9 @@ PP_Bool IsHostResolver(PP_Resource resource) { int32_t Resolve(PP_Resource host_resolver, const char* host, uint16_t port, - const struct PP_HostResolver_Hint_Dev* hint, + const struct PP_HostResolver_Hint* hint, struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_HostResolver_Dev::Resolve()"; + VLOG(4) << "PPB_HostResolver::Resolve()"; EnterResource<PPB_HostResolver_API> enter(host_resolver, callback, true); if (enter.failed()) return enter.retval(); @@ -49,7 +49,7 @@ int32_t Resolve(PP_Resource host_resolver, } struct PP_Var GetCanonicalName(PP_Resource host_resolver) { - VLOG(4) << "PPB_HostResolver_Dev::GetCanonicalName()"; + VLOG(4) << "PPB_HostResolver::GetCanonicalName()"; EnterResource<PPB_HostResolver_API> enter(host_resolver, true); if (enter.failed()) return PP_MakeUndefined(); @@ -57,7 +57,7 @@ struct PP_Var GetCanonicalName(PP_Resource host_resolver) { } uint32_t GetNetAddressCount(PP_Resource host_resolver) { - VLOG(4) << "PPB_HostResolver_Dev::GetNetAddressCount()"; + VLOG(4) << "PPB_HostResolver::GetNetAddressCount()"; EnterResource<PPB_HostResolver_API> enter(host_resolver, true); if (enter.failed()) return 0; @@ -65,14 +65,14 @@ uint32_t GetNetAddressCount(PP_Resource host_resolver) { } PP_Resource GetNetAddress(PP_Resource host_resolver, uint32_t index) { - VLOG(4) << "PPB_HostResolver_Dev::GetNetAddress()"; + VLOG(4) << "PPB_HostResolver::GetNetAddress()"; EnterResource<PPB_HostResolver_API> enter(host_resolver, true); if (enter.failed()) return 0; return enter.object()->GetNetAddress(index); } -const PPB_HostResolver_Dev_0_1 g_ppb_hostresolver_dev_thunk_0_1 = { +const PPB_HostResolver_1_0 g_ppb_hostresolver_thunk_1_0 = { &Create, &IsHostResolver, &Resolve, @@ -83,8 +83,8 @@ const PPB_HostResolver_Dev_0_1 g_ppb_hostresolver_dev_thunk_0_1 = { } // namespace -const PPB_HostResolver_Dev_0_1* GetPPB_HostResolver_Dev_0_1_Thunk() { - return &g_ppb_hostresolver_dev_thunk_0_1; +const PPB_HostResolver_1_0* GetPPB_HostResolver_1_0_Thunk() { + return &g_ppb_hostresolver_thunk_1_0; } } // namespace thunk diff --git a/ppapi/thunk/ppb_image_data_thunk.cc b/ppapi/thunk/ppb_image_data_thunk.cc index b16c9c0d1b..51daa59045 100644 --- a/ppapi/thunk/ppb_image_data_thunk.cc +++ b/ppapi/thunk/ppb_image_data_thunk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From ppb_image_data.idl modified Thu Apr 25 14:42:27 2013. +// From ppb_image_data.idl modified Thu Jun 6 18:05:40 2013. #include <string.h> @@ -40,11 +40,6 @@ PP_Resource Create(PP_Instance instance, if (enter.failed()) return 0; return enter.functions()->CreateImageData(instance, -#if !defined(OS_NACL) - PPB_ImageData_Shared::PLATFORM, -#else - PPB_ImageData_Shared::SIMPLE, -#endif format, size, init_to_zero); diff --git a/ppapi/thunk/ppb_net_address_api.h b/ppapi/thunk/ppb_net_address_api.h index 7a22c3ccf3..7ae9d7f878 100644 --- a/ppapi/thunk/ppb_net_address_api.h +++ b/ppapi/thunk/ppb_net_address_api.h @@ -5,7 +5,7 @@ #ifndef PPAPI_THUNK_PPB_NET_ADDRESS_API_H_ #define PPAPI_THUNK_PPB_NET_ADDRESS_API_H_ -#include "ppapi/c/dev/ppb_net_address_dev.h" +#include "ppapi/c/ppb_net_address.h" #include "ppapi/thunk/ppapi_thunk_export.h" struct PP_NetAddress_Private; @@ -17,10 +17,10 @@ class PPAPI_THUNK_EXPORT PPB_NetAddress_API { public: virtual ~PPB_NetAddress_API() {} - virtual PP_NetAddress_Family_Dev GetFamily() = 0; + virtual PP_NetAddress_Family GetFamily() = 0; virtual PP_Var DescribeAsString(PP_Bool include_port) = 0; - virtual PP_Bool DescribeAsIPv4Address(PP_NetAddress_IPv4_Dev* ipv4_addr) = 0; - virtual PP_Bool DescribeAsIPv6Address(PP_NetAddress_IPv6_Dev* ipv6_addr) = 0; + virtual PP_Bool DescribeAsIPv4Address(PP_NetAddress_IPv4* ipv4_addr) = 0; + virtual PP_Bool DescribeAsIPv6Address(PP_NetAddress_IPv6* ipv6_addr) = 0; virtual const PP_NetAddress_Private& GetNetAddressPrivate() = 0; }; diff --git a/ppapi/thunk/ppb_net_address_dev_thunk.cc b/ppapi/thunk/ppb_net_address_thunk.cc index 9f0e5088f6..f8916fe971 100644 --- a/ppapi/thunk/ppb_net_address_dev_thunk.cc +++ b/ppapi/thunk/ppb_net_address_thunk.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/c/dev/ppb_net_address_dev.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_net_address.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_instance_api.h" @@ -18,8 +18,8 @@ namespace { PP_Resource CreateFromIPv4Address( PP_Instance instance, - const struct PP_NetAddress_IPv4_Dev* ipv4_addr) { - VLOG(4) << "PPB_NetAddress_Dev::CreateFromIPv4Address()"; + const struct PP_NetAddress_IPv4* ipv4_addr) { + VLOG(4) << "PPB_NetAddress::CreateFromIPv4Address()"; EnterResourceCreation enter(instance); if (enter.failed()) return 0; @@ -29,8 +29,8 @@ PP_Resource CreateFromIPv4Address( PP_Resource CreateFromIPv6Address( PP_Instance instance, - const struct PP_NetAddress_IPv6_Dev* ipv6_addr) { - VLOG(4) << "PPB_NetAddress_Dev::CreateFromIPv6Address()"; + const struct PP_NetAddress_IPv6* ipv6_addr) { + VLOG(4) << "PPB_NetAddress::CreateFromIPv6Address()"; EnterResourceCreation enter(instance); if (enter.failed()) return 0; @@ -38,14 +38,14 @@ PP_Resource CreateFromIPv6Address( ipv6_addr); } -PP_Bool IsNetAddress(PP_Resource addr) { - VLOG(4) << "PPB_NetAddress_Dev::IsNetAddress()"; - EnterResource<PPB_NetAddress_API> enter(addr, false); +PP_Bool IsNetAddress(PP_Resource resource) { + VLOG(4) << "PPB_NetAddress::IsNetAddress()"; + EnterResource<PPB_NetAddress_API> enter(resource, false); return PP_FromBool(enter.succeeded()); } -PP_NetAddress_Family_Dev GetFamily(PP_Resource addr) { - VLOG(4) << "PPB_NetAddress_Dev::GetFamily()"; +PP_NetAddress_Family GetFamily(PP_Resource addr) { + VLOG(4) << "PPB_NetAddress::GetFamily()"; EnterResource<PPB_NetAddress_API> enter(addr, true); if (enter.failed()) return PP_NETADDRESS_FAMILY_UNSPECIFIED; @@ -53,7 +53,7 @@ PP_NetAddress_Family_Dev GetFamily(PP_Resource addr) { } struct PP_Var DescribeAsString(PP_Resource addr, PP_Bool include_port) { - VLOG(4) << "PPB_NetAddress_Dev::DescribeAsString()"; + VLOG(4) << "PPB_NetAddress::DescribeAsString()"; EnterResource<PPB_NetAddress_API> enter(addr, true); if (enter.failed()) return PP_MakeUndefined(); @@ -61,8 +61,8 @@ struct PP_Var DescribeAsString(PP_Resource addr, PP_Bool include_port) { } PP_Bool DescribeAsIPv4Address(PP_Resource addr, - struct PP_NetAddress_IPv4_Dev* ipv4_addr) { - VLOG(4) << "PPB_NetAddress_Dev::DescribeAsIPv4Address()"; + struct PP_NetAddress_IPv4* ipv4_addr) { + VLOG(4) << "PPB_NetAddress::DescribeAsIPv4Address()"; EnterResource<PPB_NetAddress_API> enter(addr, true); if (enter.failed()) return PP_FALSE; @@ -70,15 +70,15 @@ PP_Bool DescribeAsIPv4Address(PP_Resource addr, } PP_Bool DescribeAsIPv6Address(PP_Resource addr, - struct PP_NetAddress_IPv6_Dev* ipv6_addr) { - VLOG(4) << "PPB_NetAddress_Dev::DescribeAsIPv6Address()"; + struct PP_NetAddress_IPv6* ipv6_addr) { + VLOG(4) << "PPB_NetAddress::DescribeAsIPv6Address()"; EnterResource<PPB_NetAddress_API> enter(addr, true); if (enter.failed()) return PP_FALSE; return enter.object()->DescribeAsIPv6Address(ipv6_addr); } -const PPB_NetAddress_Dev_0_1 g_ppb_netaddress_dev_thunk_0_1 = { +const PPB_NetAddress_1_0 g_ppb_netaddress_thunk_1_0 = { &CreateFromIPv4Address, &CreateFromIPv6Address, &IsNetAddress, @@ -90,8 +90,8 @@ const PPB_NetAddress_Dev_0_1 g_ppb_netaddress_dev_thunk_0_1 = { } // namespace -const PPB_NetAddress_Dev_0_1* GetPPB_NetAddress_Dev_0_1_Thunk() { - return &g_ppb_netaddress_dev_thunk_0_1; +const PPB_NetAddress_1_0* GetPPB_NetAddress_1_0_Thunk() { + return &g_ppb_netaddress_thunk_1_0; } } // namespace thunk diff --git a/ppapi/thunk/ppb_network_proxy_api.h b/ppapi/thunk/ppb_network_proxy_api.h new file mode 100644 index 0000000000..3cefaa070b --- /dev/null +++ b/ppapi/thunk/ppb_network_proxy_api.h @@ -0,0 +1,38 @@ +// Copyright (c) 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. + +#ifndef PPAPI_THUNK_PPB_NETWORK_PROXY_API_H_ +#define PPAPI_THUNK_PPB_NETWORK_PROXY_API_H_ + +#include "base/basictypes.h" +#include "base/memory/ref_counted.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/shared_impl/singleton_resource_id.h" +#include "ppapi/thunk/ppapi_thunk_export.h" + +struct PP_Var; + +namespace ppapi { + +class TrackedCallback; + +namespace thunk { + +class PPAPI_THUNK_EXPORT PPB_NetworkProxy_API { + public: + virtual ~PPB_NetworkProxy_API() {} + + virtual int32_t GetProxyForURL(PP_Instance instance, + PP_Var url, + PP_Var* proxy_string, + scoped_refptr<TrackedCallback> callback) = 0; + + static const SingletonResourceID kSingletonResourceID = + NETWORK_PROXY_SINGLETON_ID; +}; + +} // namespace thunk +} // namespace ppapi + +#endif // PPAPI_THUNK_PPB_NETWORK_PROXY_API_H_ diff --git a/ppapi/thunk/ppb_network_proxy_thunk.cc b/ppapi/thunk/ppb_network_proxy_thunk.cc new file mode 100644 index 0000000000..20c14ade98 --- /dev/null +++ b/ppapi/thunk/ppb_network_proxy_thunk.cc @@ -0,0 +1,47 @@ +// 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. + +// From ppb_network_proxy.idl modified Thu Jun 20 22:03:12 2013. + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_network_proxy.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_instance_api.h" +#include "ppapi/thunk/ppb_network_proxy_api.h" +#include "ppapi/thunk/resource_creation_api.h" +#include "ppapi/thunk/thunk.h" + +namespace ppapi { +namespace thunk { + +namespace { + +int32_t GetProxyForURL(PP_Instance instance, + struct PP_Var url, + struct PP_Var* proxy_string, + struct PP_CompletionCallback callback) { + VLOG(4) << "PPB_NetworkProxy::GetProxyForURL()"; + EnterInstanceAPI<PPB_NetworkProxy_API> enter(instance, callback); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.functions()->GetProxyForURL(instance, + url, + proxy_string, + enter.callback())); +} + +const PPB_NetworkProxy_1_0 g_ppb_networkproxy_thunk_1_0 = { + &GetProxyForURL +}; + +} // namespace + +const PPB_NetworkProxy_1_0* GetPPB_NetworkProxy_1_0_Thunk() { + return &g_ppb_networkproxy_thunk_1_0; +} + +} // namespace thunk +} // namespace ppapi diff --git a/ppapi/thunk/ppb_tcp_socket_api.h b/ppapi/thunk/ppb_tcp_socket_api.h index 1b94a83f93..d33685fd97 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 43a19683a9..ff612fb54d 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 diff --git a/ppapi/thunk/ppb_udp_socket_api.h b/ppapi/thunk/ppb_udp_socket_api.h index 1368e9c3d0..adc2799116 100644 --- a/ppapi/thunk/ppb_udp_socket_api.h +++ b/ppapi/thunk/ppb_udp_socket_api.h @@ -6,7 +6,7 @@ #define PPAPI_THUNK_PPB_UDP_SOCKET_API_H_ #include "base/memory/ref_counted.h" -#include "ppapi/c/dev/ppb_udp_socket_dev.h" +#include "ppapi/c/ppb_udp_socket.h" #include "ppapi/thunk/ppapi_thunk_export.h" namespace ppapi { @@ -31,7 +31,7 @@ class PPAPI_THUNK_EXPORT PPB_UDPSocket_API { PP_Resource addr, scoped_refptr<TrackedCallback> callback) = 0; virtual void Close() = 0; - virtual int32_t SetOption(PP_UDPSocket_Option_Dev name, + virtual int32_t SetOption(PP_UDPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback) = 0; }; diff --git a/ppapi/thunk/ppb_udp_socket_dev_thunk.cc b/ppapi/thunk/ppb_udp_socket_thunk.cc index aa5165da66..8343d2f862 100644 --- a/ppapi/thunk/ppb_udp_socket_dev_thunk.cc +++ b/ppapi/thunk/ppb_udp_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_udp_socket_dev.idl modified Fri Jun 07 14:22:41 2013. +// From ppb_udp_socket.idl modified Thu Jun 20 14:03:55 2013. -#include "ppapi/c/dev/ppb_udp_socket_dev.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_udp_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_UDPSocket_Dev::Create()"; + VLOG(4) << "PPB_UDPSocket::Create()"; EnterResourceCreation enter(instance); if (enter.failed()) return 0; @@ -28,7 +28,7 @@ PP_Resource Create(PP_Instance instance) { } PP_Bool IsUDPSocket(PP_Resource resource) { - VLOG(4) << "PPB_UDPSocket_Dev::IsUDPSocket()"; + VLOG(4) << "PPB_UDPSocket::IsUDPSocket()"; EnterResource<PPB_UDPSocket_API> enter(resource, false); return PP_FromBool(enter.succeeded()); } @@ -36,7 +36,7 @@ PP_Bool IsUDPSocket(PP_Resource resource) { int32_t Bind(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_UDPSocket_Dev::Bind()"; + VLOG(4) << "PPB_UDPSocket::Bind()"; EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); if (enter.failed()) return enter.retval(); @@ -44,7 +44,7 @@ int32_t Bind(PP_Resource udp_socket, } PP_Resource GetBoundAddress(PP_Resource udp_socket) { - VLOG(4) << "PPB_UDPSocket_Dev::GetBoundAddress()"; + VLOG(4) << "PPB_UDPSocket::GetBoundAddress()"; EnterResource<PPB_UDPSocket_API> enter(udp_socket, true); if (enter.failed()) return 0; @@ -56,7 +56,7 @@ int32_t RecvFrom(PP_Resource udp_socket, int32_t num_bytes, PP_Resource* addr, struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_UDPSocket_Dev::RecvFrom()"; + VLOG(4) << "PPB_UDPSocket::RecvFrom()"; EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); if (enter.failed()) return enter.retval(); @@ -71,7 +71,7 @@ int32_t SendTo(PP_Resource udp_socket, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_UDPSocket_Dev::SendTo()"; + VLOG(4) << "PPB_UDPSocket::SendTo()"; EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); if (enter.failed()) return enter.retval(); @@ -82,7 +82,7 @@ int32_t SendTo(PP_Resource udp_socket, } void Close(PP_Resource udp_socket) { - VLOG(4) << "PPB_UDPSocket_Dev::Close()"; + VLOG(4) << "PPB_UDPSocket::Close()"; EnterResource<PPB_UDPSocket_API> enter(udp_socket, true); if (enter.failed()) return; @@ -90,10 +90,10 @@ void Close(PP_Resource udp_socket) { } int32_t SetOption(PP_Resource udp_socket, - PP_UDPSocket_Option_Dev name, + PP_UDPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_UDPSocket_Dev::SetOption()"; + VLOG(4) << "PPB_UDPSocket::SetOption()"; EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); if (enter.failed()) return enter.retval(); @@ -102,7 +102,7 @@ int32_t SetOption(PP_Resource udp_socket, enter.callback())); } -const PPB_UDPSocket_Dev_0_1 g_ppb_udpsocket_dev_thunk_0_1 = { +const PPB_UDPSocket_1_0 g_ppb_udpsocket_thunk_1_0 = { &Create, &IsUDPSocket, &Bind, @@ -115,8 +115,8 @@ const PPB_UDPSocket_Dev_0_1 g_ppb_udpsocket_dev_thunk_0_1 = { } // namespace -const PPB_UDPSocket_Dev_0_1* GetPPB_UDPSocket_Dev_0_1_Thunk() { - return &g_ppb_udpsocket_dev_thunk_0_1; +const PPB_UDPSocket_1_0* GetPPB_UDPSocket_1_0_Thunk() { + return &g_ppb_udpsocket_thunk_1_0; } } // namespace thunk diff --git a/ppapi/thunk/ppb_var_array_thunk.cc b/ppapi/thunk/ppb_var_array_thunk.cc index 7321424d29..9ab52ac6cc 100644 --- a/ppapi/thunk/ppb_var_array_thunk.cc +++ b/ppapi/thunk/ppb_var_array_thunk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/c/dev/ppb_var_array_dev.h" +#include "ppapi/c/ppb_var_array.h" #include "ppapi/shared_impl/array_var.h" #include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/thunk/thunk.h" @@ -56,7 +56,7 @@ PP_Bool SetLength(PP_Var array, uint32_t length) { return array_var->SetLength(length); } -const PPB_VarArray_Dev_0_1 g_ppb_vararray_0_1_thunk = { +const PPB_VarArray_1_0 g_ppb_vararray_1_0_thunk = { &Create, &Get, &Set, @@ -66,8 +66,8 @@ const PPB_VarArray_Dev_0_1 g_ppb_vararray_0_1_thunk = { } // namespace -const PPB_VarArray_Dev_0_1* GetPPB_VarArray_Dev_0_1_Thunk() { - return &g_ppb_vararray_0_1_thunk; +const PPB_VarArray_1_0* GetPPB_VarArray_1_0_Thunk() { + return &g_ppb_vararray_1_0_thunk; } } // namespace thunk diff --git a/ppapi/thunk/ppb_var_dictionary_thunk.cc b/ppapi/thunk/ppb_var_dictionary_thunk.cc index 25a82249f2..f2ace6516f 100644 --- a/ppapi/thunk/ppb_var_dictionary_thunk.cc +++ b/ppapi/thunk/ppb_var_dictionary_thunk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" +#include "ppapi/c/ppb_var_dictionary.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_var.h" #include "ppapi/shared_impl/dictionary_var.h" @@ -67,7 +67,7 @@ PP_Var GetKeys(PP_Var dict) { return dict_var->GetKeys(); } -const PPB_VarDictionary_Dev_0_1 g_ppb_vardictionary_0_1_thunk = { +const PPB_VarDictionary_1_0 g_ppb_vardictionary_1_0_thunk = { &Create, &Get, &Set, @@ -78,8 +78,8 @@ const PPB_VarDictionary_Dev_0_1 g_ppb_vardictionary_0_1_thunk = { } // namespace -const PPB_VarDictionary_Dev_0_1* GetPPB_VarDictionary_Dev_0_1_Thunk() { - return &g_ppb_vardictionary_0_1_thunk; +const PPB_VarDictionary_1_0* GetPPB_VarDictionary_1_0_Thunk() { + return &g_ppb_vardictionary_1_0_thunk; } } // namespace thunk diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h index 2d0fd90e5b..082f1ccb07 100644 --- a/ppapi/thunk/resource_creation_api.h +++ b/ppapi/thunk/resource_creation_api.h @@ -26,8 +26,8 @@ struct PP_Flash_Menu; struct PP_FontDescription_Dev; struct PP_BrowserFont_Trusted_Description; -struct PP_NetAddress_IPv4_Dev; -struct PP_NetAddress_IPv6_Dev; +struct PP_NetAddress_IPv4; +struct PP_NetAddress_IPv6; struct PP_NetAddress_Private; struct PP_Size; @@ -133,16 +133,19 @@ class ResourceCreationAPI { virtual PP_Resource CreateHostResolver(PP_Instance instance) = 0; virtual PP_Resource CreateHostResolverPrivate(PP_Instance instance) = 0; virtual PP_Resource CreateImageData(PP_Instance instance, - PPB_ImageData_Shared::ImageDataType type, PP_ImageDataFormat format, const PP_Size* size, PP_Bool init_to_zero) = 0; + virtual PP_Resource CreateImageDataSimple(PP_Instance instance, + PP_ImageDataFormat format, + const PP_Size* size, + PP_Bool init_to_zero) = 0; virtual PP_Resource CreateNetAddressFromIPv4Address( PP_Instance instance, - const PP_NetAddress_IPv4_Dev* ipv4_addr) = 0; + const PP_NetAddress_IPv4* ipv4_addr) = 0; virtual PP_Resource CreateNetAddressFromIPv6Address( PP_Instance instance, - const PP_NetAddress_IPv6_Dev* ipv6_addr) = 0; + const PP_NetAddress_IPv6* ipv6_addr) = 0; virtual PP_Resource CreateNetAddressFromNetAddressPrivate( PP_Instance instance, const PP_NetAddress_Private& private_addr) = 0; @@ -156,6 +159,8 @@ class ResourceCreationAPI { virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instace) = 0; virtual PP_Resource CreateUDPSocket(PP_Instance instace) = 0; virtual PP_Resource CreateUDPSocketPrivate(PP_Instance instace) = 0; + virtual PP_Resource CreateVideoDestination(PP_Instance instance) = 0; + virtual PP_Resource CreateVideoSource(PP_Instance instance) = 0; virtual PP_Resource CreateWebSocket(PP_Instance instance) = 0; virtual PP_Resource CreateX509CertificatePrivate(PP_Instance instance) = 0; #if !defined(OS_NACL) @@ -181,8 +186,6 @@ class ResourceCreationAPI { PP_Instance instance, PP_Resource context3d_id, PP_VideoDecoder_Profile profile) = 0; - virtual PP_Resource CreateVideoDestination(PP_Instance instance) = 0; - virtual PP_Resource CreateVideoSource(PP_Instance instance) = 0; #endif // !defined(OS_NACL) static const ApiID kApiID = API_ID_RESOURCE_CREATION; |