Merge from Chromium at DEPS revision r198571
This commit was generated by merge_to_master.py.
Change-Id: I951118a03836157090561764dd2627f0add8118f
diff --git a/ppapi/OWNERS b/ppapi/OWNERS
index 91a1e19..6caf4de 100644
--- a/ppapi/OWNERS
+++ b/ppapi/OWNERS
@@ -1,4 +1,5 @@
brettw@chromium.org
dmichael@chromium.org
+raymes@chromium.org
viettrungluu@chromium.org
yzshen@chromium.org
diff --git a/ppapi/PRESUBMIT.py b/ppapi/PRESUBMIT.py
index 9b6f716..72672e9 100644
--- a/ppapi/PRESUBMIT.py
+++ b/ppapi/PRESUBMIT.py
@@ -65,6 +65,8 @@
# Only examine public stable interfaces.
if name_parts[2] in ['dev', 'private', 'trusted']:
continue
+ if name_parts[2] == 'extensions' and name_parts[3] == 'dev':
+ continue
filepath = os.path.join('..', filename)
if RE_TODO.search(open(filepath, 'rb').read()):
@@ -175,7 +177,7 @@
for line in lines:
if line[2].split()[:2] == ['#define', 'PPAPI_RELEASE']:
results.append(
- output_api.PresubmitNotifyResult(
+ output_api.PresubmitPromptOrNotify(
'PPAPI_RELEASE has changed', long_text=line[2]))
releaseChanged = True
break
diff --git a/ppapi/api/dev/pp_video_dev.idl b/ppapi/api/dev/pp_video_dev.idl
index 936eede..97bd4ce 100644
--- a/ppapi/api/dev/pp_video_dev.idl
+++ b/ppapi/api/dev/pp_video_dev.idl
@@ -97,9 +97,8 @@
};
/**
- * Decoder error codes reported to the plugin. A reasonable naive
+ * Decoder error codes reported to the plugin. A reasonable naive
* error handling policy is for the plugin to Destroy() the decoder on error.
- * Note: Keep these in sync with media::VideoDecodeAccelerator::Error.
*/
[assert_size(4)]
enum PP_VideoDecodeError_Dev {
diff --git a/ppapi/api/dev/ppb_directory_reader_dev.idl b/ppapi/api/dev/ppb_directory_reader_dev.idl
deleted file mode 100644
index 5ba6065..0000000
--- a/ppapi/api/dev/ppb_directory_reader_dev.idl
+++ /dev/null
@@ -1,46 +0,0 @@
-/* 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.
- */
-
-/*
- * This file defines the <code>PPB_DirectoryReader_Dev</code> interface.
- */
-
-label Chrome {
- M27 = 0.6
-};
-
-[assert_size(8)]
-struct PP_DirectoryEntry_Dev {
- PP_Resource file_ref;
- PP_FileType file_type;
-};
-
-interface PPB_DirectoryReader_Dev {
- // Creates a DirectoryReader for the given directory. Upon success, the
- // corresponding directory is classified as "in use" by the resulting
- // DirectoryReader object until such time as the DirectoryReader object is
- // destroyed.
- PP_Resource Create([in] PP_Resource directory_ref);
-
- // Returns PP_TRUE if the given resource is a DirectoryReader. Returns
- // PP_FALSE if the resource is invalid or some type other than a
- // DirectoryReader.
- PP_Bool IsDirectoryReader([in] PP_Resource resource);
-
- // Reads all entries in the directory.
- //
- // @param[in] directory_reader A <code>PP_Resource</code>
- // corresponding to a directory reader resource.
- // @param[in] output An output array which will receive
- // <code>PP_DirectoryEntry_Dev</code> objects on success.
- // @param[in] callback A <code>PP_CompletionCallback</code> to run on
- // completion.
- //
- // @return An error code from <code>pp_errors.h</code>.
- //
- int32_t ReadEntries([in] PP_Resource directory_reader,
- [in] PP_ArrayOutput output,
- [in] PP_CompletionCallback callback);
-};
diff --git a/ppapi/api/dev/ppb_file_chooser_dev.idl b/ppapi/api/dev/ppb_file_chooser_dev.idl
index c545a04..594ba3e 100644
--- a/ppapi/api/dev/ppb_file_chooser_dev.idl
+++ b/ppapi/api/dev/ppb_file_chooser_dev.idl
@@ -8,6 +8,8 @@
* This file defines the <code>PPB_FileChooser_Dev</code> interface.
*/
+[generate_thunk]
+
label Chrome {
M16 = 0.5,
M19 = 0.6
diff --git a/ppapi/api/dev/ppb_font_dev.idl b/ppapi/api/dev/ppb_font_dev.idl
index 5d582d1..d2051a0 100644
--- a/ppapi/api/dev/ppb_font_dev.idl
+++ b/ppapi/api/dev/ppb_font_dev.idl
@@ -126,7 +126,7 @@
* When <code>override_direction</code> is false, the browser will perform
* the Unicode Bidirectional Algorithm (http://unicode.org/reports/tr9/) on
* the text. The value of the <code>rtl</code> flag specifies the
- * direcionality of the surrounding environment. This means that Hebrew
+ * directionality of the surrounding environment. This means that Hebrew
* word will always display right to left, even if <code>rtl</code> is false.
*
* When <code>override_direction</code> is true, no autodetection will be done
@@ -142,7 +142,7 @@
* content.
*
* If this flag is set, the browser will skip autodetection of the content
- * and will display all text in the direction speficied by the
+ * and will display all text in the direction specified by the
* <code>rtl</code> flag.
*/
PP_Bool override_direction;
@@ -206,7 +206,7 @@
* clipped to the image.
*
* The image_data_is_opaque flag indicates whether subpixel antialiasing can
- * be performend, if it is supported. When the image below the text is
+ * be performed, if it is supported. When the image below the text is
* opaque, subpixel antialiasing is supported and you should set this to
* PP_TRUE to pick up the user's default preferences. If your plugin is
* partially transparent, then subpixel antialiasing is not possible and
diff --git a/ppapi/api/dev/ppb_graphics_2d_dev.idl b/ppapi/api/dev/ppb_graphics_2d_dev.idl
index 6d0c99a..33b5f59 100644
--- a/ppapi/api/dev/ppb_graphics_2d_dev.idl
+++ b/ppapi/api/dev/ppb_graphics_2d_dev.idl
@@ -4,6 +4,9 @@
*/
/* This file contains the <code>PPB_Graphics2D_Dev</code> interface. */
+
+[generate_thunk]
+
label Chrome {
M22 = 0.1
};
diff --git a/ppapi/api/dev/ppb_printing_dev.idl b/ppapi/api/dev/ppb_printing_dev.idl
index e793e50..60239d2 100644
--- a/ppapi/api/dev/ppb_printing_dev.idl
+++ b/ppapi/api/dev/ppb_printing_dev.idl
@@ -7,17 +7,14 @@
* Definition of the PPB_Printing interface.
*/
+[generate_thunk]
+
// Note: This version should always match the PPP_Printing_Dev interface.
label Chrome {
- M21 = 0.6,
M23 = 0.7
};
interface PPB_Printing_Dev {
- [version=0.6]
- PP_Bool GetDefaultPrintSettings([in] PP_Instance instance,
- [out] PP_PrintSettings_Dev print_settings);
-
/** Create a resource for accessing printing functionality.
*
* @param[in] instance A <code>PP_Instance</code> identifying one instance
@@ -26,7 +23,6 @@
* @return A <code>PP_Resource</code> containing the printing resource if
* successful or 0 if it could not be created.
*/
- [version=0.7]
PP_Resource Create([in] PP_Instance instance);
/**
@@ -42,9 +38,7 @@
* @return PP_OK_COMPLETIONPENDING if request for the default print settings
* was successful, another error code from pp_errors.h on failure.
*/
- [version=0.7]
int32_t GetDefaultPrintSettings([in] PP_Resource resource,
[out] PP_PrintSettings_Dev print_settings,
[in] PP_CompletionCallback callback);
-
};
diff --git a/ppapi/api/dev/ppb_testing_dev.idl b/ppapi/api/dev/ppb_testing_dev.idl
index 6c0b22b..c114db0 100644
--- a/ppapi/api/dev/ppb_testing_dev.idl
+++ b/ppapi/api/dev/ppb_testing_dev.idl
@@ -13,7 +13,8 @@
M14 = 0.7,
M15 = 0.8,
M17 = 0.9,
- M18 = 0.91
+ M18 = 0.91,
+ M28 = 0.92
};
interface PPB_Testing_Dev {
@@ -127,4 +128,15 @@
[version=0.91]
uint32_t GetLiveVars([size_as=array_size] PP_Var[] live_vars,
[in] uint32_t array_size);
+
+ /**
+ * Sets the threshold size at which point we switch from transmitting
+ * array buffers in IPC messages to using shared memory. This is only used
+ * for testing purposes where we need to transmit small buffers using shmem
+ * (in order to have fast tests). Passing a value of 0 resets the threshold
+ * to its default. The threshold is in bytes.
+ */
+ [version=0.92]
+ void SetMinimumArrayBufferSizeForShmem([in] PP_Instance instance,
+ [in] uint32_t threshold);
};
diff --git a/ppapi/api/dev/ppb_text_input_dev.idl b/ppapi/api/dev/ppb_text_input_dev.idl
index d8c4176..27704b0 100644
--- a/ppapi/api/dev/ppb_text_input_dev.idl
+++ b/ppapi/api/dev/ppb_text_input_dev.idl
@@ -73,16 +73,16 @@
* call, informs the browser about the current text selection and surrounding
* text. <code>text</code> is a UTF-8 string that contains the current range
* of text selection in the plugin. <code>caret</code> is the byte-index of
- * the caret poisition within <code>text</code>. <code>anchor</code> is the
+ * the caret position within <code>text</code>. <code>anchor</code> is the
* byte-index of the anchor position (i.e., if a range of text is selected,
- * it is the other edge of selection diffrent from <code>caret</code>. If
+ * it is the other edge of selection different from <code>caret</code>. If
* there are no selection, <code>anchor</code> is equal to <code>caret</code>.
*
* Typical use of this information in the browser is to enable "reconversion"
* features of IME that puts back the already committed text into the
* pre-commit composition state. Another use is to improve the precision
* of suggestion of IME by taking the context into account (e.g., if the caret
- * looks to be on the begining of a sentense, suggest capital letters in a
+ * looks to be on the beginning of a sentence, suggest capital letters in a
* virtual keyboard).
*
* When the focus is not on text, call this function setting <code>text</code>
diff --git a/ppapi/api/dev/ppb_truetype_font_dev.idl b/ppapi/api/dev/ppb_truetype_font_dev.idl
index 9775d98..b327eec 100644
--- a/ppapi/api/dev/ppb_truetype_font_dev.idl
+++ b/ppapi/api/dev/ppb_truetype_font_dev.idl
@@ -8,6 +8,9 @@
* interface exposes font table data for 'sfnt' fonts on the host system. These
* include TrueType and OpenType fonts.
*/
+
+[generate_thunk,thunk_include="ppapi/thunk/ppb_truetype_font_singleton_api.h"]
+
label Chrome {
M26 = 0.1
};
@@ -31,7 +34,7 @@
};
/**
- * The PP_TrueTypeFontStyle_Dev defines font styles.
+ * The PP_TrueTypeFontStyle_Dev enum defines font styles.
*/
[assert_size(4)]
enum PP_TrueTypeFontStyle_Dev {
@@ -40,7 +43,7 @@
};
/**
- * The PP_TrueTypeFontWeight_Dev defines font weights.
+ * The PP_TrueTypeFontWeight_Dev enum defines font weights.
*/
[assert_size(4)]
enum PP_TrueTypeFontWeight_Dev {
@@ -56,7 +59,7 @@
};
/**
- * The PP_TrueTypeFontWidth_Dev defines font widths.
+ * The PP_TrueTypeFontWidth_Dev enum defines font widths.
*/
[assert_size(4)]
enum PP_TrueTypeFontWidth_Dev {
@@ -72,7 +75,7 @@
};
/**
- * The PP_TrueTypeFontCharset defines font character sets.
+ * The PP_TrueTypeFontCharset enum defines font character sets.
*/
[assert_size(4)]
enum PP_TrueTypeFontCharset_Dev {
@@ -98,8 +101,8 @@
};
/**
- * The <code>PP_TrueTypeFontDesc</code> structure describes a TrueType font. It
- * is passed to Create, and returned by Describe.
+ * The <code>PP_TrueTypeFontDesc</code> struct describes a TrueType font. It is
+ * passed to Create(), and returned by Describe().
*/
[assert_size(40)]
struct PP_TrueTypeFontDesc_Dev {
@@ -114,14 +117,19 @@
/** This value specifies a generic font family. If a family name string is
* provided when creating a font, this is ignored. */
PP_TrueTypeFontFamily_Dev generic_family;
+
/** This value specifies the font style. */
PP_TrueTypeFontStyle_Dev style;
+
/** This value specifies the font weight. */
PP_TrueTypeFontWeight_Dev weight;
+
/** This value specifies the font width, for condensed or expanded fonts */
PP_TrueTypeFontWidth_Dev width;
+
/** This value specifies a character set. */
PP_TrueTypeFontCharset_Dev charset;
+
/**
* Ensure that this struct is 40-bytes wide by padding the end. In some
* compilers, PP_Var is 8-byte aligned, so those compilers align this struct
@@ -146,11 +154,36 @@
* @return If >= 0, the number of family names returned, otherwise an error
* code from <code>pp_errors.h</code>.
*/
+ [singleton,api=PPB_TrueTypeFont_Singleton_API]
int32_t GetFontFamilies([in] PP_Instance instance,
[in] PP_ArrayOutput output,
[in] PP_CompletionCallback callback);
/**
+ * Gets an array of TrueType font descriptors for a given font family. These
+ * descriptors can be used to create a font in that family and matching the
+ * descriptor attributes.
+ *
+ * @param[in] instance A <code>PP_Instance</code> requesting the font
+ * descriptors.
+ * @param[in] family A <code>PP_Var</code> holding a string specifying the
+ * font family.
+ * @param[in] output A <code>PP_ArrayOutput</code> to hold the descriptors.
+ * The output is an array of <code>PP_TrueTypeFontDesc</code> structs. Each
+ * desc contains a PP_Var for the family name which must be released.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of GetFontsInFamily.
+ *
+ * @return If >= 0, the number of font descriptors returned, otherwise an
+ * error code from <code>pp_errors.h</code>.
+ */
+ [singleton,api=PPB_TrueTypeFont_Singleton_API]
+ int32_t GetFontsInFamily([in] PP_Instance instance,
+ [in] PP_Var family,
+ [in] PP_ArrayOutput output,
+ [in] PP_CompletionCallback callback);
+
+ /**
* Creates a font resource matching the given font characteristics. The
* resource id will be non-zero on success, or zero on failure.
*
@@ -162,14 +195,14 @@
[in] PP_TrueTypeFontDesc_Dev desc);
/**
- * Determines if the given resource is a font.
+ * Determines if the given resource is a TrueType font.
*
- * @param[in] resource A <code>PP_Resource</code> corresponding to a font.
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a resource.
*
* @return <code>PP_TRUE</code> if the resource is a
* <code>PPB_TrueTypeFont_Dev</code>, <code>PP_FALSE</code> otherwise.
*/
- PP_Bool IsFont([in] PP_Resource resource);
+ PP_Bool IsTrueTypeFont([in] PP_Resource resource);
/**
* Returns a description of the given font resource. This description may
@@ -193,8 +226,8 @@
[in] PP_CompletionCallback callback);
/**
- * Gets an array of identifying tags for each table in the font.
- * These tags can be used to request specific tables using GetTable.
+ * Gets an array of identifying tags for each table in the font. These tags
+ * can be used to request specific tables using GetTable.
*
* @param[in] font A <code>PP_Resource</code> corresponding to a font.
* @param[in] output A <code>PP_ArrayOutput</code> to hold the tags.
diff --git a/ppapi/api/dev/ppb_zoom_dev.idl b/ppapi/api/dev/ppb_zoom_dev.idl
index 5e9514e..8e03bd0 100644
--- a/ppapi/api/dev/ppb_zoom_dev.idl
+++ b/ppapi/api/dev/ppb_zoom_dev.idl
@@ -7,6 +7,8 @@
* Implementation of the Zoom interface.
*/
+[generate_thunk]
+
label Chrome {
M14 = 0.2
};
@@ -25,10 +27,10 @@
void ZoomChanged([in] PP_Instance instance,
[in] double_t factor);
/**
- * Sets the mininum and maximium zoom factors.
+ * Sets the minimum and maximum zoom factors.
*/
void ZoomLimitsChanged([in] PP_Instance instance,
[in] double_t minimum_factor,
- [in] double_t maximium_factor);
+ [in] double_t maximum_factor);
};
diff --git a/ppapi/api/dev/ppp_text_input_dev.idl b/ppapi/api/dev/ppp_text_input_dev.idl
index 6e692bf..b6bdd88 100644
--- a/ppapi/api/dev/ppp_text_input_dev.idl
+++ b/ppapi/api/dev/ppp_text_input_dev.idl
@@ -17,7 +17,7 @@
*/
interface PPP_TextInput_Dev {
/**
- * Requests the plugin to send back the text arround the current caret or
+ * Requests the plugin to send back the text around the current caret or
* selection by <code>PPB_TextInput_Dev::UpdateSurroundingText</code>.
* It is recommended to include the <code>desired_number_of_characters</code>
* characters before and after the selection, but not mandatory.
diff --git a/ppapi/api/extensions/dev/ppb_alarms_dev.idl b/ppapi/api/extensions/dev/ppb_ext_alarms_dev.idl
similarity index 99%
rename from ppapi/api/extensions/dev/ppb_alarms_dev.idl
rename to ppapi/api/extensions/dev/ppb_ext_alarms_dev.idl
index b227993..9e1fc65 100644
--- a/ppapi/api/extensions/dev/ppb_alarms_dev.idl
+++ b/ppapi/api/extensions/dev/ppb_ext_alarms_dev.idl
@@ -13,7 +13,7 @@
};
#inline c
-#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h"
#endinl
/**
diff --git a/ppapi/api/extensions/dev/ppb_events_dev.idl b/ppapi/api/extensions/dev/ppb_ext_events_dev.idl
similarity index 100%
rename from ppapi/api/extensions/dev/ppb_events_dev.idl
rename to ppapi/api/extensions/dev/ppb_ext_events_dev.idl
diff --git a/ppapi/api/extensions/dev/ppb_ext_socket_dev.idl b/ppapi/api/extensions/dev/ppb_ext_socket_dev.idl
new file mode 100644
index 0000000..10051d7
--- /dev/null
+++ b/ppapi/api/extensions/dev/ppb_ext_socket_dev.idl
@@ -0,0 +1,417 @@
+/* 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.
+ */
+
+/**
+ * This file defines the Pepper equivalent of the <code>chrome.socket</code>
+ * extension API.
+ */
+
+label Chrome {
+ M28 = 0.1
+};
+
+/**
+ * A string <code>PP_Var</code> which has one of the following values:
+ * - "tcp"
+ * - "udp"
+ */
+typedef PP_Var PP_Ext_Socket_SocketType_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code>.
+ */
+typedef PP_Var PP_Ext_Socket_CreateOptions_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "socketId" : integer <code>PP_Var</code>
+ * The id of the newly created socket.
+ */
+typedef PP_Var PP_Ext_Socket_CreateInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "resultCode" : integer <code>PP_Var</code>
+ * - "socketId" : integer or undefined <code>PP_Var</code>
+ * The id of the accepted socket.
+ */
+typedef PP_Var PP_Ext_Socket_AcceptInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "resultCode" : integer <code>PP_Var</code>
+ * The resultCode returned from the underlying read() call.
+ * - "data" : array buffer <code>PP_Var</code>
+ */
+typedef PP_Var PP_Ext_Socket_ReadInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "bytesWritten" : integer <code>PP_Var</code>
+ * The number of bytes sent, or a negative error code.
+ */
+typedef PP_Var PP_Ext_Socket_WriteInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "resultCode" : integer <code>PP_Var</code>
+ * The resultCode returned from the underlying recvfrom() call.
+ * - "data": array buffer <code>PP_Var</code>
+ * - "address": string <code>PP_Var</code>
+ * The address of the remote machine.
+ * - "port": integer <code>PP_Var</code>
+ */
+typedef PP_Var PP_Ext_Socket_RecvFromInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "socketType" : string <code>PP_Var</code> which matches the description of
+ * <code>PP_Ext_Socket_SocketType_Dev</code>
+ * The type of the passed socket. This will be <code>tcp</code> or
+ * <code>udp</code>.
+ * - "connected" : boolean <code>PP_Var</code>
+ * Whether or not the underlying socket is connected.
+ *
+ * For <code>tcp</code> sockets, this will remain true even if the remote peer
+ * has disconnected. Reading or writing to the socket may then result in an
+ * error, hinting that this socket should be disconnected via
+ * <code>Disconnect()</code>.
+ *
+ * For <code>udp</code> sockets, this just represents whether a default remote
+ * address has been specified for reading and writing packets.
+ * - "peerAddress" : string or undefined <code>PP_Var</code>
+ * If the underlying socket is connected, contains the IPv4/6 address of the
+ * peer.
+ * - "peerPort" : integer or undefined <code>PP_Var</code>
+ * If the underlying socket is connected, contains the port of the connected
+ * peer.
+ * - "localAddress" : string or undefined <code>PP_Var</code>
+ * If the underlying socket is bound or connected, contains its local IPv4/6
+ * address.
+ * - "localPort" : integer or undefined <code>PP_Var</code>
+ * If the underlying socket is bound or connected, contains its local port.
+ */
+typedef PP_Var PP_Ext_Socket_SocketInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "name" : string <code>PP_Var</code>
+ * The underlying name of the adapter. On *nix, this will typically be "eth0",
+ * "lo", etc.
+ * - "address": string <code>PP_Var</code>
+ * The available IPv4/6 address.
+ */
+typedef PP_Var PP_Ext_Socket_NetworkInterface_Dev;
+
+/**
+ * An array <code>PP_Var</code> which contains elements of
+ * <code>PP_Ext_Socket_NetworkInterface_Dev</code>.
+ */
+typedef PP_Var PP_Ext_Socket_NetworkInterface_Dev_Array;
+
+interface PPB_Ext_Socket_Dev {
+ /**
+ * Creates a socket of the specified type that will connect to the specified
+ * remote machine.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] type A <code>PP_Ext_Socket_SocketType_Dev</code>. The type of
+ * socket to create. Must be <code>tcp</code> or <code>udp</code>.
+ * @param[in] options An undefined <code>PP_Var</code> or
+ * <code>PP_Ext_Socket_CreateOptions_Dev</code>. The socket options.
+ * @param[out] create_info A <code>PP_Ext_Socket_CreateInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t Create(
+ [in] PP_Instance instance,
+ [in] PP_Ext_Socket_SocketType_Dev type,
+ [in] PP_Ext_Socket_CreateOptions_Dev options,
+ [out] PP_Ext_Socket_CreateInfo_Dev create_info,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Destroys the socket. Each socket created should be destroyed after use.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ */
+ void Destroy(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id);
+
+ /**
+ * Connects the socket to the remote machine (for a <code>tcp</code> socket).
+ * For a <code>udp</code> socket, this sets the default address which packets
+ * are sent to and read from for <code>Read()</code> and <code>Write()</code>
+ * calls.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] hostname A string <code>PP_Var</code>. The hostname or IP
+ * address of the remote machine.
+ * @param[in] port An integer <code>PP_Var</code>. The port of the remote
+ * machine.
+ * @param[out] result An integer <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t Connect(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [in] PP_Var hostname,
+ [in] PP_Var port,
+ [out] PP_Var result,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Binds the local address for socket. Currently, it does not support TCP
+ * socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] address A string <code>PP_Var</code>. The address of the local
+ * machine.
+ * @param[in] port An integer <code>PP_Var</code>. The port of the local
+ * machine.
+ * @param[out] result An integer <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t Bind(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [in] PP_Var address,
+ [in] PP_Var port,
+ [out] PP_Var result,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Disconnects the socket. For UDP sockets, <code>Disconnect</code> is a
+ * non-operation but is safe to call.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ */
+ void Disconnect(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id);
+
+ /**
+ * Reads data from the given connected socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] buffer_size An undefined or integer <code>PP_Var</code>. The
+ * read buffer size.
+ * @param[out] read_info A <code>PP_Ext_Socket_ReadInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t Read(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [in] PP_Var buffer_size,
+ [out] PP_Ext_Socket_ReadInfo_Dev read_info,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Writes data on the given connected socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] data An array buffer <code>PP_Var</code>. The data to write.
+ * @param[out] write_info A <code>PP_Ext_Socket_WriteInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t Write(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [in] PP_Var data,
+ [out] PP_Ext_Socket_WriteInfo_Dev write_info,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Receives data from the given UDP socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] buffer_size An undefined or integer <code>PP_Var</code>. The
+ * receive buffer size.
+ * @param[out] recv_from_info A <code>PP_Ext_Socket_RecvFromInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t RecvFrom(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [in] PP_Var buffer_size,
+ [out] PP_Ext_Socket_RecvFromInfo_Dev recv_from_info,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Sends data on the given UDP socket to the given address and port.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] data An array buffer <code>PP_Var</code>.
+ * @param[in] address A string <code>PP_Var</code>. The address of the remote
+ * machine.
+ * @param[in] port An integer <code>PP_Var</code>. The port of the remote
+ * machine.
+ * @param[out] write_info A <code>PP_Ext_Socket_WriteInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t SendTo(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [in] PP_Var data,
+ [in] PP_Var address,
+ [in] PP_Var port,
+ [out] PP_Ext_Socket_WriteInfo_Dev write_info,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * This method applies to TCP sockets only.
+ * Listens for connections on the specified port and address. This effectively
+ * makes this a server socket, and client socket functions (Connect, Read,
+ * Write) can no longer be used on this socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] address A string <code>PP_Var</code>. The address of the local
+ * machine.
+ * @param[in] port An integer <code>PP_Var</code>. The port of the local
+ * machine.
+ * @param[in] backlog An undefined or integer <code>PP_Var</code>. Length of
+ * the socket's listen queue.
+ * @param[out] result An integer <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t Listen(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [in] PP_Var address,
+ [in] PP_Var port,
+ [in] PP_Var backlog,
+ [out] PP_Var result,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * This method applies to TCP sockets only.
+ * Registers a callback function to be called when a connection is accepted on
+ * this listening server socket. Listen must be called first.
+ * If there is already an active accept callback, this callback will be
+ * invoked immediately with an error as the resultCode.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[out] accept_info A <code>PP_Ext_Socket_AcceptInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t Accept(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [out] PP_Ext_Socket_AcceptInfo_Dev accept_info,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Enables or disables the keep-alive functionality for a TCP connection.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] enable A boolean <code>PP_Var</code>. If true, enable keep-alive
+ * functionality.
+ * @param[in] delay An undefined or integer <code>PP_Var</code>. Set the delay
+ * seconds between the last data packet received and the first keepalive
+ * probe. Default is 0.
+ * @param[out] result A boolean <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t SetKeepAlive(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [in] PP_Var enable,
+ [in] PP_Var delay,
+ [out] PP_Var result,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Sets or clears <code>TCP_NODELAY</code> for a TCP connection. Nagle's
+ * algorithm will be disabled when <code>TCP_NODELAY</code> is set.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] no_delay A boolean <code>PP_Var</code>.
+ * @param[out] result A boolean <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t SetNoDelay(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [in] PP_Var no_delay,
+ [out] PP_Var result,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Retrieves the state of the given socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[out] result A <code>PP_Ext_Socket_SocketInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t GetInfo(
+ [in] PP_Instance instance,
+ [in] PP_Var socket_id,
+ [out] PP_Ext_Socket_SocketInfo_Dev result,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Retrieves information about local adapters on this system.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[out] result A <code>PP_Ext_Socket_NetworkInterface_Dev_Array</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t GetNetworkList(
+ [in] PP_Instance instance,
+ [out] PP_Ext_Socket_NetworkInterface_Dev_Array result,
+ [in] PP_CompletionCallback callback);
+};
diff --git a/ppapi/api/pp_array_output.idl b/ppapi/api/pp_array_output.idl
index b3b508a..be1aca7 100644
--- a/ppapi/api/pp_array_output.idl
+++ b/ppapi/api/pp_array_output.idl
@@ -43,7 +43,7 @@
/**
* A structure that defines a way for the browser to return arrays of data
* to the plugin. The browser can not allocate memory on behalf of the plugin
- * becaues the plugin and browser may have different allocators.
+ * because the plugin and browser may have different allocators.
*
* Array output works by having the browser call to the plugin to allocate a
* buffer, and then the browser will copy the contents of the array into that
diff --git a/ppapi/api/pp_completion_callback.idl b/ppapi/api/pp_completion_callback.idl
index 833a31a..46b6342 100644
--- a/ppapi/api/pp_completion_callback.idl
+++ b/ppapi/api/pp_completion_callback.idl
@@ -66,10 +66,10 @@
* ways:
* - Required: The callback will always be invoked asynchronously on the
* thread where the associated PPB method was invoked. The method
- * will always return <code>PP_OK_COMPLETIONPENDING when a
- * required callback, and the callback will be invoked later
- * (barring system or thread shutdown; see PPB_MessageLoop for
- * details). Required callbacks are the default.
+ * will always return PP_OK_COMPLETIONPENDING when a required
+ * callback, and the callback will be invoked later (barring
+ * system or thread shutdown; see PPB_MessageLoop for details).
+ * Required callbacks are the default.
*
* NOTE: If you use a required callback on a background thread,
* you must have created and attached a PPB_MessageLoop.
@@ -141,16 +141,16 @@
*
* <strong>Example, creating a Required callback:</strong>
*
- * <code>
+ * @code
* struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL);
- * </code>
+ * @endcode
*
* <strong>Example, creating an Optional callback:</strong>
*
- * <code>
+ * @code
* struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL);
* cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL;
- * </code>
+ * @endcode
*
* @param[in] func A <code>PP_CompletionCallback_Func</code> that will be
* called.
diff --git a/ppapi/api/pp_directory_entry.idl b/ppapi/api/pp_directory_entry.idl
new file mode 100644
index 0000000..4b12c34
--- /dev/null
+++ b/ppapi/api/pp_directory_entry.idl
@@ -0,0 +1,14 @@
+/* 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.
+ */
+
+/*
+ * This file defines the <code>PP_DirectoryEntry</code> struct.
+ */
+
+[assert_size(8)]
+struct PP_DirectoryEntry {
+ PP_Resource file_ref;
+ PP_FileType file_type;
+};
diff --git a/ppapi/api/pp_errors.idl b/ppapi/api/pp_errors.idl
index 54a3ace..587d057 100644
--- a/ppapi/api/pp_errors.idl
+++ b/ppapi/api/pp_errors.idl
@@ -89,7 +89,7 @@
* calls on background threads are not currently supported. Until this
* support is complete, you must either do asynchronous operations on the
* main thread, or provide an adaptor for a blocking background thread to
- * execute the operaitions on the main thread.
+ * execute the operations on the main thread.
*/
PP_ERROR_BLOCKS_MAIN_THREAD = -13,
diff --git a/ppapi/api/pp_file_info.idl b/ppapi/api/pp_file_info.idl
index b0fa373..0d2c3b6 100644
--- a/ppapi/api/pp_file_info.idl
+++ b/ppapi/api/pp_file_info.idl
@@ -29,7 +29,7 @@
PP_FILESYSTEMTYPE_INVALID = 0,
/** For external file system types */
PP_FILESYSTEMTYPE_EXTERNAL = 1,
- /** For local persistant file system types */
+ /** For local persistent file system types */
PP_FILESYSTEMTYPE_LOCALPERSISTENT = 2,
/** For local temporary file system types */
PP_FILESYSTEMTYPE_LOCALTEMPORARY = 3
diff --git a/ppapi/api/pp_input_event.idl b/ppapi/api/pp_input_event.idl
index d5a6389..e08f090 100644
--- a/ppapi/api/pp_input_event.idl
+++ b/ppapi/api/pp_input_event.idl
@@ -54,8 +54,8 @@
* accent up (it didn't generate a character), letter key down, letter with
* accent character event (it was modified by the previous accent key), letter
* key up. If the letter can't be combined with the accent, like an umlaut and
- * an 'R', the system might send unlaut down, umlaut up, 'R' key down, umlaut
- * character (can't combine it with 'R', so just send the raw unlaut so it
+ * an 'R', the system might send umlaut down, umlaut up, 'R' key down, umlaut
+ * character (can't combine it with 'R', so just send the raw umlaut so it
* isn't lost"), 'R' character event, 'R' key up.
*/
[assert_size(12)]
diff --git a/ppapi/api/pp_resource.idl b/ppapi/api/pp_resource.idl
index 453a00e..7f09d29 100644
--- a/ppapi/api/pp_resource.idl
+++ b/ppapi/api/pp_resource.idl
@@ -9,7 +9,7 @@
*/
/**
- * This typdef represents an opaque handle assigned by the browser to the
+ * This typedef represents an opaque handle assigned by the browser to the
* resource. The handle is guaranteed never to be 0 for a valid resource, so a
* module can initialize it to 0 to indicate a "NULL handle." Some interfaces
* may return a NULL resource to indicate failure.
diff --git a/ppapi/api/pp_touch_point.idl b/ppapi/api/pp_touch_point.idl
index 3d58380..42c0809 100644
--- a/ppapi/api/pp_touch_point.idl
+++ b/ppapi/api/pp_touch_point.idl
@@ -11,7 +11,7 @@
/**
* The <code>PP_TouchPoint</code> struct represents all information about a
- * single touch point, such ase position, id, rotation angle, and pressure.
+ * single touch point, such as position, id, rotation angle, and pressure.
*/
[assert_size(28), returnByValue]
struct PP_TouchPoint {
diff --git a/ppapi/api/ppb_audio_config.idl b/ppapi/api/ppb_audio_config.idl
index 73666e7..1d64b4f 100644
--- a/ppapi/api/ppb_audio_config.idl
+++ b/ppapi/api/ppb_audio_config.idl
@@ -200,7 +200,7 @@
* RecommendSampleRate() returns the native sample rate that the browser
* is using in the backend. Applications that use the recommended sample
* rate will have potentially better latency and fidelity. The return value
- * is indended for audio output devices. If the output sample rate cannot be
+ * is intended for audio output devices. If the output sample rate cannot be
* determined, this function can return PP_AUDIOSAMPLERATE_NONE.
*
* @param[in] instance
diff --git a/ppapi/api/ppb_file_ref.idl b/ppapi/api/ppb_file_ref.idl
index 1265830..e783027 100644
--- a/ppapi/api/ppb_file_ref.idl
+++ b/ppapi/api/ppb_file_ref.idl
@@ -9,7 +9,8 @@
*/
label Chrome {
- M14 = 1.0
+ M14 = 1.0,
+ M28 = 1.1
};
/**
@@ -166,5 +167,40 @@
int32_t Rename([in] PP_Resource file_ref,
[in] PP_Resource new_file_ref,
[in] PP_CompletionCallback callback);
+
+ /**
+ * Query() queries info about a file or directory. You must have access to
+ * read this file or directory if it exists in the external filesystem.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ * @param[out] info A pointer to a <code>PP_FileInfo</code> which will be
+ * populated with information about the file or directory.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Query().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ [version=1.1]
+ int32_t Query([in] PP_Resource file_ref,
+ [out] PP_FileInfo info,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * ReadDirectoryEntries() reads all entries in a directory.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a directory
+ * reference.
+ * @param[in] output An output array which will receive
+ * <code>PP_DirectoryEntry</code> objects on success.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+ * completion.
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ [version=1.1]
+ int32_t ReadDirectoryEntries([in] PP_Resource file_ref,
+ [in] PP_ArrayOutput output,
+ [in] PP_CompletionCallback callback);
};
diff --git a/ppapi/api/ppb_fullscreen.idl b/ppapi/api/ppb_fullscreen.idl
index 2f26418..0599e18 100644
--- a/ppapi/api/ppb_fullscreen.idl
+++ b/ppapi/api/ppb_fullscreen.idl
@@ -9,6 +9,8 @@
* handling transitions of a module instance to and from fullscreen mode.
*/
+[generate_thunk]
+
label Chrome {
M16 = 1.0
};
diff --git a/ppapi/api/ppb_gamepad.idl b/ppapi/api/ppb_gamepad.idl
index 845714b..1552fd6 100644
--- a/ppapi/api/ppb_gamepad.idl
+++ b/ppapi/api/ppb_gamepad.idl
@@ -8,6 +8,8 @@
* provides access to gamepad devices.
*/
+[generate_thunk]
+
label Chrome {
M19 = 1.0
};
@@ -83,13 +85,13 @@
* The <code>PPB_Gamepad</code> interface allows retrieving data from
* gamepad/joystick devices that are connected to the system.
*/
-[version=1.0, macro="PPB_GAMEPAD_INTERFACE"]
+[version=1.0, macro="PPB_GAMEPAD_INTERFACE", singleton]
interface PPB_Gamepad {
/**
- * Samples the current state of the connected gamepads.
+ * Samples the current state of the available gamepads.
*/
+ [always_set_output_parameters]
void Sample(
[in] PP_Instance instance,
[out] PP_GamepadsSampleData data);
-
};
diff --git a/ppapi/api/ppb_graphics_2d.idl b/ppapi/api/ppb_graphics_2d.idl
index 938f428..56450f0 100644
--- a/ppapi/api/ppb_graphics_2d.idl
+++ b/ppapi/api/ppb_graphics_2d.idl
@@ -8,8 +8,11 @@
* context within the browser.
*/
+[generate_thunk]
+
label Chrome {
- M14 = 1.0
+ M14 = 1.0,
+ M27 = 1.1
};
/**
@@ -66,14 +69,15 @@
* @param[in,out] is_always_opaque Identifies whether only opaque data
* will be painted.
*
- * @return Returns <code>PP_TRUE</code> on succes or <code>PP_FALSE</code> if
+ * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if
* the resource is invalid. The output parameters will be set to 0 on a
* <code>PP_FALSE</code>.
*/
+ [always_set_output_parameters]
PP_Bool Describe(
[in] PP_Resource graphics_2d,
[out] PP_Size size,
- [out] PP_Bool is_always_opqaue);
+ [out] PP_Bool is_always_opaque);
/**
* PaintImageData() enqueues a paint of the given image into the context.
@@ -242,5 +246,41 @@
int32_t Flush(
[in] PP_Resource graphics_2d,
[in] PP_CompletionCallback callback);
+
+ /**
+ * SetScale() sets the scale factor that will be applied when painting the
+ * graphics context onto the output device. Typically, if rendering at device
+ * resolution is desired, the context would be created with the width and
+ * height scaled up by the view's GetDeviceScale and SetScale called with a
+ * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed
+ * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of
+ * 2.0, one would call Create with a size of (w=400, h=200) and then call
+ * SetScale with 0.5. One would then treat each pixel in the context as a
+ * single device pixel.
+ *
+ * @param[in] resource A <code>Graphics2D</code> context resource.
+ * @param[in] scale The scale to apply when painting.
+ *
+ * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if
+ * the resource is invalid or the scale factor is 0 or less.
+ */
+ [version=1.1]
+ PP_Bool SetScale(
+ [in] PP_Resource resource,
+ [in] float_t scale);
+
+ /***
+ * GetScale() gets the scale factor that will be applied when painting the
+ * graphics context onto the output device.
+ *
+ * @param[in] resource A <code>Graphics2D</code> context resource.
+ *
+ * @return Returns the scale factor for the graphics context. If the resource
+ * is not a valid <code>Graphics2D</code> context, this will return 0.0.
+ */
+ [version=1.1]
+ float_t GetScale(
+ [in] PP_Resource resource);
+
};
diff --git a/ppapi/api/ppb_graphics_3d.idl b/ppapi/api/ppb_graphics_3d.idl
index 454b3e3..28a0c40 100644
--- a/ppapi/api/ppb_graphics_3d.idl
+++ b/ppapi/api/ppb_graphics_3d.idl
@@ -8,6 +8,8 @@
* context within the browser.
*/
+[generate_thunk]
+
label Chrome {
M15 = 1.0
};
@@ -22,25 +24,25 @@
* <strong>Example usage from plugin code:</strong>
*
* <strong>Setup:</strong>
- * <code>
+ * @code
* PP_Resource context;
* int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800,
* PP_GRAPHICS3DATTRIB_HEIGHT, 800,
* PP_GRAPHICS3DATTRIB_NONE};
* context = g3d->Create(instance, attribs, &context);
* inst->BindGraphics(instance, context);
- * </code>
+ * @endcode
*
* <strong>Present one frame:</strong>
- * <code>
+ * @code
* gles2->Clear(context, GL_COLOR_BUFFER);
* g3d->SwapBuffers(context);
- * </code>
+ * @endcode
*
* <strong>Shutdown:</strong>
- * <code>
+ * @code
* core->ReleaseResource(context);
- * </code>
+ * @endcode
*/
[macro="PPB_GRAPHICS_3D_INTERFACE"]
interface PPB_Graphics3D {
@@ -168,7 +170,7 @@
*
* <strong>Example usage:</strong> To get the values for rgb bits in the
* color buffer, this function must be called as following:
- * <code>
+ * @code
* int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0,
* PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0,
* PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0,
@@ -177,7 +179,7 @@
* int red_bits = attrib_list[1];
* int green_bits = attrib_list[3];
* int blue_bits = attrib_list[5];
- * </code>
+ * @endcode
*/
int32_t GetAttribs(
[in] PP_Resource context,
@@ -209,7 +211,7 @@
* The recoverable error conditions that have no side effect are
* detected and returned immediately by all functions in this interface.
* In addition the implementation may get into a fatal state while
- * processing a command. In this case the application must detroy the
+ * processing a command. In this case the application must destroy the
* context and reinitialize client API state and objects to continue
* rendering.
*
@@ -217,7 +219,7 @@
* It is recommended to handle error in the SwapBuffers callback because
* GetError is synchronous. This function may be useful in rare cases where
* drawing a frame is expensive and you want to verify the result of
- * ResizeBuffers before attemptimg to draw a frame.
+ * ResizeBuffers before attempting to draw a frame.
*
* @param[in] The 3D graphics context.
* @return Returns:
diff --git a/ppapi/api/ppb_image_data.idl b/ppapi/api/ppb_image_data.idl
index 4934f79..8e1d09d 100644
--- a/ppapi/api/ppb_image_data.idl
+++ b/ppapi/api/ppb_image_data.idl
@@ -8,9 +8,11 @@
* a browser handles image data.
*/
- label Chrome {
- M14 = 1.0
- };
+[generate_thunk]
+
+label Chrome {
+ M14 = 1.0
+};
/**
* <code>PP_ImageDataFormat</code> is an enumeration of the different types of
@@ -157,6 +159,7 @@
* <code>PP_FALSE</code>, the <code>desc</code> structure will be filled
* with 0.
*/
+ [always_set_output_parameters]
PP_Bool Describe(
[in] PP_Resource image_data,
[out] PP_ImageDataDesc desc);
diff --git a/ppapi/api/ppb_input_event.idl b/ppapi/api/ppb_input_event.idl
index 496a0a6..e50a879 100644
--- a/ppapi/api/ppb_input_event.idl
+++ b/ppapi/api/ppb_input_event.idl
@@ -320,11 +320,11 @@
* a crack at the message.
*
* <strong>Example:</strong>
- * <code>
+ * @code
* RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE);
* RequestFilteringInputEvents(instance,
* PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
- * </code>
+ * @endcode
*
* @param instance The <code>PP_Instance</code> of the instance requesting
* the given events.
@@ -363,11 +363,11 @@
* can have significant overhead.
*
* <strong>Example:</strong>
- * <code>
+ * @code
* RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE);
* RequestFilteringInputEvents(instance,
* PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
- * </code>
+ * @endcode
*
* @return <code>PP_OK</code> if the operation succeeded,
* <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or
@@ -890,7 +890,7 @@
[in] uint32_t index);
/**
- * Returns the touch-point with the spcified touch-id in the specified list.
+ * Returns the touch-point with the specified touch-id in the specified list.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to a touch
* event.
diff --git a/ppapi/api/ppb_message_loop.idl b/ppapi/api/ppb_message_loop.idl
index 5ae00b1..83c198f 100644
--- a/ppapi/api/ppb_message_loop.idl
+++ b/ppapi/api/ppb_message_loop.idl
@@ -23,7 +23,7 @@
* suddenly see their PP_Resource handles become invalid. In this case, calls
* will fail with PP_ERROR_BADRESOURCE. If you need to access data associated
* with your instance, you will probably want to create some kind of threadsafe
- * proxy object that can handle asynchonous destruction of the instance object.
+ * proxy object that can handle asynchronous destruction of the instance object.
*
* Typical usage:
* On the main thread:
@@ -36,7 +36,8 @@
* - Call AttachToCurrentThread() with the message loop resource.
* - Call Run() with the message loop resource.
*
- * Your callacks should look like this:
+ * Your callbacks should look like this:
+ * @code
* void DoMyWork(void* user_data, int32_t status) {
* if (status != PP_OK) {
* Cleanup(); // e.g. free user_data.
@@ -44,6 +45,7 @@
* }
* ... do your work...
* }
+ * @endcode
* For a C++ example, see ppapi/utility/threading/simple_thread.h
*
* (You can also create the message loop resource on the background thread,
@@ -206,7 +208,7 @@
*
* @param callback The completion callback to execute from the message loop.
*
- * @param delay_ms The number of millseconds to delay execution of the given
+ * @param delay_ms The number of milliseconds to delay execution of the given
* completion callback. Passing 0 means it will get queued normally and
* executed in order.
*
@@ -221,7 +223,7 @@
* run your callback with an error without causing unexpected threading
* problems). If you associate memory with the completion callback (for
* example, you're using the C++ CompletionCallbackFactory), you will need to
- * free this or manually run the callback. See "Desctruction and error
+ * free this or manually run the callback. See "Destruction and error
* handling" above.
*
*
diff --git a/ppapi/api/ppb_mouse_cursor.idl b/ppapi/api/ppb_mouse_cursor.idl
index cb91786..9fba254 100644
--- a/ppapi/api/ppb_mouse_cursor.idl
+++ b/ppapi/api/ppb_mouse_cursor.idl
@@ -82,7 +82,7 @@
* cursor, set the type to <code>PP_MOUSECURSOR_TYPE_CUSTOM</code> and
* specify your image and hot spot.
*
- * @param[in] instance A <code>PP_Instance</code> indentifying the instance
+ * @param[in] instance A <code>PP_Instance</code> identifying the instance
* that the mouse cursor will affect.
*
* @param[in] type A <code>PP_MouseCursor_Type</code> identifying the type of
@@ -94,7 +94,7 @@
* pixels in each direction and must be of the system's native image format.
* When you are specifying a predefined cursor, this parameter must be 0.
*
- * @param[in] hot_spot When setting a custom cursor, this idenfifies the
+ * @param[in] hot_spot When setting a custom cursor, this identifies the
* pixel position within the given image of the "hot spot" of the cursor.
* When specifying a stock cursor, this parameter is ignored.
*
diff --git a/ppapi/api/ppb_mouse_lock.idl b/ppapi/api/ppb_mouse_lock.idl
index ca4605a..b0e9488 100644
--- a/ppapi/api/ppb_mouse_lock.idl
+++ b/ppapi/api/ppb_mouse_lock.idl
@@ -8,6 +8,8 @@
* locking the target of mouse events to a specific module instance.
*/
+[generate_thunk]
+
label Chrome {
M16 = 1.0
};
diff --git a/ppapi/api/ppb_url_loader.idl b/ppapi/api/ppb_url_loader.idl
index ad31100..6e1a271 100644
--- a/ppapi/api/ppb_url_loader.idl
+++ b/ppapi/api/ppb_url_loader.idl
@@ -8,6 +8,8 @@
* URLs.
*/
+[generate_thunk]
+
label Chrome {
M14 = 1.0
};
@@ -71,7 +73,7 @@
* <code>URLRequestInfo</code>.
* @param[in] callback A <code>PP_CompletionCallback</code> to run on
* asynchronous completion of Open(). This callback will run when response
- * headers for the url are received or error occured. This callback
+ * headers for the url are received or error occurred. This callback
* will only run if Open() returns <code>PP_OK_COMPLETIONPENDING</code>.
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
@@ -116,6 +118,7 @@
* @return <code>PP_TRUE</code> if the upload progress is available,
* <code>PP_FALSE</code> if it is not available.
*/
+ [always_set_output_parameters]
PP_Bool GetUploadProgress(
[in] PP_Resource loader,
[out] int64_t bytes_sent,
@@ -140,6 +143,7 @@
* @return <code>PP_TRUE</code> if the download progress is available,
* <code>PP_FALSE</code> if it is not available.
*/
+ [always_set_output_parameters]
PP_Bool GetDownloadProgress(
[in] PP_Resource loader,
[out] int64_t bytes_received,
diff --git a/ppapi/api/ppb_url_request_info.idl b/ppapi/api/ppb_url_request_info.idl
index 06c9edd..856ae81 100644
--- a/ppapi/api/ppb_url_request_info.idl
+++ b/ppapi/api/ppb_url_request_info.idl
@@ -8,6 +8,8 @@
* manipulating URL requests.
*/
+[generate_thunk]
+
label Chrome {
M14 = 1.0
};
@@ -33,7 +35,7 @@
* This corresponds to a string (<code>PP_VARTYPE_STRING</code>); \n
* delimited. Refer to the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"Header
- * Field Definitions</a> documentaiton for further information.
+ * Field Definitions</a> documentation for further information.
*/
PP_URLREQUESTPROPERTY_HEADERS = 2,
@@ -67,7 +69,7 @@
* This corresponds to a <code>PP_Bool</code>
* (default=<code>PP_FALSE</code>). Set this value to <code>PP_TRUE</code> if
* you want to be able to poll the upload progress using
- * PPB_URLLoader.GetUplaodProgress().
+ * PPB_URLLoader.GetUploadProgress().
*/
PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS = 6,
diff --git a/ppapi/api/ppb_url_response_info.idl b/ppapi/api/ppb_url_response_info.idl
index 01c7df8..2998b7a 100644
--- a/ppapi/api/ppb_url_response_info.idl
+++ b/ppapi/api/ppb_url_response_info.idl
@@ -8,6 +8,8 @@
* responses.
*/
+[generate_thunk]
+
label Chrome {
M14 = 1.0
};
diff --git a/ppapi/api/ppb_view.idl b/ppapi/api/ppb_view.idl
index cc61ed2..a01c5e8 100644
--- a/ppapi/api/ppb_view.idl
+++ b/ppapi/api/ppb_view.idl
@@ -11,7 +11,8 @@
[generate_thunk]
label Chrome {
- M18 = 1.0
+ M18 = 1.0,
+ M28 = 1.1
};
/**
@@ -159,5 +160,38 @@
*/
PP_Bool GetClipRect([in] PP_Resource resource,
[out] PP_Rect clip);
+
+ /**
+ * GetDeviceScale returns the scale factor between device pixels and Density
+ * Independent Pixels (DIPs, also known as logical pixels or UI pixels on
+ * some platforms). This allows the developer to render their contents at
+ * device resolution, even as coordinates / sizes are given in DIPs through
+ * the API.
+ *
+ * Note that the coordinate system for Pepper APIs is DIPs. Also note that
+ * one DIP might not equal one CSS pixel - when page scale/zoom is in effect.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a
+ * <code>PPB_View</code> resource.
+ *
+ * @return A <code>float</code> value representing the number of device pixels
+ * per DIP. If the resource is invalid, the value will be 0.0.
+ */
+ [version=1.1]
+ float_t GetDeviceScale([in] PP_Resource resource);
+
+ /**
+ * GetCSSScale returns the scale factor between DIPs and CSS pixels. This
+ * allows proper scaling between DIPs - as sent via the Pepper API - and CSS
+ * pixel coordinates used for Web content.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a
+ * <code>PPB_View</code> resource.
+ *
+ * @return css_scale A <code>float</code> value representing the number of
+ * DIPs per CSS pixel. If the resource is invalid, the value will be 0.0.
+ */
+ [version=1.1]
+ float_t GetCSSScale([in] PP_Resource resource);
};
diff --git a/ppapi/api/private/pp_video_frame_private.idl b/ppapi/api/private/pp_video_frame_private.idl
new file mode 100644
index 0000000..593f363
--- /dev/null
+++ b/ppapi/api/private/pp_video_frame_private.idl
@@ -0,0 +1,36 @@
+/* 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.
+ */
+
+/**
+ * This file defines the struct used to hold a video frame.
+ */
+
+/**
+ * The <code>PP_VideoFrame_Private</code> struct represents a video frame.
+ * Video sources and destinations use frames to transfer video to and from
+ * the browser.
+ */
+[assert_size(16)]
+struct PP_VideoFrame_Private {
+ /**
+ * A timestamp placing the frame in a video stream.
+ */
+ PP_TimeTicks timestamp;
+
+ /**
+ * An image data resource to hold the video frame.
+ */
+ PP_Resource image_data;
+
+ /**
+ * Ensure that this struct is 16-bytes wide by padding the end. In some
+ * compilers, PP_TimeTicks is 8-byte aligned, so those compilers align this
+ * struct on 8-byte boundaries as well and pad it to 8 bytes even without this
+ * padding attribute. This padding makes its size consistent across
+ * compilers.
+ */
+ int32_t padding;
+};
+
diff --git a/ppapi/api/private/ppb_content_decryptor_private.idl b/ppapi/api/private/ppb_content_decryptor_private.idl
index e18afef..9a6422d 100644
--- a/ppapi/api/private/ppb_content_decryptor_private.idl
+++ b/ppapi/api/private/ppb_content_decryptor_private.idl
@@ -33,7 +33,7 @@
*
* The browser must notify the application that a key is needed, and, in
* response, the web application must direct the browser to call
- * <code>AddKey()</code> on the <code>PPP_ContentDecryptor_Private<code>
+ * <code>AddKey()</code> on the <code>PPP_ContentDecryptor_Private</code>
* interface.
*
* @param[in] key_system A <code>PP_Var</code> of type
diff --git a/ppapi/api/private/ppb_file_io_private.idl b/ppapi/api/private/ppb_file_io_private.idl
new file mode 100644
index 0000000..38b2339
--- /dev/null
+++ b/ppapi/api/private/ppb_file_io_private.idl
@@ -0,0 +1,26 @@
+/* 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.
+ */
+
+#inline c
+#include "ppapi/c/private/pp_file_handle.h"
+#endinl
+
+/* This file contains the <code>PPB_FileIO_Private</code> interface. */
+label Chrome {
+ M28 = 0.1
+};
+
+/* PPB_FileIO_Private interface */
+interface PPB_FileIO_Private {
+ /**
+ * Returns a file handle corresponding to the given FileIO
+ * object. The FileIO object must have been opened with a
+ * successful call to FileIO::Open. The caller gets the ownership
+ * of the returned file handle and must close it.
+ */
+ int32_t RequestOSFileHandle([in] PP_Resource file_io,
+ [out] PP_FileHandle handle,
+ [in] PP_CompletionCallback callback);
+};
diff --git a/ppapi/api/private/ppb_flash.idl b/ppapi/api/private/ppb_flash.idl
index bedef84..f16cbc9 100644
--- a/ppapi/api/private/ppb_flash.idl
+++ b/ppapi/api/private/ppb_flash.idl
@@ -52,7 +52,7 @@
PP_FLASHSETTING_3DENABLED = 1,
/**
- * Specifies if the given instance is in private/inconito/off-the-record mode
+ * Specifies if the given instance is in private/incognito/off-the-record mode
* (returns true) or "regular" mode (returns false). Returns an undefined
* PP_Var on invalid instance.
*/
@@ -103,7 +103,12 @@
/**
* Specifies the document URL which contains the flash instance.
*/
- PP_FLASHCRASHKEY_URL = 1
+ PP_FLASHCRASHKEY_URL = 1,
+
+ /**
+ * Specifies the URL of the current swf.
+ */
+ PP_FLASHCRASHKEY_RESOURCE_URL = 2
};
/**
@@ -187,7 +192,7 @@
[in] PP_Module module);
/**
- * Loads the given font in a more priviledged process on Windows. Call this if
+ * Loads the given font in a more privileged process on Windows. Call this if
* Windows is giving errors for font calls. See
* content/renderer/font_cache_dispatcher_win.cc
*
diff --git a/ppapi/api/private/ppb_flash_clipboard.idl b/ppapi/api/private/ppb_flash_clipboard.idl
index c8a01eb..5a97318 100644
--- a/ppapi/api/private/ppb_flash_clipboard.idl
+++ b/ppapi/api/private/ppb_flash_clipboard.idl
@@ -26,7 +26,7 @@
};
/**
- * This enumeration contains the predfined clipboard data formats.
+ * This enumeration contains the predefined clipboard data formats.
*/
[assert_size(4)]
enum PP_Flash_Clipboard_Format {
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index 4f14d5a..b1f47ce 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -3,7 +3,8 @@
* found in the LICENSE file.
*/
-/* This file contains NaCl private interfaces. */
+/* This file contains NaCl private interfaces. This interface is not versioned
+ * and is for internal Chrome use. It may change without notice. */
#inline c
#include "ppapi/c/private/pp_file_handle.h"
@@ -33,6 +34,12 @@
PP_NACL_MANIFEST_MISSING_ARCH = 0
};
+struct PP_NaClExecutableMetadata {
+ /** File path of NaCl executable. This is created by the OpenNaClExecutableFd
+ * function. It is the caller's responsiblity to release it. */
+ PP_Var file_path;
+};
+
/* PPB_NaCl_Private */
interface PPB_NaCl_Private {
/* Launches NaCl's sel_ldr process. Returns PP_NACL_OK on success and
@@ -44,12 +51,15 @@
* does not need PPAPI, then it can run off the main thread.
* The |uses_irt| flag indicates whether the IRT should be loaded in this
* NaCl process. This is true for ABI stable nexes.
+ * The |enable_dyncode_syscalls| flag indicates whether or not the nexe
+ * will be able to use dynamic code system calls (e.g., mmap with PROT_EXEC).
*/
PP_NaClResult LaunchSelLdr([in] PP_Instance instance,
[in] str_t alleged_url,
[in] PP_Bool uses_irt,
[in] PP_Bool uses_ppapi,
[in] PP_Bool enable_ppapi_dev,
+ [in] PP_Bool enable_dyncode_syscalls,
[out] mem_t imc_handle);
/* This function starts the IPC proxy so the nexe can communicate with the
@@ -89,7 +99,7 @@
[in] uint32_t options);
/* Returns a read-only file descriptor of a file rooted in the Pnacl
- * component directory, or -1 on error.
+ * component directory, or an invalid handle on failure.
* Do we want this to take a completion callback and be async, or
* could we make this happen on another thread?
*/
@@ -112,4 +122,12 @@
/* Display a UI message to the user. */
PP_NaClResult ReportNaClError([in] PP_Instance instance,
[in] PP_NaClError message_id);
+
+ /* Opens a NaCl executable file in the application's extension directory
+ * corresponding to the file URL and returns a file descriptor, or an invalid
+ * handle on failure. |metadata| is left unchanged on failure.
+ */
+ PP_FileHandle OpenNaClExecutable([in] PP_Instance instance,
+ [in] str_t file_url,
+ [out] PP_NaClExecutableMetadata metadata);
};
diff --git a/ppapi/api/private/ppb_network_list_private.idl b/ppapi/api/private/ppb_network_list_private.idl
index 540aa1d..8ec330f 100644
--- a/ppapi/api/private/ppb_network_list_private.idl
+++ b/ppapi/api/private/ppb_network_list_private.idl
@@ -7,6 +7,8 @@
* This file defines the <code>PPB_NetworkList_Private</code> interface.
*/
+[generate_thunk]
+
label Chrome {
M19 = 0.2
};
@@ -90,6 +92,7 @@
* @return Returns type of the network interface with the specified
* <code>index</code>.
*/
+ [on_failure=PP_NETWORKLIST_UNKNOWN]
PP_NetworkListType_Private GetType([in] PP_Resource resource,
[in] uint32_t index);
@@ -97,6 +100,7 @@
* @return Returns current state of the network interface with the
* specified <code>index</code>.
*/
+ [on_failure=PP_NETWORKLIST_DOWN]
PP_NetworkListState_Private GetState([in] PP_Resource resource,
[in] uint32_t index);
diff --git a/ppapi/api/private/ppb_network_monitor_private.idl b/ppapi/api/private/ppb_network_monitor_private.idl
index 8144605..fe264a6 100644
--- a/ppapi/api/private/ppb_network_monitor_private.idl
+++ b/ppapi/api/private/ppb_network_monitor_private.idl
@@ -31,7 +31,7 @@
* Starts network change monitoring. The specified
* <code>callback</code> will be called on the main thread once
* after this method is called (to supply the initial network
- * configuarion) and then later every time network configuration
+ * configuration) and then later every time network configuration
* changes. Notifications are stopped when the returned resource is
* destroyed. If the plugin doesn't have access to the network list
* then the callback will be called once with the
diff --git a/ppapi/api/private/ppb_tcp_server_socket_private.idl b/ppapi/api/private/ppb_tcp_server_socket_private.idl
index a1224e1..f04635c 100644
--- a/ppapi/api/private/ppb_tcp_server_socket_private.idl
+++ b/ppapi/api/private/ppb_tcp_server_socket_private.idl
@@ -46,7 +46,7 @@
* PPB_TCPSocket_Private and stores reference to it in
* |tcp_socket|. |callback| is invoked when connection is accepted
* or in the case of failure. This method can be called only after
- * succesfull Listen call on |tcp_server_socket|.
+ * successful Listen call on |tcp_server_socket|.
*/
int32_t Accept([in] PP_Resource tcp_server_socket,
[out] PP_Resource tcp_socket,
diff --git a/ppapi/api/private/ppb_video_destination_private.idl b/ppapi/api/private/ppb_video_destination_private.idl
new file mode 100644
index 0000000..a37cbd5
--- /dev/null
+++ b/ppapi/api/private/ppb_video_destination_private.idl
@@ -0,0 +1,95 @@
+/* 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.
+ */
+
+/**
+ * This file defines the <code>PPB_VideoDestination_Private</code> interface
+ * for a video destination resource, which sends video frames to a MediaStream
+ * video track in the browser.
+ */
+
+ label Chrome {
+ M28 = 0.1
+ };
+
+/**
+ * The <code>PPB_VideoDestination_Private</code> interface contains pointers to
+ * several functions for creating video destination resources and using them to
+ * send video frames to a MediaStream video track in the browser.
+ */
+interface PPB_VideoDestination_Private {
+ /**
+ * Creates a video destination resource.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying an instance of
+ * a module.
+ *
+ * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
+ * failure. Failure means the instance was invalid.
+ */
+ PP_Resource Create([in] PP_Instance instance);
+
+ /**
+ * Determines if a resource is a video destination resource.
+ *
+ * @param[in] resource The <code>PP_Resource</code> to test.
+ *
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
+ * resource is a video destination resource or <code>PP_FALSE</code>
+ * otherwise.
+ */
+ PP_Bool IsVideoDestination([in] PP_Resource resource);
+
+ /**
+ * Opens a video destination for putting frames.
+ *
+ * @param[in] destination A <code>PP_Resource</code> corresponding to a video
+ * destination resource.
+ * @param[in] stream_url A <code>PP_Var</code> string holding a URL
+ * identifying a MediaStream.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Open().
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
+ * destination.
+ * Returns PP_ERROR_INPROGRESS if destination is already open.
+ * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
+ * some other browser error.
+ */
+ int32_t Open([in] PP_Resource destination,
+ [in] PP_Var stream_url,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Puts a frame to the video destination.
+ *
+ * After this call, you should take care to release your references to the
+ * image embedded in the video frame. If you paint to the image after
+ * PutFame(), there is the possibility of artifacts because the browser may
+ * still be copying the frame to the stream.
+ *
+ * @param[in] destination A <code>PP_Resource</code> corresponding to a video
+ * destination resource.
+ * @param[in] frame A <code>PP_VideoFrame_Private</code> holding the video
+ * frame to send to the destination.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
+ * destination.
+ * Returns PP_ERROR_FAILED if destination is not open, if the video frame has
+ * an invalid image data resource, or if some other browser error occurs.
+ */
+ int32_t PutFrame([in] PP_Resource destination,
+ [in] PP_VideoFrame_Private frame);
+
+ /**
+ * Closes the video destination.
+ *
+ * @param[in] destination A <code>PP_Resource</code> corresponding to a video
+ * destination.
+ */
+ void Close([in] PP_Resource destination);
+};
+
diff --git a/ppapi/api/private/ppb_video_source_private.idl b/ppapi/api/private/ppb_video_source_private.idl
new file mode 100644
index 0000000..3fc5872
--- /dev/null
+++ b/ppapi/api/private/ppb_video_source_private.idl
@@ -0,0 +1,92 @@
+/* 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.
+ */
+
+/**
+ * This file defines the <code>PPB_VideoSource_Private</code> interface for a
+ * video source resource, which receives video frames from a MediaStream video
+ * track in the browser.
+ */
+
+ label Chrome {
+ M28 = 0.1
+ };
+
+/**
+ * The <code>PPB_VideoSource_Private</code> interface contains pointers to
+ * several functions for creating video source resources and using them to
+ * receive video frames from a MediaStream video track in the browser.
+ */
+interface PPB_VideoSource_Private {
+ /**
+ * Creates a video source resource.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying an instance of
+ * a module.
+ *
+ * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
+ * failure. Failure means the instance was invalid.
+ */
+ PP_Resource Create([in] PP_Instance instance);
+
+ /**
+ * Determines if a resource is a video source resource.
+ *
+ * @param[in] resource The <code>PP_Resource</code> to test.
+ *
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
+ * resource is a video source resource or <code>PP_FALSE</code> otherwise.
+ */
+ PP_Bool IsVideoSource([in] PP_Resource resource);
+
+ /**
+ * Opens a video source for getting frames.
+ *
+ * @param[in] source A <code>PP_Resource</code> corresponding to a video
+ * source resource.
+ * @param[in] stream_url A <code>PP_Var</code> string holding a URL
+ * identifying a MediaStream.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Open().
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
+ * Returns PP_ERROR_INPROGRESS if source is already open.
+ * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
+ * some other browser error.
+ */
+ int32_t Open([in] PP_Resource source,
+ [in] PP_Var stream_url,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Gets a frame from the video source.
+ * The image data resource inside the returned frame will have its reference
+ * count incremented by one and must be managed by the plugin.
+ *
+ * @param[in] source A <code>PP_Resource</code> corresponding to a video
+ * source resource.
+ * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video
+ * frame from the source.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of GetNextFrame().
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
+ * Returns PP_ERROR_FAILED if the source is not open, or if some other
+ * browser error occurs.
+ */
+ int32_t GetFrame([in] PP_Resource source,
+ [out] PP_VideoFrame_Private frame,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Closes the video source.
+ *
+ * @param[in] source A <code>PP_Resource</code> corresponding to a video
+ * source resource.
+ */
+ void Close([in] PP_Resource source);
+};
+
diff --git a/ppapi/api/private/ppp_flash_browser_operations.idl b/ppapi/api/private/ppp_flash_browser_operations.idl
index acd4432..1504ad1 100644
--- a/ppapi/api/private/ppp_flash_browser_operations.idl
+++ b/ppapi/api/private/ppp_flash_browser_operations.idl
@@ -149,7 +149,7 @@
* @param[in] plugin_data_path String containing the directory where the
* plugin data is stored.
* @param[out] sites A NULL-terminated array of sites that have stored data.
- * Use FreeSiteList on the the array when done.
+ * Use FreeSiteList on the array when done.
*
* See also the NPP_GetSitesWithData function in NPAPI:
* https://wiki.mozilla.org/NPAPI:ClearSiteData
diff --git a/ppapi/api/private/ppp_instance_private.idl b/ppapi/api/private/ppp_instance_private.idl
index aaa0060..3756faf 100644
--- a/ppapi/api/private/ppp_instance_private.idl
+++ b/ppapi/api/private/ppp_instance_private.idl
@@ -29,7 +29,7 @@
* The returned PP_Var should have a reference added for the caller, which
* will be responsible for Release()ing that reference.
*
- * @param[in] instance A PP_Instance indentifying the instance from which the
+ * @param[in] instance A PP_Instance identifying the instance from which the
* instance object is being requested.
* @return A PP_Var containing scriptable object.
*/
diff --git a/ppapi/api/trusted/ppb_audio_trusted.idl b/ppapi/api/trusted/ppb_audio_trusted.idl
index c75b97b..6ea74b7 100644
--- a/ppapi/api/trusted/ppb_audio_trusted.idl
+++ b/ppapi/api/trusted/ppb_audio_trusted.idl
@@ -7,6 +7,8 @@
* This file defines the trusted audio interface.
*/
+[generate_thunk]
+
label Chrome {
M14 = 0.6
};
diff --git a/ppapi/api/trusted/ppb_browser_font_trusted.idl b/ppapi/api/trusted/ppb_browser_font_trusted.idl
index 79cee8c..7a79417 100644
--- a/ppapi/api/trusted/ppb_browser_font_trusted.idl
+++ b/ppapi/api/trusted/ppb_browser_font_trusted.idl
@@ -202,7 +202,7 @@
* clipped to the image.
*
* The image_data_is_opaque flag indicates whether subpixel antialiasing can
- * be performend, if it is supported. When the image below the text is
+ * be performed, if it is supported. When the image below the text is
* opaque, subpixel antialiasing is supported and you should set this to
* PP_TRUE to pick up the user's default preferences. If your plugin is
* partially transparent, then subpixel antialiasing is not possible and
diff --git a/ppapi/api/trusted/ppb_file_chooser_trusted.idl b/ppapi/api/trusted/ppb_file_chooser_trusted.idl
index 3d9aea0..0a0ae6b 100644
--- a/ppapi/api/trusted/ppb_file_chooser_trusted.idl
+++ b/ppapi/api/trusted/ppb_file_chooser_trusted.idl
@@ -8,6 +8,8 @@
* This file defines the <code>PPB_FileChooser_Trusted</code> interface.
*/
+[generate_thunk]
+
label Chrome {
M16 = 0.5,
M20 = 0.6
diff --git a/ppapi/api/trusted/ppb_file_io_trusted.idl b/ppapi/api/trusted/ppb_file_io_trusted.idl
index 1ee03ab..7ba20de 100644
--- a/ppapi/api/trusted/ppb_file_io_trusted.idl
+++ b/ppapi/api/trusted/ppb_file_io_trusted.idl
@@ -19,6 +19,8 @@
* descriptor. The FileIO object must have been opened with a successful
* call to FileIO::Open. The file descriptor will be closed automatically
* when the FileIO object is closed or destroyed.
+ *
+ * TODO(hamaji): Remove this and use RequestOSFileHandle instead.
*/
int32_t GetOSFileDescriptor([in] PP_Resource file_io);
diff --git a/ppapi/api/trusted/ppb_url_loader_trusted.idl b/ppapi/api/trusted/ppb_url_loader_trusted.idl
index 19156f4..bb60291 100644
--- a/ppapi/api/trusted/ppb_url_loader_trusted.idl
+++ b/ppapi/api/trusted/ppb_url_loader_trusted.idl
@@ -5,6 +5,8 @@
/* URL loader trusted interfaces. */
+[generate_thunk]
+
label Chrome {
M14 = 0.3
};
diff --git a/ppapi/c/dev/pp_video_dev.h b/ppapi/c/dev/pp_video_dev.h
index 023b505..eeb1498 100644
--- a/ppapi/c/dev/pp_video_dev.h
+++ b/ppapi/c/dev/pp_video_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/pp_video_dev.idl modified Fri Dec 7 15:33:11 2012. */
+/* From dev/pp_video_dev.idl modified Tue Apr 30 14:58:38 2013. */
#ifndef PPAPI_C_DEV_PP_VIDEO_DEV_H_
#define PPAPI_C_DEV_PP_VIDEO_DEV_H_
@@ -121,9 +121,8 @@
* @{
*/
/**
- * Decoder error codes reported to the plugin. A reasonable naive
+ * Decoder error codes reported to the plugin. A reasonable naive
* error handling policy is for the plugin to Destroy() the decoder on error.
- * Note: Keep these in sync with media::VideoDecodeAccelerator::Error.
*/
typedef enum {
/**
diff --git a/ppapi/c/dev/ppb_directory_reader_dev.h b/ppapi/c/dev/ppb_directory_reader_dev.h
deleted file mode 100644
index 060e489..0000000
--- a/ppapi/c/dev/ppb_directory_reader_dev.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* 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 dev/ppb_directory_reader_dev.idl modified Fri Feb 15 16:46:46 2013. */
-
-#ifndef PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_
-#define PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_
-
-#include "ppapi/c/pp_array_output.h"
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_file_info.h"
-#include "ppapi/c/pp_macros.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_stdint.h"
-
-#define PPB_DIRECTORYREADER_DEV_INTERFACE_0_6 "PPB_DirectoryReader(Dev);0.6"
-#define PPB_DIRECTORYREADER_DEV_INTERFACE PPB_DIRECTORYREADER_DEV_INTERFACE_0_6
-
-/**
- * @file
- *
- * This file defines the <code>PPB_DirectoryReader_Dev</code> interface.
- */
-
-
-/**
- * @addtogroup Structs
- * @{
- */
-struct PP_DirectoryEntry_Dev {
- PP_Resource file_ref;
- PP_FileType file_type;
-};
-PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DirectoryEntry_Dev, 8);
-/**
- * @}
- */
-
-/**
- * @addtogroup Interfaces
- * @{
- */
-struct PPB_DirectoryReader_Dev_0_6 {
- /* Creates a DirectoryReader for the given directory. Upon success, the
- * corresponding directory is classified as "in use" by the resulting
- * DirectoryReader object until such time as the DirectoryReader object is
- * destroyed. */
- PP_Resource (*Create)(PP_Resource directory_ref);
- /* Returns PP_TRUE if the given resource is a DirectoryReader. Returns
- * PP_FALSE if the resource is invalid or some type other than a
- * DirectoryReader. */
- PP_Bool (*IsDirectoryReader)(PP_Resource resource);
- /* Reads all entries in the directory.
- *
- * @param[in] directory_reader A <code>PP_Resource</code>
- * corresponding to a directory reader resource.
- * @param[in] output An output array which will receive
- * <code>PP_DirectoryEntry_Dev</code> objects on success.
- * @param[in] callback A <code>PP_CompletionCallback</code> to run on
- * completion.
- *
- * @return An error code from <code>pp_errors.h</code>.
- */
- int32_t (*ReadEntries)(PP_Resource directory_reader,
- struct PP_ArrayOutput output,
- struct PP_CompletionCallback callback);
-};
-
-typedef struct PPB_DirectoryReader_Dev_0_6 PPB_DirectoryReader_Dev;
-/**
- * @}
- */
-
-#endif /* PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ */
-
diff --git a/ppapi/c/dev/ppb_font_dev.h b/ppapi/c/dev/ppb_font_dev.h
index ad85a24..4e7bea1 100644
--- a/ppapi/c/dev/ppb_font_dev.h
+++ b/ppapi/c/dev/ppb_font_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_font_dev.idl modified Mon Jun 25 14:54:48 2012. */
+/* From dev/ppb_font_dev.idl modified Thu Mar 28 10:56:39 2013. */
#ifndef PPAPI_C_DEV_PPB_FONT_DEV_H_
#define PPAPI_C_DEV_PPB_FONT_DEV_H_
@@ -145,7 +145,7 @@
* When <code>override_direction</code> is false, the browser will perform
* the Unicode Bidirectional Algorithm (http://unicode.org/reports/tr9/) on
* the text. The value of the <code>rtl</code> flag specifies the
- * direcionality of the surrounding environment. This means that Hebrew
+ * directionality of the surrounding environment. This means that Hebrew
* word will always display right to left, even if <code>rtl</code> is false.
*
* When <code>override_direction</code> is true, no autodetection will be done
@@ -160,7 +160,7 @@
* content.
*
* If this flag is set, the browser will skip autodetection of the content
- * and will display all text in the direction speficied by the
+ * and will display all text in the direction specified by the
* <code>rtl</code> flag.
*/
PP_Bool override_direction;
@@ -224,7 +224,7 @@
* clipped to the image.
*
* The image_data_is_opaque flag indicates whether subpixel antialiasing can
- * be performend, if it is supported. When the image below the text is
+ * be performed, if it is supported. When the image below the text is
* opaque, subpixel antialiasing is supported and you should set this to
* PP_TRUE to pick up the user's default preferences. If your plugin is
* partially transparent, then subpixel antialiasing is not possible and
diff --git a/ppapi/c/dev/ppb_printing_dev.h b/ppapi/c/dev/ppb_printing_dev.h
index 62420b0..8b04c12 100644
--- a/ppapi/c/dev/ppb_printing_dev.h
+++ b/ppapi/c/dev/ppb_printing_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_printing_dev.idl modified Thu Jul 26 12:15:07 2012. */
+/* From dev/ppb_printing_dev.idl modified Fri Apr 19 10:45:09 2013. */
#ifndef PPAPI_C_DEV_PPB_PRINTING_DEV_H_
#define PPAPI_C_DEV_PPB_PRINTING_DEV_H_
@@ -19,7 +19,6 @@
#include "ppapi/c/pp_size.h"
#include "ppapi/c/pp_stdint.h"
-#define PPB_PRINTING_DEV_INTERFACE_0_6 "PPB_Printing(Dev);0.6"
#define PPB_PRINTING_DEV_INTERFACE_0_7 "PPB_Printing(Dev);0.7"
#define PPB_PRINTING_DEV_INTERFACE PPB_PRINTING_DEV_INTERFACE_0_7
@@ -63,12 +62,6 @@
};
typedef struct PPB_Printing_Dev_0_7 PPB_Printing_Dev;
-
-struct PPB_Printing_Dev_0_6 {
- PP_Bool (*GetDefaultPrintSettings)(
- PP_Instance instance,
- struct PP_PrintSettings_Dev* print_settings);
-};
/**
* @}
*/
diff --git a/ppapi/c/dev/ppb_testing_dev.h b/ppapi/c/dev/ppb_testing_dev.h
index 0567120..e5078e2 100644
--- a/ppapi/c/dev/ppb_testing_dev.h
+++ b/ppapi/c/dev/ppb_testing_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_testing_dev.idl modified Mon Mar 19 12:02:10 2012. */
+/* From dev/ppb_testing_dev.idl modified Thu Apr 18 13:22:09 2013. */
#ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_
#define PPAPI_C_DEV_PPB_TESTING_DEV_H_
@@ -21,7 +21,8 @@
#define PPB_TESTING_DEV_INTERFACE_0_8 "PPB_Testing(Dev);0.8"
#define PPB_TESTING_DEV_INTERFACE_0_9 "PPB_Testing(Dev);0.9"
#define PPB_TESTING_DEV_INTERFACE_0_91 "PPB_Testing(Dev);0.91"
-#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_91
+#define PPB_TESTING_DEV_INTERFACE_0_92 "PPB_Testing(Dev);0.92"
+#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_92
/**
* @file
@@ -35,7 +36,7 @@
* @addtogroup Interfaces
* @{
*/
-struct PPB_Testing_Dev_0_91 {
+struct PPB_Testing_Dev_0_92 {
/**
* Reads the bitmap data out of the backing store for the given
* DeviceContext2D and into the given image. If the data was successfully
@@ -134,9 +135,18 @@
* of the returned PP_Vars will *not* be affected by this call.
*/
uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size);
+ /**
+ * Sets the threshold size at which point we switch from transmitting
+ * array buffers in IPC messages to using shared memory. This is only used
+ * for testing purposes where we need to transmit small buffers using shmem
+ * (in order to have fast tests). Passing a value of 0 resets the threshold
+ * to its default. The threshold is in bytes.
+ */
+ void (*SetMinimumArrayBufferSizeForShmem)(PP_Instance instance,
+ uint32_t threshold);
};
-typedef struct PPB_Testing_Dev_0_91 PPB_Testing_Dev;
+typedef struct PPB_Testing_Dev_0_92 PPB_Testing_Dev;
struct PPB_Testing_Dev_0_7 {
PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
@@ -171,6 +181,20 @@
struct PP_Var (*GetDocumentURL)(PP_Instance instance,
struct PP_URLComponents_Dev* components);
};
+
+struct PPB_Testing_Dev_0_91 {
+ PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
+ PP_Resource image,
+ const struct PP_Point* top_left);
+ void (*RunMessageLoop)(PP_Instance instance);
+ void (*QuitMessageLoop)(PP_Instance instance);
+ uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
+ PP_Bool (*IsOutOfProcess)(void);
+ void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
+ struct PP_Var (*GetDocumentURL)(PP_Instance instance,
+ struct PP_URLComponents_Dev* components);
+ uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size);
+};
/**
* @}
*/
diff --git a/ppapi/c/dev/ppb_text_input_dev.h b/ppapi/c/dev/ppb_text_input_dev.h
index 7870f7e..8b7df44 100644
--- a/ppapi/c/dev/ppb_text_input_dev.h
+++ b/ppapi/c/dev/ppb_text_input_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_text_input_dev.idl modified Tue Mar 13 21:18:47 2012. */
+/* From dev/ppb_text_input_dev.idl modified Thu Mar 28 10:54:47 2013. */
#ifndef PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
#define PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
@@ -93,16 +93,16 @@
* call, informs the browser about the current text selection and surrounding
* text. <code>text</code> is a UTF-8 string that contains the current range
* of text selection in the plugin. <code>caret</code> is the byte-index of
- * the caret poisition within <code>text</code>. <code>anchor</code> is the
+ * the caret position within <code>text</code>. <code>anchor</code> is the
* byte-index of the anchor position (i.e., if a range of text is selected,
- * it is the other edge of selection diffrent from <code>caret</code>. If
+ * it is the other edge of selection different from <code>caret</code>. If
* there are no selection, <code>anchor</code> is equal to <code>caret</code>.
*
* Typical use of this information in the browser is to enable "reconversion"
* features of IME that puts back the already committed text into the
* pre-commit composition state. Another use is to improve the precision
* of suggestion of IME by taking the context into account (e.g., if the caret
- * looks to be on the begining of a sentense, suggest capital letters in a
+ * looks to be on the beginning of a sentence, suggest capital letters in a
* virtual keyboard).
*
* When the focus is not on text, call this function setting <code>text</code>
diff --git a/ppapi/c/dev/ppb_truetype_font_dev.h b/ppapi/c/dev/ppb_truetype_font_dev.h
index e0fc499..5172cae 100644
--- a/ppapi/c/dev/ppb_truetype_font_dev.h
+++ b/ppapi/c/dev/ppb_truetype_font_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_truetype_font_dev.idl modified Mon Mar 11 14:12:14 2013. */
+/* From dev/ppb_truetype_font_dev.idl modified Wed Apr 17 15:38:46 2013. */
#ifndef PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_
#define PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_
@@ -51,7 +51,7 @@
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontFamily_Dev, 4);
/**
- * The PP_TrueTypeFontStyle_Dev defines font styles.
+ * The PP_TrueTypeFontStyle_Dev enum defines font styles.
*/
typedef enum {
PP_TRUETYPEFONTSTYLE_NORMAL = 0,
@@ -60,7 +60,7 @@
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontStyle_Dev, 4);
/**
- * The PP_TrueTypeFontWeight_Dev defines font weights.
+ * The PP_TrueTypeFontWeight_Dev enum defines font weights.
*/
typedef enum {
PP_TRUETYPEFONTWEIGHT_THIN = 100,
@@ -76,7 +76,7 @@
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontWeight_Dev, 4);
/**
- * The PP_TrueTypeFontWidth_Dev defines font widths.
+ * The PP_TrueTypeFontWidth_Dev enum defines font widths.
*/
typedef enum {
PP_TRUETYPEFONTWIDTH_ULTRACONDENSED = 0,
@@ -92,7 +92,7 @@
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontWidth_Dev, 4);
/**
- * The PP_TrueTypeFontCharset defines font character sets.
+ * The PP_TrueTypeFontCharset enum defines font character sets.
*/
typedef enum {
PP_TRUETYPEFONTCHARSET_ANSI = 0,
@@ -125,8 +125,8 @@
* @{
*/
/**
- * The <code>PP_TrueTypeFontDesc</code> structure describes a TrueType font. It
- * is passed to Create, and returned by Describe.
+ * The <code>PP_TrueTypeFontDesc</code> struct describes a TrueType font. It is
+ * passed to Create(), and returned by Describe().
*/
struct PP_TrueTypeFontDesc_Dev {
/**
@@ -183,6 +183,28 @@
struct PP_ArrayOutput output,
struct PP_CompletionCallback callback);
/**
+ * Gets an array of TrueType font descriptors for a given font family. These
+ * descriptors can be used to create a font in that family and matching the
+ * descriptor attributes.
+ *
+ * @param[in] instance A <code>PP_Instance</code> requesting the font
+ * descriptors.
+ * @param[in] family A <code>PP_Var</code> holding a string specifying the
+ * font family.
+ * @param[in] output A <code>PP_ArrayOutput</code> to hold the descriptors.
+ * The output is an array of <code>PP_TrueTypeFontDesc</code> structs. Each
+ * desc contains a PP_Var for the family name which must be released.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of GetFontsInFamily.
+ *
+ * @return If >= 0, the number of font descriptors returned, otherwise an
+ * error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*GetFontsInFamily)(PP_Instance instance,
+ struct PP_Var family,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback);
+ /**
* Creates a font resource matching the given font characteristics. The
* resource id will be non-zero on success, or zero on failure.
*
@@ -193,14 +215,14 @@
PP_Resource (*Create)(PP_Instance instance,
const struct PP_TrueTypeFontDesc_Dev* desc);
/**
- * Determines if the given resource is a font.
+ * Determines if the given resource is a TrueType font.
*
- * @param[in] resource A <code>PP_Resource</code> corresponding to a font.
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a resource.
*
* @return <code>PP_TRUE</code> if the resource is a
* <code>PPB_TrueTypeFont_Dev</code>, <code>PP_FALSE</code> otherwise.
*/
- PP_Bool (*IsFont)(PP_Resource resource);
+ PP_Bool (*IsTrueTypeFont)(PP_Resource resource);
/**
* Returns a description of the given font resource. This description may
* differ from the description passed to Create, reflecting the host's font
@@ -222,8 +244,8 @@
struct PP_TrueTypeFontDesc_Dev* desc,
struct PP_CompletionCallback callback);
/**
- * Gets an array of identifying tags for each table in the font.
- * These tags can be used to request specific tables using GetTable.
+ * Gets an array of identifying tags for each table in the font. These tags
+ * can be used to request specific tables using GetTable.
*
* @param[in] font A <code>PP_Resource</code> corresponding to a font.
* @param[in] output A <code>PP_ArrayOutput</code> to hold the tags.
diff --git a/ppapi/c/dev/ppb_zoom_dev.h b/ppapi/c/dev/ppb_zoom_dev.h
index f80ec12..e8cf4ce 100644
--- a/ppapi/c/dev/ppb_zoom_dev.h
+++ b/ppapi/c/dev/ppb_zoom_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_zoom_dev.idl modified Wed Oct 5 14:06:02 2011. */
+/* From dev/ppb_zoom_dev.idl modified Thu Apr 18 10:24:21 2013. */
#ifndef PPAPI_C_DEV_PPB_ZOOM_DEV_H_
#define PPAPI_C_DEV_PPB_ZOOM_DEV_H_
@@ -38,11 +38,11 @@
*/
void (*ZoomChanged)(PP_Instance instance, double factor);
/**
- * Sets the mininum and maximium zoom factors.
+ * Sets the minimum and maximum zoom factors.
*/
void (*ZoomLimitsChanged)(PP_Instance instance,
double minimum_factor,
- double maximium_factor);
+ double maximum_factor);
};
typedef struct PPB_Zoom_Dev_0_2 PPB_Zoom_Dev;
diff --git a/ppapi/c/dev/ppp_text_input_dev.h b/ppapi/c/dev/ppp_text_input_dev.h
index 3bfea58..bc25e57 100644
--- a/ppapi/c/dev/ppp_text_input_dev.h
+++ b/ppapi/c/dev/ppp_text_input_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppp_text_input_dev.idl modified Tue Mar 13 20:19:19 2012. */
+/* From dev/ppp_text_input_dev.idl modified Thu Mar 28 10:55:30 2013. */
#ifndef PPAPI_C_DEV_PPP_TEXT_INPUT_DEV_H_
#define PPAPI_C_DEV_PPP_TEXT_INPUT_DEV_H_
@@ -31,7 +31,7 @@
*/
struct PPP_TextInput_Dev_0_1 {
/**
- * Requests the plugin to send back the text arround the current caret or
+ * Requests the plugin to send back the text around the current caret or
* selection by <code>PPB_TextInput_Dev::UpdateSurroundingText</code>.
* It is recommended to include the <code>desired_number_of_characters</code>
* characters before and after the selection, but not mandatory.
diff --git a/ppapi/c/extensions/dev/ppb_alarms_dev.h b/ppapi/c/extensions/dev/ppb_ext_alarms_dev.h
similarity index 95%
rename from ppapi/c/extensions/dev/ppb_alarms_dev.h
rename to ppapi/c/extensions/dev/ppb_ext_alarms_dev.h
index a573527..e73de60 100644
--- a/ppapi/c/extensions/dev/ppb_alarms_dev.h
+++ b/ppapi/c/extensions/dev/ppb_ext_alarms_dev.h
@@ -3,10 +3,12 @@
* found in the LICENSE file.
*/
-/* From extensions/dev/ppb_alarms_dev.idl modified Tue Mar 05 14:02:41 2013. */
+/* From extensions/dev/ppb_ext_alarms_dev.idl,
+ * modified Wed Mar 20 13:50:11 2013.
+ */
-#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_ALARMS_DEV_H_
-#define PPAPI_C_EXTENSIONS_DEV_PPB_ALARMS_DEV_H_
+#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_EXT_ALARMS_DEV_H_
+#define PPAPI_C_EXTENSIONS_DEV_PPB_EXT_ALARMS_DEV_H_
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_completion_callback.h"
@@ -25,7 +27,7 @@
*/
-#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h"
/**
* @addtogroup Typedefs
@@ -198,5 +200,5 @@
}
#define PP_Ext_Alarms_OnAlarm_Dev PP_Ext_Alarms_OnAlarm_Dev_0_1
-#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_ALARMS_DEV_H_ */
+#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EXT_ALARMS_DEV_H_ */
diff --git a/ppapi/c/extensions/dev/ppb_events_dev.h b/ppapi/c/extensions/dev/ppb_ext_events_dev.h
similarity index 91%
rename from ppapi/c/extensions/dev/ppb_events_dev.h
rename to ppapi/c/extensions/dev/ppb_ext_events_dev.h
index 5483dc9..0c1c57a 100644
--- a/ppapi/c/extensions/dev/ppb_events_dev.h
+++ b/ppapi/c/extensions/dev/ppb_ext_events_dev.h
@@ -3,10 +3,12 @@
* found in the LICENSE file.
*/
-/* From extensions/dev/ppb_events_dev.idl modified Sun Mar 10 10:37:48 2013. */
+/* From extensions/dev/ppb_ext_events_dev.idl,
+ * modified Mon Mar 18 17:18:20 2013.
+ */
-#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_
-#define PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_
+#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_EXT_EVENTS_DEV_H_
+#define PPAPI_C_EXTENSIONS_DEV_PPB_EXT_EVENTS_DEV_H_
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
@@ -114,5 +116,5 @@
listener.user_data = user_data;
return listener;
}
-#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_ */
+#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EXT_EVENTS_DEV_H_ */
diff --git a/ppapi/c/extensions/dev/ppb_ext_socket_dev.h b/ppapi/c/extensions/dev/ppb_ext_socket_dev.h
new file mode 100644
index 0000000..b24e129
--- /dev/null
+++ b/ppapi/c/extensions/dev/ppb_ext_socket_dev.h
@@ -0,0 +1,420 @@
+/* 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.
+ */
+
+/* From extensions/dev/ppb_ext_socket_dev.idl,
+ * modified Tue Apr 02 16:04:00 2013.
+ */
+
+#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_EXT_SOCKET_DEV_H_
+#define PPAPI_C_EXTENSIONS_DEV_PPB_EXT_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_stdint.h"
+#include "ppapi/c/pp_var.h"
+
+#define PPB_EXT_SOCKET_DEV_INTERFACE_0_1 "PPB_Ext_Socket(Dev);0.1"
+#define PPB_EXT_SOCKET_DEV_INTERFACE PPB_EXT_SOCKET_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the Pepper equivalent of the <code>chrome.socket</code>
+ * extension API.
+ */
+
+
+/**
+ * @addtogroup Typedefs
+ * @{
+ */
+/**
+ * A string <code>PP_Var</code> which has one of the following values:
+ * - "tcp"
+ * - "udp"
+ */
+typedef struct PP_Var PP_Ext_Socket_SocketType_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code>.
+ */
+typedef struct PP_Var PP_Ext_Socket_CreateOptions_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "socketId" : integer <code>PP_Var</code>
+ * The id of the newly created socket.
+ */
+typedef struct PP_Var PP_Ext_Socket_CreateInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "resultCode" : integer <code>PP_Var</code>
+ * - "socketId" : integer or undefined <code>PP_Var</code>
+ * The id of the accepted socket.
+ */
+typedef struct PP_Var PP_Ext_Socket_AcceptInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "resultCode" : integer <code>PP_Var</code>
+ * The resultCode returned from the underlying read() call.
+ * - "data" : array buffer <code>PP_Var</code>
+ */
+typedef struct PP_Var PP_Ext_Socket_ReadInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "bytesWritten" : integer <code>PP_Var</code>
+ * The number of bytes sent, or a negative error code.
+ */
+typedef struct PP_Var PP_Ext_Socket_WriteInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "resultCode" : integer <code>PP_Var</code>
+ * The resultCode returned from the underlying recvfrom() call.
+ * - "data": array buffer <code>PP_Var</code>
+ * - "address": string <code>PP_Var</code>
+ * The address of the remote machine.
+ * - "port": integer <code>PP_Var</code>
+ */
+typedef struct PP_Var PP_Ext_Socket_RecvFromInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "socketType" : string <code>PP_Var</code> which matches the description of
+ * <code>PP_Ext_Socket_SocketType_Dev</code>
+ * The type of the passed socket. This will be <code>tcp</code> or
+ * <code>udp</code>.
+ * - "connected" : boolean <code>PP_Var</code>
+ * Whether or not the underlying socket is connected.
+ *
+ * For <code>tcp</code> sockets, this will remain true even if the remote peer
+ * has disconnected. Reading or writing to the socket may then result in an
+ * error, hinting that this socket should be disconnected via
+ * <code>Disconnect()</code>.
+ *
+ * For <code>udp</code> sockets, this just represents whether a default remote
+ * address has been specified for reading and writing packets.
+ * - "peerAddress" : string or undefined <code>PP_Var</code>
+ * If the underlying socket is connected, contains the IPv4/6 address of the
+ * peer.
+ * - "peerPort" : integer or undefined <code>PP_Var</code>
+ * If the underlying socket is connected, contains the port of the connected
+ * peer.
+ * - "localAddress" : string or undefined <code>PP_Var</code>
+ * If the underlying socket is bound or connected, contains its local IPv4/6
+ * address.
+ * - "localPort" : integer or undefined <code>PP_Var</code>
+ * If the underlying socket is bound or connected, contains its local port.
+ */
+typedef struct PP_Var PP_Ext_Socket_SocketInfo_Dev;
+
+/**
+ * A dictionary <code>PP_Var</code> which contains
+ * - "name" : string <code>PP_Var</code>
+ * The underlying name of the adapter. On *nix, this will typically be "eth0",
+ * "lo", etc.
+ * - "address": string <code>PP_Var</code>
+ * The available IPv4/6 address.
+ */
+typedef struct PP_Var PP_Ext_Socket_NetworkInterface_Dev;
+
+/**
+ * An array <code>PP_Var</code> which contains elements of
+ * <code>PP_Ext_Socket_NetworkInterface_Dev</code>.
+ */
+typedef struct PP_Var PP_Ext_Socket_NetworkInterface_Dev_Array;
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_Ext_Socket_Dev_0_1 {
+ /**
+ * Creates a socket of the specified type that will connect to the specified
+ * remote machine.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] type A <code>PP_Ext_Socket_SocketType_Dev</code>. The type of
+ * socket to create. Must be <code>tcp</code> or <code>udp</code>.
+ * @param[in] options An undefined <code>PP_Var</code> or
+ * <code>PP_Ext_Socket_CreateOptions_Dev</code>. The socket options.
+ * @param[out] create_info A <code>PP_Ext_Socket_CreateInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Create)(PP_Instance instance,
+ PP_Ext_Socket_SocketType_Dev type,
+ PP_Ext_Socket_CreateOptions_Dev options,
+ PP_Ext_Socket_CreateInfo_Dev* create_info,
+ struct PP_CompletionCallback callback);
+ /**
+ * Destroys the socket. Each socket created should be destroyed after use.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ */
+ void (*Destroy)(PP_Instance instance, struct PP_Var socket_id);
+ /**
+ * Connects the socket to the remote machine (for a <code>tcp</code> socket).
+ * For a <code>udp</code> socket, this sets the default address which packets
+ * are sent to and read from for <code>Read()</code> and <code>Write()</code>
+ * calls.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] hostname A string <code>PP_Var</code>. The hostname or IP
+ * address of the remote machine.
+ * @param[in] port An integer <code>PP_Var</code>. The port of the remote
+ * machine.
+ * @param[out] result An integer <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Connect)(PP_Instance instance,
+ struct PP_Var socket_id,
+ struct PP_Var hostname,
+ struct PP_Var port,
+ struct PP_Var* result,
+ struct PP_CompletionCallback callback);
+ /**
+ * Binds the local address for socket. Currently, it does not support TCP
+ * socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] address A string <code>PP_Var</code>. The address of the local
+ * machine.
+ * @param[in] port An integer <code>PP_Var</code>. The port of the local
+ * machine.
+ * @param[out] result An integer <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Bind)(PP_Instance instance,
+ struct PP_Var socket_id,
+ struct PP_Var address,
+ struct PP_Var port,
+ struct PP_Var* result,
+ struct PP_CompletionCallback callback);
+ /**
+ * Disconnects the socket. For UDP sockets, <code>Disconnect</code> is a
+ * non-operation but is safe to call.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ */
+ void (*Disconnect)(PP_Instance instance, struct PP_Var socket_id);
+ /**
+ * Reads data from the given connected socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] buffer_size An undefined or integer <code>PP_Var</code>. The
+ * read buffer size.
+ * @param[out] read_info A <code>PP_Ext_Socket_ReadInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Read)(PP_Instance instance,
+ struct PP_Var socket_id,
+ struct PP_Var buffer_size,
+ PP_Ext_Socket_ReadInfo_Dev* read_info,
+ struct PP_CompletionCallback callback);
+ /**
+ * Writes data on the given connected socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] data An array buffer <code>PP_Var</code>. The data to write.
+ * @param[out] write_info A <code>PP_Ext_Socket_WriteInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Write)(PP_Instance instance,
+ struct PP_Var socket_id,
+ struct PP_Var data,
+ PP_Ext_Socket_WriteInfo_Dev* write_info,
+ struct PP_CompletionCallback callback);
+ /**
+ * Receives data from the given UDP socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] buffer_size An undefined or integer <code>PP_Var</code>. The
+ * receive buffer size.
+ * @param[out] recv_from_info A <code>PP_Ext_Socket_RecvFromInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*RecvFrom)(PP_Instance instance,
+ struct PP_Var socket_id,
+ struct PP_Var buffer_size,
+ PP_Ext_Socket_RecvFromInfo_Dev* recv_from_info,
+ struct PP_CompletionCallback callback);
+ /**
+ * Sends data on the given UDP socket to the given address and port.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] data An array buffer <code>PP_Var</code>.
+ * @param[in] address A string <code>PP_Var</code>. The address of the remote
+ * machine.
+ * @param[in] port An integer <code>PP_Var</code>. The port of the remote
+ * machine.
+ * @param[out] write_info A <code>PP_Ext_Socket_WriteInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*SendTo)(PP_Instance instance,
+ struct PP_Var socket_id,
+ struct PP_Var data,
+ struct PP_Var address,
+ struct PP_Var port,
+ PP_Ext_Socket_WriteInfo_Dev* write_info,
+ struct PP_CompletionCallback callback);
+ /**
+ * This method applies to TCP sockets only.
+ * Listens for connections on the specified port and address. This effectively
+ * makes this a server socket, and client socket functions (Connect, Read,
+ * Write) can no longer be used on this socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] address A string <code>PP_Var</code>. The address of the local
+ * machine.
+ * @param[in] port An integer <code>PP_Var</code>. The port of the local
+ * machine.
+ * @param[in] backlog An undefined or integer <code>PP_Var</code>. Length of
+ * the socket's listen queue.
+ * @param[out] result An integer <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Listen)(PP_Instance instance,
+ struct PP_Var socket_id,
+ struct PP_Var address,
+ struct PP_Var port,
+ struct PP_Var backlog,
+ struct PP_Var* result,
+ struct PP_CompletionCallback callback);
+ /**
+ * This method applies to TCP sockets only.
+ * Registers a callback function to be called when a connection is accepted on
+ * this listening server socket. Listen must be called first.
+ * If there is already an active accept callback, this callback will be
+ * invoked immediately with an error as the resultCode.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[out] accept_info A <code>PP_Ext_Socket_AcceptInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Accept)(PP_Instance instance,
+ struct PP_Var socket_id,
+ PP_Ext_Socket_AcceptInfo_Dev* accept_info,
+ struct PP_CompletionCallback callback);
+ /**
+ * Enables or disables the keep-alive functionality for a TCP connection.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] enable A boolean <code>PP_Var</code>. If true, enable keep-alive
+ * functionality.
+ * @param[in] delay An undefined or integer <code>PP_Var</code>. Set the delay
+ * seconds between the last data packet received and the first keepalive
+ * probe. Default is 0.
+ * @param[out] result A boolean <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*SetKeepAlive)(PP_Instance instance,
+ struct PP_Var socket_id,
+ struct PP_Var enable,
+ struct PP_Var delay,
+ struct PP_Var* result,
+ struct PP_CompletionCallback callback);
+ /**
+ * Sets or clears <code>TCP_NODELAY</code> for a TCP connection. Nagle's
+ * algorithm will be disabled when <code>TCP_NODELAY</code> is set.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[in] no_delay A boolean <code>PP_Var</code>.
+ * @param[out] result A boolean <code>PP_Var</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*SetNoDelay)(PP_Instance instance,
+ struct PP_Var socket_id,
+ struct PP_Var no_delay,
+ struct PP_Var* result,
+ struct PP_CompletionCallback callback);
+ /**
+ * Retrieves the state of the given socket.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[in] socket_id An integer <code>PP_Var</code>. The socket ID.
+ * @param[out] result A <code>PP_Ext_Socket_SocketInfo_Dev</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*GetInfo)(PP_Instance instance,
+ struct PP_Var socket_id,
+ PP_Ext_Socket_SocketInfo_Dev* result,
+ struct PP_CompletionCallback callback);
+ /**
+ * Retrieves information about local adapters on this system.
+ *
+ * @param[in] instance A <code>PP_Instance</code>.
+ * @param[out] result A <code>PP_Ext_Socket_NetworkInterface_Dev_Array</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called
+ * upon completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*GetNetworkList)(PP_Instance instance,
+ PP_Ext_Socket_NetworkInterface_Dev_Array* result,
+ struct PP_CompletionCallback callback);
+};
+
+typedef struct PPB_Ext_Socket_Dev_0_1 PPB_Ext_Socket_Dev;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EXT_SOCKET_DEV_H_ */
+
diff --git a/ppapi/c/pp_array_output.h b/ppapi/c/pp_array_output.h
index e5902e0..add873c 100644
--- a/ppapi/c/pp_array_output.h
+++ b/ppapi/c/pp_array_output.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From pp_array_output.idl modified Tue Mar 6 21:52:16 2012. */
+/* From pp_array_output.idl modified Thu Mar 28 11:07:53 2013. */
#ifndef PPAPI_C_PP_ARRAY_OUTPUT_H_
#define PPAPI_C_PP_ARRAY_OUTPUT_H_
@@ -65,7 +65,7 @@
/**
* A structure that defines a way for the browser to return arrays of data
* to the plugin. The browser can not allocate memory on behalf of the plugin
- * becaues the plugin and browser may have different allocators.
+ * because the plugin and browser may have different allocators.
*
* Array output works by having the browser call to the plugin to allocate a
* buffer, and then the browser will copy the contents of the array into that
diff --git a/ppapi/c/pp_completion_callback.h b/ppapi/c/pp_completion_callback.h
index 8d45da0..73dc57e 100644
--- a/ppapi/c/pp_completion_callback.h
+++ b/ppapi/c/pp_completion_callback.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From pp_completion_callback.idl modified Mon Feb 11 15:42:11 2013. */
+/* From pp_completion_callback.idl modified Thu Mar 28 15:25:03 2013. */
#ifndef PPAPI_C_PP_COMPLETION_CALLBACK_H_
#define PPAPI_C_PP_COMPLETION_CALLBACK_H_
@@ -92,10 +92,10 @@
* ways:
* - Required: The callback will always be invoked asynchronously on the
* thread where the associated PPB method was invoked. The method
- * will always return <code>PP_OK_COMPLETIONPENDING when a
- * required callback, and the callback will be invoked later
- * (barring system or thread shutdown; see PPB_MessageLoop for
- * details). Required callbacks are the default.
+ * will always return PP_OK_COMPLETIONPENDING when a required
+ * callback, and the callback will be invoked later (barring
+ * system or thread shutdown; see PPB_MessageLoop for details).
+ * Required callbacks are the default.
*
* NOTE: If you use a required callback on a background thread,
* you must have created and attached a PPB_MessageLoop.
@@ -168,16 +168,16 @@
*
* <strong>Example, creating a Required callback:</strong>
*
- * <code>
+ * @code
* struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL);
- * </code>
+ * @endcode
*
* <strong>Example, creating an Optional callback:</strong>
*
- * <code>
+ * @code
* struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL);
* cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL;
- * </code>
+ * @endcode
*
* @param[in] func A <code>PP_CompletionCallback_Func</code> that will be
* called.
diff --git a/ppapi/c/pp_directory_entry.h b/ppapi/c/pp_directory_entry.h
new file mode 100644
index 0000000..4bf6fb3
--- /dev/null
+++ b/ppapi/c/pp_directory_entry.h
@@ -0,0 +1,37 @@
+/* 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.
+ */
+
+/* From pp_directory_entry.idl modified Tue Apr 30 05:44:50 2013. */
+
+#ifndef PPAPI_C_PP_DIRECTORY_ENTRY_H_
+#define PPAPI_C_PP_DIRECTORY_ENTRY_H_
+
+#include "ppapi/c/pp_file_info.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+
+/**
+ * @file
+ *
+ * This file defines the <code>PP_DirectoryEntry</code> struct.
+ */
+
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+struct PP_DirectoryEntry {
+ PP_Resource file_ref;
+ PP_FileType file_type;
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DirectoryEntry, 8);
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PP_DIRECTORY_ENTRY_H_ */
+
diff --git a/ppapi/c/pp_errors.h b/ppapi/c/pp_errors.h
index 180ebb3..9b44a71 100644
--- a/ppapi/c/pp_errors.h
+++ b/ppapi/c/pp_errors.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From pp_errors.idl modified Thu Dec 20 14:28:44 2012. */
+/* From pp_errors.idl modified Thu Mar 28 10:12:22 2013. */
#ifndef PPAPI_C_PP_ERRORS_H_
#define PPAPI_C_PP_ERRORS_H_
@@ -90,7 +90,7 @@
* calls on background threads are not currently supported. Until this
* support is complete, you must either do asynchronous operations on the
* main thread, or provide an adaptor for a blocking background thread to
- * execute the operaitions on the main thread.
+ * execute the operations on the main thread.
*/
PP_ERROR_BLOCKS_MAIN_THREAD = -13,
PP_ERROR_FILENOTFOUND = -20,
diff --git a/ppapi/c/pp_file_info.h b/ppapi/c/pp_file_info.h
index 2f0261b..e53cae1 100644
--- a/ppapi/c/pp_file_info.h
+++ b/ppapi/c/pp_file_info.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From pp_file_info.idl modified Mon Nov 14 10:36:01 2011. */
+/* From pp_file_info.idl modified Thu Mar 28 11:11:01 2013. */
#ifndef PPAPI_C_PP_FILE_INFO_H_
#define PPAPI_C_PP_FILE_INFO_H_
@@ -43,7 +43,7 @@
PP_FILESYSTEMTYPE_INVALID = 0,
/** For external file system types */
PP_FILESYSTEMTYPE_EXTERNAL = 1,
- /** For local persistant file system types */
+ /** For local persistent file system types */
PP_FILESYSTEMTYPE_LOCALPERSISTENT = 2,
/** For local temporary file system types */
PP_FILESYSTEMTYPE_LOCALTEMPORARY = 3
diff --git a/ppapi/c/pp_input_event.h b/ppapi/c/pp_input_event.h
index cf7277e..ea65ae5 100644
--- a/ppapi/c/pp_input_event.h
+++ b/ppapi/c/pp_input_event.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From pp_input_event.idl modified Mon Mar 5 10:13:42 2012. */
+/* From pp_input_event.idl modified Thu Mar 28 10:52:59 2013. */
#ifndef PPAPI_C_PP_INPUT_EVENT_H_
#define PPAPI_C_PP_INPUT_EVENT_H_
@@ -68,8 +68,8 @@
* accent up (it didn't generate a character), letter key down, letter with
* accent character event (it was modified by the previous accent key), letter
* key up. If the letter can't be combined with the accent, like an umlaut and
- * an 'R', the system might send unlaut down, umlaut up, 'R' key down, umlaut
- * character (can't combine it with 'R', so just send the raw unlaut so it
+ * an 'R', the system might send umlaut down, umlaut up, 'R' key down, umlaut
+ * character (can't combine it with 'R', so just send the raw umlaut so it
* isn't lost"), 'R' character event, 'R' key up.
*/
struct PP_InputEvent_Character {
diff --git a/ppapi/c/pp_macros.h b/ppapi/c/pp_macros.h
index 83f85d6..6179380 100644
--- a/ppapi/c/pp_macros.h
+++ b/ppapi/c/pp_macros.h
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
-/* From pp_macros.idl modified Fri Feb 15 16:46:46 2013. */
+/* From pp_macros.idl modified Tue Mar 19 12:29:49 2013. */
#ifndef PPAPI_C_PP_MACROS_H_
#define PPAPI_C_PP_MACROS_H_
-#define PPAPI_RELEASE 27
+#define PPAPI_RELEASE 28
/**
* @file
diff --git a/ppapi/c/pp_resource.h b/ppapi/c/pp_resource.h
index 2ea82bc..d63e13d 100644
--- a/ppapi/c/pp_resource.h
+++ b/ppapi/c/pp_resource.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_resource.idl modified Sat Jul 16 16:50:26 2011. */
+/* From pp_resource.idl modified Thu Mar 28 10:09:51 2013. */
#ifndef PPAPI_C_PP_RESOURCE_H_
#define PPAPI_C_PP_RESOURCE_H_
@@ -23,7 +23,7 @@
* @{
*/
/**
- * This typdef represents an opaque handle assigned by the browser to the
+ * This typedef represents an opaque handle assigned by the browser to the
* resource. The handle is guaranteed never to be 0 for a valid resource, so a
* module can initialize it to 0 to indicate a "NULL handle." Some interfaces
* may return a NULL resource to indicate failure.
diff --git a/ppapi/c/pp_touch_point.h b/ppapi/c/pp_touch_point.h
index bcdc37a..1a6f91f 100644
--- a/ppapi/c/pp_touch_point.h
+++ b/ppapi/c/pp_touch_point.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From pp_touch_point.idl modified Mon Feb 11 15:42:54 2013. */
+/* From pp_touch_point.idl modified Thu Mar 28 10:13:07 2013. */
#ifndef PPAPI_C_PP_TOUCH_POINT_H_
#define PPAPI_C_PP_TOUCH_POINT_H_
@@ -25,7 +25,7 @@
*/
/**
* The <code>PP_TouchPoint</code> struct represents all information about a
- * single touch point, such ase position, id, rotation angle, and pressure.
+ * single touch point, such as position, id, rotation angle, and pressure.
*/
struct PP_TouchPoint {
/**
diff --git a/ppapi/c/ppb_audio_config.h b/ppapi/c/ppb_audio_config.h
index 8570708..a1e2e4b 100644
--- a/ppapi/c/ppb_audio_config.h
+++ b/ppapi/c/ppb_audio_config.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_audio_config.idl modified Mon Jul 9 12:02:26 2012. */
+/* From ppb_audio_config.idl modified Thu Mar 28 10:07:11 2013. */
#ifndef PPAPI_C_PPB_AUDIO_CONFIG_H_
#define PPAPI_C_PPB_AUDIO_CONFIG_H_
@@ -179,7 +179,7 @@
* RecommendSampleRate() returns the native sample rate that the browser
* is using in the backend. Applications that use the recommended sample
* rate will have potentially better latency and fidelity. The return value
- * is indended for audio output devices. If the output sample rate cannot be
+ * is intended for audio output devices. If the output sample rate cannot be
* determined, this function can return PP_AUDIOSAMPLERATE_NONE.
*
* @param[in] instance
diff --git a/ppapi/c/ppb_file_ref.h b/ppapi/c/ppb_file_ref.h
index d359a7b..951c30d 100644
--- a/ppapi/c/ppb_file_ref.h
+++ b/ppapi/c/ppb_file_ref.h
@@ -3,11 +3,12 @@
* found in the LICENSE file.
*/
-/* From ppb_file_ref.idl modified Wed Oct 5 14:06:02 2011. */
+/* From ppb_file_ref.idl modified Thu May 2 16:22:57 2013. */
#ifndef PPAPI_C_PPB_FILE_REF_H_
#define PPAPI_C_PPB_FILE_REF_H_
+#include "ppapi/c/pp_array_output.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_file_info.h"
@@ -18,7 +19,8 @@
#include "ppapi/c/pp_var.h"
#define PPB_FILEREF_INTERFACE_1_0 "PPB_FileRef;1.0"
-#define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_0
+#define PPB_FILEREF_INTERFACE_1_1 "PPB_FileRef;1.1"
+#define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_1
/**
* @file
@@ -36,7 +38,7 @@
* a file system. This struct contains a <code>PP_FileSystemType</code>
* identifier and a file path string.
*/
-struct PPB_FileRef_1_0 {
+struct PPB_FileRef_1_1 {
/**
* Create() creates a weak pointer to a file in the given file system. File
* paths are POSIX style.
@@ -177,9 +179,61 @@
int32_t (*Rename)(PP_Resource file_ref,
PP_Resource new_file_ref,
struct PP_CompletionCallback callback);
+ /**
+ * Query() queries info about a file or directory. You must have access to
+ * read this file or directory if it exists in the external filesystem.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ * @param[out] info A pointer to a <code>PP_FileInfo</code> which will be
+ * populated with information about the file or directory.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Query().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Query)(PP_Resource file_ref,
+ struct PP_FileInfo* info,
+ struct PP_CompletionCallback callback);
+ /**
+ * ReadDirectoryEntries() reads all entries in a directory.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a directory
+ * reference.
+ * @param[in] output An output array which will receive
+ * <code>PP_DirectoryEntry</code> objects on success.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+ * completion.
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*ReadDirectoryEntries)(PP_Resource file_ref,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback);
};
-typedef struct PPB_FileRef_1_0 PPB_FileRef;
+typedef struct PPB_FileRef_1_1 PPB_FileRef;
+
+struct PPB_FileRef_1_0 {
+ PP_Resource (*Create)(PP_Resource file_system, const char* path);
+ PP_Bool (*IsFileRef)(PP_Resource resource);
+ PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref);
+ struct PP_Var (*GetName)(PP_Resource file_ref);
+ struct PP_Var (*GetPath)(PP_Resource file_ref);
+ PP_Resource (*GetParent)(PP_Resource file_ref);
+ int32_t (*MakeDirectory)(PP_Resource directory_ref,
+ PP_Bool make_ancestors,
+ struct PP_CompletionCallback callback);
+ int32_t (*Touch)(PP_Resource file_ref,
+ PP_Time last_access_time,
+ PP_Time last_modified_time,
+ struct PP_CompletionCallback callback);
+ int32_t (*Delete)(PP_Resource file_ref,
+ struct PP_CompletionCallback callback);
+ int32_t (*Rename)(PP_Resource file_ref,
+ PP_Resource new_file_ref,
+ struct PP_CompletionCallback callback);
+};
/**
* @}
*/
diff --git a/ppapi/c/ppb_gamepad.h b/ppapi/c/ppb_gamepad.h
index 6726568..4beb9b8 100644
--- a/ppapi/c/ppb_gamepad.h
+++ b/ppapi/c/ppb_gamepad.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_gamepad.idl modified Thu Mar 1 11:41:21 2012. */
+/* From ppb_gamepad.idl modified Tue Apr 16 09:04:34 2013. */
#ifndef PPAPI_C_PPB_GAMEPAD_H_
#define PPAPI_C_PPB_GAMEPAD_H_
@@ -98,7 +98,7 @@
*/
struct PPB_Gamepad_1_0 {
/**
- * Samples the current state of the connected gamepads.
+ * Samples the current state of the available gamepads.
*/
void (*Sample)(PP_Instance instance, struct PP_GamepadsSampleData* data);
};
diff --git a/ppapi/c/ppb_graphics_2d.h b/ppapi/c/ppb_graphics_2d.h
index 6c41f3f..251f34e 100644
--- a/ppapi/c/ppb_graphics_2d.h
+++ b/ppapi/c/ppb_graphics_2d.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_graphics_2d.idl modified Mon Mar 19 11:35:04 2012. */
+/* From ppb_graphics_2d.idl modified Fri Apr 26 08:49:08 2013. */
#ifndef PPAPI_C_PPB_GRAPHICS_2D_H_
#define PPAPI_C_PPB_GRAPHICS_2D_H_
@@ -19,7 +19,8 @@
#include "ppapi/c/pp_stdint.h"
#define PPB_GRAPHICS_2D_INTERFACE_1_0 "PPB_Graphics2D;1.0"
-#define PPB_GRAPHICS_2D_INTERFACE PPB_GRAPHICS_2D_INTERFACE_1_0
+#define PPB_GRAPHICS_2D_INTERFACE_1_1 "PPB_Graphics2D;1.1"
+#define PPB_GRAPHICS_2D_INTERFACE PPB_GRAPHICS_2D_INTERFACE_1_1
/**
* @file
@@ -35,7 +36,7 @@
/**
* <code>PPB_Graphics2D</code> defines the interface for a 2D graphics context.
*/
-struct PPB_Graphics2D_1_0 {
+struct PPB_Graphics2D_1_1 {
/**
* Create() creates a 2D graphics context. The returned graphics context will
* not be bound to the module instance on creation (call BindGraphics() on
@@ -81,13 +82,13 @@
* @param[in,out] is_always_opaque Identifies whether only opaque data
* will be painted.
*
- * @return Returns <code>PP_TRUE</code> on succes or <code>PP_FALSE</code> if
+ * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if
* the resource is invalid. The output parameters will be set to 0 on a
* <code>PP_FALSE</code>.
*/
PP_Bool (*Describe)(PP_Resource graphics_2d,
struct PP_Size* size,
- PP_Bool* is_always_opqaue);
+ PP_Bool* is_always_opaque);
/**
* PaintImageData() enqueues a paint of the given image into the context.
* This function has no effect until you call Flush() As a result, what
@@ -247,9 +248,57 @@
*/
int32_t (*Flush)(PP_Resource graphics_2d,
struct PP_CompletionCallback callback);
+ /**
+ * SetScale() sets the scale factor that will be applied when painting the
+ * graphics context onto the output device. Typically, if rendering at device
+ * resolution is desired, the context would be created with the width and
+ * height scaled up by the view's GetDeviceScale and SetScale called with a
+ * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed
+ * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of
+ * 2.0, one would call Create with a size of (w=400, h=200) and then call
+ * SetScale with 0.5. One would then treat each pixel in the context as a
+ * single device pixel.
+ *
+ * @param[in] resource A <code>Graphics2D</code> context resource.
+ * @param[in] scale The scale to apply when painting.
+ *
+ * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if
+ * the resource is invalid or the scale factor is 0 or less.
+ */
+ PP_Bool (*SetScale)(PP_Resource resource, float scale);
+ /***
+ * GetScale() gets the scale factor that will be applied when painting the
+ * graphics context onto the output device.
+ *
+ * @param[in] resource A <code>Graphics2D</code> context resource.
+ *
+ * @return Returns the scale factor for the graphics context. If the resource
+ * is not a valid <code>Graphics2D</code> context, this will return 0.0.
+ */
+ float (*GetScale)(PP_Resource resource);
};
-typedef struct PPB_Graphics2D_1_0 PPB_Graphics2D;
+typedef struct PPB_Graphics2D_1_1 PPB_Graphics2D;
+
+struct PPB_Graphics2D_1_0 {
+ PP_Resource (*Create)(PP_Instance instance,
+ const struct PP_Size* size,
+ PP_Bool is_always_opaque);
+ PP_Bool (*IsGraphics2D)(PP_Resource resource);
+ PP_Bool (*Describe)(PP_Resource graphics_2d,
+ struct PP_Size* size,
+ PP_Bool* is_always_opaque);
+ void (*PaintImageData)(PP_Resource graphics_2d,
+ PP_Resource image_data,
+ const struct PP_Point* top_left,
+ const struct PP_Rect* src_rect);
+ void (*Scroll)(PP_Resource graphics_2d,
+ const struct PP_Rect* clip_rect,
+ const struct PP_Point* amount);
+ void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data);
+ int32_t (*Flush)(PP_Resource graphics_2d,
+ struct PP_CompletionCallback callback);
+};
/**
* @}
*/
diff --git a/ppapi/c/ppb_graphics_3d.h b/ppapi/c/ppb_graphics_3d.h
index 8f482e6..1da70a0 100644
--- a/ppapi/c/ppb_graphics_3d.h
+++ b/ppapi/c/ppb_graphics_3d.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_graphics_3d.idl modified Tue Feb 07 11:38:46 2012. */
+/* From ppb_graphics_3d.idl modified Thu Mar 28 10:12:11 2013. */
#ifndef PPAPI_C_PPB_GRAPHICS_3D_H_
#define PPAPI_C_PPB_GRAPHICS_3D_H_
@@ -37,25 +37,25 @@
* <strong>Example usage from plugin code:</strong>
*
* <strong>Setup:</strong>
- * <code>
+ * @code
* PP_Resource context;
* int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800,
* PP_GRAPHICS3DATTRIB_HEIGHT, 800,
* PP_GRAPHICS3DATTRIB_NONE};
* context = g3d->Create(instance, attribs, &context);
* inst->BindGraphics(instance, context);
- * </code>
+ * @endcode
*
* <strong>Present one frame:</strong>
- * <code>
+ * @code
* gles2->Clear(context, GL_COLOR_BUFFER);
* g3d->SwapBuffers(context);
- * </code>
+ * @endcode
*
* <strong>Shutdown:</strong>
- * <code>
+ * @code
* core->ReleaseResource(context);
- * </code>
+ * @endcode
*/
struct PPB_Graphics3D_1_0 {
/**
@@ -176,7 +176,7 @@
*
* <strong>Example usage:</strong> To get the values for rgb bits in the
* color buffer, this function must be called as following:
- * <code>
+ * @code
* int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0,
* PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0,
* PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0,
@@ -185,7 +185,7 @@
* int red_bits = attrib_list[1];
* int green_bits = attrib_list[3];
* int blue_bits = attrib_list[5];
- * </code>
+ * @endcode
*/
int32_t (*GetAttribs)(PP_Resource context, int32_t attrib_list[]);
/**
@@ -211,7 +211,7 @@
* The recoverable error conditions that have no side effect are
* detected and returned immediately by all functions in this interface.
* In addition the implementation may get into a fatal state while
- * processing a command. In this case the application must detroy the
+ * processing a command. In this case the application must destroy the
* context and reinitialize client API state and objects to continue
* rendering.
*
@@ -219,7 +219,7 @@
* It is recommended to handle error in the SwapBuffers callback because
* GetError is synchronous. This function may be useful in rare cases where
* drawing a frame is expensive and you want to verify the result of
- * ResizeBuffers before attemptimg to draw a frame.
+ * ResizeBuffers before attempting to draw a frame.
*
* @param[in] The 3D graphics context.
* @return Returns:
diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h
index bc6ebcb..35ef6be 100644
--- a/ppapi/c/ppb_input_event.h
+++ b/ppapi/c/ppb_input_event.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_input_event.idl modified Mon Nov 26 19:51:21 2012. */
+/* From ppb_input_event.idl modified Thu Mar 28 10:51:06 2013. */
#ifndef PPAPI_C_PPB_INPUT_EVENT_H_
#define PPAPI_C_PPB_INPUT_EVENT_H_
@@ -335,11 +335,11 @@
* a crack at the message.
*
* <strong>Example:</strong>
- * <code>
+ * @code
* RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE);
* RequestFilteringInputEvents(instance,
* PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
- * </code>
+ * @endcode
*
* @param instance The <code>PP_Instance</code> of the instance requesting
* the given events.
@@ -376,11 +376,11 @@
* can have significant overhead.
*
* <strong>Example:</strong>
- * <code>
+ * @code
* RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE);
* RequestFilteringInputEvents(instance,
* PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
- * </code>
+ * @endcode
*
* @return <code>PP_OK</code> if the operation succeeded,
* <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or
@@ -872,7 +872,7 @@
PP_TouchListType list,
uint32_t index);
/**
- * Returns the touch-point with the spcified touch-id in the specified list.
+ * Returns the touch-point with the specified touch-id in the specified list.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to a touch
* event.
diff --git a/ppapi/c/ppb_message_loop.h b/ppapi/c/ppb_message_loop.h
index 2ff9511..d582abc 100644
--- a/ppapi/c/ppb_message_loop.h
+++ b/ppapi/c/ppb_message_loop.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_message_loop.idl modified Thu Jan 17 12:04:14 2013. */
+/* From ppb_message_loop.idl modified Mon Apr 1 12:14:25 2013. */
#ifndef PPAPI_C_PPB_MESSAGE_LOOP_H_
#define PPAPI_C_PPB_MESSAGE_LOOP_H_
@@ -41,7 +41,7 @@
* suddenly see their PP_Resource handles become invalid. In this case, calls
* will fail with PP_ERROR_BADRESOURCE. If you need to access data associated
* with your instance, you will probably want to create some kind of threadsafe
- * proxy object that can handle asynchonous destruction of the instance object.
+ * proxy object that can handle asynchronous destruction of the instance object.
*
* Typical usage:
* On the main thread:
@@ -54,7 +54,8 @@
* - Call AttachToCurrentThread() with the message loop resource.
* - Call Run() with the message loop resource.
*
- * Your callacks should look like this:
+ * Your callbacks should look like this:
+ * @code
* void DoMyWork(void* user_data, int32_t status) {
* if (status != PP_OK) {
* Cleanup(); // e.g. free user_data.
@@ -62,6 +63,7 @@
* }
* ... do your work...
* }
+ * @endcode
* For a C++ example, see ppapi/utility/threading/simple_thread.h
*
* (You can also create the message loop resource on the background thread,
@@ -219,7 +221,7 @@
*
* @param callback The completion callback to execute from the message loop.
*
- * @param delay_ms The number of millseconds to delay execution of the given
+ * @param delay_ms The number of milliseconds to delay execution of the given
* completion callback. Passing 0 means it will get queued normally and
* executed in order.
*
@@ -234,7 +236,7 @@
* run your callback with an error without causing unexpected threading
* problems). If you associate memory with the completion callback (for
* example, you're using the C++ CompletionCallbackFactory), you will need to
- * free this or manually run the callback. See "Desctruction and error
+ * free this or manually run the callback. See "Destruction and error
* handling" above.
*
*
diff --git a/ppapi/c/ppb_mouse_cursor.h b/ppapi/c/ppb_mouse_cursor.h
index 1be5889..bc6a5f5 100644
--- a/ppapi/c/ppb_mouse_cursor.h
+++ b/ppapi/c/ppb_mouse_cursor.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_mouse_cursor.idl modified Mon Mar 26 22:05:07 2012. */
+/* From ppb_mouse_cursor.idl modified Thu Mar 28 10:11:32 2013. */
#ifndef PPAPI_C_PPB_MOUSE_CURSOR_H_
#define PPAPI_C_PPB_MOUSE_CURSOR_H_
@@ -104,7 +104,7 @@
* cursor, set the type to <code>PP_MOUSECURSOR_TYPE_CUSTOM</code> and
* specify your image and hot spot.
*
- * @param[in] instance A <code>PP_Instance</code> indentifying the instance
+ * @param[in] instance A <code>PP_Instance</code> identifying the instance
* that the mouse cursor will affect.
*
* @param[in] type A <code>PP_MouseCursor_Type</code> identifying the type of
@@ -116,7 +116,7 @@
* pixels in each direction and must be of the system's native image format.
* When you are specifying a predefined cursor, this parameter must be 0.
*
- * @param[in] hot_spot When setting a custom cursor, this idenfifies the
+ * @param[in] hot_spot When setting a custom cursor, this identifies the
* pixel position within the given image of the "hot spot" of the cursor.
* When specifying a stock cursor, this parameter is ignored.
*
diff --git a/ppapi/c/ppb_url_loader.h b/ppapi/c/ppb_url_loader.h
index c19cc9d..b1df360 100644
--- a/ppapi/c/ppb_url_loader.h
+++ b/ppapi/c/ppb_url_loader.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_url_loader.idl modified Wed Oct 5 14:06:02 2011. */
+/* From ppb_url_loader.idl modified Thu Mar 28 10:07:37 2013. */
#ifndef PPAPI_C_PPB_URL_LOADER_H_
#define PPAPI_C_PPB_URL_LOADER_H_
@@ -84,7 +84,7 @@
* <code>URLRequestInfo</code>.
* @param[in] callback A <code>PP_CompletionCallback</code> to run on
* asynchronous completion of Open(). This callback will run when response
- * headers for the url are received or error occured. This callback
+ * headers for the url are received or error occurred. This callback
* will only run if Open() returns <code>PP_OK_COMPLETIONPENDING</code>.
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
diff --git a/ppapi/c/ppb_url_request_info.h b/ppapi/c/ppb_url_request_info.h
index 4eaf0db..5719eab 100644
--- a/ppapi/c/ppb_url_request_info.h
+++ b/ppapi/c/ppb_url_request_info.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_url_request_info.idl modified Tue Jul 10 09:05:59 2012. */
+/* From ppb_url_request_info.idl modified Thu Mar 28 10:19:35 2013. */
#ifndef PPAPI_C_PPB_URL_REQUEST_INFO_H_
#define PPAPI_C_PPB_URL_REQUEST_INFO_H_
@@ -48,7 +48,7 @@
* This corresponds to a string (<code>PP_VARTYPE_STRING</code>); \n
* delimited. Refer to the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"Header
- * Field Definitions</a> documentaiton for further information.
+ * Field Definitions</a> documentation for further information.
*/
PP_URLREQUESTPROPERTY_HEADERS = 2,
/**
@@ -78,7 +78,7 @@
* This corresponds to a <code>PP_Bool</code>
* (default=<code>PP_FALSE</code>). Set this value to <code>PP_TRUE</code> if
* you want to be able to poll the upload progress using
- * PPB_URLLoader.GetUplaodProgress().
+ * PPB_URLLoader.GetUploadProgress().
*/
PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS = 6,
/**
diff --git a/ppapi/c/ppb_view.h b/ppapi/c/ppb_view.h
index a2a92ac..8b82c78 100644
--- a/ppapi/c/ppb_view.h
+++ b/ppapi/c/ppb_view.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_view.idl modified Fri Feb 17 09:09:15 2012. */
+/* From ppb_view.idl modified Fri Mar 29 11:55:32 2013. */
#ifndef PPAPI_C_PPB_VIEW_H_
#define PPAPI_C_PPB_VIEW_H_
@@ -17,7 +17,8 @@
#include "ppapi/c/pp_stdint.h"
#define PPB_VIEW_INTERFACE_1_0 "PPB_View;1.0"
-#define PPB_VIEW_INTERFACE PPB_VIEW_INTERFACE_1_0
+#define PPB_VIEW_INTERFACE_1_1 "PPB_View;1.1"
+#define PPB_VIEW_INTERFACE PPB_VIEW_INTERFACE_1_1
/**
* @file
@@ -35,7 +36,7 @@
* You will receive new view information using
* <code>PPP_Instance.DidChangeView</code>.
*/
-struct PPB_View_1_0 {
+struct PPB_View_1_1 {
/**
* IsView() determines if the given resource is a valid
* <code>PPB_View</code> resource. Note that <code>PPB_ViewChanged</code>
@@ -167,9 +168,47 @@
* clip rect was filled in, <code>PP_FALSE</code> if not.
*/
PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip);
+ /**
+ * GetDeviceScale returns the scale factor between device pixels and Density
+ * Independent Pixels (DIPs, also known as logical pixels or UI pixels on
+ * some platforms). This allows the developer to render their contents at
+ * device resolution, even as coordinates / sizes are given in DIPs through
+ * the API.
+ *
+ * Note that the coordinate system for Pepper APIs is DIPs. Also note that
+ * one DIP might not equal one CSS pixel - when page scale/zoom is in effect.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a
+ * <code>PPB_View</code> resource.
+ *
+ * @return A <code>float</code> value representing the number of device pixels
+ * per DIP. If the resource is invalid, the value will be 0.0.
+ */
+ float (*GetDeviceScale)(PP_Resource resource);
+ /**
+ * GetCSSScale returns the scale factor between DIPs and CSS pixels. This
+ * allows proper scaling between DIPs - as sent via the Pepper API - and CSS
+ * pixel coordinates used for Web content.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a
+ * <code>PPB_View</code> resource.
+ *
+ * @return css_scale A <code>float</code> value representing the number of
+ * DIPs per CSS pixel. If the resource is invalid, the value will be 0.0.
+ */
+ float (*GetCSSScale)(PP_Resource resource);
};
-typedef struct PPB_View_1_0 PPB_View;
+typedef struct PPB_View_1_1 PPB_View;
+
+struct PPB_View_1_0 {
+ PP_Bool (*IsView)(PP_Resource resource);
+ PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect);
+ PP_Bool (*IsFullscreen)(PP_Resource resource);
+ PP_Bool (*IsVisible)(PP_Resource resource);
+ PP_Bool (*IsPageVisible)(PP_Resource resource);
+ PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip);
+};
/**
* @}
*/
diff --git a/ppapi/c/private/pp_video_frame_private.h b/ppapi/c/private/pp_video_frame_private.h
new file mode 100644
index 0000000..8c64476
--- /dev/null
+++ b/ppapi/c/private/pp_video_frame_private.h
@@ -0,0 +1,55 @@
+/* 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.
+ */
+
+/* From private/pp_video_frame_private.idl modified Wed Apr 24 11:49:01 2013. */
+
+#ifndef PPAPI_C_PRIVATE_PP_VIDEO_FRAME_PRIVATE_H_
+#define PPAPI_C_PRIVATE_PP_VIDEO_FRAME_PRIVATE_H_
+
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_time.h"
+
+/**
+ * @file
+ * This file defines the struct used to hold a video frame.
+ */
+
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+/**
+ * The <code>PP_VideoFrame_Private</code> struct represents a video frame.
+ * Video sources and destinations use frames to transfer video to and from
+ * the browser.
+ */
+struct PP_VideoFrame_Private {
+ /**
+ * A timestamp placing the frame in a video stream.
+ */
+ PP_TimeTicks timestamp;
+ /**
+ * An image data resource to hold the video frame.
+ */
+ PP_Resource image_data;
+ /**
+ * Ensure that this struct is 16-bytes wide by padding the end. In some
+ * compilers, PP_TimeTicks is 8-byte aligned, so those compilers align this
+ * struct on 8-byte boundaries as well and pad it to 8 bytes even without this
+ * padding attribute. This padding makes its size consistent across
+ * compilers.
+ */
+ int32_t padding;
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoFrame_Private, 16);
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PRIVATE_PP_VIDEO_FRAME_PRIVATE_H_ */
+
diff --git a/ppapi/c/private/ppb_content_decryptor_private.h b/ppapi/c/private/ppb_content_decryptor_private.h
index 984c6c1..e42c3c9 100644
--- a/ppapi/c/private/ppb_content_decryptor_private.h
+++ b/ppapi/c/private/ppb_content_decryptor_private.h
@@ -4,7 +4,7 @@
*/
/* From private/ppb_content_decryptor_private.idl,
- * modified Mon Dec 10 21:43:51 2012.
+ * modified Thu Mar 28 15:22:02 2013.
*/
#ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_
@@ -53,7 +53,7 @@
*
* The browser must notify the application that a key is needed, and, in
* response, the web application must direct the browser to call
- * <code>AddKey()</code> on the <code>PPP_ContentDecryptor_Private<code>
+ * <code>AddKey()</code> on the <code>PPP_ContentDecryptor_Private</code>
* interface.
*
* @param[in] key_system A <code>PP_Var</code> of type
diff --git a/ppapi/c/private/ppb_file_io_private.h b/ppapi/c/private/ppb_file_io_private.h
new file mode 100644
index 0000000..cdbbae7
--- /dev/null
+++ b/ppapi/c/private/ppb_file_io_private.h
@@ -0,0 +1,49 @@
+/* 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.
+ */
+
+/* From private/ppb_file_io_private.idl modified Wed Mar 27 14:43:25 2013. */
+
+#ifndef PPAPI_C_PRIVATE_PPB_FILE_IO_PRIVATE_H_
+#define PPAPI_C_PRIVATE_PPB_FILE_IO_PRIVATE_H_
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_FILEIO_PRIVATE_INTERFACE_0_1 "PPB_FileIO_Private;0.1"
+#define PPB_FILEIO_PRIVATE_INTERFACE PPB_FILEIO_PRIVATE_INTERFACE_0_1
+
+/**
+ * @file
+ */
+
+
+#include "ppapi/c/private/pp_file_handle.h"
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/* PPB_FileIO_Private interface */
+struct PPB_FileIO_Private_0_1 {
+ /**
+ * Returns a file handle corresponding to the given FileIO
+ * object. The FileIO object must have been opened with a
+ * successful call to FileIO::Open. The caller gets the ownership
+ * of the returned file handle and must close it.
+ */
+ int32_t (*RequestOSFileHandle)(PP_Resource file_io,
+ PP_FileHandle* handle,
+ struct PP_CompletionCallback callback);
+};
+
+typedef struct PPB_FileIO_Private_0_1 PPB_FileIO_Private;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PRIVATE_PPB_FILE_IO_PRIVATE_H_ */
+
diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h
index 3a586dd..c1c4c93 100644
--- a/ppapi/c/private/ppb_flash.h
+++ b/ppapi/c/private/ppb_flash.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_flash.idl modified Thu Jan 31 16:23:42 2013. */
+/* From private/ppb_flash.idl modified Thu Apr 18 15:06:12 2013. */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_
#define PPAPI_C_PRIVATE_PPB_FLASH_H_
@@ -72,7 +72,7 @@
*/
PP_FLASHSETTING_3DENABLED = 1,
/**
- * Specifies if the given instance is in private/inconito/off-the-record mode
+ * Specifies if the given instance is in private/incognito/off-the-record mode
* (returns true) or "regular" mode (returns false). Returns an undefined
* PP_Var on invalid instance.
*/
@@ -118,7 +118,11 @@
/**
* Specifies the document URL which contains the flash instance.
*/
- PP_FLASHCRASHKEY_URL = 1
+ PP_FLASHCRASHKEY_URL = 1,
+ /**
+ * Specifies the URL of the current swf.
+ */
+ PP_FLASHCRASHKEY_RESOURCE_URL = 2
} PP_FlashCrashKey;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashCrashKey, 4);
/**
@@ -182,7 +186,7 @@
*/
struct PP_Var (*GetCommandLineArgs)(PP_Module module);
/**
- * Loads the given font in a more priviledged process on Windows. Call this if
+ * Loads the given font in a more privileged process on Windows. Call this if
* Windows is giving errors for font calls. See
* content/renderer/font_cache_dispatcher_win.cc
*
diff --git a/ppapi/c/private/ppb_flash_clipboard.h b/ppapi/c/private/ppb_flash_clipboard.h
index 5da06cc..d59957a 100644
--- a/ppapi/c/private/ppb_flash_clipboard.h
+++ b/ppapi/c/private/ppb_flash_clipboard.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_flash_clipboard.idl modified Mon Oct 29 12:51:16 2012. */
+/* From private/ppb_flash_clipboard.idl modified Thu Mar 28 10:23:59 2013. */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_
#define PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_
@@ -42,7 +42,7 @@
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Type, 4);
/**
- * This enumeration contains the predfined clipboard data formats.
+ * This enumeration contains the predefined clipboard data formats.
*/
typedef enum {
/** Indicates an invalid or unsupported clipboard data format. */
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index b73de17..8e40fd8 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_nacl_private.idl modified Thu Jan 10 15:59:03 2013. */
+/* From private/ppb_nacl_private.idl modified Mon Apr 22 22:25:20 2013. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -12,13 +12,15 @@
#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_NACL_PRIVATE_INTERFACE_1_0 "PPB_NaCl_Private;1.0"
#define PPB_NACL_PRIVATE_INTERFACE PPB_NACL_PRIVATE_INTERFACE_1_0
/**
* @file
- * This file contains NaCl private interfaces. */
+ * This file contains NaCl private interfaces. This interface is not versioned
+ * and is for internal Chrome use. It may change without notice. */
#include "ppapi/c/private/pp_file_handle.h"
@@ -55,6 +57,19 @@
*/
/**
+ * @addtogroup Structs
+ * @{
+ */
+struct PP_NaClExecutableMetadata {
+ /** File path of NaCl executable. This is created by the OpenNaClExecutableFd
+ * function. It is the caller's responsiblity to release it. */
+ struct PP_Var file_path;
+};
+/**
+ * @}
+ */
+
+/**
* @addtogroup Interfaces
* @{
*/
@@ -69,12 +84,15 @@
* does not need PPAPI, then it can run off the main thread.
* The |uses_irt| flag indicates whether the IRT should be loaded in this
* NaCl process. This is true for ABI stable nexes.
+ * The |enable_dyncode_syscalls| flag indicates whether or not the nexe
+ * will be able to use dynamic code system calls (e.g., mmap with PROT_EXEC).
*/
PP_NaClResult (*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,
void* imc_handle);
/* This function starts the IPC proxy so the nexe can communicate with the
* browser. Returns PP_NACL_OK on success, otherwise a result code indicating
@@ -108,7 +126,7 @@
uint32_t desired_access,
uint32_t options);
/* Returns a read-only file descriptor of a file rooted in the Pnacl
- * component directory, or -1 on error.
+ * component directory, or an invalid handle on failure.
* Do we want this to take a completion callback and be async, or
* could we make this happen on another thread?
*/
@@ -127,6 +145,14 @@
/* Display a UI message to the user. */
PP_NaClResult (*ReportNaClError)(PP_Instance instance,
PP_NaClError message_id);
+ /* Opens a NaCl executable file in the application's extension directory
+ * corresponding to the file URL and returns a file descriptor, or an invalid
+ * handle on failure. |metadata| is left unchanged on failure.
+ */
+ PP_FileHandle (*OpenNaClExecutable)(
+ PP_Instance instance,
+ const char* file_url,
+ struct PP_NaClExecutableMetadata* metadata);
};
typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private;
diff --git a/ppapi/c/private/ppb_network_monitor_private.h b/ppapi/c/private/ppb_network_monitor_private.h
index 9893150..93c1ff0 100644
--- a/ppapi/c/private/ppb_network_monitor_private.h
+++ b/ppapi/c/private/ppb_network_monitor_private.h
@@ -4,7 +4,7 @@
*/
/* From private/ppb_network_monitor_private.idl,
- * modified Fri Feb 24 10:51:22 2012.
+ * modified Thu Mar 28 10:30:11 2013.
*/
#ifndef PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_
@@ -57,7 +57,7 @@
* Starts network change monitoring. The specified
* <code>callback</code> will be called on the main thread once
* after this method is called (to supply the initial network
- * configuarion) and then later every time network configuration
+ * configuration) and then later every time network configuration
* changes. Notifications are stopped when the returned resource is
* destroyed. If the plugin doesn't have access to the network list
* then the callback will be called once with the
diff --git a/ppapi/c/private/ppb_pdf.h b/ppapi/c/private/ppb_pdf.h
index e9a6d78..2e2e73b 100644
--- a/ppapi/c/private/ppb_pdf.h
+++ b/ppapi/c/private/ppb_pdf.h
@@ -69,11 +69,13 @@
PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_END_HOVER = 41,
PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_END_PRESSED = 42,
PP_RESOURCEIMAGE_PDF_PAN_SCROLL_ICON = 43,
- PP_RESOURCEIMAGE_PDF_PAGE_INDICATOR_BACKGROUND = 44
+ PP_RESOURCEIMAGE_PDF_PAGE_INDICATOR_BACKGROUND = 44,
+ PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_DISABLED = 45
} PP_ResourceImage;
typedef enum {
- PP_PDFFEATURE_HIDPI = 0
+ PP_PDFFEATURE_HIDPI = 0,
+ PP_PDFFEATURE_PRINTING = 1
} PP_PDFFeature;
struct PP_PrivateFontFileDescription {
@@ -102,7 +104,7 @@
// Currently Linux-only.
PP_Resource (*GetFontFileWithFallback)(
PP_Instance instance,
- const struct PP_FontDescription_Dev* description,
+ const struct PP_BrowserFont_Trusted_Description* description,
PP_PrivateFontCharset charset);
// Given a resource previously returned by GetFontFileWithFallback, returns
diff --git a/ppapi/c/private/ppb_tcp_server_socket_private.h b/ppapi/c/private/ppb_tcp_server_socket_private.h
index 8355b15..f019519 100644
--- a/ppapi/c/private/ppb_tcp_server_socket_private.h
+++ b/ppapi/c/private/ppb_tcp_server_socket_private.h
@@ -4,7 +4,7 @@
*/
/* From private/ppb_tcp_server_socket_private.idl,
- * modified Tue Feb 14 12:24:48 2012.
+ * modified Thu Mar 28 10:31:11 2013.
*/
#ifndef PPAPI_C_PRIVATE_PPB_TCP_SERVER_SOCKET_PRIVATE_H_
@@ -65,7 +65,7 @@
* PPB_TCPSocket_Private and stores reference to it in
* |tcp_socket|. |callback| is invoked when connection is accepted
* or in the case of failure. This method can be called only after
- * succesfull Listen call on |tcp_server_socket|.
+ * successful Listen call on |tcp_server_socket|.
*/
int32_t (*Accept)(PP_Resource tcp_server_socket,
PP_Resource* tcp_socket,
diff --git a/ppapi/c/private/ppb_video_destination_private.h b/ppapi/c/private/ppb_video_destination_private.h
new file mode 100644
index 0000000..775ec96
--- /dev/null
+++ b/ppapi/c/private/ppb_video_destination_private.h
@@ -0,0 +1,122 @@
+/* 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.
+ */
+
+/* From private/ppb_video_destination_private.idl,
+ * modified Thu Apr 25 11:51:30 2013.
+ */
+
+#ifndef PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_
+#define PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_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_resource.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_time.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
+
+#define PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1 \
+ "PPB_VideoDestination_Private;0.1"
+#define PPB_VIDEODESTINATION_PRIVATE_INTERFACE \
+ PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_VideoDestination_Private</code> interface
+ * for a video destination resource, which sends video frames to a MediaStream
+ * video track in the browser.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * The <code>PPB_VideoDestination_Private</code> interface contains pointers to
+ * several functions for creating video destination resources and using them to
+ * send video frames to a MediaStream video track in the browser.
+ */
+struct PPB_VideoDestination_Private_0_1 {
+ /**
+ * Creates a video destination resource.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying an instance of
+ * a module.
+ *
+ * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
+ * failure. Failure means the instance was invalid.
+ */
+ PP_Resource (*Create)(PP_Instance instance);
+ /**
+ * Determines if a resource is a video destination resource.
+ *
+ * @param[in] resource The <code>PP_Resource</code> to test.
+ *
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
+ * resource is a video destination resource or <code>PP_FALSE</code>
+ * otherwise.
+ */
+ PP_Bool (*IsVideoDestination)(PP_Resource resource);
+ /**
+ * Opens a video destination for putting frames.
+ *
+ * @param[in] destination A <code>PP_Resource</code> corresponding to a video
+ * destination resource.
+ * @param[in] stream_url A <code>PP_Var</code> string holding a URL
+ * identifying a MediaStream.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Open().
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
+ * destination.
+ * Returns PP_ERROR_INPROGRESS if destination is already open.
+ * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
+ * some other browser error.
+ */
+ int32_t (*Open)(PP_Resource destination,
+ struct PP_Var stream_url,
+ struct PP_CompletionCallback callback);
+ /**
+ * Puts a frame to the video destination.
+ *
+ * After this call, you should take care to release your references to the
+ * image embedded in the video frame. If you paint to the image after
+ * PutFame(), there is the possibility of artifacts because the browser may
+ * still be copying the frame to the stream.
+ *
+ * @param[in] destination A <code>PP_Resource</code> corresponding to a video
+ * destination resource.
+ * @param[in] frame A <code>PP_VideoFrame_Private</code> holding the video
+ * frame to send to the destination.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
+ * destination.
+ * Returns PP_ERROR_FAILED if destination is not open, if the video frame has
+ * an invalid image data resource, or if some other browser error occurs.
+ */
+ int32_t (*PutFrame)(PP_Resource destination,
+ const struct PP_VideoFrame_Private* frame);
+ /**
+ * Closes the video destination.
+ *
+ * @param[in] destination A <code>PP_Resource</code> corresponding to a video
+ * destination.
+ */
+ void (*Close)(PP_Resource destination);
+};
+
+typedef struct PPB_VideoDestination_Private_0_1 PPB_VideoDestination_Private;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ */
+
diff --git a/ppapi/c/private/ppb_video_source_private.h b/ppapi/c/private/ppb_video_source_private.h
new file mode 100644
index 0000000..a3ba071
--- /dev/null
+++ b/ppapi/c/private/ppb_video_source_private.h
@@ -0,0 +1,117 @@
+/* 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.
+ */
+
+/* From private/ppb_video_source_private.idl,
+ * modified Thu Apr 25 11:51:30 2013.
+ */
+
+#ifndef PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_
+#define PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_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_resource.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_time.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
+
+#define PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1 "PPB_VideoSource_Private;0.1"
+#define PPB_VIDEOSOURCE_PRIVATE_INTERFACE PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_VideoSource_Private</code> interface for a
+ * video source resource, which receives video frames from a MediaStream video
+ * track in the browser.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * The <code>PPB_VideoSource_Private</code> interface contains pointers to
+ * several functions for creating video source resources and using them to
+ * receive video frames from a MediaStream video track in the browser.
+ */
+struct PPB_VideoSource_Private_0_1 {
+ /**
+ * Creates a video source resource.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying an instance of
+ * a module.
+ *
+ * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
+ * failure. Failure means the instance was invalid.
+ */
+ PP_Resource (*Create)(PP_Instance instance);
+ /**
+ * Determines if a resource is a video source resource.
+ *
+ * @param[in] resource The <code>PP_Resource</code> to test.
+ *
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
+ * resource is a video source resource or <code>PP_FALSE</code> otherwise.
+ */
+ PP_Bool (*IsVideoSource)(PP_Resource resource);
+ /**
+ * Opens a video source for getting frames.
+ *
+ * @param[in] source A <code>PP_Resource</code> corresponding to a video
+ * source resource.
+ * @param[in] stream_url A <code>PP_Var</code> string holding a URL
+ * identifying a MediaStream.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Open().
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
+ * Returns PP_ERROR_INPROGRESS if source is already open.
+ * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
+ * some other browser error.
+ */
+ int32_t (*Open)(PP_Resource source,
+ struct PP_Var stream_url,
+ struct PP_CompletionCallback callback);
+ /**
+ * Gets a frame from the video source.
+ * The image data resource inside the returned frame will have its reference
+ * count incremented by one and must be managed by the plugin.
+ *
+ * @param[in] source A <code>PP_Resource</code> corresponding to a video
+ * source resource.
+ * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video
+ * frame from the source.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of GetNextFrame().
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
+ * Returns PP_ERROR_FAILED if the source is not open, or if some other
+ * browser error occurs.
+ */
+ int32_t (*GetFrame)(PP_Resource source,
+ struct PP_VideoFrame_Private* frame,
+ struct PP_CompletionCallback callback);
+ /**
+ * Closes the video source.
+ *
+ * @param[in] source A <code>PP_Resource</code> corresponding to a video
+ * source resource.
+ */
+ void (*Close)(PP_Resource source);
+};
+
+typedef struct PPB_VideoSource_Private_0_1 PPB_VideoSource_Private;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ */
+
diff --git a/ppapi/c/private/ppp_flash_browser_operations.h b/ppapi/c/private/ppp_flash_browser_operations.h
index 12d1c86..301b74c 100644
--- a/ppapi/c/private/ppp_flash_browser_operations.h
+++ b/ppapi/c/private/ppp_flash_browser_operations.h
@@ -4,7 +4,7 @@
*/
/* From private/ppp_flash_browser_operations.idl,
- * modified Wed Jul 25 16:53:17 2012.
+ * modified Thu Mar 28 10:23:11 2013.
*/
#ifndef PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_
@@ -181,7 +181,7 @@
* @param[in] plugin_data_path String containing the directory where the
* plugin data is stored.
* @param[out] sites A NULL-terminated array of sites that have stored data.
- * Use FreeSiteList on the the array when done.
+ * Use FreeSiteList on the array when done.
*
* See also the NPP_GetSitesWithData function in NPAPI:
* https://wiki.mozilla.org/NPAPI:ClearSiteData
diff --git a/ppapi/c/private/ppp_instance_private.h b/ppapi/c/private/ppp_instance_private.h
index aa439a0..15d80c5 100644
--- a/ppapi/c/private/ppp_instance_private.h
+++ b/ppapi/c/private/ppp_instance_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppp_instance_private.idl modified Tue Oct 2 13:42:46 2012. */
+/* From private/ppp_instance_private.idl modified Thu Mar 28 10:22:54 2013. */
#ifndef PPAPI_C_PRIVATE_PPP_INSTANCE_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPP_INSTANCE_PRIVATE_H_
@@ -45,7 +45,7 @@
* The returned PP_Var should have a reference added for the caller, which
* will be responsible for Release()ing that reference.
*
- * @param[in] instance A PP_Instance indentifying the instance from which the
+ * @param[in] instance A PP_Instance identifying the instance from which the
* instance object is being requested.
* @return A PP_Var containing scriptable object.
*/
diff --git a/ppapi/c/trusted/ppb_browser_font_trusted.h b/ppapi/c/trusted/ppb_browser_font_trusted.h
index c16a153..bb626a7 100644
--- a/ppapi/c/trusted/ppb_browser_font_trusted.h
+++ b/ppapi/c/trusted/ppb_browser_font_trusted.h
@@ -4,7 +4,7 @@
*/
/* From trusted/ppb_browser_font_trusted.idl,
- * modified Wed Jun 27 14:43:20 2012.
+ * modified Thu Mar 28 10:14:27 2013.
*/
#ifndef PPAPI_C_TRUSTED_PPB_BROWSER_FONT_TRUSTED_H_
@@ -221,7 +221,7 @@
* clipped to the image.
*
* The image_data_is_opaque flag indicates whether subpixel antialiasing can
- * be performend, if it is supported. When the image below the text is
+ * be performed, if it is supported. When the image below the text is
* opaque, subpixel antialiasing is supported and you should set this to
* PP_TRUE to pick up the user's default preferences. If your plugin is
* partially transparent, then subpixel antialiasing is not possible and
diff --git a/ppapi/c/trusted/ppb_file_io_trusted.h b/ppapi/c/trusted/ppb_file_io_trusted.h
index 53953fb..8e05589 100644
--- a/ppapi/c/trusted/ppb_file_io_trusted.h
+++ b/ppapi/c/trusted/ppb_file_io_trusted.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From trusted/ppb_file_io_trusted.idl modified Wed Oct 5 14:06:02 2011. */
+/* From trusted/ppb_file_io_trusted.idl modified Wed Mar 27 14:50:12 2013. */
#ifndef PPAPI_C_TRUSTED_PPB_FILE_IO_TRUSTED_H_
#define PPAPI_C_TRUSTED_PPB_FILE_IO_TRUSTED_H_
@@ -35,6 +35,8 @@
* descriptor. The FileIO object must have been opened with a successful
* call to FileIO::Open. The file descriptor will be closed automatically
* when the FileIO object is closed or destroyed.
+ *
+ * TODO(hamaji): Remove this and use RequestOSFileHandle instead.
*/
int32_t (*GetOSFileDescriptor)(PP_Resource file_io);
/**
diff --git a/ppapi/cpp/array_output.h b/ppapi/cpp/array_output.h
index 3a52190..fe0bbc3 100644
--- a/ppapi/cpp/array_output.h
+++ b/ppapi/cpp/array_output.h
@@ -7,10 +7,8 @@
#include <vector>
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
#include "ppapi/c/pp_array_output.h"
#include "ppapi/c/pp_resource.h"
-#include "ppapi/cpp/dev/directory_entry_dev.h"
#include "ppapi/cpp/logging.h"
#include "ppapi/cpp/pass_ref.h"
#include "ppapi/cpp/var.h"
@@ -269,47 +267,6 @@
std::vector<T> output_storage_;
};
-class DirectoryEntryArrayOutputAdapterWithStorage
- : public ArrayOutputAdapter<PP_DirectoryEntry_Dev> {
- public:
- DirectoryEntryArrayOutputAdapterWithStorage() {
- set_output(&temp_storage_);
- };
-
- virtual ~DirectoryEntryArrayOutputAdapterWithStorage() {
- if (!temp_storage_.empty()) {
- // An easy way to release the resource references held by |temp_storage_|.
- // A destructor for PP_DirectoryEntry_Dev will release them.
- output();
- }
- };
-
- // Returns the final array of resource objects, converting the
- // PP_DirectoryEntry_Dev written by the browser to pp::DirectoryEntry_Dev
- // objects.
- //
- // This function should only be called once or we would end up converting
- // the array more than once, which would mess up the refcounting.
- std::vector<pp::DirectoryEntry_Dev>& output() {
- PP_DCHECK(output_storage_.empty());
- typedef std::vector<PP_DirectoryEntry_Dev> Entries;
- for (Entries::iterator it = temp_storage_.begin();
- it != temp_storage_.end(); ++it)
- output_storage_.push_back(DirectoryEntry_Dev(PASS_REF, *it));
- temp_storage_.clear();
- return output_storage_;
- }
-
- private:
- // The browser will write the PP_DirectoryEntry_Devs into this array.
- std::vector<PP_DirectoryEntry_Dev> temp_storage_;
-
- // When asked for the output, the PP_DirectoryEntry_Devs above will be
- // converted to the pp::DirectoryEntry_Devs in this array for passing to the
- // calling code.
- std::vector<pp::DirectoryEntry_Dev> output_storage_;
-};
-
} // namespace pp
#endif // PPAPI_CPP_ARRAY_OUTPUT_H_
diff --git a/ppapi/cpp/audio_config.h b/ppapi/cpp/audio_config.h
index 8ece912..e7ade54 100644
--- a/ppapi/cpp/audio_config.h
+++ b/ppapi/cpp/audio_config.h
@@ -100,7 +100,7 @@
/// @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either
/// <code>PP_AUDIOSAMPLERATE_44100</code> or
/// <code>PP_AUDIOSAMPLERATE_48000</code>.
- /// @param[in] requested_sample_frame_count A uint_32t requested frame count.
+ /// @param[in] requested_sample_frame_count A uint32_t requested frame count.
///
/// @return A uint32_t containing the recommended sample frame count if
/// successful. If the sample frame count or bit rate is not supported,
diff --git a/ppapi/cpp/completion_callback.h b/ppapi/cpp/completion_callback.h
index ec892f6..cdd8b06 100644
--- a/ppapi/cpp/completion_callback.h
+++ b/ppapi/cpp/completion_callback.h
@@ -7,19 +7,15 @@
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/extensions/ext_output_traits.h"
#include "ppapi/cpp/logging.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/output_traits.h"
-struct PP_ArrayOutput;
-
/// @file
/// This file defines the API to create and run a callback.
namespace pp {
-template<typename T> class AsyncArrayOutputAdapter;
-template<typename T> class AsyncResourceArrayOutputAdapter;
-
/// This API enables you to implement and receive callbacks when
/// Pepper operations complete asynchronously.
///
@@ -159,6 +155,50 @@
PP_CompletionCallback cc_;
};
+namespace internal {
+
+/// The base class of [Ext]CompletionCallbackWithOutput.
+///
+/// The template parameter Traits determines the storage type
+/// (OutputStorageType), the output parameter type used by the browser
+/// (APIArgType), and how to map OutputStorageType to APIArgType.
+template <typename T, typename Traits>
+class CompletionCallbackWithOutputBase : public CompletionCallback {
+ public:
+ typedef typename Traits::StorageType OutputStorageType;
+ typedef typename Traits::APIArgType APIArgType;
+ typedef Traits TraitsType;
+
+ explicit CompletionCallbackWithOutputBase(OutputStorageType* output)
+ : CompletionCallback(),
+ output_(output) {
+ }
+
+ CompletionCallbackWithOutputBase(PP_CompletionCallback_Func func,
+ void* user_data,
+ OutputStorageType* output)
+ : CompletionCallback(func, user_data),
+ output_(output) {
+ }
+
+ CompletionCallbackWithOutputBase(PP_CompletionCallback_Func func,
+ void* user_data,
+ int32_t flags,
+ OutputStorageType* output)
+ : CompletionCallback(func, user_data, flags),
+ output_(output) {
+ }
+
+ APIArgType output() const {
+ return Traits::StorageToAPIArg(*output_);
+ }
+
+ private:
+ OutputStorageType* output_;
+};
+
+} // namespace internal
+
/// A CompletionCallbackWithOutput defines a completion callback that
/// additionally stores a pointer to some output data. Some C++ wrappers
/// take a CompletionCallbackWithOutput when the browser is returning a
@@ -175,36 +215,37 @@
/// it just stores a pointer to it. C++ wrapper objects that accept a
/// CompletionCallbackWithOutput will retrieve this pointer and pass it to
/// the browser as the output parameter.
-template<typename T>
-class CompletionCallbackWithOutput : public CompletionCallback {
+template <typename T>
+class CompletionCallbackWithOutput
+ : public internal::CompletionCallbackWithOutputBase<
+ T, internal::CallbackOutputTraits<T> > {
public:
- /// The type that will actually be stored in the completion callback. In the
- /// common case, this will be equal to the template parameter (for example,
- /// CompletionCallbackWithOutput<int> would obviously take an int*. However,
- /// resources are passed as PP_Resource, vars as PP_Var, and arrays as our
- /// special ArrayOutputAdapter object. The CallbackOutputTraits defines
- /// specializations for all of these cases.
- typedef typename internal::CallbackOutputTraits<T>::StorageType
- OutputStorageType;
- typedef typename internal::CallbackOutputTraits<T>::APIArgType
- APIArgType;
+ typedef internal::CompletionCallbackWithOutputBase<
+ T, internal::CallbackOutputTraits<T> > BaseType;
/// The default constructor will create a blocking
- /// <code>CompletionCallback</code> that references the given output
+ /// <code>CompletionCallbackWithOutput</code> that references the given output
/// data.
///
/// @param[in] output A pointer to the data associated with the callback. The
/// caller must ensure that this pointer outlives the completion callback.
+ /// In the common case, <code>OutputStorageType</code> will be equal to the
+ /// template parameter T (for example,
+ /// <code>CompletionCallbackWithOutput<int></code> would obviously take an
+ /// int*. However, resources are passed as PP_Resource, vars as PP_Var, and
+ /// arrays as our special ArrayOutputAdapter object.
+ /// <code>internal::CallbackOutputTraits</code> defines specializations for
+ /// all of these cases.
///
/// <strong>Note:</strong> Blocking completion callbacks are only allowed from
- /// from background threads.
- CompletionCallbackWithOutput(OutputStorageType* output)
- : CompletionCallback(),
- output_(output) {
+ /// background threads.
+ explicit CompletionCallbackWithOutput(
+ typename BaseType::OutputStorageType* output)
+ : BaseType(output) {
}
- /// A constructor for creating a <code>CompletionCallback</code> that
- /// references the given output data.
+ /// A constructor for creating a <code>CompletionCallbackWithOutput</code>
+ /// that references the given output data.
///
/// @param[in] func The function to be called on completion.
/// @param[in] user_data The user data to be passed to the callback function.
@@ -214,13 +255,12 @@
/// caller must ensure that this pointer outlives the completion callback.
CompletionCallbackWithOutput(PP_CompletionCallback_Func func,
void* user_data,
- OutputStorageType* output)
- : CompletionCallback(func, user_data),
- output_(output) {
+ typename BaseType::OutputStorageType* output)
+ : BaseType(func, user_data, output) {
}
- /// A constructor for creating a <code>CompletionCallback</code> that
- /// references the given output data.
+ /// A constructor for creating a <code>CompletionCallbackWithOutput</code>
+ /// that references the given output data.
///
/// @param[in] func The function to be called on completion.
///
@@ -237,19 +277,82 @@
CompletionCallbackWithOutput(PP_CompletionCallback_Func func,
void* user_data,
int32_t flags,
- OutputStorageType* output)
- : CompletionCallback(func, user_data, flags),
- output_(output) {
+ typename BaseType::OutputStorageType* output)
+ : BaseType(func, user_data, flags, output) {
}
-
- APIArgType output() const {
- return internal::CallbackOutputTraits<T>::StorageToAPIArg(*output_);
- }
-
- private:
- OutputStorageType* output_;
};
+namespace ext {
+
+/// ExtCompletionCallbackWithOutput is similar to CompletionCallbackWithOutput,
+/// but used by APIs within the pp::ext namespace. Usually it is used with the
+/// CompletionCallbackFactory's NewExtCallbackWithOutput.
+template <typename T>
+class ExtCompletionCallbackWithOutput
+ : public ::pp::internal::CompletionCallbackWithOutputBase<
+ T, internal::ExtCallbackOutputTraits<T> > {
+ public:
+ typedef ::pp::internal::CompletionCallbackWithOutputBase<
+ T, internal::ExtCallbackOutputTraits<T> > BaseType;
+
+ /// The default constructor will create a blocking
+ /// <code>ExtCompletionCallbackWithOutput</code> that references the given
+ /// output data.
+ ///
+ /// @param[in] output A pointer to the data associated with the callback. The
+ /// caller must ensure that this pointer outlives the completion callback.
+ /// <code>OutputStorageType</code> is either
+ /// <code>ext::internal::ArrayVarOutputAdapterWithStorage<U></code> (if the
+ /// template parameter T is of the form std::vector<U>) or
+ /// <code>ext::internal::VarOutputAdapterWithStorage<T></code> (otherwise).
+ ///
+ /// <strong>Note:</strong> Blocking completion callbacks are only allowed from
+ /// background threads.
+ explicit ExtCompletionCallbackWithOutput(
+ typename BaseType::OutputStorageType* output)
+ : BaseType(output) {
+ }
+
+ /// A constructor for creating an <code>ExtCompletionCallbackWithOutput</code>
+ /// that references the given output data.
+ ///
+ /// @param[in] func The function to be called on completion.
+ /// @param[in] user_data The user data to be passed to the callback function.
+ /// This is optional and is typically used to help track state in case of
+ /// multiple pending callbacks.
+ /// @param[in] output A pointer to the data associated with the callback. The
+ /// caller must ensure that this pointer outlives the completion callback.
+ ExtCompletionCallbackWithOutput(PP_CompletionCallback_Func func,
+ void* user_data,
+ typename BaseType::OutputStorageType* output)
+ : BaseType(func, user_data, output) {
+ }
+
+ /// A constructor for creating an <code>ExtCompletionCallbackWithOutput</code>
+ /// that references the given output data.
+ ///
+ /// @param[in] func The function to be called on completion.
+ ///
+ /// @param[in] user_data The user data to be passed to the callback function.
+ /// This is optional and is typically used to help track state in case of
+ /// multiple pending callbacks.
+ ///
+ /// @param[in] flags Bit field combination of
+ /// <code>PP_CompletionCallback_Flag</code> flags used to control how
+ /// non-NULL callbacks are scheduled by asynchronous methods.
+ ///
+ /// @param[in] output A pointer to the data associated with the callback. The
+ /// caller must ensure that this pointer outlives the completion callback.
+ ExtCompletionCallbackWithOutput(PP_CompletionCallback_Func func,
+ void* user_data,
+ int32_t flags,
+ typename BaseType::OutputStorageType* output)
+ : BaseType(func, user_data, flags, output) {
+ }
+};
+
+} // namespace ext
+
/// BlockUntilComplete() is used in place of an actual completion callback
/// to request blocking behavior. If specified, the calling thread will block
/// until the function completes. Blocking completion callbacks are only
diff --git a/ppapi/cpp/dev/directory_entry_dev.cc b/ppapi/cpp/dev/directory_entry_dev.cc
deleted file mode 100644
index bef42c3..0000000
--- a/ppapi/cpp/dev/directory_entry_dev.cc
+++ /dev/null
@@ -1,45 +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 "ppapi/cpp/dev/directory_entry_dev.h"
-
-#include <string.h>
-
-#include "ppapi/cpp/module.h"
-
-namespace pp {
-
-DirectoryEntry_Dev::DirectoryEntry_Dev() {
- memset(&data_, 0, sizeof(data_));
-}
-
-DirectoryEntry_Dev::DirectoryEntry_Dev(
- PassRef, const PP_DirectoryEntry_Dev& data) {
- data_.file_ref = data.file_ref;
- data_.file_type = data.file_type;
-}
-
-DirectoryEntry_Dev::DirectoryEntry_Dev(const DirectoryEntry_Dev& other) {
- data_.file_ref = other.data_.file_ref;
- data_.file_type = other.data_.file_type;
- if (data_.file_ref)
- Module::Get()->core()->AddRefResource(data_.file_ref);
-}
-
-DirectoryEntry_Dev::~DirectoryEntry_Dev() {
- if (data_.file_ref)
- Module::Get()->core()->ReleaseResource(data_.file_ref);
-}
-
-DirectoryEntry_Dev& DirectoryEntry_Dev::operator=(
- const DirectoryEntry_Dev& other) {
- if (data_.file_ref)
- Module::Get()->core()->ReleaseResource(data_.file_ref);
- data_ = other.data_;
- if (data_.file_ref)
- Module::Get()->core()->AddRefResource(data_.file_ref);
- return *this;
-}
-
-} // namespace pp
diff --git a/ppapi/cpp/dev/directory_entry_dev.h b/ppapi/cpp/dev/directory_entry_dev.h
deleted file mode 100644
index 9866213..0000000
--- a/ppapi/cpp/dev/directory_entry_dev.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2011 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_DIRECTORY_ENTRY_DEV_H_
-#define PPAPI_CPP_DEV_DIRECTORY_ENTRY_DEV_H_
-
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
-#include "ppapi/cpp/file_ref.h"
-
-namespace pp {
-
-class DirectoryEntry_Dev {
- public:
- DirectoryEntry_Dev();
- DirectoryEntry_Dev(PassRef, const PP_DirectoryEntry_Dev& data);
- DirectoryEntry_Dev(const DirectoryEntry_Dev& other);
-
- ~DirectoryEntry_Dev();
-
- DirectoryEntry_Dev& operator=(const DirectoryEntry_Dev& other);
-
- // Returns true if the DirectoryEntry is invalid or uninitialized.
- bool is_null() const { return !data_.file_ref; }
-
- // Returns the FileRef held by this DirectoryEntry.
- FileRef file_ref() const { return FileRef(data_.file_ref); }
-
- // Returns the type of the file referenced by this DirectoryEntry.
- PP_FileType file_type() const { return data_.file_type; }
-
- private:
- PP_DirectoryEntry_Dev data_;
-};
-
-} // namespace pp
-
-#endif // PPAPI_CPP_DEV_DIRECTORY_ENTRY_DEV_H_
diff --git a/ppapi/cpp/dev/directory_reader_dev.cc b/ppapi/cpp/dev/directory_reader_dev.cc
deleted file mode 100644
index aebdca5..0000000
--- a/ppapi/cpp/dev/directory_reader_dev.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2011 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/directory_reader_dev.h"
-
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/cpp/dev/directory_entry_dev.h"
-#include "ppapi/cpp/file_ref.h"
-#include "ppapi/cpp/module.h"
-#include "ppapi/cpp/module_impl.h"
-
-namespace pp {
-
-namespace {
-
-template <> const char* interface_name<PPB_DirectoryReader_Dev_0_6>() {
- return PPB_DIRECTORYREADER_DEV_INTERFACE_0_6;
-}
-
-} // namespace
-
-DirectoryReader_Dev::DirectoryReader_Dev(const FileRef& directory_ref) {
- if (!has_interface<PPB_DirectoryReader_Dev_0_6>())
- return;
- PassRefFromConstructor(get_interface<PPB_DirectoryReader_Dev_0_6>()->Create(
- directory_ref.pp_resource()));
-}
-
-DirectoryReader_Dev::DirectoryReader_Dev(const DirectoryReader_Dev& other)
- : Resource(other) {
-}
-
-int32_t DirectoryReader_Dev::ReadEntries(
- const CompletionCallbackWithOutput< std::vector<DirectoryEntry_Dev> >&
- callback) {
- if (!has_interface<PPB_DirectoryReader_Dev_0_6>())
- return callback.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_DirectoryReader_Dev_0_6>()->ReadEntries(
- pp_resource(), callback.output(), callback.pp_completion_callback());
-}
-
-} // namespace pp
diff --git a/ppapi/cpp/dev/directory_reader_dev.h b/ppapi/cpp/dev/directory_reader_dev.h
deleted file mode 100644
index cd2ce78..0000000
--- a/ppapi/cpp/dev/directory_reader_dev.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2011 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_DIRECTORY_READER_DEV_H_
-#define PPAPI_CPP_DEV_DIRECTORY_READER_DEV_H_
-
-#include <vector>
-
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
-#include "ppapi/cpp/resource.h"
-
-namespace pp {
-
-class DirectoryEntry_Dev;
-class FileRef;
-template<typename T> class CompletionCallbackWithOutput;
-
-class DirectoryReader_Dev : public Resource {
- public:
- /// A constructor that creates a DirectoryReader resource for the given
- /// directory.
- ///
- /// @param[in] directory_ref A <code>PP_Resource</code> corresponding to the
- /// directory reference to be read.
- explicit DirectoryReader_Dev(const FileRef& directory_ref);
-
- DirectoryReader_Dev(const DirectoryReader_Dev& other);
-
- /// ReadEntries() Reads all entries in the directory.
- ///
- /// @param[in] cc A <code>CompletionCallbackWithOutput</code> to be called
- /// upon completion of ReadEntries(). On success, the directory entries will
- /// be passed to the given function.
- ///
- /// Normally you would use a CompletionCallbackFactory to allow callbacks to
- /// be bound to your class. See completion_callback_factory.h for more
- /// discussion on how to use this. Your callback will generally look like:
- ///
- /// @code
- /// void OnReadEntries(int32_t result,
- /// const std::vector<DirectoryEntry_Dev>& entries) {
- /// if (result == PP_OK)
- /// // use entries...
- /// }
- /// @endcode
- ///
- /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
- int32_t ReadEntries(
- const CompletionCallbackWithOutput< std::vector<DirectoryEntry_Dev> >&
- callback);
-};
-
-} // namespace pp
-
-#endif // PPAPI_CPP_DIRECTORY_READER_H_
diff --git a/ppapi/cpp/dev/file_chooser_dev.h b/ppapi/cpp/dev/file_chooser_dev.h
index 4feee6a..3d5ee00 100644
--- a/ppapi/cpp/dev/file_chooser_dev.h
+++ b/ppapi/cpp/dev/file_chooser_dev.h
@@ -34,7 +34,7 @@
/// (PP_FILECHOOSERMODE_OPENMULTIPLE). Unlike the HTML5 <input type="file">
/// tag, a PPB_FileChooser_Dev instance cannot be used to select a directory.
/// In order to get the list of files in a directory, the
- /// PPB_DirectoryReader_Dev interface must be used.
+ /// PPB_FileRef::ReadDirectoryEntries interface must be used.
///
/// @param accept_types A comma-separated list of MIME types and file
/// extensions such as "audio/ *,text/plain,.html" (note there should be
@@ -86,7 +86,7 @@
PP_CompletionCallback original_callback;
};
- // Provide backwards-compatability for older versions. Converts the old-style
+ // Provide backwards-compatibility for older versions. Converts the old-style
// 0.5 "iterator" interface to the new-style 0.6 "array output" interface that
// the caller is expecting.
//
diff --git a/ppapi/cpp/dev/printing_dev.cc b/ppapi/cpp/dev/printing_dev.cc
index 8e07194..60154cd 100644
--- a/ppapi/cpp/dev/printing_dev.cc
+++ b/ppapi/cpp/dev/printing_dev.cc
@@ -20,10 +20,6 @@
return PPB_PRINTING_DEV_INTERFACE_0_7;
}
-template <> const char* interface_name<PPB_Printing_Dev_0_6>() {
- return PPB_PRINTING_DEV_INTERFACE_0_6;
-}
-
uint32_t QuerySupportedFormats(PP_Instance instance) {
void* object =
Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
@@ -97,9 +93,7 @@
// static
bool Printing_Dev::IsAvailable() {
- return has_interface<PPB_Printing_Dev_0_7>() ||
- has_interface<PPB_Printing_Dev_0_6>();
-
+ return has_interface<PPB_Printing_Dev_0_7>();
}
int32_t Printing_Dev::GetDefaultPrintSettings(
@@ -107,11 +101,6 @@
if (has_interface<PPB_Printing_Dev_0_7>()) {
return get_interface<PPB_Printing_Dev_0_7>()->GetDefaultPrintSettings(
pp_resource(), callback.output(), callback.pp_completion_callback());
- } else if (has_interface<PPB_Printing_Dev_0_6>()) {
- bool success = PP_ToBool(get_interface<PPB_Printing_Dev_0_6>()->
- GetDefaultPrintSettings(associated_instance_.pp_instance(),
- callback.output()));
- return callback.MayForce(success ? PP_OK : PP_ERROR_FAILED);
}
return callback.MayForce(PP_ERROR_NOINTERFACE);
}
diff --git a/ppapi/cpp/dev/scriptable_object_deprecated.cc b/ppapi/cpp/dev/scriptable_object_deprecated.cc
index 449e760..1b701cb 100644
--- a/ppapi/cpp/dev/scriptable_object_deprecated.cc
+++ b/ppapi/cpp/dev/scriptable_object_deprecated.cc
@@ -178,7 +178,7 @@
Var ScriptableObject::Construct(const std::vector<Var>& /*args*/,
Var* exception) {
- *exception = Var("Constuct method does not exist in ScriptableObject");
+ *exception = Var("Construct method does not exist in ScriptableObject");
return Var();
}
diff --git a/ppapi/cpp/dev/scriptable_object_deprecated.h b/ppapi/cpp/dev/scriptable_object_deprecated.h
index 3099977..7423d23 100644
--- a/ppapi/cpp/dev/scriptable_object_deprecated.h
+++ b/ppapi/cpp/dev/scriptable_object_deprecated.h
@@ -80,7 +80,7 @@
friend class ::pp::VarPrivate;
static const PPP_Class_Deprecated* GetClass();
- // Unimplemented, copy and assigmnent is not allowed.
+ // Unimplemented, copy and assignment is not allowed.
ScriptableObject(const ScriptableObject& other);
ScriptableObject& operator=(const ScriptableObject& other);
};
diff --git a/ppapi/cpp/dev/text_input_dev.cc b/ppapi/cpp/dev/text_input_dev.cc
index 3b38df8..657a0b3 100644
--- a/ppapi/cpp/dev/text_input_dev.cc
+++ b/ppapi/cpp/dev/text_input_dev.cc
@@ -54,7 +54,7 @@
void TextInput_Dev::RequestSurroundingText(uint32_t) {
// Default implementation. Send a null range.
- UpdateSurroundingText("", 0, 0);
+ UpdateSurroundingText(std::string(), 0, 0);
}
void TextInput_Dev::SetTextInputType(PP_TextInput_Type type) {
diff --git a/ppapi/cpp/dev/truetype_font_dev.cc b/ppapi/cpp/dev/truetype_font_dev.cc
index 3de81fd..b10348a 100644
--- a/ppapi/cpp/dev/truetype_font_dev.cc
+++ b/ppapi/cpp/dev/truetype_font_dev.cc
@@ -4,7 +4,6 @@
#include "ppapi/cpp/dev/truetype_font_dev.h"
-#include <stdio.h>
#include <string.h> // memcpy
#include "ppapi/c/dev/ppb_truetype_font_dev.h"
@@ -41,7 +40,7 @@
PassRef,
const PP_TrueTypeFontDesc_Dev& pp_desc) {
desc_ = pp_desc;
- family_ = Var(PASS_REF, pp_desc.family);
+ set_family(Var(PASS_REF, pp_desc.family));
}
TrueTypeFontDesc_Dev::TrueTypeFontDesc_Dev(const TrueTypeFontDesc_Dev& other) {
@@ -61,12 +60,12 @@
if (this == &other)
return *this;
- desc_ = other.desc_;
- // Be careful about the refcount of the string, the assignment above doesn't
- // copy a ref. The assignments below take a ref to the new name and copy the
- // PP_Var into the wrapped descriptor.
- family_ = other.family();
- desc_.family = family_.pp_var();
+ set_family(other.family());
+ set_generic_family(other.generic_family());
+ set_style(other.style());
+ set_weight(other.weight());
+ set_width(other.width());
+ set_charset(other.charset());
return *this;
}
@@ -104,6 +103,21 @@
return cc.MayForce(PP_ERROR_NOINTERFACE);
}
+// static
+int32_t TrueTypeFont_Dev::GetFontsInFamily(
+ const InstanceHandle& instance,
+ const Var& family,
+ const CompletionCallbackWithOutput<std::vector<TrueTypeFontDesc_Dev> >& cc)
+ {
+ if (has_interface<PPB_TrueTypeFont_Dev_0_1>()) {
+ return get_interface<PPB_TrueTypeFont_Dev_0_1>()->GetFontsInFamily(
+ instance.pp_instance(),
+ family.pp_var(),
+ cc.output(), cc.pp_completion_callback());
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
int32_t TrueTypeFont_Dev::Describe(
const CompletionCallbackWithOutput<TrueTypeFontDesc_Dev>& cc) {
if (has_interface<PPB_TrueTypeFont_Dev_0_1>()) {
diff --git a/ppapi/cpp/dev/truetype_font_dev.h b/ppapi/cpp/dev/truetype_font_dev.h
index 124d3eb..cdaeade 100644
--- a/ppapi/cpp/dev/truetype_font_dev.h
+++ b/ppapi/cpp/dev/truetype_font_dev.h
@@ -27,14 +27,17 @@
/// Default constructor for creating a <code>TrueTypeFontDesc_Dev</code>
/// object.
TrueTypeFontDesc_Dev();
+
/// Constructor that takes an existing <code>PP_TrueTypeFontDesc_Dev</code>
/// structure. The 'family' PP_Var field in the structure will be managed by
/// this instance.
TrueTypeFontDesc_Dev(PassRef, const PP_TrueTypeFontDesc_Dev& pp_desc);
+
/// The copy constructor for <code>TrueTypeFontDesc_Dev</code>.
///
/// @param[in] other A reference to a <code>TrueTypeFontDesc_Dev</code>.
TrueTypeFontDesc_Dev(const TrueTypeFontDesc_Dev& other);
+
~TrueTypeFontDesc_Dev();
TrueTypeFontDesc_Dev& operator=(const TrueTypeFontDesc_Dev& other);
@@ -81,8 +84,6 @@
}
private:
- friend class TrueTypeFont_Dev;
-
pp::Var family_; // This manages the PP_Var embedded in desc_.
PP_TrueTypeFontDesc_Dev desc_;
};
@@ -125,7 +126,26 @@
/// code from <code>pp_errors.h</code>.
static int32_t GetFontFamilies(
const InstanceHandle& instance,
- const CompletionCallbackWithOutput<std::vector<Var> >& cc);
+ const CompletionCallbackWithOutput<std::vector<Var> >& callback);
+
+ /// Gets an array of TrueType font descriptors for a given font family. These
+ /// descriptors can be used to create a font in that family and matching the
+ /// descriptor attributes.
+ ///
+ /// @param[in] instance A <code>PP_Instance</code> requesting the font
+ /// descriptors.
+ /// @param[in] family A <code>Var</code> holding a string specifying the font
+ /// family.
+ /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
+ /// called upon completion of GetFontsInFamily.
+ ///
+ /// @return If >= 0, the number of font descriptors returned, otherwise an
+ /// error code from <code>pp_errors.h</code>.
+ static int32_t GetFontsInFamily(
+ const InstanceHandle& instance,
+ const Var& family,
+ const CompletionCallbackWithOutput<std::vector<TrueTypeFontDesc_Dev> >&
+ callback);
/// Returns a description of the given font resource. This description may
/// differ from the description passed to Create, reflecting the host's font
@@ -137,7 +157,7 @@
/// @return A return code from <code>pp_errors.h</code>. If an error code is
/// returned, the descriptor will be left unchanged.
int32_t Describe(
- const CompletionCallbackWithOutput<TrueTypeFontDesc_Dev>& cc);
+ const CompletionCallbackWithOutput<TrueTypeFontDesc_Dev>& callback);
/// Gets an array of identifying tags for each table in the font.
/// These tags can be used to request specific tables using GetTable.
@@ -148,7 +168,7 @@
/// @return If >= 0, the number of table tags returned, otherwise an error
/// code from <code>pp_errors.h</code>.
int32_t GetTableTags(
- const CompletionCallbackWithOutput<std::vector<uint32_t> >& cc);
+ const CompletionCallbackWithOutput<std::vector<uint32_t> >& callback);
/// Copies the given font table into client memory.
///
@@ -158,8 +178,6 @@
/// @param[in] offset The offset into the font table.
/// @param[in] max_data_length The maximum number of bytes to transfer from
/// <code>offset</code>.
- /// @param[in] output A <code>PP_ArrayOutput</code> to hold the font data.
- /// The data is an array of bytes.
/// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
/// called upon completion of GetTable.
///
@@ -169,17 +187,17 @@
uint32_t table,
int32_t offset,
int32_t max_data_length,
- const CompletionCallbackWithOutput<std::vector<char> >& cc);
+ const CompletionCallbackWithOutput<std::vector<char> >& callback);
};
namespace internal {
// A specialization of CallbackOutputTraits to provide the callback system the
-// information on how to handle pp::TrueTypeFontDesc_Dev. This converts
+ // information on how to handle pp::TrueTypeFontDesc_Dev. This converts
// PP_TrueTypeFontDesc_Dev to pp::TrueTypeFontDesc_Dev when passing to the
// plugin, and specifically manages the PP_Var embedded in the desc_ field.
template<>
-struct CallbackOutputTraits<pp::TrueTypeFontDesc_Dev> {
+struct CallbackOutputTraits<TrueTypeFontDesc_Dev> {
typedef PP_TrueTypeFontDesc_Dev* APIArgType;
typedef PP_TrueTypeFontDesc_Dev StorageType;
@@ -187,8 +205,55 @@
return &t;
}
- static inline pp::TrueTypeFontDesc_Dev StorageToPluginArg(StorageType& t) {
- return pp::TrueTypeFontDesc_Dev(PASS_REF, t);
+ static inline TrueTypeFontDesc_Dev StorageToPluginArg(StorageType& t) {
+ return TrueTypeFontDesc_Dev(PASS_REF, t);
+ }
+};
+
+class TrueTypeFontDescArrayOutputAdapterWithStorage
+ : public ArrayOutputAdapter<PP_TrueTypeFontDesc_Dev> {
+ public:
+ TrueTypeFontDescArrayOutputAdapterWithStorage() {
+ set_output(&temp_storage_);
+ };
+
+ virtual ~TrueTypeFontDescArrayOutputAdapterWithStorage() {
+ if (!temp_storage_.empty()) {
+ // An easy way to release the resource references held by |temp_storage_|.
+ output();
+ }
+ };
+
+ std::vector<TrueTypeFontDesc_Dev>& output() {
+ PP_DCHECK(output_storage_.empty());
+ typedef std::vector<PP_TrueTypeFontDesc_Dev> Entries;
+ for (Entries::iterator it = temp_storage_.begin();
+ it != temp_storage_.end(); ++it)
+ output_storage_.push_back(TrueTypeFontDesc_Dev(PASS_REF, *it));
+ temp_storage_.clear();
+ return output_storage_;
+ }
+
+ private:
+ std::vector<PP_TrueTypeFontDesc_Dev> temp_storage_;
+ std::vector<TrueTypeFontDesc_Dev> output_storage_;
+};
+
+// A specialization of CallbackOutputTraits to provide the callback system the
+// information on how to handle vectors of TrueTypeFontDesc_Dev. This converts
+// PP_TrueTypeFontDesc_Dev to TrueTypeFontDesc_Dev when passing to the plugin.
+template<>
+struct CallbackOutputTraits< std::vector<TrueTypeFontDesc_Dev> > {
+ typedef PP_ArrayOutput APIArgType;
+ typedef TrueTypeFontDescArrayOutputAdapterWithStorage StorageType;
+
+ static inline APIArgType StorageToAPIArg(StorageType& t) {
+ return t.pp_array_output();
+ }
+
+ static inline std::vector<TrueTypeFontDesc_Dev>& StorageToPluginArg(
+ StorageType& t) {
+ return t.output();
}
};
diff --git a/ppapi/cpp/dev/var_array_dev.h b/ppapi/cpp/dev/var_array_dev.h
index e790f97..17a3277 100644
--- a/ppapi/cpp/dev/var_array_dev.h
+++ b/ppapi/cpp/dev/var_array_dev.h
@@ -19,14 +19,14 @@
/// Constructs a new array var.
VarArray_Dev();
- /// Contructs a <code>VarArray_Dev</code> given a var for which is_array() is
+ /// Constructs a <code>VarArray_Dev</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);
- /// Contructs a <code>VarArray_Dev</code> given a <code>PP_Var</code> of type
+ /// Constructs a <code>VarArray_Dev</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.
diff --git a/ppapi/cpp/dev/var_dictionary_dev.h b/ppapi/cpp/dev/var_dictionary_dev.h
index 5934b81..2b2e79d 100644
--- a/ppapi/cpp/dev/var_dictionary_dev.h
+++ b/ppapi/cpp/dev/var_dictionary_dev.h
@@ -19,14 +19,14 @@
/// Constructs a new dictionary var.
VarDictionary_Dev();
- /// Contructs a <code>VarDictionary_Dev</code> given a var for which
+ /// Constructs a <code>VarDictionary_Dev</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);
- /// Contructs a <code>VarDictionary_Dev</code> given a <code>PP_Var</code>
+ /// Constructs a <code>VarDictionary_Dev</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.
diff --git a/ppapi/cpp/directory_entry.cc b/ppapi/cpp/directory_entry.cc
new file mode 100644
index 0000000..c8e2b9d
--- /dev/null
+++ b/ppapi/cpp/directory_entry.cc
@@ -0,0 +1,76 @@
+// 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 "ppapi/cpp/directory_entry.h"
+
+#include <string.h>
+
+#include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/module.h"
+
+namespace pp {
+
+DirectoryEntry::DirectoryEntry() {
+ memset(&data_, 0, sizeof(data_));
+}
+
+DirectoryEntry::DirectoryEntry(
+ PassRef, const PP_DirectoryEntry& data) {
+ data_.file_ref = data.file_ref;
+ data_.file_type = data.file_type;
+}
+
+DirectoryEntry::DirectoryEntry(const DirectoryEntry& other) {
+ data_.file_ref = other.data_.file_ref;
+ data_.file_type = other.data_.file_type;
+ if (data_.file_ref)
+ Module::Get()->core()->AddRefResource(data_.file_ref);
+}
+
+DirectoryEntry::~DirectoryEntry() {
+ if (data_.file_ref)
+ Module::Get()->core()->ReleaseResource(data_.file_ref);
+}
+
+DirectoryEntry& DirectoryEntry::operator=(
+ const DirectoryEntry& other) {
+ if (data_.file_ref)
+ Module::Get()->core()->ReleaseResource(data_.file_ref);
+ data_ = other.data_;
+ if (data_.file_ref)
+ Module::Get()->core()->AddRefResource(data_.file_ref);
+ return *this;
+}
+
+namespace internal {
+
+DirectoryEntryArrayOutputAdapterWithStorage::
+ DirectoryEntryArrayOutputAdapterWithStorage() {
+ set_output(&temp_storage_);
+}
+
+DirectoryEntryArrayOutputAdapterWithStorage::
+ ~DirectoryEntryArrayOutputAdapterWithStorage() {
+ if (!temp_storage_.empty()) {
+ // An easy way to release the resource references held by |temp_storage_|.
+ // A destructor for PP_DirectoryEntry will release them.
+ output();
+ }
+}
+
+std::vector<DirectoryEntry>&
+ DirectoryEntryArrayOutputAdapterWithStorage::output() {
+ PP_DCHECK(output_storage_.empty());
+ typedef std::vector<PP_DirectoryEntry> Entries;
+ for (Entries::iterator it = temp_storage_.begin();
+ it != temp_storage_.end();
+ ++it) {
+ output_storage_.push_back(DirectoryEntry(PASS_REF, *it));
+ }
+ temp_storage_.clear();
+ return output_storage_;
+}
+
+} // namespace internal
+} // namespace pp
diff --git a/ppapi/cpp/directory_entry.h b/ppapi/cpp/directory_entry.h
new file mode 100644
index 0000000..81be79e
--- /dev/null
+++ b/ppapi/cpp/directory_entry.h
@@ -0,0 +1,127 @@
+// Copyright (c) 2011 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_DIRECTORY_ENTRY_H_
+#define PPAPI_CPP_DIRECTORY_ENTRY_H_
+
+#include <vector>
+
+#include "ppapi/c/pp_array_output.h"
+#include "ppapi/c/pp_directory_entry.h"
+#include "ppapi/cpp/array_output.h"
+#include "ppapi/cpp/file_ref.h"
+#include "ppapi/cpp/output_traits.h"
+#include "ppapi/cpp/pass_ref.h"
+
+/// @file
+/// This file defines the API used to handle a directory entry.
+
+namespace pp {
+
+/// The <code>DirectoryEntry</code> class represents information about
+/// a directory entry.
+class DirectoryEntry {
+ public:
+ /// Default constructor for creating an is_null() <code>DirectoryEntry</code>
+ /// object.
+ DirectoryEntry();
+
+ /// A constructor used when you have a <code>PP_DirectoryEntry</code> which
+ /// contains a <code>FileRef</code> that has already been reference counted
+ /// as a return value.
+ ///
+ /// @param[in] data A <code>PP_DirectoryEntry</code> to be copied.
+ DirectoryEntry(PassRef, const PP_DirectoryEntry& data);
+
+ /// A copy constructor for <code>DirectoryEntry</code>. This constructor
+ /// increments a reference count of the <code>FileRef</code> held by this
+ /// DirectoryEntry.
+ ///
+ /// @param[in] other A pointer to a <code>DirectoryEntry</code>.
+ DirectoryEntry(const DirectoryEntry& other);
+
+ /// A destructor that decrements a reference count of the <code>FileRef</code>
+ /// held by this <code>DirectoryEntry</code>.
+ ~DirectoryEntry();
+
+ /// This function assigns one <code>DirectoryEntry</code> object to this
+ /// <code>DirectoryEntry</code> object. This function increases the reference
+ /// count of the <code>FileRef</code> of the other DirectoryEntry while
+ /// decrementing the reference count of the FileRef of this DirectoryEntry.
+ ///
+ /// @param[in] other A pointer to a <code>DirectoryEntry</code>.
+ ///
+ /// @return A new <code>DirectoryEntry</code> object.
+ DirectoryEntry& operator=(const DirectoryEntry& other);
+
+ /// This function determines if this <code>DirectoryEntry</code> is a null
+ /// value.
+ ///
+ /// @return true if this <code>DirectoryEntry</code> is null, otherwise false.
+ bool is_null() const { return !data_.file_ref; }
+
+ /// This function returns the <code>FileRef</code> held by this
+ /// <code>DirectoryEntry</code>.
+ ///
+ /// @return A <code>FileRef</code> of the file.
+ FileRef file_ref() const { return FileRef(data_.file_ref); }
+
+ /// This function returns the <code>PP_FileType</code> of the file referenced
+ /// by this <code>DirectoryEntry</code>.
+ ///
+ /// @return A <code>PP_FileType</code> of the file.
+ PP_FileType file_type() const { return data_.file_type; }
+
+ private:
+ PP_DirectoryEntry data_;
+};
+
+namespace internal {
+
+class DirectoryEntryArrayOutputAdapterWithStorage
+ : public ArrayOutputAdapter<PP_DirectoryEntry> {
+ public:
+ DirectoryEntryArrayOutputAdapterWithStorage();
+ virtual ~DirectoryEntryArrayOutputAdapterWithStorage();
+
+ // Returns the final array of resource objects, converting the
+ // PP_DirectoryEntry written by the browser to pp::DirectoryEntry
+ // objects.
+ //
+ // This function should only be called once or we would end up converting
+ // the array more than once, which would mess up the refcounting.
+ std::vector<DirectoryEntry>& output();
+
+ private:
+ // The browser will write the PP_DirectoryEntrys into this array.
+ std::vector<PP_DirectoryEntry> temp_storage_;
+
+ // When asked for the output, the PP_DirectoryEntrys above will be
+ // converted to the pp::DirectoryEntrys in this array for passing to the
+ // calling code.
+ std::vector<DirectoryEntry> output_storage_;
+};
+
+// A specialization of CallbackOutputTraits to provide the callback system the
+// information on how to handle vectors of pp::DirectoryEntry. This converts
+// PP_DirectoryEntry to pp::DirectoryEntry when passing to the plugin.
+template <>
+struct CallbackOutputTraits< std::vector<DirectoryEntry> > {
+ typedef PP_ArrayOutput APIArgType;
+ typedef DirectoryEntryArrayOutputAdapterWithStorage StorageType;
+
+ static inline APIArgType StorageToAPIArg(StorageType& t) {
+ return t.pp_array_output();
+ }
+
+ static inline std::vector<DirectoryEntry>& StorageToPluginArg(
+ StorageType& t) {
+ return t.output();
+ }
+};
+
+} // namespace internal
+} // namespace pp
+
+#endif // PPAPI_CPP_DIRECTORY_ENTRY_H_
diff --git a/ppapi/cpp/extensions/dev/alarms_dev.cc b/ppapi/cpp/extensions/dev/alarms_dev.cc
index 879efec..94baf47 100644
--- a/ppapi/cpp/extensions/dev/alarms_dev.cc
+++ b/ppapi/cpp/extensions/dev/alarms_dev.cc
@@ -117,9 +117,8 @@
alarm_info_var.pp_var());
}
-int32_t Alarms_Dev::Get(
- const Optional<std::string>& name,
- const CompletionCallbackWithOutput<Alarm_Dev>& callback) {
+int32_t Alarms_Dev::Get(const Optional<std::string>& name,
+ const GetCallback& callback) {
if (!has_interface<PPB_Ext_Alarms_Dev_0_1>())
return callback.MayForce(PP_ERROR_NOINTERFACE);
@@ -132,8 +131,7 @@
callback.pp_completion_callback());
}
-int32_t Alarms_Dev::GetAll(
- const CompletionCallbackWithOutput<std::vector<Alarm_Dev> >& callback) {
+int32_t Alarms_Dev::GetAll(const GetAllCallback& callback) {
if (!has_interface<PPB_Ext_Alarms_Dev_0_1>())
return callback.MayForce(PP_ERROR_NOINTERFACE);
diff --git a/ppapi/cpp/extensions/dev/alarms_dev.h b/ppapi/cpp/extensions/dev/alarms_dev.h
index 762e006..57d82d0 100644
--- a/ppapi/cpp/extensions/dev/alarms_dev.h
+++ b/ppapi/cpp/extensions/dev/alarms_dev.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "ppapi/c/extensions/dev/ppb_alarms_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h"
#include "ppapi/cpp/extensions/dict_field.h"
#include "ppapi/cpp/extensions/event_base.h"
#include "ppapi/cpp/extensions/ext_output_traits.h"
@@ -16,11 +16,10 @@
#include "ppapi/cpp/var.h"
namespace pp {
+namespace ext {
template <class T>
-class CompletionCallbackWithOutput;
-
-namespace ext {
+class ExtCompletionCallbackWithOutput;
template <class T>
class Optional;
@@ -28,7 +27,7 @@
namespace alarms {
// Data types ------------------------------------------------------------------
-class Alarm_Dev : public internal::OutputObjectBase {
+class Alarm_Dev {
public:
Alarm_Dev();
~Alarm_Dev();
@@ -72,11 +71,16 @@
void Create(const Optional<std::string>& name,
const AlarmCreateInfo_Dev& alarm_info);
- int32_t Get(const Optional<std::string>& name,
- const CompletionCallbackWithOutput<Alarm_Dev>& callback);
- int32_t GetAll(
- const CompletionCallbackWithOutput<std::vector<Alarm_Dev> >& callback);
+
+ typedef ExtCompletionCallbackWithOutput<Alarm_Dev> GetCallback;
+ int32_t Get(const Optional<std::string>& name, const GetCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<std::vector<Alarm_Dev> >
+ GetAllCallback;
+ int32_t GetAll(const GetAllCallback& callback);
+
void Clear(const Optional<std::string>& name);
+
void ClearAll();
private:
diff --git a/ppapi/cpp/extensions/dev/events_dev.cc b/ppapi/cpp/extensions/dev/events_dev.cc
index 4b51fb5..d80008f 100644
--- a/ppapi/cpp/extensions/dev/events_dev.cc
+++ b/ppapi/cpp/extensions/dev/events_dev.cc
@@ -4,7 +4,7 @@
#include "ppapi/cpp/extensions/dev/events_dev.h"
-#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h"
#include "ppapi/cpp/module_impl.h"
namespace pp {
diff --git a/ppapi/cpp/extensions/dev/socket_dev.cc b/ppapi/cpp/extensions/dev/socket_dev.cc
new file mode 100644
index 0000000..fb493ba
--- /dev/null
+++ b/ppapi/cpp/extensions/dev/socket_dev.cc
@@ -0,0 +1,570 @@
+// 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/extensions/dev/socket_dev.h"
+
+#include "ppapi/cpp/completion_callback.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"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_Ext_Socket_Dev_0_1>() {
+ return PPB_EXT_SOCKET_DEV_INTERFACE_0_1;
+}
+
+} // namespace
+
+namespace ext {
+namespace socket {
+
+const char* const SocketType_Dev::kTcp = "tcp";
+const char* const SocketType_Dev::kUdp = "udp";
+
+SocketType_Dev::SocketType_Dev() : value(NONE) {
+}
+
+SocketType_Dev::SocketType_Dev(ValueType in_value) : value(in_value) {
+}
+
+SocketType_Dev::~SocketType_Dev() {
+}
+
+bool SocketType_Dev::Populate(const PP_Var& var_value) {
+ if (var_value.type != PP_VARTYPE_STRING)
+ return false;
+
+ std::string string_value = Var(var_value).AsString();
+ if (string_value == kTcp) {
+ value = TCP;
+ } else if (string_value == kUdp) {
+ value = UDP;
+ } else {
+ value = NONE;
+ return false;
+ }
+ return true;
+}
+
+Var SocketType_Dev::CreateVar() const {
+ switch (value) {
+ case TCP:
+ return Var(kTcp);
+ case UDP:
+ return Var(kUdp);
+ default:
+ PP_NOTREACHED();
+ return Var(std::string());
+ }
+}
+
+const char* const CreateInfo_Dev::kSocketId = "socketId";
+
+CreateInfo_Dev::CreateInfo_Dev()
+ : socket_id(kSocketId) {
+}
+
+CreateInfo_Dev::~CreateInfo_Dev() {
+}
+
+bool CreateInfo_Dev::Populate(const PP_Ext_Socket_CreateInfo_Dev& value) {
+ if (value.type != PP_VARTYPE_DICTIONARY)
+ return false;
+
+ VarDictionary_Dev dict(value);
+ bool result = socket_id.Populate(dict);
+
+ return result;
+}
+
+Var CreateInfo_Dev::CreateVar() const {
+ VarDictionary_Dev dict;
+
+ bool result = socket_id.AddTo(&dict);
+ // Suppress unused variable warnings.
+ static_cast<void>(result);
+ PP_DCHECK(result);
+
+ return dict;
+}
+
+const char* const AcceptInfo_Dev::kResultCode = "resultCode";
+const char* const AcceptInfo_Dev::kSocketId = "socketId";
+
+AcceptInfo_Dev::AcceptInfo_Dev()
+ : result_code(kResultCode),
+ socket_id(kSocketId) {
+}
+
+AcceptInfo_Dev::~AcceptInfo_Dev() {
+}
+
+bool AcceptInfo_Dev::Populate(const PP_Ext_Socket_AcceptInfo_Dev& value) {
+ if (value.type != PP_VARTYPE_DICTIONARY)
+ return false;
+
+ VarDictionary_Dev dict(value);
+ bool result = result_code.Populate(dict);
+ result = socket_id.Populate(dict) && result;
+
+ return result;
+}
+
+Var AcceptInfo_Dev::CreateVar() const {
+ VarDictionary_Dev dict;
+
+ bool result = result_code.AddTo(&dict);
+ result = socket_id.MayAddTo(&dict) && result;
+ PP_DCHECK(result);
+
+ return dict;
+}
+
+const char* const ReadInfo_Dev::kResultCode = "resultCode";
+const char* const ReadInfo_Dev::kData = "data";
+
+ReadInfo_Dev::ReadInfo_Dev()
+ : result_code(kResultCode),
+ data(kData) {
+}
+
+ReadInfo_Dev::~ReadInfo_Dev() {
+}
+
+bool ReadInfo_Dev::Populate(const PP_Ext_Socket_ReadInfo_Dev& value) {
+ if (value.type != PP_VARTYPE_DICTIONARY)
+ return false;
+
+ VarDictionary_Dev dict(value);
+ bool result = result_code.Populate(dict);
+ result = data.Populate(dict) && result;
+
+ return result;
+}
+
+Var ReadInfo_Dev::CreateVar() const {
+ VarDictionary_Dev dict;
+
+ bool result = result_code.AddTo(&dict);
+ result = data.AddTo(&dict) && result;
+ PP_DCHECK(result);
+
+ return dict;
+}
+
+const char* const WriteInfo_Dev::kBytesWritten = "bytesWritten";
+
+WriteInfo_Dev::WriteInfo_Dev()
+ : bytes_written(kBytesWritten) {
+}
+
+WriteInfo_Dev::~WriteInfo_Dev() {
+}
+
+bool WriteInfo_Dev::Populate(const PP_Ext_Socket_WriteInfo_Dev& value) {
+ if (value.type != PP_VARTYPE_DICTIONARY)
+ return false;
+
+ VarDictionary_Dev dict(value);
+ bool result = bytes_written.Populate(dict);
+
+ return result;
+}
+
+Var WriteInfo_Dev::CreateVar() const {
+ VarDictionary_Dev dict;
+
+ bool result = bytes_written.AddTo(&dict);
+ // Suppress unused variable warnings.
+ static_cast<void>(result);
+ PP_DCHECK(result);
+
+ return dict;
+}
+
+const char* const RecvFromInfo_Dev::kResultCode = "resultCode";
+const char* const RecvFromInfo_Dev::kData = "data";
+const char* const RecvFromInfo_Dev::kAddress = "address";
+const char* const RecvFromInfo_Dev::kPort = "port";
+
+RecvFromInfo_Dev::RecvFromInfo_Dev()
+ : result_code(kResultCode),
+ data(kData),
+ address(kAddress),
+ port(kPort) {
+}
+
+RecvFromInfo_Dev::~RecvFromInfo_Dev() {
+}
+
+bool RecvFromInfo_Dev::Populate(const PP_Ext_Socket_RecvFromInfo_Dev& value) {
+ if (value.type != PP_VARTYPE_DICTIONARY)
+ return false;
+
+ VarDictionary_Dev dict(value);
+ bool result = result_code.Populate(dict);
+ result = data.Populate(dict) && result;
+ result = address.Populate(dict) && result;
+ result = port.Populate(dict) && result;
+
+ return result;
+}
+
+Var RecvFromInfo_Dev::CreateVar() const {
+ VarDictionary_Dev dict;
+
+ bool result = result_code.AddTo(&dict);
+ result = data.AddTo(&dict) && result;
+ result = address.AddTo(&dict) && result;
+ result = port.AddTo(&dict) && result;
+ PP_DCHECK(result);
+
+ return dict;
+}
+
+const char* const SocketInfo_Dev::kSocketType = "socketType";
+const char* const SocketInfo_Dev::kConnected = "connected";
+const char* const SocketInfo_Dev::kPeerAddress = "peerAddress";
+const char* const SocketInfo_Dev::kPeerPort = "peerPort";
+const char* const SocketInfo_Dev::kLocalAddress = "localAddress";
+const char* const SocketInfo_Dev::kLocalPort = "localPort";
+
+SocketInfo_Dev::SocketInfo_Dev()
+ : socket_type(kSocketType),
+ connected(kConnected),
+ peer_address(kPeerAddress),
+ peer_port(kPeerPort),
+ local_address(kLocalAddress),
+ local_port(kLocalPort) {
+}
+
+SocketInfo_Dev::~SocketInfo_Dev() {
+}
+
+bool SocketInfo_Dev::Populate(const PP_Ext_Socket_SocketInfo_Dev& value) {
+ if (value.type != PP_VARTYPE_DICTIONARY)
+ return false;
+
+ VarDictionary_Dev dict(value);
+ bool result = socket_type.Populate(dict);
+ result = connected.Populate(dict) && result;
+ result = peer_address.Populate(dict) && result;
+ result = peer_port.Populate(dict) && result;
+ result = local_address.Populate(dict) && result;
+ result = local_port.Populate(dict) && result;
+
+ return result;
+}
+
+Var SocketInfo_Dev::CreateVar() const {
+ VarDictionary_Dev dict;
+
+ bool result = socket_type.AddTo(&dict);
+ result = connected.AddTo(&dict) && result;
+ result = peer_address.MayAddTo(&dict) && result;
+ result = peer_port.MayAddTo(&dict) && result;
+ result = local_address.MayAddTo(&dict) && result;
+ result = local_port.MayAddTo(&dict) && result;
+ PP_DCHECK(result);
+
+ return dict;
+}
+
+const char* const NetworkInterface_Dev::kName = "name";
+const char* const NetworkInterface_Dev::kAddress = "address";
+
+NetworkInterface_Dev::NetworkInterface_Dev()
+ : name(kName),
+ address(kAddress) {
+}
+
+NetworkInterface_Dev::~NetworkInterface_Dev() {
+}
+
+bool NetworkInterface_Dev::Populate(
+ const PP_Ext_Socket_NetworkInterface_Dev& value) {
+ if (value.type != PP_VARTYPE_DICTIONARY)
+ return false;
+
+ VarDictionary_Dev dict(value);
+ bool result = name.Populate(dict);
+ result = address.Populate(dict) && result;
+
+ return result;
+}
+
+Var NetworkInterface_Dev::CreateVar() const {
+ VarDictionary_Dev dict;
+
+ bool result = name.AddTo(&dict);
+ result = address.AddTo(&dict) && result;
+ PP_DCHECK(result);
+
+ return dict;
+}
+
+Socket_Dev::Socket_Dev(const InstanceHandle& instance) : instance_(instance) {
+}
+
+Socket_Dev::~Socket_Dev() {
+}
+
+int32_t Socket_Dev::Create(const SocketType_Dev& type,
+ const Optional<CreateOptions_Dev>& options,
+ const CreateCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<SocketType_Dev> type_var(type);
+ internal::ToVarConverter<Optional<CreateOptions_Dev> > options_var(options);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->Create(
+ instance_.pp_instance(),
+ type_var.pp_var(),
+ options_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+void Socket_Dev::Destroy(int32_t socket_id) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return;
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->Destroy(
+ instance_.pp_instance(),
+ socket_id_var.pp_var());
+}
+
+int32_t Socket_Dev::Connect(int32_t socket_id,
+ const std::string& hostname,
+ int32_t port,
+ const ConnectCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+ internal::ToVarConverter<std::string> hostname_var(hostname);
+ internal::ToVarConverter<int32_t> port_var(port);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->Connect(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ hostname_var.pp_var(),
+ port_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::Bind(int32_t socket_id,
+ const std::string& address,
+ int32_t port,
+ const BindCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+ internal::ToVarConverter<std::string> address_var(address);
+ internal::ToVarConverter<int32_t> port_var(port);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->Bind(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ address_var.pp_var(),
+ port_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+void Socket_Dev::Disconnect(int32_t socket_id) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return;
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->Disconnect(
+ instance_.pp_instance(),
+ socket_id_var.pp_var());
+}
+
+int32_t Socket_Dev::Read(int32_t socket_id,
+ const Optional<int32_t>& buffer_size,
+ const ReadCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+ internal::ToVarConverter<Optional<int32_t> > buffer_size_var(buffer_size);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->Read(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ buffer_size_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::Write(int32_t socket_id,
+ const VarArrayBuffer& data,
+ const WriteCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+ internal::ToVarConverter<Var> data_var(data);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->Write(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ data_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::RecvFrom(int32_t socket_id,
+ const Optional<int32_t>& buffer_size,
+ const RecvFromCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+ internal::ToVarConverter<Optional<int32_t> > buffer_size_var(buffer_size);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->RecvFrom(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ buffer_size_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::SendTo(int32_t socket_id,
+ const VarArrayBuffer& data,
+ const std::string& address,
+ int32_t port,
+ const SendToCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+ internal::ToVarConverter<Var> data_var(data);
+ internal::ToVarConverter<std::string> address_var(address);
+ internal::ToVarConverter<int32_t> port_var(port);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->SendTo(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ data_var.pp_var(),
+ address_var.pp_var(),
+ port_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::Listen(int32_t socket_id,
+ const std::string& address,
+ int32_t port,
+ const Optional<int32_t>& backlog,
+ const ListenCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+ internal::ToVarConverter<std::string> address_var(address);
+ internal::ToVarConverter<int32_t> port_var(port);
+ internal::ToVarConverter<Optional<int32_t> > backlog_var(backlog);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->Listen(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ address_var.pp_var(),
+ port_var.pp_var(),
+ backlog_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::Accept(int32_t socket_id,
+ const AcceptCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->Accept(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::SetKeepAlive(int32_t socket_id,
+ bool enable,
+ const Optional<int32_t>& delay,
+ const SetKeepAliveCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+ internal::ToVarConverter<bool> enable_var(enable);
+ internal::ToVarConverter<Optional<int32_t> > delay_var(delay);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->SetKeepAlive(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ enable_var.pp_var(),
+ delay_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::SetNoDelay(int32_t socket_id,
+ bool no_delay,
+ const SetNoDelayCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+ internal::ToVarConverter<bool> no_delay_var(no_delay);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->SetNoDelay(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ no_delay_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::GetInfo(int32_t socket_id,
+ const GetInfoCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ internal::ToVarConverter<int32_t> socket_id_var(socket_id);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->GetInfo(
+ instance_.pp_instance(),
+ socket_id_var.pp_var(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+int32_t Socket_Dev::GetNetworkList(const GetNetworkListCallback& callback) {
+ if (!has_interface<PPB_Ext_Socket_Dev_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ return get_interface<PPB_Ext_Socket_Dev_0_1>()->GetNetworkList(
+ instance_.pp_instance(),
+ callback.output(),
+ callback.pp_completion_callback());
+}
+
+} // namespace socket
+} // namespace ext
+} // namespace pp
diff --git a/ppapi/cpp/extensions/dev/socket_dev.h b/ppapi/cpp/extensions/dev/socket_dev.h
new file mode 100644
index 0000000..c51b6cc
--- /dev/null
+++ b/ppapi/cpp/extensions/dev/socket_dev.h
@@ -0,0 +1,261 @@
+// 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_CPP_EXTENSIONS_DEV_SOCKET_DEV_H_
+#define PPAPI_CPP_EXTENSIONS_DEV_SOCKET_DEV_H_
+
+#include <string>
+#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"
+
+namespace pp {
+namespace ext {
+
+template <class T>
+class ExtCompletionCallbackWithOutput;
+
+template <class T>
+class Optional;
+
+namespace socket {
+
+// Data types ------------------------------------------------------------------
+class SocketType_Dev {
+ public:
+ enum ValueType {
+ NONE,
+ TCP,
+ UDP
+ };
+
+ SocketType_Dev();
+ SocketType_Dev(ValueType in_value);
+ ~SocketType_Dev();
+
+ bool Populate(const PP_Var& var_value);
+
+ Var CreateVar() const;
+
+ ValueType value;
+
+ static const char* const kTcp;
+ static const char* const kUdp;
+};
+
+typedef VarDictionary_Dev CreateOptions_Dev;
+
+class CreateInfo_Dev {
+ public:
+ CreateInfo_Dev();
+ ~CreateInfo_Dev();
+
+ bool Populate(const PP_Ext_Socket_CreateInfo_Dev& value);
+
+ Var CreateVar() const;
+
+ static const char* const kSocketId;
+
+ DictField<int32_t> socket_id;
+};
+
+class AcceptInfo_Dev {
+ public:
+ AcceptInfo_Dev();
+ ~AcceptInfo_Dev();
+
+ bool Populate(const PP_Ext_Socket_AcceptInfo_Dev& value);
+
+ Var CreateVar() const;
+
+ static const char* const kResultCode;
+ static const char* const kSocketId;
+
+ DictField<int32_t> result_code;
+ OptionalDictField<int32_t> socket_id;
+};
+
+class ReadInfo_Dev {
+ public:
+ ReadInfo_Dev();
+ ~ReadInfo_Dev();
+
+ bool Populate(const PP_Ext_Socket_ReadInfo_Dev& value);
+
+ Var CreateVar() const;
+
+ static const char* const kResultCode;
+ static const char* const kData;
+
+ DictField<int32_t> result_code;
+ DictField<VarArrayBuffer> data;
+};
+
+class WriteInfo_Dev {
+ public:
+ WriteInfo_Dev();
+ ~WriteInfo_Dev();
+
+ bool Populate(const PP_Ext_Socket_WriteInfo_Dev& value);
+
+ Var CreateVar() const;
+
+ static const char* const kBytesWritten;
+
+ DictField<int32_t> bytes_written;
+};
+
+class RecvFromInfo_Dev {
+ public:
+ RecvFromInfo_Dev();
+ ~RecvFromInfo_Dev();
+
+ bool Populate(const PP_Ext_Socket_RecvFromInfo_Dev& value);
+
+ Var CreateVar() const;
+
+ static const char* const kResultCode;
+ static const char* const kData;
+ static const char* const kAddress;
+ static const char* const kPort;
+
+ DictField<int32_t> result_code;
+ DictField<VarArrayBuffer> data;
+ DictField<std::string> address;
+ DictField<int32_t> port;
+};
+
+class SocketInfo_Dev {
+ public:
+ SocketInfo_Dev();
+ ~SocketInfo_Dev();
+
+ bool Populate(const PP_Ext_Socket_SocketInfo_Dev& value);
+
+ Var CreateVar() const;
+
+ static const char* const kSocketType;
+ static const char* const kConnected;
+ static const char* const kPeerAddress;
+ static const char* const kPeerPort;
+ static const char* const kLocalAddress;
+ static const char* const kLocalPort;
+
+ DictField<SocketType_Dev> socket_type;
+ DictField<bool> connected;
+ OptionalDictField<std::string> peer_address;
+ OptionalDictField<int32_t> peer_port;
+ OptionalDictField<std::string> local_address;
+ OptionalDictField<int32_t> local_port;
+};
+
+class NetworkInterface_Dev {
+ public:
+ NetworkInterface_Dev();
+ ~NetworkInterface_Dev();
+
+ bool Populate(const PP_Ext_Socket_NetworkInterface_Dev& value);
+
+ Var CreateVar() const;
+
+ static const char* const kName;
+ static const char* const kAddress;
+
+ DictField<std::string> name;
+ DictField<std::string> address;
+};
+
+// Functions -------------------------------------------------------------------
+class Socket_Dev {
+ public:
+ explicit Socket_Dev(const InstanceHandle& instance);
+ ~Socket_Dev();
+
+ typedef ExtCompletionCallbackWithOutput<CreateInfo_Dev> CreateCallback;
+ int32_t Create(const SocketType_Dev& type,
+ const Optional<CreateOptions_Dev>& options,
+ const CreateCallback& callback);
+
+ void Destroy(int32_t socket_id);
+
+ typedef ExtCompletionCallbackWithOutput<int32_t> ConnectCallback;
+ int32_t Connect(int32_t socket_id,
+ const std::string& hostname,
+ int32_t port,
+ const ConnectCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<int32_t> BindCallback;
+ int32_t Bind(int32_t socket_id,
+ const std::string& address,
+ int32_t port,
+ const BindCallback& callback);
+
+ void Disconnect(int32_t socket_id);
+
+ typedef ExtCompletionCallbackWithOutput<ReadInfo_Dev> ReadCallback;
+ int32_t Read(int32_t socket_id,
+ const Optional<int32_t>& buffer_size,
+ const ReadCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<WriteInfo_Dev> WriteCallback;
+ int32_t Write(int32_t socket_id,
+ const VarArrayBuffer& data,
+ const WriteCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<RecvFromInfo_Dev> RecvFromCallback;
+ int32_t RecvFrom(int32_t socket_id,
+ const Optional<int32_t>& buffer_size,
+ const RecvFromCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<WriteInfo_Dev> SendToCallback;
+ int32_t SendTo(int32_t socket_id,
+ const VarArrayBuffer& data,
+ const std::string& address,
+ int32_t port,
+ const SendToCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<int32_t> ListenCallback;
+ int32_t Listen(int32_t socket_id,
+ const std::string& address,
+ int32_t port,
+ const Optional<int32_t>& backlog,
+ const ListenCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<AcceptInfo_Dev> AcceptCallback;
+ int32_t Accept(int32_t socket_id, const AcceptCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<bool> SetKeepAliveCallback;
+ int32_t SetKeepAlive(int32_t socket_id,
+ bool enable,
+ const Optional<int32_t>& delay,
+ const SetKeepAliveCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<bool> SetNoDelayCallback;
+ int32_t SetNoDelay(int32_t socket_id,
+ bool no_delay,
+ const SetNoDelayCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<SocketInfo_Dev> GetInfoCallback;
+ int32_t GetInfo(int32_t socket_id,
+ const GetInfoCallback& callback);
+
+ typedef ExtCompletionCallbackWithOutput<std::vector<NetworkInterface_Dev> >
+ GetNetworkListCallback;
+ int32_t GetNetworkList(const GetNetworkListCallback& callback);
+
+ private:
+ InstanceHandle instance_;
+};
+
+} // namespace socket
+} // namespace ext
+} // namespace pp
+
+#endif // PPAPI_CPP_EXTENSIONS_DEV_SOCKET_DEV_H_
diff --git a/ppapi/cpp/extensions/event_base.h b/ppapi/cpp/extensions/event_base.h
index 8a65fb0..75144c0 100644
--- a/ppapi/cpp/extensions/event_base.h
+++ b/ppapi/cpp/extensions/event_base.h
@@ -5,7 +5,7 @@
#ifndef PPAPI_CPP_EXTENSIONS_EVENT_BASE_H_
#define PPAPI_CPP_EXTENSIONS_EVENT_BASE_H_
-#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h"
diff --git a/ppapi/cpp/extensions/ext_output_traits.h b/ppapi/cpp/extensions/ext_output_traits.h
index d03258d..9c1cb2a 100644
--- a/ppapi/cpp/extensions/ext_output_traits.h
+++ b/ppapi/cpp/extensions/ext_output_traits.h
@@ -18,18 +18,6 @@
namespace ext {
namespace internal {
-// Base class for all those types within the pp::ext namespace that are used
-// with CompletionCallbackWithOutput. This class doesn't do anything itself,
-// but it affects the behavior of CallbackOutputTraits for all its subclasses.
-//
-// TODO(yzshen): Within pp::ext, basic types such as std::string or double may
-// be used with CompletionCallbackWithOutput as well. This approach doesn't
-// work for them. One way is to refactor CallbackOutputTraits to consider not
-// only the output C++ object type, but also the output parameter type that the
-// C interface uses. And then we can remove this class.
-class OutputObjectBase {
-};
-
template <class T>
class VarOutputAdapterWithStorage {
public:
@@ -59,8 +47,15 @@
const VarOutputAdapterWithStorage<T>&);
};
+// ExtCallbackOutputTraits is used with ExtCompletionCallbackWithOutput. Unlike
+// pp::internal::CallbackOutputTraits, it always uses PP_Var* as output
+// parameter type to interact with the browser.
+//
+// For example, CompletionCallbackWithOutput<double> (using
+// pp::internal::CallbackOutputTraits) uses double* as the output parameter
+// type; while ExtCompletionCallbackWithOutput<double> uses PP_Var*.
template <class T>
-struct ExtensionsCallbackOutputTraits {
+struct ExtCallbackOutputTraits {
typedef PP_Var* APIArgType;
typedef VarOutputAdapterWithStorage<T> StorageType;
@@ -76,7 +71,7 @@
};
// This class provides storage for a PP_Var and a vector of objects which are
-// of type T. The PP_Var is used as an output parameter to recevie an array var
+// of type T. The PP_Var is used as an output parameter to receive an array var
// from the browser. Each element in the array var is converted to a T object,
// using FromVarConverter, and stores in the vector.
template <class T>
@@ -121,7 +116,7 @@
};
template <class T>
-struct ExtensionsVectorCallbackOutputTraits {
+struct ExtCallbackOutputTraits< std::vector<T> > {
typedef PP_Var* APIArgType;
typedef ArrayVarOutputAdapterWithStorage<T> StorageType;
diff --git a/ppapi/cpp/extensions/from_var_converter.h b/ppapi/cpp/extensions/from_var_converter.h
index 6fb8a32..094f0c4 100644
--- a/ppapi/cpp/extensions/from_var_converter.h
+++ b/ppapi/cpp/extensions/from_var_converter.h
@@ -8,9 +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_buffer.h"
namespace pp {
namespace ext {
@@ -40,7 +43,7 @@
FromVarConverter() {
}
- FromVarConverter(const PP_Var& var) {
+ explicit FromVarConverter(const PP_Var& var) {
Set(var);
}
@@ -62,7 +65,7 @@
FromVarConverter() {
}
- FromVarConverter(const PP_Var& var) {
+ explicit FromVarConverter(const PP_Var& var) {
Set(var);
}
@@ -80,12 +83,66 @@
};
template <>
+class FromVarConverter<bool> : public FromVarConverterBase<bool> {
+ public:
+ FromVarConverter() {
+ }
+
+ explicit FromVarConverter(const PP_Var& var) {
+ Set(var);
+ }
+
+ ~FromVarConverter() {
+ }
+
+ void Set(const PP_Var& var) {
+ FromVarConverterBase<bool>::value_ = Var(var).AsBool();
+ }
+};
+
+template <>
+class FromVarConverter<int32_t> : public FromVarConverterBase<int32_t> {
+ public:
+ FromVarConverter() {
+ }
+
+ explicit FromVarConverter(const PP_Var& var) {
+ Set(var);
+ }
+
+ ~FromVarConverter() {
+ }
+
+ void Set(const PP_Var& var) {
+ FromVarConverterBase<int32_t>::value_ = Var(var).AsInt();
+ }
+};
+
+template <>
+class FromVarConverter<double> : public FromVarConverterBase<double> {
+ public:
+ FromVarConverter() {
+ }
+
+ explicit FromVarConverter(const PP_Var& var) {
+ Set(var);
+ }
+
+ ~FromVarConverter() {
+ }
+
+ void Set(const PP_Var& var) {
+ FromVarConverterBase<double>::value_ = Var(var).AsDouble();
+ }
+};
+
+template <>
class FromVarConverter<std::string> : public FromVarConverterBase<std::string> {
public:
FromVarConverter() {
}
- FromVarConverter(const PP_Var& var) {
+ explicit FromVarConverter(const PP_Var& var) {
Set(var);
}
@@ -98,12 +155,12 @@
};
template <>
-class FromVarConverter<double> : public FromVarConverterBase<double> {
+class FromVarConverter<Var> : public FromVarConverterBase<Var> {
public:
FromVarConverter() {
}
- FromVarConverter(const PP_Var& var) {
+ explicit FromVarConverter(const PP_Var& var) {
Set(var);
}
@@ -111,7 +168,64 @@
}
void Set(const PP_Var& var) {
- FromVarConverterBase<double>::value_ = Var(var).AsDouble();
+ FromVarConverterBase<Var>::value_ = Var(var);
+ }
+};
+
+template <>
+class FromVarConverter<VarArray_Dev>
+ : public FromVarConverterBase<VarArray_Dev> {
+ public:
+ FromVarConverter() {
+ }
+
+ explicit FromVarConverter(const PP_Var& var) {
+ Set(var);
+ }
+
+ ~FromVarConverter() {
+ }
+
+ void Set(const PP_Var& var) {
+ FromVarConverterBase<VarArray_Dev>::value_ = Var(var);
+ }
+};
+
+template <>
+class FromVarConverter<VarDictionary_Dev>
+ : public FromVarConverterBase<VarDictionary_Dev> {
+ public:
+ FromVarConverter() {
+ }
+
+ explicit FromVarConverter(const PP_Var& var) {
+ Set(var);
+ }
+
+ ~FromVarConverter() {
+ }
+
+ void Set(const PP_Var& var) {
+ FromVarConverterBase<VarDictionary_Dev>::value_ = Var(var);
+ }
+};
+
+template <>
+class FromVarConverter<VarArrayBuffer>
+ : public FromVarConverterBase<VarArrayBuffer> {
+ public:
+ FromVarConverter() {
+ }
+
+ explicit FromVarConverter(const PP_Var& var) {
+ Set(var);
+ }
+
+ ~FromVarConverter() {
+ }
+
+ void Set(const PP_Var& var) {
+ FromVarConverterBase<VarArrayBuffer>::value_ = Var(var);
}
};
diff --git a/ppapi/cpp/extensions/to_var_converter.h b/ppapi/cpp/extensions/to_var_converter.h
index ba05064..5913652 100644
--- a/ppapi/cpp/extensions/to_var_converter.h
+++ b/ppapi/cpp/extensions/to_var_converter.h
@@ -8,8 +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_buffer.h"
namespace pp {
namespace ext {
@@ -66,6 +69,36 @@
};
template <>
+class ToVarConverter<bool> : public ToVarConverterBase {
+ public:
+ explicit ToVarConverter(bool object) : ToVarConverterBase(Var(object)) {
+ }
+
+ ~ToVarConverter() {
+ }
+};
+
+template <>
+class ToVarConverter<int32_t> : public ToVarConverterBase {
+ public:
+ explicit ToVarConverter(int32_t object) : ToVarConverterBase(Var(object)) {
+ }
+
+ ~ToVarConverter() {
+ }
+};
+
+template <>
+class ToVarConverter<double> : public ToVarConverterBase {
+ public:
+ explicit ToVarConverter(double object) : ToVarConverterBase(Var(object)) {
+ }
+
+ ~ToVarConverter() {
+ }
+};
+
+template <>
class ToVarConverter<std::string> : public ToVarConverterBase {
public:
explicit ToVarConverter(const std::string& object)
@@ -77,9 +110,39 @@
};
template <>
-class ToVarConverter<double> : public ToVarConverterBase {
+class ToVarConverter<Var> : public ToVarConverterBase {
public:
- explicit ToVarConverter(double object) : ToVarConverterBase(Var(object)) {
+ explicit ToVarConverter(const Var& object) : ToVarConverterBase(object) {
+ }
+
+ ~ToVarConverter() {
+ }
+};
+
+template <>
+class ToVarConverter<VarArray_Dev> : public ToVarConverterBase {
+ public:
+ explicit ToVarConverter(const Var& object) : ToVarConverterBase(object) {
+ }
+
+ ~ToVarConverter() {
+ }
+};
+
+template <>
+class ToVarConverter<VarDictionary_Dev> : public ToVarConverterBase {
+ public:
+ explicit ToVarConverter(const Var& object) : ToVarConverterBase(object) {
+ }
+
+ ~ToVarConverter() {
+ }
+};
+
+template <>
+class ToVarConverter<VarArrayBuffer> : public ToVarConverterBase {
+ public:
+ explicit ToVarConverter(const Var& object) : ToVarConverterBase(object) {
}
~ToVarConverter() {
diff --git a/ppapi/cpp/file_io.h b/ppapi/cpp/file_io.h
index bf2c857..9bbb5f7 100644
--- a/ppapi/cpp/file_io.h
+++ b/ppapi/cpp/file_io.h
@@ -117,7 +117,7 @@
/// where a copy of your FileIO resource could outlive your class, the
/// callback will still be pending when your class goes out of scope, creating
/// the possibility of writing into invalid memory. So it's recommended to
- /// keep your FileIO resource and any oubput buffers tightly controlled in
+ /// keep your FileIO resource and any output buffers tightly controlled in
/// the same scope.
///
/// <strong>Caveat:</strong> This Read() is potentially unsafe if you're using
@@ -229,7 +229,7 @@
PP_CompletionCallback original_callback;
};
- // Provide backwards-compatability for older Read versions. Converts the
+ // Provide backwards-compatibility for older Read versions. Converts the
// old-style "char*" output buffer of 1.0 to the new "PP_ArrayOutput"
// interface in 1.1.
//
diff --git a/ppapi/cpp/file_ref.cc b/ppapi/cpp/file_ref.cc
index fbfd49b..0bc9487 100644
--- a/ppapi/cpp/file_ref.cc
+++ b/ppapi/cpp/file_ref.cc
@@ -6,10 +6,10 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/directory_entry.h"
#include "ppapi/cpp/file_system.h"
#include "ppapi/cpp/module_impl.h"
-
namespace pp {
namespace {
@@ -18,6 +18,10 @@
return PPB_FILEREF_INTERFACE_1_0;
}
+template <> const char* interface_name<PPB_FileRef_1_1>() {
+ return PPB_FILEREF_INTERFACE_1_1;
+}
+
} // namespace
FileRef::FileRef(PP_Resource resource) : Resource(resource) {
@@ -28,10 +32,13 @@
FileRef::FileRef(const FileSystem& file_system,
const char* path) {
- if (!has_interface<PPB_FileRef_1_0>())
- return;
- PassRefFromConstructor(get_interface<PPB_FileRef_1_0>()->Create(
- file_system.pp_resource(), path));
+ if (has_interface<PPB_FileRef_1_1>()) {
+ PassRefFromConstructor(get_interface<PPB_FileRef_1_1>()->Create(
+ file_system.pp_resource(), path));
+ } else if (has_interface<PPB_FileRef_1_0>()) {
+ PassRefFromConstructor(get_interface<PPB_FileRef_1_0>()->Create(
+ file_system.pp_resource(), path));
+ }
}
FileRef::FileRef(const FileRef& other)
@@ -39,74 +46,137 @@
}
PP_FileSystemType FileRef::GetFileSystemType() const {
- if (!has_interface<PPB_FileRef_1_0>())
- return PP_FILESYSTEMTYPE_EXTERNAL;
- return get_interface<PPB_FileRef_1_0>()->GetFileSystemType(pp_resource());
+ if (has_interface<PPB_FileRef_1_1>())
+ return get_interface<PPB_FileRef_1_1>()->GetFileSystemType(pp_resource());
+ if (has_interface<PPB_FileRef_1_0>())
+ return get_interface<PPB_FileRef_1_0>()->GetFileSystemType(pp_resource());
+ return PP_FILESYSTEMTYPE_EXTERNAL;
}
Var FileRef::GetName() const {
- if (!has_interface<PPB_FileRef_1_0>())
- return Var();
- return Var(PASS_REF,
- get_interface<PPB_FileRef_1_0>()->GetName(pp_resource()));
+ if (has_interface<PPB_FileRef_1_1>()) {
+ return Var(PASS_REF,
+ get_interface<PPB_FileRef_1_1>()->GetName(pp_resource()));
+ }
+ if (has_interface<PPB_FileRef_1_0>()) {
+ return Var(PASS_REF,
+ get_interface<PPB_FileRef_1_0>()->GetName(pp_resource()));
+ }
+ return Var();
}
Var FileRef::GetPath() const {
- if (!has_interface<PPB_FileRef_1_0>())
- return Var();
- return Var(PASS_REF,
- get_interface<PPB_FileRef_1_0>()->GetPath(pp_resource()));
+ if (has_interface<PPB_FileRef_1_1>()) {
+ return Var(PASS_REF,
+ get_interface<PPB_FileRef_1_1>()->GetPath(pp_resource()));
+ }
+ if (has_interface<PPB_FileRef_1_0>()) {
+ return Var(PASS_REF,
+ get_interface<PPB_FileRef_1_0>()->GetPath(pp_resource()));
+ }
+ return Var();
}
FileRef FileRef::GetParent() const {
- if (!has_interface<PPB_FileRef_1_0>())
- return FileRef();
- return FileRef(PASS_REF,
- get_interface<PPB_FileRef_1_0>()->GetParent(pp_resource()));
+ if (has_interface<PPB_FileRef_1_1>()) {
+ return FileRef(PASS_REF,
+ get_interface<PPB_FileRef_1_1>()->GetParent(pp_resource()));
+ }
+ if (has_interface<PPB_FileRef_1_0>()) {
+ return FileRef(PASS_REF,
+ get_interface<PPB_FileRef_1_0>()->GetParent(pp_resource()));
+ }
+ return FileRef();
}
int32_t FileRef::MakeDirectory(const CompletionCallback& cc) {
- if (!has_interface<PPB_FileRef_1_0>())
- return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_FileRef_1_0>()->MakeDirectory(
- pp_resource(),
- PP_FALSE, // make_ancestors
- cc.pp_completion_callback());
+ if (has_interface<PPB_FileRef_1_1>()) {
+ return get_interface<PPB_FileRef_1_1>()->MakeDirectory(
+ pp_resource(),
+ PP_FALSE, // make_ancestors
+ cc.pp_completion_callback());
+ }
+ if (has_interface<PPB_FileRef_1_0>()) {
+ return get_interface<PPB_FileRef_1_0>()->MakeDirectory(
+ pp_resource(),
+ PP_FALSE, // make_ancestors
+ cc.pp_completion_callback());
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
}
int32_t FileRef::MakeDirectoryIncludingAncestors(
const CompletionCallback& cc) {
- if (!has_interface<PPB_FileRef_1_0>())
- return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_FileRef_1_0>()->MakeDirectory(
- pp_resource(),
- PP_TRUE, // make_ancestors
- cc.pp_completion_callback());
+ if (has_interface<PPB_FileRef_1_1>()) {
+ return get_interface<PPB_FileRef_1_1>()->MakeDirectory(
+ pp_resource(),
+ PP_TRUE, // make_ancestors
+ cc.pp_completion_callback());
+ }
+ if (has_interface<PPB_FileRef_1_0>()) {
+ return get_interface<PPB_FileRef_1_0>()->MakeDirectory(
+ pp_resource(),
+ PP_TRUE, // make_ancestors
+ cc.pp_completion_callback());
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
}
int32_t FileRef::Touch(PP_Time last_access_time,
PP_Time last_modified_time,
const CompletionCallback& cc) {
- if (!has_interface<PPB_FileRef_1_0>())
- return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_FileRef_1_0>()->Touch(
- pp_resource(), last_access_time, last_modified_time,
- cc.pp_completion_callback());
+ if (has_interface<PPB_FileRef_1_1>()) {
+ return get_interface<PPB_FileRef_1_1>()->Touch(
+ pp_resource(), last_access_time, last_modified_time,
+ cc.pp_completion_callback());
+ }
+ if (has_interface<PPB_FileRef_1_0>()) {
+ return get_interface<PPB_FileRef_1_0>()->Touch(
+ pp_resource(), last_access_time, last_modified_time,
+ cc.pp_completion_callback());
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
}
int32_t FileRef::Delete(const CompletionCallback& cc) {
- if (!has_interface<PPB_FileRef_1_0>())
- return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_FileRef_1_0>()->Delete(
- pp_resource(), cc.pp_completion_callback());
+ if (has_interface<PPB_FileRef_1_1>()) {
+ return get_interface<PPB_FileRef_1_1>()->Delete(
+ pp_resource(), cc.pp_completion_callback());
+ }
+ if (has_interface<PPB_FileRef_1_0>()) {
+ return get_interface<PPB_FileRef_1_0>()->Delete(
+ pp_resource(), cc.pp_completion_callback());
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
}
int32_t FileRef::Rename(const FileRef& new_file_ref,
const CompletionCallback& cc) {
- if (!has_interface<PPB_FileRef_1_0>())
+ if (has_interface<PPB_FileRef_1_1>()) {
+ return get_interface<PPB_FileRef_1_1>()->Rename(
+ pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback());
+ }
+ if (has_interface<PPB_FileRef_1_0>()) {
+ return get_interface<PPB_FileRef_1_0>()->Rename(
+ pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback());
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t FileRef::Query(const CompletionCallbackWithOutput<PP_FileInfo>& cc) {
+ if (!has_interface<PPB_FileRef_1_1>())
return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_FileRef_1_0>()->Rename(
- pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback());
+ return get_interface<PPB_FileRef_1_1>()->Query(
+ pp_resource(), cc.output(), cc.pp_completion_callback());
+}
+
+int32_t FileRef::ReadDirectoryEntries(
+ const CompletionCallbackWithOutput<std::vector<DirectoryEntry> >&
+ callback) {
+ if (!has_interface<PPB_FileRef_1_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+ return get_interface<PPB_FileRef_1_1>()->ReadDirectoryEntries(
+ pp_resource(), callback.output(), callback.pp_completion_callback());
}
} // namespace pp
diff --git a/ppapi/cpp/file_ref.h b/ppapi/cpp/file_ref.h
index 05cdc36..b7e5e65 100644
--- a/ppapi/cpp/file_ref.h
+++ b/ppapi/cpp/file_ref.h
@@ -5,6 +5,7 @@
#ifndef PPAPI_CPP_FILE_REF_H_
#define PPAPI_CPP_FILE_REF_H_
+#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/cpp/resource.h"
@@ -16,8 +17,10 @@
namespace pp {
-class CompletionCallback;
+class DirectoryEntry;
class FileSystem;
+class CompletionCallback;
+template <typename T> class CompletionCallbackWithOutput;
/// The <code>FileRef</code> class represents a "weak pointer" to a file in
/// a file system.
@@ -143,6 +146,39 @@
///
/// @return An int32_t containing an error code from <code>pp_errors.h</code>.
int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc);
+
+ /// Query() queries info about a file or directory. You must have access to
+ /// read this file or directory if it exists in the external filesystem.
+ ///
+ /// @param[in] callback A <code>CompletionCallbackWithOutput</code>
+ /// to be called upon completion of Query().
+ ///
+ /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ int32_t Query(const CompletionCallbackWithOutput<PP_FileInfo>& callback);
+
+ /// ReadDirectoryEntries() Reads all entries in the directory.
+ ///
+ /// @param[in] cc A <code>CompletionCallbackWithOutput</code> to be called
+ /// upon completion of ReadDirectoryEntries(). On success, the
+ /// directory entries will be passed to the given function.
+ ///
+ /// Normally you would use a CompletionCallbackFactory to allow callbacks to
+ /// be bound to your class. See completion_callback_factory.h for more
+ /// discussion on how to use this. Your callback will generally look like:
+ ///
+ /// @code
+ /// void OnReadDirectoryEntries(
+ /// int32_t result,
+ /// const std::vector<DirectoryEntry>& entries) {
+ /// if (result == PP_OK)
+ /// // use entries...
+ /// }
+ /// @endcode
+ ///
+ /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ int32_t ReadDirectoryEntries(
+ const CompletionCallbackWithOutput< std::vector<DirectoryEntry> >&
+ callback);
};
} // namespace pp
diff --git a/ppapi/cpp/graphics_2d.cc b/ppapi/cpp/graphics_2d.cc
index f4cd645..3a766c8 100644
--- a/ppapi/cpp/graphics_2d.cc
+++ b/ppapi/cpp/graphics_2d.cc
@@ -22,6 +22,10 @@
return PPB_GRAPHICS_2D_INTERFACE_1_0;
}
+template <> const char* interface_name<PPB_Graphics2D_1_1>() {
+ return PPB_GRAPHICS_2D_INTERFACE_1_1;
+}
+
} // namespace
Graphics2D::Graphics2D() : Resource() {
@@ -36,12 +40,19 @@
const Size& size,
bool is_always_opaque)
: Resource() {
- if (!has_interface<PPB_Graphics2D_1_0>())
+ if (has_interface<PPB_Graphics2D_1_1>()) {
+ PassRefFromConstructor(get_interface<PPB_Graphics2D_1_1>()->Create(
+ instance.pp_instance(),
+ &size.pp_size(),
+ PP_FromBool(is_always_opaque)));
+ } else if (has_interface<PPB_Graphics2D_1_0>()) {
+ PassRefFromConstructor(get_interface<PPB_Graphics2D_1_0>()->Create(
+ instance.pp_instance(),
+ &size.pp_size(),
+ PP_FromBool(is_always_opaque)));
+ } else {
return;
- PassRefFromConstructor(get_interface<PPB_Graphics2D_1_0>()->Create(
- instance.pp_instance(),
- &size.pp_size(),
- PP_FromBool(is_always_opaque)));
+ }
if (!is_null()) {
// Only save the size if allocation succeeded.
size_ = size;
@@ -59,38 +70,57 @@
void Graphics2D::PaintImageData(const ImageData& image,
const Point& top_left) {
- if (!has_interface<PPB_Graphics2D_1_0>())
- return;
- get_interface<PPB_Graphics2D_1_0>()->PaintImageData(pp_resource(),
- image.pp_resource(),
- &top_left.pp_point(),
- NULL);
+ if (has_interface<PPB_Graphics2D_1_1>()) {
+ get_interface<PPB_Graphics2D_1_1>()->PaintImageData(pp_resource(),
+ image.pp_resource(),
+ &top_left.pp_point(),
+ NULL);
+ } else if (has_interface<PPB_Graphics2D_1_0>()) {
+ get_interface<PPB_Graphics2D_1_0>()->PaintImageData(pp_resource(),
+ image.pp_resource(),
+ &top_left.pp_point(),
+ NULL);
+ }
}
void Graphics2D::PaintImageData(const ImageData& image,
const Point& top_left,
const Rect& src_rect) {
- if (!has_interface<PPB_Graphics2D_1_0>())
- return;
- get_interface<PPB_Graphics2D_1_0>()->PaintImageData(pp_resource(),
- image.pp_resource(),
- &top_left.pp_point(),
- &src_rect.pp_rect());
+ if (has_interface<PPB_Graphics2D_1_1>()) {
+ get_interface<PPB_Graphics2D_1_1>()->PaintImageData(pp_resource(),
+ image.pp_resource(),
+ &top_left.pp_point(),
+ &src_rect.pp_rect());
+ } else if (has_interface<PPB_Graphics2D_1_0>()) {
+ get_interface<PPB_Graphics2D_1_0>()->PaintImageData(pp_resource(),
+ image.pp_resource(),
+ &top_left.pp_point(),
+ &src_rect.pp_rect());
+ }
}
void Graphics2D::Scroll(const Rect& clip, const Point& amount) {
- if (!has_interface<PPB_Graphics2D_1_0>())
- return;
- get_interface<PPB_Graphics2D_1_0>()->Scroll(pp_resource(),
- &clip.pp_rect(),
- &amount.pp_point());
+ if (has_interface<PPB_Graphics2D_1_1>()) {
+ get_interface<PPB_Graphics2D_1_1>()->Scroll(pp_resource(),
+ &clip.pp_rect(),
+ &amount.pp_point());
+ } else if (has_interface<PPB_Graphics2D_1_0>()) {
+ get_interface<PPB_Graphics2D_1_0>()->Scroll(pp_resource(),
+ &clip.pp_rect(),
+ &amount.pp_point());
+ }
}
void Graphics2D::ReplaceContents(ImageData* image) {
- if (!has_interface<PPB_Graphics2D_1_0>())
+ if (has_interface<PPB_Graphics2D_1_1>()) {
+ get_interface<PPB_Graphics2D_1_1>()->ReplaceContents(pp_resource(),
+ image->pp_resource());
+ } else if (has_interface<PPB_Graphics2D_1_0>()) {
+ get_interface<PPB_Graphics2D_1_0>()->ReplaceContents(pp_resource(),
+ image->pp_resource());
+ } else {
return;
- get_interface<PPB_Graphics2D_1_0>()->ReplaceContents(pp_resource(),
- image->pp_resource());
+ }
// On success, reset the image data. This is to help prevent people
// from continuing to use the resource which will result in artifacts.
@@ -98,10 +128,28 @@
}
int32_t Graphics2D::Flush(const CompletionCallback& cc) {
- if (!has_interface<PPB_Graphics2D_1_0>())
+ if (has_interface<PPB_Graphics2D_1_1>()) {
+ return get_interface<PPB_Graphics2D_1_1>()->Flush(
+ pp_resource(), cc.pp_completion_callback());
+ } else if (has_interface<PPB_Graphics2D_1_0>()) {
+ return get_interface<PPB_Graphics2D_1_0>()->Flush(
+ pp_resource(), cc.pp_completion_callback());
+ } else {
return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_Graphics2D_1_0>()->Flush(
- pp_resource(), cc.pp_completion_callback());
+ }
+}
+
+bool Graphics2D::SetScale(float scale) {
+ if (!has_interface<PPB_Graphics2D_1_1>())
+ return false;
+ return PP_ToBool(get_interface<PPB_Graphics2D_1_1>()->SetScale(pp_resource(),
+ scale));
+}
+
+float Graphics2D::GetScale() {
+ if (!has_interface<PPB_Graphics2D_1_1>())
+ return 1.0f;
+ return get_interface<PPB_Graphics2D_1_1>()->GetScale(pp_resource());
}
} // namespace pp
diff --git a/ppapi/cpp/graphics_2d.h b/ppapi/cpp/graphics_2d.h
index 0ce6641..c6a2390 100644
--- a/ppapi/cpp/graphics_2d.h
+++ b/ppapi/cpp/graphics_2d.h
@@ -41,7 +41,7 @@
/// associated.
///
/// @param[in] size The size of the 2D graphics context in the browser,
- /// measured in device pixels.
+ /// measured in pixels. See <code>SetScale()</code> for more information.
///
/// @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag
/// to true if you know that you will be painting only opaque data to this
@@ -58,7 +58,7 @@
/// A destructor that decrements the reference count of a
/// <code>Graphics2D</code> object made using the previous copy constructor.
- /// It is possible that the destructor does not toally destroy the underlying
+ /// It is possible that the destructor does not totally destroy the underlying
/// 2D context if there are outstanding references to it.
virtual ~Graphics2D();
@@ -74,7 +74,7 @@
/// Getter function for returning size of the 2D graphics context.
///
- /// @return The size of the 2D graphics context measured in device pixels.
+ /// @return The size of the 2D graphics context measured in pixels.
const Size& size() const { return size_; }
/// PaintImageData() enqueues a paint command of the given image into
@@ -260,6 +260,30 @@
// for it.
int32_t Flush(const CompletionCallback& cc);
+ /// SetScale() sets the scale factor that will be applied when painting the
+ /// graphics context onto the output device. Typically, if rendering at device
+ /// resolution is desired, the context would be created with the width and
+ /// height scaled up by the view's GetDeviceScale and SetScale called with a
+ /// scale of 1.0 / GetDeviceScale(). For example, if the view resource passed
+ /// to DidChangeView has a rectangle of (w=200, h=100) and a device scale of
+ /// 2.0, one would call Create with a size of (w=400, h=200) and then call
+ /// SetScale with 0.5. One would then treat each pixel in the context as a
+ /// single device pixel.
+ ///
+ /// @param[in] scale The scale to apply when painting.
+ ///
+ /// @return Returns <code>true</code> on success or <code>false</code>
+ /// if the resource is invalid or the scale factor is 0 or less.
+ bool SetScale(float scale);
+
+ /// GetScale() gets the scale factor that will be applied when painting the
+ /// graphics context onto the output device.
+ ///
+ /// @return Returns the scale factor for the graphics context. If the resource
+ /// is invalid, 0.0 will be returned. The default scale for a graphics context
+ /// is 1.0.
+ float GetScale();
+
private:
Size size_;
};
diff --git a/ppapi/cpp/graphics_3d.h b/ppapi/cpp/graphics_3d.h
index 56383da..31af687 100644
--- a/ppapi/cpp/graphics_3d.h
+++ b/ppapi/cpp/graphics_3d.h
@@ -21,7 +21,7 @@
/// Default constructor for creating an is_null() Graphics3D object.
Graphics3D();
- /// A constructor for creating and and initializing a 3D rendering context.
+ /// A constructor for creating and initializing a 3D rendering context.
/// The returned context is created off-screen and must be attached
/// to a module instance using <code>Instance::BindGraphics</code> to draw on
/// the web page.
@@ -109,7 +109,7 @@
///
/// <strong>Example:</strong>
///
- /// <code>
+ /// @code
/// int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0,
/// PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0,
/// PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0,
@@ -118,7 +118,7 @@
/// int red_bits = attrib_list[1];
/// int green_bits = attrib_list[3];
/// int blue_bits = attrib_list[5];
- /// </code>
+ /// @endcode
///
/// This example retrieves the values for rgb bits in the color buffer.
int32_t GetAttribs(int32_t attrib_list[]) const;
diff --git a/ppapi/cpp/input_event.h b/ppapi/cpp/input_event.h
index 379e0e8..44de16c 100644
--- a/ppapi/cpp/input_event.h
+++ b/ppapi/cpp/input_event.h
@@ -29,7 +29,7 @@
/// appropriate event-specific object to query the properties.
///
/// <strong>Example:</strong>
-/// <code>
+/// @code
///
/// bool MyInstance::HandleInputEvent(const pp::InputEvent& event) {
/// switch (event.GetType()) {
@@ -41,7 +41,7 @@
/// return false;
/// }
///
-/// </code>
+/// @endcode
class InputEvent : public Resource {
public:
/// Default constructor that creates an is_null() InputEvent object.
@@ -103,13 +103,13 @@
/// This constructor manually constructs a mouse event from the provided
/// parameters.
///
- /// @param[in] instance The instance for which this event occured.
+ /// @param[in] instance The instance for which this event occurred.
///
/// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of
/// input event.
///
/// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
- /// when the event occured.
+ /// when the event occurred.
///
/// @param[in] modifiers A bit field combination of the
/// <code>PP_InputEvent_Modifier</code> flags.
@@ -119,7 +119,7 @@
/// mouse move, enter, and leave events.
///
/// @param[in] mouse_position A <code>Point</code> containing the x and y
- /// position of the mouse when the eent occurred.
+ /// position of the mouse when the event occurred.
///
/// @param[in] click_count
// TODO(brettw) figure out exactly what this means.
@@ -178,10 +178,10 @@
/// Constructs a wheel input even from the given parameters.
///
- /// @param[in] instance The instance for which this event occured.
+ /// @param[in] instance The instance for which this event occurred.
///
/// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
- /// when the event occured.
+ /// when the event occurred.
///
/// @param[in] modifiers A bit field combination of the
/// <code>PP_InputEvent_Modifier</code> flags.
@@ -216,7 +216,7 @@
/// possible, for example, on some trackpads and newer mice that don't have
/// "clicks".
///
- /// @return The vertial and horizontal scroll values. The units are either in
+ /// @return The vertical and horizontal scroll values. The units are either in
/// pixels (when scroll_by_page is false) or pages (when scroll_by_page is
/// true). For example, y = -3 means scroll up 3 pixels when scroll_by_page
/// is false, and scroll up 3 pages when scroll_by_page is true.
@@ -263,13 +263,13 @@
/// Constructs a keyboard input even from the given parameters.
///
- /// @param[in] instance The instance for which this event occured.
+ /// @param[in] instance The instance for which this event occurred.
///
/// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of
/// input event.
///
/// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
- /// when the event occured.
+ /// when the event occurred.
///
/// @param[in] modifiers A bit field combination of the
/// <code>PP_InputEvent_Modifier</code> flags.
@@ -311,13 +311,13 @@
/// Constructs a touch input even from the given parameters.
///
- /// @param[in] instance The instance for which this event occured.
+ /// @param[in] instance The instance for which this event occurred.
///
/// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of
/// input event.
///
/// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
- /// when the event occured.
+ /// when the event occurred.
///
/// @param[in] modifiers A bit field combination of the
/// <code>PP_InputEvent_Modifier</code> flags.
diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h
index 00eaadc..48bca90 100644
--- a/ppapi/cpp/instance.h
+++ b/ppapi/cpp/instance.h
@@ -139,7 +139,7 @@
/// the clip when the instance is partially visible. Instead, update the
/// entire region. The time saved doing partial paints is usually not
/// significant and it can create artifacts when scrolling (this notification
- /// is sent asynchronously from scolling so there can be flashes of old
+ /// is sent asynchronously from scrolling so there can be flashes of old
/// content in the exposed regions).
virtual void DidChangeView(const Rect& position, const Rect& clip);
@@ -250,7 +250,7 @@
/// the instance on which it was invoked, with <code>message</code> being a
/// string <code>Var</code> containing "Hello world!"
///
- /// <code>
+ /// @code{.html}
///
/// <body>
/// <object id="plugin"
@@ -260,7 +260,7 @@
/// </script>
/// </body>
///
- /// </code>
+ /// @endcode
///
/// Refer to PostMessage() for sending messages to JavaScript.
///
@@ -333,7 +333,7 @@
/// do optimizations for scroll or touch events that can be processed
/// substantially faster if it knows there are no non-default receivers for
/// that message. Requesting that such messages be delivered, even if they are
- /// processed very quickly, may have a noticable effect on the performance of
+ /// processed very quickly, may have a noticeable effect on the performance of
/// the page.
///
/// When requesting input events through this function, the events will be
@@ -343,12 +343,12 @@
///
/// <strong>Example:</strong>
///
- /// <code>
+ /// @code
/// RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
/// RequestFilteringInputEvents(
/// PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
///
- /// </code>
+ /// @endcode
///
/// @param event_classes A combination of flags from
/// <code>PP_InputEvent_Class</code> that identifies the classes of events
@@ -381,13 +381,13 @@
///
/// <strong>Example:</strong>
///
- /// <code>
+ /// @code
///
/// RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
/// RequestFilteringInputEvents(
/// PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
///
- /// </code>
+ /// @endcode
///
/// @param event_classes A combination of flags from
/// <code>PP_InputEvent_Class</code> that identifies the classes of events
@@ -428,7 +428,7 @@
///
/// <strong>Example:</strong>
///
- /// <code>
+ /// @code{.html}
///
/// <body>
/// <object id="plugin"
@@ -441,15 +441,15 @@
/// </script>
/// </body>
///
- /// </code>
+ /// @endcode
///
/// The instance then invokes PostMessage() as follows:
///
- /// <code>
+ /// @code
///
/// PostMessage(pp::Var("Hello world!"));
///
- /// </code>
+ /// @endcode
///
/// The browser will pop-up an alert saying "Hello world!"
///
diff --git a/ppapi/cpp/logging.h b/ppapi/cpp/logging.h
index 97479a2..d0a4f5b 100644
--- a/ppapi/cpp/logging.h
+++ b/ppapi/cpp/logging.h
@@ -20,7 +20,7 @@
///
/// <strong>Example:</strong>
///
-/// <code>
+/// @code
/// if (!pointer) {
/// // Pointer wasn't valid! This shouldn't happen.
/// PP_NOTREACHED();
@@ -28,7 +28,7 @@
/// }
/// // Do stuff to the pointer, since you know it's valid.
/// pointer->DoSomething();
-/// </code>
+/// @endcode
#define PP_NOTREACHED() assert(false)
#endif // PPAPI_CPP_LOGGING_H_
diff --git a/ppapi/cpp/message_loop.h b/ppapi/cpp/message_loop.h
index fa38c66..9e28b2d 100644
--- a/ppapi/cpp/message_loop.h
+++ b/ppapi/cpp/message_loop.h
@@ -24,7 +24,8 @@
/// suddenly see their PP_Resource handles become invalid. In this case, calls
/// will fail with PP_ERROR_BADRESOURCE. If you need to access data associated
/// with your instance, you will probably want to create some kind of threadsafe
-/// proxy object that can handle asynchonous destruction of the instance object.
+/// proxy object that can handle asynchronous destruction of the instance
+/// object.
///
/// Typical usage:
/// On the main thread:
@@ -37,7 +38,7 @@
/// - Call AttachToCurrentThread() with the message loop resource.
/// - Call Run() with the message loop resource.
///
-/// Your callacks should look like this:
+/// Your callbacks should look like this:
/// void DoMyWork(void* user_data, int32_t status) {
/// if (status != PP_OK) {
/// Cleanup(); // e.g. free user_data.
@@ -199,7 +200,7 @@
/// @param callback A pointer to the completion callback to execute from the
/// message loop.
///
- /// @param delay_ms The number of millseconds to delay execution of the given
+ /// @param delay_ms The number of milliseconds to delay execution of the given
/// completion callback. Passing 0 means it will get queued normally and
/// executed in order.
///
diff --git a/ppapi/cpp/module.h b/ppapi/cpp/module.h
index 07cfea9..40de3b8 100644
--- a/ppapi/cpp/module.h
+++ b/ppapi/cpp/module.h
@@ -82,7 +82,7 @@
/// GetBrowserInterface() returns interfaces which the browser implements
/// (i.e. PPB interfaces).
- /// @param[in] interface_name The browser interface for the moduel to get.
+ /// @param[in] interface_name The browser interface for the module to get.
const void* GetBrowserInterface(const char* interface_name);
/// InstanceForPPInstance() returns the object associated with this
diff --git a/ppapi/cpp/mouse_cursor.h b/ppapi/cpp/mouse_cursor.h
index ec1374c..827d95c 100644
--- a/ppapi/cpp/mouse_cursor.h
+++ b/ppapi/cpp/mouse_cursor.h
@@ -26,7 +26,7 @@
/// <code>PP_MOUSECURSOR_TYPE_CUSTOM</code> and specify your image and hot
/// spot.
///
- /// @param[in] instance A handle indentifying the instance that the mouse
+ /// @param[in] instance A handle identifying the instance that the mouse
/// cursor will affect.
///
/// @param[in] type A <code>PP_MouseCursor_Type</code> identifying the type
@@ -39,7 +39,7 @@
/// When you are specifying a predefined cursor, this parameter should be a
/// default-constructed ImageData.
///
- /// @param[in] hot_spot When setting a custom cursor, this idenfifies the
+ /// @param[in] hot_spot When setting a custom cursor, this identifies the
/// pixel position within the given image of the "hot spot" of the cursor.
/// When specifying a stock cursor, this parameter is ignored.
///
diff --git a/ppapi/cpp/mouse_lock.h b/ppapi/cpp/mouse_lock.h
index c743aed..ed5b07a 100644
--- a/ppapi/cpp/mouse_lock.h
+++ b/ppapi/cpp/mouse_lock.h
@@ -26,16 +26,16 @@
/// composition.
///
/// <strong>Example (inheritance):</strong>
-/// <code>
+/// @code
/// class MyInstance : public pp::Instance, public pp::MouseLock {
/// class MyInstance() : pp::MouseLock(this) {
/// }
/// ...
/// };
-/// </code>
+/// @endcode
///
/// <strong>Example (composition):</strong>
-/// <code>
+/// @code
/// class MyMouseLock : public pp::MouseLock {
/// ...
/// };
@@ -46,7 +46,7 @@
///
/// MyMouseLock mouse_lock_;
/// };
-/// </code>
+/// @endcode
class MouseLock {
public:
/// A constructor for creating a <code>MouseLock</code>.
diff --git a/ppapi/cpp/output_traits.h b/ppapi/cpp/output_traits.h
index 889c612..1779e7a 100644
--- a/ppapi/cpp/output_traits.h
+++ b/ppapi/cpp/output_traits.h
@@ -9,8 +9,6 @@
#include "ppapi/c/pp_resource.h"
#include "ppapi/cpp/array_output.h"
-#include "ppapi/cpp/dev/directory_entry_dev.h"
-#include "ppapi/cpp/extensions/ext_output_traits.h"
#include "ppapi/cpp/resource.h"
/// @file
@@ -118,20 +116,16 @@
};
// The general templatized base class for all CallbackOutputTraits. This class
-// covers resources, extensions API output objects and POD (ints, structs, etc.)
-// by inheriting from the appropriate base class depending on whether the given
-// type derives from pp::Resource or ext::internal::OutputObjectBase. This trick
-// allows us to do this once rather than writing specializations for every
-// object type.
+// covers both resources and POD (ints, structs, etc.) by inheriting from the
+// appropriate base class depending on whether the given type derives from
+// pp::Resource. This trick allows us to do this once rather than writing
+// specializations for every resource object type.
template<typename T>
struct CallbackOutputTraits
- : public InheritIf<ResourceCallbackOutputTraits<T>,
- IsBaseOf<Resource, T>::value>,
- public InheritIf<ext::internal::ExtensionsCallbackOutputTraits<T>,
- IsBaseOf<ext::internal::OutputObjectBase, T>::value>,
- public InheritIf<GenericCallbackOutputTraits<T>,
- !IsBaseOf<Resource, T>::value &&
- !IsBaseOf<ext::internal::OutputObjectBase, T>::value> {
+ : public InheritIf<GenericCallbackOutputTraits<T>,
+ !IsBaseOf<Resource, T>::value>,
+ public InheritIf<ResourceCallbackOutputTraits<T>,
+ IsBaseOf<Resource, T>::value> {
};
// A specialization of CallbackOutputTraits for pp::Var output parameters.
@@ -204,21 +198,17 @@
}
};
-// Specialization of CallbackOutputTraits for vectors. This struct covers arrays
-// of resources, extensions API output objects and POD (ints, structs, etc.) by
-// inheriting from the appropriate base class depending on whether the given
-// type derives from pp::Resource or ext::internal::OutputObjectBase. This trick
-// allows us to do this once rather than writing specializations for every
-// object type.
+// Specialization of CallbackOutputTraits for vectors. This struct covers both
+// arrays of resources and arrays of POD (ints, structs, etc.) by inheriting
+// from the appropriate base class depending on whether the given type derives
+// from pp::Resource. This trick allows us to do this once rather than writing
+// specializations for every resource object type.
template<typename T>
struct CallbackOutputTraits< std::vector<T> >
- : public InheritIf<ResourceVectorCallbackOutputTraits<T>,
- IsBaseOf<Resource, T>::value>,
- public InheritIf<ext::internal::ExtensionsVectorCallbackOutputTraits<T>,
- IsBaseOf<ext::internal::OutputObjectBase, T>::value>,
- public InheritIf<GenericVectorCallbackOutputTraits<T>,
- !IsBaseOf<Resource, T>::value &&
- !IsBaseOf<ext::internal::OutputObjectBase, T>::value> {
+ : public InheritIf<GenericVectorCallbackOutputTraits<T>,
+ !IsBaseOf<Resource, T>::value>,
+ public InheritIf<ResourceVectorCallbackOutputTraits<T>,
+ IsBaseOf<Resource, T>::value> {
};
// A specialization of CallbackOutputTraits to provide the callback system
@@ -245,24 +235,6 @@
}
};
-// A specialization of CallbackOutputTraits to provide the callback system the
-// information on how to handle vectors of pp::DirectoryEntry_Dev. This converts
-// PP_DirectoryEntry_Dev to pp::DirectoryEntry_Dev when passing to the plugin.
-template<>
-struct CallbackOutputTraits< std::vector<pp::DirectoryEntry_Dev> > {
- typedef PP_ArrayOutput APIArgType;
- typedef DirectoryEntryArrayOutputAdapterWithStorage StorageType;
-
- static inline APIArgType StorageToAPIArg(StorageType& t) {
- return t.pp_array_output();
- }
-
- static inline std::vector<pp::DirectoryEntry_Dev>& StorageToPluginArg(
- StorageType& t) {
- return t.output();
- }
-};
-
} // namespace internal
} // namespace pp
diff --git a/ppapi/cpp/point.h b/ppapi/cpp/point.h
index 9daa6b5..c881bbd 100644
--- a/ppapi/cpp/point.h
+++ b/ppapi/cpp/point.h
@@ -101,7 +101,7 @@
}
/// Subtracts one Point from another Point by subtracting their x values
- /// and y values. Returnes a new point with the result.
+ /// and y values. Returns a new point with the result.
///
/// @param[in] other A Point.
///
@@ -240,7 +240,7 @@
}
/// Subtracts one Point from another Point by subtracting their x values
- /// and y values. Returnes a new point with the result.
+ /// and y values. Returns a new point with the result.
///
/// @param[in] other A FloatPoint.
///
diff --git a/ppapi/cpp/private/file_io_private.cc b/ppapi/cpp/private/file_io_private.cc
new file mode 100644
index 0000000..b0f5a00
--- /dev/null
+++ b/ppapi/cpp/private/file_io_private.cc
@@ -0,0 +1,40 @@
+// 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/private/file_io_private.h"
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_file_io_private.h"
+#include "ppapi/cpp/file_io.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_FileIO_Private>() {
+ return PPB_FILEIO_PRIVATE_INTERFACE_0_1;
+}
+
+} // namespace
+
+FileIO_Private::FileIO_Private()
+ : FileIO() {
+}
+
+FileIO_Private::FileIO_Private(const InstanceHandle& instance)
+ : FileIO(instance) {
+}
+
+int32_t FileIO_Private::RequestOSFileHandle(
+ const CompletionCallbackWithOutput<PassFileHandle>& cc) {
+ if (has_interface<PPB_FileIO_Private>())
+ return get_interface<PPB_FileIO_Private>()->RequestOSFileHandle(
+ pp_resource(),
+ cc.output(),
+ cc.pp_completion_callback());
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/private/file_io_private.h b/ppapi/cpp/private/file_io_private.h
new file mode 100644
index 0000000..6f0d06d
--- /dev/null
+++ b/ppapi/cpp/private/file_io_private.h
@@ -0,0 +1,29 @@
+// 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_CPP_PRIVATE_FILE_IO_PRIVATE_H_
+#define PPAPI_CPP_PRIVATE_FILE_IO_PRIVATE_H_
+
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/private/pp_file_handle.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/file_io.h"
+#include "ppapi/cpp/private/pass_file_handle.h"
+
+namespace pp {
+
+class FileIO;
+
+class FileIO_Private : public FileIO {
+ public:
+ FileIO_Private();
+ explicit FileIO_Private(const InstanceHandle& instance);
+
+ int32_t RequestOSFileHandle(
+ const CompletionCallbackWithOutput<PassFileHandle>& cc);
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_PRIVATE_FILE_IO_PRIVATE_H_
diff --git a/ppapi/cpp/private/network_list_private.cc b/ppapi/cpp/private/network_list_private.cc
index 35bb66a..1297aa3 100644
--- a/ppapi/cpp/private/network_list_private.cc
+++ b/ppapi/cpp/private/network_list_private.cc
@@ -64,7 +64,7 @@
if (!has_interface<PPB_NetworkList_Private>())
return;
- // Most netword interfaces don't have more than 3 network
+ // Most network interfaces don't have more than 3 network
// interfaces.
addresses->resize(3);
diff --git a/ppapi/cpp/private/pass_file_handle.cc b/ppapi/cpp/private/pass_file_handle.cc
new file mode 100644
index 0000000..5735d33
--- /dev/null
+++ b/ppapi/cpp/private/pass_file_handle.cc
@@ -0,0 +1,48 @@
+// 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/private/pass_file_handle.h"
+
+#ifdef _WIN32
+# include <windows.h>
+#else
+# include <unistd.h>
+#endif
+
+namespace pp {
+
+PassFileHandle::PassFileHandle()
+ : handle_(PP_kInvalidFileHandle) {
+}
+
+PassFileHandle::PassFileHandle(PP_FileHandle handle)
+ : handle_(handle) {
+}
+
+PassFileHandle::PassFileHandle(PassFileHandle& handle)
+ : handle_(handle.Release()) {
+}
+
+PassFileHandle::~PassFileHandle() {
+ Close();
+}
+
+PP_FileHandle PassFileHandle::Release() {
+ PP_FileHandle released = handle_;
+ handle_ = PP_kInvalidFileHandle;
+ return released;
+}
+
+void PassFileHandle::Close() {
+ if (handle_ != PP_kInvalidFileHandle) {
+#ifdef _WIN32
+ CloseHandle(handle_);
+#else
+ close(handle_);
+#endif
+ handle_ = PP_kInvalidFileHandle;
+ }
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/private/pass_file_handle.h b/ppapi/cpp/private/pass_file_handle.h
new file mode 100644
index 0000000..53f32dd
--- /dev/null
+++ b/ppapi/cpp/private/pass_file_handle.h
@@ -0,0 +1,75 @@
+// 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_CPP_PRIVATE_PASS_FILE_HANDLE_H_
+#define PPAPI_CPP_PRIVATE_PASS_FILE_HANDLE_H_
+
+#include "ppapi/c/private/pp_file_handle.h"
+#include "ppapi/cpp/output_traits.h"
+
+namespace pp {
+
+// A wrapper class for PP_FileHandle to make sure a file handle is
+// closed. This object takes the ownership of the file handle when it
+// is constructed. This loses the ownership when this object is
+// assigned to another object, just like auto_ptr.
+class PassFileHandle {
+ public:
+ PassFileHandle();
+ // This constructor takes the ownership of |handle|.
+ explicit PassFileHandle(PP_FileHandle handle);
+ // Moves the ownership of |handle| to this object.
+ PassFileHandle(PassFileHandle& handle);
+ ~PassFileHandle();
+
+ // Releases |handle_|. The caller must close the file handle returned.
+ PP_FileHandle Release();
+
+ private:
+ // PassFileHandleRef allows users to return PassFileHandle as a
+ // value. This technique is also used by auto_ptr_ref.
+ struct PassFileHandleRef {
+ PP_FileHandle handle;
+ explicit PassFileHandleRef(PP_FileHandle h)
+ : handle(h) {
+ }
+ };
+
+ public:
+ PassFileHandle(PassFileHandleRef ref)
+ : handle_(ref.handle) {
+ }
+
+ operator PassFileHandleRef() {
+ return PassFileHandleRef(Release());
+ }
+
+ private:
+ void operator=(const PassFileHandle&);
+
+ void Close();
+
+ PP_FileHandle handle_;
+};
+
+namespace internal {
+
+template<>
+struct CallbackOutputTraits<PassFileHandle> {
+ typedef PP_FileHandle* APIArgType;
+ typedef PP_FileHandle StorageType;
+
+ static inline APIArgType StorageToAPIArg(StorageType& t) {
+ return &t;
+ }
+
+ static inline PassFileHandle StorageToPluginArg(StorageType& t) {
+ return PassFileHandle(t);
+ }
+};
+
+} // namespace internal
+} // namespace pp
+
+#endif // PPAPI_CPP_PRIVATE_PASS_FILE_HANDLE_H_
diff --git a/ppapi/cpp/private/pdf.cc b/ppapi/cpp/private/pdf.cc
index e61cefc..753613c 100644
--- a/ppapi/cpp/private/pdf.cc
+++ b/ppapi/cpp/private/pdf.cc
@@ -4,6 +4,7 @@
#include "ppapi/cpp/private/pdf.h"
+#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
#include "ppapi/cpp/image_data.h"
#include "ppapi/cpp/instance_handle.h"
#include "ppapi/cpp/module_impl.h"
@@ -52,6 +53,29 @@
const PP_FontDescription_Dev* description,
PP_PrivateFontCharset charset) {
if (has_interface<PPB_PDF>()) {
+ PP_BrowserFont_Trusted_Description converted_desc;
+ converted_desc.face = description->face;
+ converted_desc.family = static_cast<PP_BrowserFont_Trusted_Family>(
+ description->family);
+ converted_desc.size = description->size;
+ converted_desc.weight = static_cast<PP_BrowserFont_Trusted_Weight>(
+ description->weight);
+ converted_desc.italic = description->italic;
+ converted_desc.small_caps = description->small_caps;
+ converted_desc.letter_spacing = description->letter_spacing;
+ converted_desc.word_spacing = description->word_spacing;
+ return get_interface<PPB_PDF>()->GetFontFileWithFallback(
+ instance.pp_instance(), &converted_desc, charset);
+ }
+ return 0;
+}
+
+// static
+PP_Resource PDF::GetFontFileWithFallback(
+ const InstanceHandle& instance,
+ const PP_BrowserFont_Trusted_Description* description,
+ PP_PrivateFontCharset charset) {
+ if (has_interface<PPB_PDF>()) {
return get_interface<PPB_PDF>()->GetFontFileWithFallback(
instance.pp_instance(), description, charset);
}
diff --git a/ppapi/cpp/private/pdf.h b/ppapi/cpp/private/pdf.h
index 570c0e7..893f9e3 100644
--- a/ppapi/cpp/private/pdf.h
+++ b/ppapi/cpp/private/pdf.h
@@ -9,6 +9,8 @@
#include "ppapi/c/private/ppb_pdf.h"
+struct PP_BrowserFont_Trusted_Description;
+
namespace pp {
class ImageData;
@@ -24,10 +26,16 @@
PP_ResourceString string_id);
static ImageData GetResourceImage(const InstanceHandle& instance,
PP_ResourceImage image_id);
+ // TODO(raymes): Remove this version when the PDF code is changed to use
+ // PP_BrowserFont_Trusted_Description.
static PP_Resource GetFontFileWithFallback(
const InstanceHandle& instance,
const PP_FontDescription_Dev* description,
PP_PrivateFontCharset charset);
+ static PP_Resource GetFontFileWithFallback(
+ const InstanceHandle& instance,
+ const PP_BrowserFont_Trusted_Description* description,
+ PP_PrivateFontCharset charset);
static bool GetFontTableForPrivateFontFile(PP_Resource font_file,
uint32_t table,
void* output,
diff --git a/ppapi/cpp/private/var_private.h b/ppapi/cpp/private/var_private.h
index 1c4cc8a..7cc0e31 100644
--- a/ppapi/cpp/private/var_private.h
+++ b/ppapi/cpp/private/var_private.h
@@ -16,7 +16,7 @@
}
// VarPrivate is a version of Var that exposes the private scripting API.
-// It's designed to be mostly interchangable with Var since most callers will
+// It's designed to be mostly interchangeable with Var since most callers will
// be dealing with Vars from various places.
class VarPrivate : public Var {
public:
diff --git a/ppapi/cpp/private/video_destination_private.cc b/ppapi/cpp/private/video_destination_private.cc
new file mode 100644
index 0000000..5233b5f
--- /dev/null
+++ b/ppapi/cpp/private/video_destination_private.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/cpp/private/video_destination_private.h"
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_video_destination_private.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/private/video_frame_private.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_VideoDestination_Private_0_1>() {
+ return PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1;
+}
+
+} // namespace
+
+VideoDestination_Private::VideoDestination_Private() {
+}
+
+VideoDestination_Private::VideoDestination_Private(
+ const InstanceHandle& instance) {
+ if (!has_interface<PPB_VideoDestination_Private_0_1>())
+ return;
+ PassRefFromConstructor(
+ get_interface<PPB_VideoDestination_Private_0_1>()->Create(
+ instance.pp_instance()));
+}
+
+VideoDestination_Private::VideoDestination_Private(
+ const VideoDestination_Private& other)
+ : Resource(other) {
+}
+
+VideoDestination_Private::VideoDestination_Private(PassRef,
+ PP_Resource resource)
+ : Resource(PASS_REF, resource) {
+}
+
+int32_t VideoDestination_Private::Open(const Var& stream_url,
+ const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoDestination_Private_0_1>()) {
+ int32_t result =
+ get_interface<PPB_VideoDestination_Private_0_1>()->Open(
+ pp_resource(),
+ stream_url.pp_var(),
+ cc.pp_completion_callback());
+ return result;
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t VideoDestination_Private::PutFrame(
+ const VideoFrame_Private& frame) {
+ if (has_interface<PPB_VideoDestination_Private_0_1>()) {
+ return get_interface<PPB_VideoDestination_Private_0_1>()->PutFrame(
+ pp_resource(),
+ &frame.pp_video_frame());
+ }
+ return PP_ERROR_NOINTERFACE;
+}
+
+void VideoDestination_Private::Close() {
+ if (has_interface<PPB_VideoDestination_Private_0_1>()) {
+ get_interface<PPB_VideoDestination_Private_0_1>()->Close(pp_resource());
+ }
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/private/video_destination_private.h b/ppapi/cpp/private/video_destination_private.h
new file mode 100644
index 0000000..a936485
--- /dev/null
+++ b/ppapi/cpp/private/video_destination_private.h
@@ -0,0 +1,87 @@
+// 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_CPP_PRIVATE_VIDEO_DESTINATION_PRIVATE_H_
+#define PPAPI_CPP_PRIVATE_VIDEO_DESTINATION_PRIVATE_H_
+
+#include <string>
+
+#include "ppapi/c/pp_time.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/pass_ref.h"
+#include "ppapi/cpp/resource.h"
+
+/// @file
+/// This file defines the <code>PPB_VideoDestination_Private</code> interface
+/// for a video destination resource, which sends video frames to a MediaStream
+/// video track in the browser.
+
+namespace pp {
+
+class InstanceHandle;
+class VideoFrame_Private;
+
+/// The <code>VideoDestination_Private</code> class contains methods for
+/// creating video destination resources and using them to send video frames to
+/// a MediaStream video track in the browser.
+class VideoDestination_Private : public Resource {
+ public:
+ /// Default constructor for creating a <code>VideoDestination_Private</code>
+ /// object.
+ VideoDestination_Private();
+
+ /// Constructor for creating a <code>VideoDestination_Private</code> for an
+ /// instance.
+ explicit VideoDestination_Private(const InstanceHandle& instance);
+
+ /// The copy constructor for <code>VideoDestination_Private</code>.
+ ///
+ /// @param[in] other A reference to a <code>VideoDestination_Private</code>.
+ VideoDestination_Private(const VideoDestination_Private& other);
+
+ /// A constructor used when you have received a PP_Resource as a return
+ /// value that has had its reference count incremented for you.
+ ///
+ /// @param[in] resource A PP_Resource corresponding to a video destination.
+ VideoDestination_Private(PassRef, PP_Resource resource);
+
+ /// Opens a video destination for putting frames.
+ ///
+ /// @param[in] stream_url A <code>Var</code> string holding a URL identifying
+ /// a MediaStream.
+ /// @param[in] callback A <code>CompletionCallback</code> to be
+ /// called upon completion of Open().
+ ///
+ /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ /// Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
+ /// destination.
+ /// Returns PP_ERROR_INPROGRESS if destination is already open.
+ /// Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
+ /// some other browser error.
+ int32_t Open(const Var& stream_url, const CompletionCallback& cc);
+
+ /// Puts a frame to the video destination.
+ ///
+ /// After this call, you should take care to release your references to the
+ /// image embedded in the video frame. If you paint to the image after
+ /// PutFrame(), there is the possibility of artifacts because the browser may
+ /// still be copying the frame to the stream.
+ ///
+ /// @param[in] frame A <code>VideoFrame_Private</code> holding the video
+ /// frame to send to the destination.
+ ///
+ /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ /// Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
+ /// destination.
+ /// Returns PP_ERROR_FAILED if destination is not open, if the video frame has
+ /// an invalid image data resource, or if some other browser error occurs.
+ int32_t PutFrame(const VideoFrame_Private& frame);
+
+ /// Closes the video destination.
+ void Close();
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_PRIVATE_VIDEO_DESTINATION_PRIVATE_H_
diff --git a/ppapi/cpp/private/video_frame_private.cc b/ppapi/cpp/private/video_frame_private.cc
new file mode 100644
index 0000000..9976647
--- /dev/null
+++ b/ppapi/cpp/private/video_frame_private.cc
@@ -0,0 +1,49 @@
+// 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/private/video_frame_private.h"
+
+namespace pp {
+
+VideoFrame_Private::VideoFrame_Private()
+ : video_frame_() {
+ video_frame_.image_data = image_data_.pp_resource();
+}
+
+VideoFrame_Private::VideoFrame_Private(const ImageData& image_data,
+ PP_TimeTicks timestamp)
+ : image_data_(image_data), video_frame_() {
+ video_frame_.timestamp = timestamp;
+ video_frame_.image_data = image_data_.pp_resource();
+}
+
+VideoFrame_Private::VideoFrame_Private(
+ PassRef,
+ const PP_VideoFrame_Private& pp_video_frame)
+ : video_frame_(pp_video_frame) {
+ // Take over the image_data resource in the frame.
+ image_data_ = ImageData(PASS_REF, video_frame_.image_data);
+}
+
+VideoFrame_Private::VideoFrame_Private(const VideoFrame_Private& other)
+ : video_frame_() {
+ set_image_data(other.image_data());
+ set_timestamp(other.timestamp());
+}
+
+VideoFrame_Private::~VideoFrame_Private() {
+}
+
+VideoFrame_Private& VideoFrame_Private::operator=(
+ const VideoFrame_Private& other) {
+ if (this == &other)
+ return *this;
+
+ set_image_data(other.image_data());
+ set_timestamp(other.timestamp());
+
+ return *this;
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/private/video_frame_private.h b/ppapi/cpp/private/video_frame_private.h
new file mode 100644
index 0000000..fed9d1d
--- /dev/null
+++ b/ppapi/cpp/private/video_frame_private.h
@@ -0,0 +1,96 @@
+// 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_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_
+#define PPAPI_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_
+
+#include "ppapi/c/pp_time.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/image_data.h"
+#include "ppapi/cpp/pass_ref.h"
+
+/// @file
+/// This file defines the struct used to hold a video frame.
+
+namespace pp {
+
+/// The <code>PP_VideoFrame_Private</code> struct represents a video frame.
+/// Video sources and destinations use frames to transfer video to and from
+/// the browser.
+class VideoFrame_Private {
+ public:
+ /// Default constructor for creating a <code>VideoFrame_Private</code> object.
+ VideoFrame_Private();
+
+ /// Constructor that takes an existing <code>PP_VideoFrame_Private</code>
+ /// structure. The 'image_data' PP_Resource field in the structure will be
+ /// managed by this instance.
+ VideoFrame_Private(PassRef, const PP_VideoFrame_Private& pp_video_frame);
+
+ /// Constructor that takes an existing <code>ImageData</code> instance and
+ /// a timestamp.
+ VideoFrame_Private(const ImageData& image_data, PP_TimeTicks timestamp);
+
+ /// The copy constructor for <code>VideoFrame_Private</code>.
+ ///
+ /// @param[in] other A reference to a <code>VideoFrame_Private</code>.
+ VideoFrame_Private(const VideoFrame_Private& other);
+
+ ~VideoFrame_Private();
+
+ /// The assignment operator for <code>VideoFrame_Private</code>.
+ ///
+ /// @param[in] other A reference to a <code>VideoFrame_Private</code>.
+ VideoFrame_Private& operator=(const VideoFrame_Private& other);
+
+ const PP_VideoFrame_Private& pp_video_frame() const {
+ return video_frame_;
+ }
+
+ ImageData image_data() const {
+ return image_data_;
+ }
+ void set_image_data(const ImageData& image_data) {
+ image_data_ = image_data;
+ // The assignment above manages the underlying PP_Resources. Copy the new
+ // one into our internal video frame struct.
+ video_frame_.image_data = image_data_.pp_resource();
+ }
+
+ PP_TimeTicks timestamp() const { return video_frame_.timestamp; }
+ void set_timestamp(PP_TimeTicks timestamp) {
+ video_frame_.timestamp = timestamp;
+ }
+
+ private:
+ ImageData image_data_; // This manages the PP_Resource in video_frame_.
+ PP_VideoFrame_Private video_frame_;
+};
+
+namespace internal {
+
+// A specialization of CallbackOutputTraits to provide the callback system the
+// information on how to handle pp::VideoFrame_Private. This converts
+// PP_VideoFrame_Private to pp::VideoFrame_Private when passing to the plugin,
+// and specifically manages the PP_Resource embedded in the video_frame_ field.
+template<>
+struct CallbackOutputTraits<pp::VideoFrame_Private> {
+ typedef PP_VideoFrame_Private* APIArgType;
+ typedef PP_VideoFrame_Private StorageType;
+
+ static inline APIArgType StorageToAPIArg(StorageType& t) {
+ return &t;
+ }
+
+ static inline pp::VideoFrame_Private StorageToPluginArg(StorageType& t) {
+ return pp::VideoFrame_Private(PASS_REF, t);
+ }
+};
+
+} // namespace internal
+
+} // namespace pp
+
+#endif // PPAPI_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_
diff --git a/ppapi/cpp/private/video_source_private.cc b/ppapi/cpp/private/video_source_private.cc
new file mode 100644
index 0000000..264c001
--- /dev/null
+++ b/ppapi/cpp/private/video_source_private.cc
@@ -0,0 +1,71 @@
+// 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/private/video_source_private.h"
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_video_source_private.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/private/video_frame_private.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_VideoSource_Private_0_1>() {
+ return PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1;
+}
+
+} // namespace
+
+VideoSource_Private::VideoSource_Private() {
+}
+
+VideoSource_Private::VideoSource_Private(const InstanceHandle& instance) {
+ if (!has_interface<PPB_VideoSource_Private_0_1>())
+ return;
+ PassRefFromConstructor(get_interface<PPB_VideoSource_Private_0_1>()->Create(
+ instance.pp_instance()));
+}
+
+VideoSource_Private::VideoSource_Private(const VideoSource_Private& other)
+ : Resource(other) {
+}
+
+VideoSource_Private::VideoSource_Private(PassRef, PP_Resource resource)
+ : Resource(PASS_REF, resource) {
+}
+
+int32_t VideoSource_Private::Open(const Var& stream_url,
+ const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoSource_Private_0_1>()) {
+ int32_t result =
+ get_interface<PPB_VideoSource_Private_0_1>()->Open(
+ pp_resource(),
+ stream_url.pp_var(), cc.pp_completion_callback());
+ return result;
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t VideoSource_Private::GetFrame(
+ const CompletionCallbackWithOutput<VideoFrame_Private>& cc) {
+ if (has_interface<PPB_VideoSource_Private_0_1>()) {
+ return get_interface<PPB_VideoSource_Private_0_1>()->GetFrame(
+ pp_resource(),
+ cc.output(), cc.pp_completion_callback());
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+void VideoSource_Private::Close() {
+ if (has_interface<PPB_VideoSource_Private_0_1>()) {
+ get_interface<PPB_VideoSource_Private_0_1>()->Close(pp_resource());
+ }
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/private/video_source_private.h b/ppapi/cpp/private/video_source_private.h
new file mode 100644
index 0000000..3d919bf
--- /dev/null
+++ b/ppapi/cpp/private/video_source_private.h
@@ -0,0 +1,84 @@
+// 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_CPP_PRIVATE_VIDEO_SOURCE_PRIVATE_H_
+#define PPAPI_CPP_PRIVATE_VIDEO_SOURCE_PRIVATE_H_
+
+#include <string>
+
+#include "ppapi/c/pp_time.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/pass_ref.h"
+#include "ppapi/cpp/resource.h"
+
+/// @file
+/// This file defines the <code>PPB_VideoSource_Private</code> interface for a
+/// video source resource, which receives video frames from a MediaStream video
+/// track in the browser.
+
+namespace pp {
+
+class InstanceHandle;
+class VideoFrame_Private;
+
+/// The <code>VideoSource_Private</code> class contains methods for creating
+/// video source resources and using them to receive video frames from a
+/// MediaStream video track in the browser.
+class VideoSource_Private : public Resource {
+ public:
+ /// Default constructor for creating a <code>VideoSource_Private</code>
+ /// object.
+ VideoSource_Private();
+
+ /// Constructor for creating a <code>VideoSource_Private</code> for an
+ /// instance.
+ explicit VideoSource_Private(const InstanceHandle& instance);
+
+ /// The copy constructor for <code>VideoSource_Private</code>.
+ ///
+ /// @param[in] other A reference to a <code>VideoSource_Private</code>.
+ VideoSource_Private(const VideoSource_Private& other);
+
+ /// A constructor used when you have received a PP_Resource as a return
+ /// value that has had its reference count incremented for you.
+ ///
+ /// @param[in] resource A PP_Resource corresponding to a video source.
+ VideoSource_Private(PassRef, PP_Resource resource);
+
+ /// Opens a video source for getting frames.
+ ///
+ /// @param[in] stream_url A <code>Var</code> string holding a URL identifying
+ /// a MediaStream.
+ /// @param[in] callback A <code>CompletionCallback</code> to be called upon
+ /// completion of Open().
+ ///
+ /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ /// Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
+ /// Returns PP_ERROR_INPROGRESS if source is already open.
+ /// Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
+ /// some other browser error.
+ int32_t Open(const Var& stream_url,
+ const CompletionCallback& cc);
+
+ /// Gets a frame from the video source.
+ ///
+ /// @param[out] frame A <code>VideoFrame_Private</code> to hold a video
+ /// frame from the source.
+ /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
+ /// called upon completion of ReceiveFrame().
+ ///
+ /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ /// Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
+ /// Returns PP_ERROR_FAILED if the source is not open, or if some other
+ /// browser error occurs.
+ int32_t GetFrame(
+ const CompletionCallbackWithOutput<VideoFrame_Private>& cc);
+
+ /// Closes the video source.
+ void Close();
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_PRIVATE_VIDEO_SOURCE_PRIVATE_H_
diff --git a/ppapi/cpp/rect.cc b/ppapi/cpp/rect.cc
index 39d8018..1e9ff05 100644
--- a/ppapi/cpp/rect.cc
+++ b/ppapi/cpp/rect.cc
@@ -89,14 +89,14 @@
int32_t rb = bottom();
if (rect.y() <= y() && rect.bottom() >= bottom()) {
- // complete int32_tersection in the y-direction
+ // complete intersection in the y-direction
if (rect.x() <= x()) {
rx = rect.right();
} else {
rr = rect.x();
}
} else if (rect.x() <= x() && rect.right() >= right()) {
- // complete int32_tersection in the x-direction
+ // complete intersection in the x-direction
if (rect.y() <= y()) {
ry = rect.bottom();
} else {
diff --git a/ppapi/cpp/rect.h b/ppapi/cpp/rect.h
index aa659d1..b47226b 100644
--- a/ppapi/cpp/rect.h
+++ b/ppapi/cpp/rect.h
@@ -282,7 +282,7 @@
/// Offset() moves the rectangle by a horizontal and vertical distance.
///
- /// @param[in] horizontal An int32_t value representing a horzontal
+ /// @param[in] horizontal An int32_t value representing a horizontal
/// move distance.
/// @param[in] vertical An int32_t value representing a vertical
/// move distance.
@@ -331,7 +331,7 @@
/// @return true if the rectangle fall inside this rectangle.
bool Contains(const Rect& rect) const;
- /// Insersects() determines if this rectangle intersects the specified
+ /// Intersects() determines if this rectangle intersects the specified
/// rectangle.
///
/// @param[in] rect A pointer to a <code>Rect</code>.
diff --git a/ppapi/cpp/url_loader.h b/ppapi/cpp/url_loader.h
index 3ed5fe6..00c086e 100644
--- a/ppapi/cpp/url_loader.h
+++ b/ppapi/cpp/url_loader.h
@@ -54,7 +54,7 @@
/// URLRequestInfo.
/// @param[in] cc A <code>CompletionCallback</code> to run on asynchronous
/// completion of Open(). This callback will run when response
- /// headers for the url are received or error occured. This callback
+ /// headers for the url are received or error occurred. This callback
/// will only run if Open() returns <code>PP_OK_COMPLETIONPENDING</code>.
///
/// @return An int32_t containing an error code from
@@ -67,7 +67,7 @@
///
/// @param[in] cc A <code>CompletionCallback</code> to run on asynchronous
/// completion of FollowRedirect(). This callback will run when response
- /// headers for the redirect url are received or error occured. This callback
+ /// headers for the redirect url are received or error occurred. This callback
/// will only run if FollowRedirect() returns
/// <code>PP_OK_COMPLETIONPENDING</code>.
///
diff --git a/ppapi/cpp/url_request_info.h b/ppapi/cpp/url_request_info.h
index 15c1713..c476be4 100644
--- a/ppapi/cpp/url_request_info.h
+++ b/ppapi/cpp/url_request_info.h
@@ -130,7 +130,7 @@
/// <code>PP_VARTYPE_STRING</code>) property for the request.
/// Refer to the
/// <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"Header
- /// Field Definitions</a> documentaiton for further information.
+ /// Field Definitions</a> documentation for further information.
///
/// @param[in] headers_string A <code>Var</code> containing the property
/// value.
diff --git a/ppapi/cpp/url_response_info.h b/ppapi/cpp/url_response_info.h
index 682fbf7..f9e60cf 100644
--- a/ppapi/cpp/url_response_info.h
+++ b/ppapi/cpp/url_response_info.h
@@ -15,7 +15,7 @@
class FileRef;
-/// URLResponseInfo provides an API for examaning URL responses.
+/// URLResponseInfo provides an API for examining URL responses.
class URLResponseInfo : public Resource {
public:
/// Default constructor. This constructor creates an <code>is_null</code>
diff --git a/ppapi/cpp/var.h b/ppapi/cpp/var.h
index 77bb5d8..fe30e10 100644
--- a/ppapi/cpp/var.h
+++ b/ppapi/cpp/var.h
@@ -132,7 +132,7 @@
/// This function determines if this <code>Var</code> is a dictionary.
///
- /// @return true if this <code>Var</code> is a dictinoary, otherwise false.
+ /// @return true if this <code>Var</code> is a dictionary, otherwise false.
bool is_dictionary() const { return var_.type == PP_VARTYPE_DICTIONARY; }
/// This function determines if this <code>Var</code> is an integer value.
@@ -237,7 +237,7 @@
std::string DebugString() const;
/// This class is used when calling the raw C PPAPI when using the C++
- /// <code>Var</code> as a possibe NULL exception. This class will handle
+ /// <code>Var</code> as a possible NULL exception. This class will handle
/// getting the address of the internal value out if it's non-NULL and
/// fixing up the reference count.
///
diff --git a/ppapi/cpp/var_array_buffer.cc b/ppapi/cpp/var_array_buffer.cc
index c05a8eb..0bc8ea5 100644
--- a/ppapi/cpp/var_array_buffer.cc
+++ b/ppapi/cpp/var_array_buffer.cc
@@ -20,6 +20,10 @@
} // namespace
+VarArrayBuffer::VarArrayBuffer() {
+ ConstructWithSize(0);
+}
+
VarArrayBuffer::VarArrayBuffer(const Var& var) : Var(var) {
if (!var.is_array_buffer()) {
PP_NOTREACHED();
@@ -28,13 +32,7 @@
}
VarArrayBuffer::VarArrayBuffer(uint32_t size_in_bytes) {
- if (has_interface<PPB_VarArrayBuffer_1_0>()) {
- var_ = get_interface<PPB_VarArrayBuffer_1_0>()->Create(size_in_bytes);
- } else {
- PP_NOTREACHED();
- var_ = PP_MakeNull();
- }
- is_managed_ = true;
+ ConstructWithSize(size_in_bytes);
}
pp::VarArrayBuffer& VarArrayBuffer::operator=(const VarArrayBuffer& other) {
@@ -74,4 +72,17 @@
PP_NOTREACHED();
}
+
+void VarArrayBuffer::ConstructWithSize(uint32_t size_in_bytes) {
+ PP_DCHECK(is_undefined());
+
+ if (has_interface<PPB_VarArrayBuffer_1_0>()) {
+ var_ = get_interface<PPB_VarArrayBuffer_1_0>()->Create(size_in_bytes);
+ } else {
+ PP_NOTREACHED();
+ var_ = PP_MakeNull();
+ }
+ is_managed_ = true;
+}
+
} // namespace pp
diff --git a/ppapi/cpp/var_array_buffer.h b/ppapi/cpp/var_array_buffer.h
index 74f97aa..7d1f9ad 100644
--- a/ppapi/cpp/var_array_buffer.h
+++ b/ppapi/cpp/var_array_buffer.h
@@ -19,7 +19,11 @@
/// <code>HandleMessage</code> functions of <code>Instance</code>.
class VarArrayBuffer : public Var {
public:
- /// Contruct a <code>VarArrayBuffer</code> given a var for which
+ /// The default constructor constructs a <code>VarArrayBuffer</code> which is
+ /// 0 byte long.
+ VarArrayBuffer();
+
+ /// Construct a <code>VarArrayBuffer</code> given a var for which
/// is_array_buffer() is true. This will refer to the same
/// <code>ArrayBuffer</code> as var, but allows you to access methods
/// specific to <code>VarArrayBuffer</code>.
@@ -27,7 +31,7 @@
/// @param[in] var An <code>ArrayBuffer</code> var.
explicit VarArrayBuffer(const Var& var);
- /// Construct a new <code>VarArrayBuffer_Dev</code> which is
+ /// Construct a new <code>VarArrayBuffer</code> which is
/// <code>size_in_bytes</code> bytes long and initialized to zero.
///
/// @param[in] size_in_bytes The size of the constructed
@@ -50,7 +54,7 @@
/// This function assigns one <code>VarArrayBuffer</code> to another
/// <code>VarArrayBuffer</code>. A Var's assignment operator is overloaded
/// here so that we can check for assigning a non-ArrayBuffer var to a
- /// <code>VarArrayBuffer_Dev</code>.
+ /// <code>VarArrayBuffer</code>.
///
/// @param[in] other The <code>VarArrayBuffer</code> to be assigned.
///
@@ -90,6 +94,9 @@
/// space. Use this if you want to save memory but might want to call Map()
/// to map the buffer again later.
void Unmap();
+
+ private:
+ void ConstructWithSize(uint32_t size_in_bytes);
};
} // namespace pp
diff --git a/ppapi/cpp/view.cc b/ppapi/cpp/view.cc
index 68c6e31..ce34785 100644
--- a/ppapi/cpp/view.cc
+++ b/ppapi/cpp/view.cc
@@ -15,6 +15,10 @@
return PPB_VIEW_INTERFACE_1_0;
}
+template <> const char* interface_name<PPB_View_1_1>() {
+ return PPB_VIEW_INTERFACE_1_1;
+}
+
} // namespace
View::View() : Resource() {
@@ -24,40 +28,71 @@
}
Rect View::GetRect() const {
- if (!has_interface<PPB_View_1_0>())
- return Rect();
PP_Rect out;
- if (PP_ToBool(get_interface<PPB_View_1_0>()->GetRect(pp_resource(), &out)))
- return Rect(out);
+ if (has_interface<PPB_View_1_1>()) {
+ if (PP_ToBool(get_interface<PPB_View_1_1>()->GetRect(pp_resource(), &out)))
+ return Rect(out);
+ } else if (has_interface<PPB_View_1_0>()) {
+ if (PP_ToBool(get_interface<PPB_View_1_0>()->GetRect(pp_resource(), &out)))
+ return Rect(out);
+ }
return Rect();
}
bool View::IsFullscreen() const {
- if (!has_interface<PPB_View_1_0>())
- return false;
- return PP_ToBool(get_interface<PPB_View_1_0>()->IsFullscreen(pp_resource()));
+ if (has_interface<PPB_View_1_1>()) {
+ return PP_ToBool(get_interface<PPB_View_1_1>()->IsFullscreen(
+ pp_resource()));
+ } else if (has_interface<PPB_View_1_0>()) {
+ return PP_ToBool(get_interface<PPB_View_1_0>()->IsFullscreen(
+ pp_resource()));
+ }
+ return false;
}
bool View::IsVisible() const {
- if (!has_interface<PPB_View_1_0>())
- return false;
- return PP_ToBool(get_interface<PPB_View_1_0>()->IsVisible(pp_resource()));
+ if (has_interface<PPB_View_1_1>())
+ return PP_ToBool(get_interface<PPB_View_1_1>()->IsVisible(pp_resource()));
+ else if (has_interface<PPB_View_1_0>())
+ return PP_ToBool(get_interface<PPB_View_1_0>()->IsVisible(pp_resource()));
+ return false;
}
bool View::IsPageVisible() const {
- if (!has_interface<PPB_View_1_0>())
- return true;
- return PP_ToBool(get_interface<PPB_View_1_0>()->IsPageVisible(pp_resource()));
+ if (has_interface<PPB_View_1_1>()) {
+ return PP_ToBool(get_interface<PPB_View_1_1>()->IsPageVisible(
+ pp_resource()));
+ } else if (has_interface<PPB_View_1_0>()) {
+ return PP_ToBool(get_interface<PPB_View_1_0>()->IsPageVisible(
+ pp_resource()));
+ }
+ return true;
}
Rect View::GetClipRect() const {
- if (!has_interface<PPB_View_1_0>())
- return Rect();
PP_Rect out;
- if (PP_ToBool(get_interface<PPB_View_1_0>()->GetClipRect(pp_resource(),
- &out)))
- return Rect(out);
+ if (has_interface<PPB_View_1_1>()) {
+ if (PP_ToBool(get_interface<PPB_View_1_1>()->GetClipRect(pp_resource(),
+ &out)))
+ return Rect(out);
+ } else if (has_interface<PPB_View_1_0>()) {
+ if (PP_ToBool(get_interface<PPB_View_1_0>()->GetClipRect(pp_resource(),
+ &out)))
+ return Rect(out);
+ }
return Rect();
}
+float View::GetDeviceScale() const {
+ if (has_interface<PPB_View_1_1>())
+ return get_interface<PPB_View_1_1>()->GetDeviceScale(pp_resource());
+ return 1.0f;
+}
+
+float View::GetCSSScale() const {
+ if (has_interface<PPB_View_1_1>())
+ return get_interface<PPB_View_1_1>()->GetCSSScale(pp_resource());
+ return 1.0f;
+}
+
} // namespace pp
diff --git a/ppapi/cpp/view.h b/ppapi/cpp/view.h
index 4494edd..7ffd168 100644
--- a/ppapi/cpp/view.h
+++ b/ppapi/cpp/view.h
@@ -118,6 +118,26 @@
/// @return The rectangle representing the visible part of the module
/// instance. If the resource is invalid, the empty rectangle is returned.
Rect GetClipRect() const;
+
+ /// GetDeviceScale returns the scale factor between device pixels and DIPs
+ /// (also known as logical pixels or UI pixels on some platforms). This allows
+ /// the developer to render their contents at device resolution, even as
+ /// coordinates / sizes are given in DIPs through the API.
+ ///
+ /// Note that the coordinate system for Pepper APIs is DIPs. Also note that
+ /// one DIP might not equal one CSS pixel - when page scale/zoom is in effect.
+ ///
+ /// @return A <code>float</code> value representing the number of device
+ /// pixels per DIP.
+ float GetDeviceScale() const;
+
+ /// GetCSSScale returns the scale factor between DIPs and CSS pixels. This
+ /// allows proper scaling between DIPs - as sent via the Pepper API - and CSS
+ /// pixel coordinates used for Web content.
+ ///
+ /// @return A <code>float</code> value representing the number of DIPs per CSS
+ /// pixel.
+ float GetCSSScale() const;
};
} // namespace pp
diff --git a/ppapi/examples/ime/ime.cc b/ppapi/examples/ime/ime.cc
index f5e2e44..6f3e655 100644
--- a/ppapi/examples/ime/ime.cc
+++ b/ppapi/examples/ime/ime.cc
@@ -245,7 +245,7 @@
int32_t target_segment,
const std::pair<uint32_t, uint32_t>& selection) {
if (HasSelection() && !text.empty())
- InsertText("");
+ InsertText(std::string());
composition_ = text;
segments_ = segments;
target_segment_ = target_segment;
@@ -344,7 +344,7 @@
if (!Focused())
return;
if (HasSelection()) {
- InsertText("");
+ InsertText(std::string());
} else {
size_t i = GetNextCharOffsetUtf8(utf8_text_, caret_pos_);
utf8_text_.erase(caret_pos_, i - caret_pos_);
@@ -356,7 +356,7 @@
if (!Focused())
return;
if (HasSelection()) {
- InsertText("");
+ InsertText(std::string());
} else if (caret_pos_ != 0) {
size_t i = GetPrevCharOffsetUtf8(utf8_text_, caret_pos_);
utf8_text_.erase(i, caret_pos_ - i);
@@ -565,8 +565,10 @@
it != textfield_.end();
++it) {
if (it->Focused()) {
- it->SetComposition("", std::vector< std::pair<uint32_t, uint32_t> >(),
- 0, std::make_pair(0, 0));
+ it->SetComposition(std::string(),
+ std::vector<std::pair<uint32_t, uint32_t> >(),
+ 0,
+ std::make_pair(0, 0));
return true;
}
}
diff --git a/ppapi/examples/scaling/scaling.cc b/ppapi/examples/scaling/scaling.cc
new file mode 100644
index 0000000..01d9265
--- /dev/null
+++ b/ppapi/examples/scaling/scaling.cc
@@ -0,0 +1,232 @@
+// 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 <sstream>
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/graphics_2d.h"
+#include "ppapi/cpp/image_data.h"
+#include "ppapi/cpp/input_event.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/rect.h"
+#include "ppapi/cpp/var.h"
+#include "ppapi/utility/completion_callback_factory.h"
+
+// When compiling natively on Windows, PostMessage can be #define-d to
+// something else.
+#ifdef PostMessage
+#undef PostMessage
+#endif
+
+// Example plugin to demonstrate usage of pp::View and pp::Graphics2D APIs for
+// rendering 2D graphics at device resolution. See Paint() for more details.
+class MyInstance : public pp::Instance {
+ public:
+ explicit MyInstance(PP_Instance instance)
+ : pp::Instance(instance),
+ width_(0),
+ height_(0),
+ pixel_width_(0),
+ pixel_height_(0),
+ device_scale_(1.0f),
+ css_scale_(1.0f),
+ using_device_pixels_(true) {
+ RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE |
+ PP_INPUTEVENT_CLASS_KEYBOARD);
+ }
+
+ virtual void DidChangeView(const pp::View& view) {
+ pp::Rect view_rect = view.GetRect();
+ if (view_rect.width() == width_ &&
+ view_rect.height() == height_ &&
+ view.GetDeviceScale() == device_scale_ &&
+ view.GetCSSScale() == css_scale_)
+ return; // We don't care about the position, only the size and scale.
+
+ width_ = view_rect.width();
+ height_ = view_rect.height();
+ device_scale_ = view.GetDeviceScale();
+ css_scale_ = view.GetCSSScale();
+
+ pixel_width_ = width_ * device_scale_;
+ pixel_height_ = height_ * device_scale_;
+
+ SetupGraphics();
+ }
+
+ virtual bool HandleInputEvent(const pp::InputEvent& event) {
+ switch (event.GetType()) {
+ case PP_INPUTEVENT_TYPE_MOUSEDOWN:
+ HandleMouseDown(event);
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ virtual void HandleMessage(const pp::Var& message_data) {
+ if (message_data.is_string()) {
+ std::string str = message_data.AsString();
+ if (str == "dip") {
+ if (using_device_pixels_) {
+ using_device_pixels_ = false;
+ SetupGraphics();
+ }
+ } else if (str == "device") {
+ if (!using_device_pixels_) {
+ using_device_pixels_ = true;
+ SetupGraphics();
+ }
+ } else if (str == "metrics") {
+ std::stringstream stream;
+ stream << "DIP (" << width_ << ", " << height_ << "), device pixels=("
+ << pixel_width_ << ", " << pixel_height_ <<"), device_scale="
+ << device_scale_ <<", css_scale=" << css_scale_;
+ PostMessage(stream.str());
+ }
+ }
+ }
+
+ private:
+ void HandleMouseDown(const pp::InputEvent& event) {
+ pp::MouseInputEvent mouse_event(event);
+ pp::Point position(mouse_event.GetPosition());
+ pp::Point position_device(position.x() * device_scale_,
+ position.y() * device_scale_);
+ std::stringstream stream;
+ stream << "Mousedown at DIP (" << position.x() << ", " << position.y()
+ << "), device pixel (" << position_device.x() << ", "
+ << position_device.y() << ")";
+ if (css_scale_ > 0.0f) {
+ pp::Point position_css(position.x() / css_scale_,
+ position.y() / css_scale_);
+ stream << ", CSS pixel (" << position_css.x() << ", " << position_css.y()
+ <<")";
+ } else {
+ stream <<", unknown CSS pixel. css_scale_=" << css_scale_;
+ }
+ PostMessage(stream.str());
+ }
+
+ void SetupGraphics() {
+ if (using_device_pixels_) {
+ // The plugin will treat 1 pixel in the device context as 1 device pixel.
+ // This will set up a properly-sized pp::Graphics2D, and tell Pepper
+ // to apply the correct scale so the resulting concatenated scale leaves
+ // each pixel in the device context as one on the display device.
+ device_context_ = pp::Graphics2D(this,
+ pp::Size(pixel_width_, pixel_height_),
+ true);
+ if (device_scale_ > 0.0f) {
+ // If SetScale is promoted to pp::Graphics2D, the dc_dev constructor
+ // can be removed, and this will become the following line instead.
+ // device_context_.SetScale(1.0f / device_scale_);
+ device_context_.SetScale(1.0f / device_scale_);
+ }
+ } else {
+ // The plugin will treat 1 pixel in the device context as one DIP.
+ device_context_ = pp::Graphics2D(this, pp::Size(width_, height_), true);
+ }
+ BindGraphics(device_context_);
+ Paint();
+ }
+
+ void Paint() {
+ int width = using_device_pixels_ ? pixel_width_ : width_;
+ int height = using_device_pixels_ ? pixel_height_ : height_;
+ pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
+ pp::Size(width, height), false);
+ if (image.is_null())
+ return;
+
+ // Painting here will demonstrate a few techniques:
+ // - painting a thin blue box and cross-hatch to show the finest resolution
+ // available.
+ // - painting a 25 DIP (logical pixel) green circle to show how objects of a
+ // fixed size in DIPs should be scaled if using a high-resolution
+ // pp::Graphics2D.
+ // - paiting a 50 CSS pixel red circle to show how objects of a fixed size
+ // in CSS pixels should be scaled if using a high-resolution
+ // pp::Graphics2D, as well as how to use the GetCSSScale value properly.
+
+ // Painting in "DIP resolution" mode (|using_device_pixels_| false) will
+ // demonstrate how unscaled graphics would look, even on a high-DPI device.
+ // Painting in "device resolution" mode (|using_device_pixels_| true) will
+ // show how scaled graphics would look crisper on a high-DPI device, in
+ // comparison to using unscaled graphics. Both modes should look identical
+ // when displayed on a non-high-DPI device (window.devicePixelRatio == 1).
+ // Toggling between "DIP resolution" mode and "device resolution" mode
+ // should not change the sizes of the circles.
+
+ // Changing the browser zoom level should cause the CSS circle to zoom, but
+ // not the DIP-sized circle.
+
+ // All painting here does not use any anti-aliasing.
+ float circle_1_radius = 25;
+ if (using_device_pixels_)
+ circle_1_radius *= device_scale_;
+
+ float circle_2_radius = 50 * css_scale_;
+ if (using_device_pixels_)
+ circle_2_radius *= device_scale_;
+
+ for (int y = 0; y < height; ++y) {
+ char* row = static_cast<char*>(image.data()) + (y * image.stride());
+ uint32_t* pixel = reinterpret_cast<uint32_t*>(row);
+ for (int x = 0; x < width; ++x) {
+ int dx = (width / 2) - x;
+ int dy = (height / 2) - y;
+ float dist_squared = (dx * dx) + (dy * dy);
+ if (x == 0 || y == 0 || x == width - 1 || y == width - 1 || x == y ||
+ width - x - 1 == y) {
+ *pixel++ = 0xFF0000FF;
+ } else if (dist_squared < circle_1_radius * circle_1_radius) {
+ *pixel++ = 0xFF00FF00;
+ } else if (dist_squared < circle_2_radius * circle_2_radius) {
+ *pixel++ = 0xFFFF0000;
+ } else {
+ *pixel++ = 0xFF000000;
+ }
+ }
+ }
+
+ device_context_.ReplaceContents(&image);
+ device_context_.Flush(pp::CompletionCallback(&OnFlush, this));
+ }
+
+ static void OnFlush(void* user_data, int32_t result) {}
+
+ pp::Graphics2D device_context_;
+ int width_;
+ int height_;
+ int pixel_width_;
+ int pixel_height_;
+ float device_scale_;
+ float css_scale_;
+ bool using_device_pixels_;
+};
+
+// This object is the global object representing this plugin library as long as
+// it is loaded.
+class MyModule : public pp::Module {
+ public:
+ MyModule() : pp::Module() {}
+ virtual ~MyModule() {}
+
+ // Override CreateInstance to create your customized Instance object.
+ virtual pp::Instance* CreateInstance(PP_Instance instance) {
+ return new MyInstance(instance);
+ }
+};
+
+namespace pp {
+
+// Factory function for your specialization of the Module object.
+Module* CreateModule() {
+ return new MyModule();
+}
+
+} // namespace pp
diff --git a/ppapi/examples/scaling/scaling.html b/ppapi/examples/scaling/scaling.html
new file mode 100644
index 0000000..983cbd6
--- /dev/null
+++ b/ppapi/examples/scaling/scaling.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+ <!--
+ 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.
+ -->
+<head>
+ <title>Pepper 2D Scaling Example</title>
+ <script>
+
+ function HandleMessage(message_event) {
+ if (message_event.data) {
+ console.log(message_event.data);
+ }
+ }
+
+ function AddListener() {
+ var plugin = document.getElementById("plugin");
+ plugin.addEventListener("message", HandleMessage, false);
+ }
+ document.addEventListener("DOMContentLoaded", AddListener, false);
+ </script>
+</head>
+
+<body>
+ <script>
+ function SendString(str) {
+ var plugin = document.getElementById("plugin");
+ plugin.postMessage(str);
+ }
+ </script>
+
+ <button onclick="SendString('dip')">DIP Res</button>
+ <button onclick="SendString('device')">Device Res</button>
+ <button onclick="SendString('metrics')">Metrics</button>
+ <hr>
+ <object id="plugin" type="application/x-ppapi-example-2d-scaling" width="200" height="200" border="2px"></object><br>
+Blue lines are one pixel thin, at either DIP or device resolution.<br>
+Green circle is 25 DIPs in radius.<br>
+Red circle is 50 CSS pixels in radius.<br>
+Mouse clicks in the plugin will generate a message in the JS console.<br>
+ <hr>
+</body>
diff --git a/ppapi/generators/idl_c_header.py b/ppapi/generators/idl_c_header.py
index 2c3cf2c..4ad27ba 100755
--- a/ppapi/generators/idl_c_header.py
+++ b/ppapi/generators/idl_c_header.py
@@ -139,11 +139,40 @@
out.Write(CommentLines(['*',' @}', '']) + '\n')
+def CheckTypedefs(filenode, releases):
+ """Checks that typedefs don't specify callbacks that take some structs.
+
+ See http://crbug.com/233439 for details.
+ """
+ cgen = CGen()
+ # TODO(teravest): Fix the following callback to pass PP_Var by pointer
+ # instead of by value.
+ node_whitelist = ['PP_Ext_Alarms_OnAlarm_Func_Dev_0_1']
+ for node in filenode.GetListOf('Typedef'):
+ if node.GetName() in node_whitelist:
+ continue
+ build_list = node.GetUniqueReleases(releases)
+ callnode = node.GetOneOf('Callspec')
+ if callnode:
+ for param in callnode.GetListOf('Param'):
+ if param.GetListOf('Array'):
+ continue
+ if cgen.GetParamMode(param) != 'in':
+ continue
+ t = param.GetType(build_list[0])
+ while t.IsA('Typedef'):
+ t = t.GetType(build_list[0])
+ if t.IsA('Struct'):
+ raise Exception('%s is a struct in callback %s. '
+ 'See http://crbug.com/233439' %
+ (t.GetName(), node.GetName()))
+
class HGen(GeneratorByFile):
def __init__(self):
Generator.__init__(self, 'C Header', 'cgen', 'Generate the C headers.')
def GenerateFile(self, filenode, releases, options):
+ CheckTypedefs(filenode, releases)
savename = GetHeaderFromNode(filenode, GetOption('dstroot'))
my_min, my_max = filenode.GetMinMax(releases)
if my_min > releases[-1] or my_max < releases[0]:
diff --git a/ppapi/generators/idl_c_proto.py b/ppapi/generators/idl_c_proto.py
index 7965630..fff3e65 100755
--- a/ppapi/generators/idl_c_proto.py
+++ b/ppapi/generators/idl_c_proto.py
@@ -398,7 +398,7 @@
def Compose(self, rtype, name, arrayspec, callspec, prefix, func_as_ptr,
- ptr_prefix, include_name, unsized_as_ptr):
+ include_name, unsized_as_ptr):
self.LogEnter('Compose: %s %s' % (rtype, name))
arrayspec = ''.join(arrayspec)
@@ -417,10 +417,10 @@
params = []
for ptype, pname, parray, pspec in callspec:
params.append(self.Compose(ptype, pname, parray, pspec, '', True,
- ptr_prefix='', include_name=True,
+ include_name=True,
unsized_as_ptr=unsized_as_ptr))
if func_as_ptr:
- name = '(%s*%s)' % (ptr_prefix, name)
+ name = '(*%s)' % name
if not params:
params = ['void']
out = '%s %s(%s)' % (rtype, name, ', '.join(params))
@@ -433,14 +433,13 @@
# Returns the 'C' style signature of the object
# prefix - A prefix for the object's name
# func_as_ptr - Formats a function as a function pointer
- # ptr_prefix - A prefix that goes before the "*" for a function pointer
# include_name - If true, include member name in the signature.
- # If false, leave it out. In any case, prefix and ptr_prefix
- # are always included.
+ # If false, leave it out. In any case, prefix is always
+ # included.
# include_version - if True, include version in the member name
#
def GetSignature(self, node, release, mode, prefix='', func_as_ptr=True,
- ptr_prefix='', include_name=True, include_version=False):
+ include_name=True, include_version=False):
self.LogEnter('GetSignature %s %s as func=%s' %
(node, mode, func_as_ptr))
rtype, name, arrayspec, callspec = self.GetComponents(node, release, mode)
@@ -451,7 +450,7 @@
unsized_as_ptr = not callspec
out = self.Compose(rtype, name, arrayspec, callspec, prefix,
- func_as_ptr, ptr_prefix, include_name, unsized_as_ptr)
+ func_as_ptr, include_name, unsized_as_ptr)
self.LogExit('Exit GetSignature: %s' % out)
return out
diff --git a/ppapi/generators/idl_gen_pnacl.py b/ppapi/generators/idl_gen_pnacl.py
index beb310f..1d7dc6e 100755
--- a/ppapi/generators/idl_gen_pnacl.py
+++ b/ppapi/generators/idl_gen_pnacl.py
@@ -42,7 +42,6 @@
'Generate the PNaCl shim.')
self.cgen = CGen()
self._skip_opt = False
- self._pnacl_attribute = '__attribute__((pnaclcall))'
############################################################
@@ -51,24 +50,6 @@
We do not generate the header files. """
return 'ppapi/generators/pnacl_shim.h'
- def GetGuardStart(self):
- return ('\n/* The PNaCl PPAPI shims are only needed on x86-64 and arm. */\n'
- '#if defined(__x86_64__) || defined(__arm__)\n\n')
-
- def GetGuardEnd(self):
- return '\n#endif\n'
-
- def InterfaceNeedsWrapper(self, iface, releases):
- """Return true if the interface has ANY methods that need wrapping.
- """
- if self._skip_opt:
- return True
- for release in iface.GetUniqueReleases(releases):
- version = iface.GetVersion(release)
- if self.InterfaceVersionNeedsWrapping(iface, version):
- return True
- return False
-
def InterfaceVersionNeedsWrapping(self, iface, version):
"""Return true if the interface+version has ANY methods that
@@ -119,20 +100,62 @@
############################################################
+ def ConvertByValueReturnType(self, ret, args_spec):
+ if self.TypeNeedsWrapping(ret, array_dims=[]):
+ args_spec = [(ret, '_struct_result', [], None)] + args_spec
+ ret2 = 'void'
+ wrap_return = True
+ else:
+ ret2 = ret
+ wrap_return = False
+ return wrap_return, ret2, args_spec
+
+
+ def ConvertByValueArguments(self, args_spec):
+ args = []
+ for type_str, name, array_dims, more_args in args_spec:
+ if self.TypeNeedsWrapping(type_str, array_dims):
+ type_str += '*'
+ args.append((type_str, name, array_dims, more_args))
+ return args
+
+
+ def FormatArgs(self, c_operator, args_spec):
+ args = []
+ for type_str, name, array_dims, more_args in args_spec:
+ if self.TypeNeedsWrapping(type_str, array_dims):
+ args.append(c_operator + name)
+ else:
+ args.append(name)
+ return ', '.join(args)
+
+
def GenerateWrapperForPPBMethod(self, iface, member):
result = []
func_prefix = self.WrapperMethodPrefix(iface.node, iface.release)
- sig = self.cgen.GetSignature(member, iface.release, 'store',
- func_prefix, False)
- result.append('static %s\n%s {\n' % (self._pnacl_attribute, sig))
- result.append(' const struct %s *iface = %s.real_iface;\n' %
- (iface.struct_name, self.GetWrapperInfoName(iface)))
ret, name, array, cspec = self.cgen.GetComponents(member,
iface.release,
'store')
- ret_str, args_str = self.GetReturnArgs(ret, cspec)
- result.append(' %siface->%s(%s);\n}\n\n' % (ret_str,
- member.GetName(), args_str))
+ wrap_return, ret2, cspec2 = self.ConvertByValueReturnType(ret, cspec)
+ cspec2 = self.ConvertByValueArguments(cspec2)
+ sig = self.cgen.Compose(ret2, name, array, cspec2,
+ prefix=func_prefix,
+ func_as_ptr=False,
+ include_name=True,
+ unsized_as_ptr=False)
+ result.append('static %s {\n' % sig)
+ result.append(' const struct %s *iface = %s.real_iface;\n' %
+ (iface.struct_name, self.GetWrapperInfoName(iface)))
+
+ return_prefix = ''
+ if wrap_return:
+ return_prefix = '*_struct_result = '
+ elif ret != 'void':
+ return_prefix = 'return '
+
+ result.append(' %siface->%s(%s);\n}\n\n' % (return_prefix,
+ member.GetName(),
+ self.FormatArgs('*', cspec)))
return result
@@ -144,24 +167,35 @@
result.append('static %s {\n' % sig)
result.append(' const struct %s *iface = %s.real_iface;\n' %
(iface.struct_name, self.GetWrapperInfoName(iface)))
- temp_fp = self.cgen.GetSignature(member, iface.release, 'return',
- 'temp_fp',
- func_as_ptr=True,
- ptr_prefix=self._pnacl_attribute + ' ',
- include_name=False)
- cast = self.cgen.GetSignature(member, iface.release, 'return',
- prefix='',
- func_as_ptr=True,
- ptr_prefix=self._pnacl_attribute + ' ',
- include_name=False)
- result.append(' %s = ((%s)iface->%s);\n' % (temp_fp,
- cast,
- member.GetName()))
ret, name, array, cspec = self.cgen.GetComponents(member,
iface.release,
'store')
- ret_str, args_str = self.GetReturnArgs(ret, cspec)
- result.append(' %stemp_fp(%s);\n}\n\n' % (ret_str, args_str))
+ wrap_return, ret2, cspec = self.ConvertByValueReturnType(ret, cspec)
+ cspec2 = self.ConvertByValueArguments(cspec)
+ temp_fp = self.cgen.Compose(ret2, name, array, cspec2,
+ prefix='temp_fp',
+ func_as_ptr=True,
+ include_name=False,
+ unsized_as_ptr=False)
+ cast = self.cgen.Compose(ret2, name, array, cspec2,
+ prefix='',
+ func_as_ptr=True,
+ include_name=False,
+ unsized_as_ptr=False)
+ result.append(' %s =\n ((%s)iface->%s);\n' % (temp_fp,
+ cast,
+ member.GetName()))
+ return_prefix = ''
+ if wrap_return:
+ result.append(' %s _struct_result;\n' % ret)
+ elif ret != 'void':
+ return_prefix = 'return '
+
+ result.append(' %stemp_fp(%s);\n' % (return_prefix,
+ self.FormatArgs('&', cspec)))
+ if wrap_return:
+ result.append(' return _struct_result;\n')
+ result.append('}\n\n')
return result
diff --git a/ppapi/generators/idl_gen_wrapper.py b/ppapi/generators/idl_gen_wrapper.py
index 5dcafbf..b828562 100644
--- a/ppapi/generators/idl_gen_wrapper.py
+++ b/ppapi/generators/idl_gen_wrapper.py
@@ -57,9 +57,6 @@
GetInterface functions).
Subclasses must implement GenerateWrapperForPPBMethod (and PPP).
- Optionally, subclasses can implement InterfaceNeedsWrapper to
- filter out interfaces that do not actually need wrappers (those
- interfaces can jump directly to the original interface functions).
"""
def __init__(self, wrapper_prefix, s1, s2, s3):
@@ -205,12 +202,6 @@
############################################################
- def InterfaceNeedsWrapper(self, iface, releases):
- """Return true if the interface has ANY methods that need wrapping.
- """
- return True
-
-
def OwnHeaderFile(self):
"""Return the header file that specifies the API of this wrapper.
We do not generate the header files. """
@@ -276,21 +267,6 @@
return '%s_%s_%s_' % (self.wrapper_prefix, release, iface.GetName())
- def GetReturnArgs(self, ret_type, args_spec):
- if ret_type != 'void':
- ret = 'return '
- else:
- ret = ''
- if args_spec:
- args = []
- for arg in args_spec:
- args.append(arg[1])
- args = ', '.join(args)
- else:
- args = ''
- return (ret, args)
-
-
def GenerateWrapperForPPBMethod(self, iface, member):
result = []
func_prefix = self.WrapperMethodPrefix(iface.node, iface.release)
@@ -357,15 +333,23 @@
if not member.InReleases([iface.release]):
continue
prefix = self.WrapperMethodPrefix(iface.node, iface.release)
- cast = self.cgen.GetSignature(member, iface.release, 'return',
- prefix='',
- func_as_ptr=True,
- ptr_prefix='',
- include_name=False)
- methods.append(' .%s = (%s)&%s%s' % (member.GetName(),
- cast,
- prefix,
- member.GetName()))
+ # Casts are necessary for the PPB_* wrappers because we must
+ # cast away "__attribute__((pnaclcall))". The PPP_* wrappers
+ # must match the default calling conventions and so don't have
+ # the attribute, so omitting casts for them provides a little
+ # extra type checking.
+ if iface.node.GetName().startswith('PPB_'):
+ cast = '(%s)' % self.cgen.GetSignature(
+ member, iface.release, 'return',
+ prefix='',
+ func_as_ptr=True,
+ include_name=False)
+ else:
+ cast = ''
+ methods.append(' .%s = %s&%s%s' % (member.GetName(),
+ cast,
+ prefix,
+ member.GetName()))
out.Write(' ' + ',\n '.join(methods) + '\n')
out.Write('};\n\n')
@@ -440,8 +424,6 @@
# Generate the includes.
self.GenerateIncludes(iface_releases, out)
- out.Write(self.GetGuardStart())
-
# Write out static helper functions (mystrcmp).
self.GenerateHelperFunctions(out)
@@ -462,6 +444,5 @@
# Write out the IDL-invariant functions.
self.GenerateFixedFunctions(out)
- out.Write(self.GetGuardEnd())
out.Close()
return 0
diff --git a/ppapi/generators/idl_outfile.py b/ppapi/generators/idl_outfile.py
index bb9b849..538267f 100755
--- a/ppapi/generators/idl_outfile.py
+++ b/ppapi/generators/idl_outfile.py
@@ -16,38 +16,6 @@
Option('diff', 'Generate a DIFF when saving the file.')
-def IsEquivalent(intext, outtext):
- if not intext: return False
- inlines = intext.split('\n')
- outlines = outtext.split('\n')
-
- # If number of lines don't match, it's a mismatch
- if len(inlines) != len(outlines): return False
-
- for index in range(len(inlines)):
- inline = inlines[index]
- outline = outlines[index]
-
- if inline == outline: continue
-
- # If the line is not an exact match, check for comment deltas
- inwords = inline.split()
- outwords = outline.split()
-
- if not inwords or not outwords: return False
- if inwords[0] != outwords[0] or inwords[0] not in ('/*', '*', '//'):
- return False
-
- # Neither the year, nor the modified date need an exact match
- if inwords[1] == 'Copyright':
- if inwords[4:] == outwords[4:]: continue
- elif inwords[1] == 'From': # Un-wrapped modified date.
- if inwords[0:4] == outwords[0:4]: continue
- elif inwords[1] == 'modified': # Wrapped modified date.
- if inwords[0:2] == outwords[0:2]: continue
- return False
- return True
-
#
# IDLOutFile
@@ -65,6 +33,53 @@
self.outlist = []
self.open = True
+ # Compare the old text to the current list of output lines.
+ def IsEquivalent_(self, oldtext):
+ if not oldtext: return False
+
+ oldlines = oldtext.split('\n')
+ curlines = (''.join(self.outlist)).split('\n')
+
+ # If number of lines don't match, it's a mismatch
+ if len(oldlines) != len(curlines):
+ return False
+
+ for index in range(len(oldlines)):
+ oldline = oldlines[index]
+ curline = curlines[index]
+
+ if oldline == curline: continue
+
+ curwords = curline.split()
+ oldwords = oldline.split()
+
+ # Unmatched lines must be the same length
+ if len(curwords) != len(oldwords):
+ return False
+
+ # If it's not a comment then it's a mismatch
+ if curwords[0] not in ['*', '/*', '//']:
+ return False
+
+ # Ignore changes to the Copyright year which is autogenerated
+ # /* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ if len(curwords) > 4 and curwords[1] == 'Copyright':
+ if curwords[4:] == oldwords[4:]: continue
+
+ # Ignore changes to auto generation timestamp when line unwrapped
+ # // From FILENAME.idl modified DAY MON DATE TIME YEAR.
+ # /* From FILENAME.idl modified DAY MON DATE TIME YEAR. */
+ if len(curwords) > 8 and curwords[1] == 'From':
+ if curwords[0:4] == oldwords[0:4]: continue
+
+ # Ignore changes to auto generation timestamp when line is wrapped
+ # * modified DAY MON DATE TIME YEAR.
+ if len(curwords) > 6 and curwords[1] == 'modified':
+ continue
+
+ return False
+ return True
+
# Return the file name
def Filename(self):
return self.filename
@@ -75,24 +90,22 @@
raise RuntimeError('Could not write to closed file %s.' % self.filename)
self.outlist.append(string)
- # Close the file
+ # Close the file, flushing it to disk
def Close(self):
filename = os.path.realpath(self.filename)
self.open = False
outtext = ''.join(self.outlist)
+
if not self.always_write:
if os.path.isfile(filename):
- intext = open(filename, 'rb').read()
- else:
- intext = ''
-
- if IsEquivalent(intext, outtext):
- if GetOption('verbose'):
- InfoOut.Log('Output %s unchanged.' % self.filename)
- return False
+ oldtext = open(filename, 'rb').read()
+ if self.IsEquivalent_(oldtext):
+ if GetOption('verbose'):
+ InfoOut.Log('Output %s unchanged.' % self.filename)
+ return False
if GetOption('diff'):
- for line in difflib.unified_diff(intext.split('\n'), outtext.split('\n'),
+ for line in difflib.unified_diff(oldtext.split('\n'), outtext.split('\n'),
'OLD ' + self.filename,
'NEW ' + self.filename,
n=1, lineterm=''):
diff --git a/ppapi/generators/idl_thunk.py b/ppapi/generators/idl_thunk.py
index 3358f18..9121cb0 100755
--- a/ppapi/generators/idl_thunk.py
+++ b/ppapi/generators/idl_thunk.py
@@ -35,6 +35,7 @@
"""Metadata about thunk body. Used for selecting which headers to emit."""
def __init__(self):
self._apis = set()
+ self._builtin_includes = set()
self._includes = set()
def AddApi(self, api):
@@ -49,6 +50,12 @@
def Includes(self):
return self._includes
+ def AddBuiltinInclude(self, include):
+ self._builtin_includes.add(include)
+
+ def BuiltinIncludes(self):
+ return self._builtin_includes
+
def _GetBaseFileName(filenode):
"""Returns the base name for output files, given the filenode.
@@ -83,32 +90,55 @@
return name
-def _MakeEnterLine(filenode, interface, arg, handle_errors, callback, meta):
+def _StripFileName(filenode):
+ """Strips path and dev, trusted, and private suffixes from the file name."""
+ api_basename = _GetBaseFileName(filenode)
+ if api_basename.endswith('_dev'):
+ api_basename = api_basename[:-len('_dev')]
+ if api_basename.endswith('_trusted'):
+ api_basename = api_basename[:-len('_trusted')]
+ if api_basename.endswith('_private'):
+ api_basename = api_basename[:-len('_private')]
+ return api_basename
+
+
+def _StripApiName(api_name):
+ """Strips Dev, Private, and Trusted suffixes from the API name."""
+ if api_name.endswith('Trusted'):
+ api_name = api_name[:-len('Trusted')]
+ if api_name.endswith('_Dev'):
+ api_name = api_name[:-len('_Dev')]
+ if api_name.endswith('_Private'):
+ api_name = api_name[:-len('_Private')]
+ return api_name
+
+
+def _MakeEnterLine(filenode, interface, member, arg, handle_errors, callback,
+ meta):
"""Returns an EnterInstance/EnterResource string for a function."""
+ api_name = _StripApiName(interface.GetName()) + '_API'
+ if member.GetProperty('api'): # Override API name.
+ manually_provided_api = True
+ # TODO(teravest): Automatically guess the API header file.
+ api_name = member.GetProperty('api')
+ else:
+ manually_provided_api = False
+
if arg[0] == 'PP_Instance':
if callback is None:
- return 'EnterInstance enter(%s);' % arg[1]
+ arg_string = arg[1]
else:
- return 'EnterInstance enter(%s, %s);' % (arg[1], callback)
+ arg_string = '%s, %s' % (arg[1], callback)
+ if interface.GetProperty('singleton') or member.GetProperty('singleton'):
+ if not manually_provided_api:
+ meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
+ return 'EnterInstanceAPI<%s> enter(%s);' % (api_name, arg_string)
+ else:
+ return 'EnterInstance enter(%s);' % arg_string
elif arg[0] == 'PP_Resource':
- api_name = interface.GetName()
- if api_name.endswith('Trusted'):
- api_name = api_name[:-len('Trusted')]
- if api_name.endswith('_Dev'):
- api_name = api_name[:-len('_Dev')]
- api_name += '_API'
-
enter_type = 'EnterResource<%s>' % api_name
- # The API header matches the file name, not the interface name.
- api_basename = _GetBaseFileName(filenode)
- if api_basename.endswith('_dev'):
- # Clip off _dev suffix.
- api_basename = api_basename[:-len('_dev')]
- if api_basename.endswith('_trusted'):
- # Clip off _trusted suffix.
- api_basename = api_basename[:-len('_trusted')]
- meta.AddApi(api_basename + '_api')
-
+ if not manually_provided_api:
+ meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
if callback is None:
return '%s enter(%s, %s);' % (enter_type, arg[1],
str(handle_errors).lower())
@@ -129,8 +159,10 @@
return ''.join(parts)
-def _IsTypeCheck(interface, node):
+def _IsTypeCheck(interface, node, args):
"""Returns true if node represents a type-checking function."""
+ if len(args) == 0 or args[0][0] != 'PP_Resource':
+ return False
return node.GetName() == 'Is%s' % _GetShortName(interface, ['Dev', 'Private'])
@@ -153,6 +185,7 @@
'uint16_t': '0',
'uint32_t': '0',
'uint64_t': '0',
+ 'void*': 'NULL'
}
if t in values:
return values[t]
@@ -191,6 +224,30 @@
return body
+def _GetOutputParams(member, release):
+ """Returns output parameters (and their types) for a member function.
+
+ Args:
+ member - IDLNode for the member function
+ release - Release to get output parameters for
+ Returns:
+ A list of name strings for all output parameters of the member
+ function.
+ """
+ out_params = []
+ callnode = member.GetOneOf('Callspec')
+ if callnode:
+ cgen = CGen()
+ for param in callnode.GetListOf('Param'):
+ mode = cgen.GetParamMode(param)
+ if mode == 'out':
+ # We use the 'store' mode when getting the parameter type, since we
+ # need to call sizeof() for memset().
+ _, pname, _, _ = cgen.GetComponents(param, release, 'store')
+ out_params.append(pname)
+ return out_params
+
+
def _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
include_version, meta):
"""Returns the body of a typical function.
@@ -205,6 +262,14 @@
include_version - whether to include the version in the invocation
meta - ThunkBodyMetadata for header hints
"""
+ if len(args) == 0:
+ # Calling into the "Shared" code for the interface seems like a reasonable
+ # heuristic when we don't have any arguments; some thunk code follows this
+ # convention today.
+ meta.AddApi('ppapi/shared_impl/%s_shared.h' % _StripFileName(filenode))
+ return 'return %s::%s();' % (_StripApiName(node.GetName()) + '_Shared',
+ member.GetName())
+
is_callback_func = args[len(args) - 1][0] == 'struct PP_CompletionCallback'
if is_callback_func:
@@ -216,9 +281,17 @@
if args[0][0] == 'PP_Instance':
call_arglist = ', '.join(a[1] for a in call_args)
function_container = 'functions'
- else:
+ elif args[0][0] == 'PP_Resource':
call_arglist = ', '.join(a[1] for a in call_args[1:])
function_container = 'object'
+ else:
+ # Calling into the "Shared" code for the interface seems like a reasonable
+ # heuristic when the first argument isn't a PP_Instance or a PP_Resource;
+ # some thunk code follows this convention today.
+ meta.AddApi('ppapi/shared_impl/%s_shared.h' % _StripFileName(filenode))
+ return 'return %s::%s(%s);' % (_StripApiName(node.GetName()) + '_Shared',
+ member.GetName(),
+ ', '.join(a[1] for a in args))
function_name = member.GetName()
if include_version:
@@ -230,32 +303,45 @@
call_arglist)
handle_errors = not (member.GetProperty('report_errors') == 'False')
+ out_params = _GetOutputParams(member, release)
if is_callback_func:
- body = '%s\n' % _MakeEnterLine(filenode, node, args[0], handle_errors,
- args[len(args) - 1][1], meta)
- body += 'if (enter.failed())\n'
- value = member.GetProperty('on_failure')
- if value is None:
- value = 'enter.retval()'
- body += ' return %s;\n' % value
- body += 'return enter.SetResult(%s);' % invocation
+ body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0],
+ handle_errors, args[len(args) - 1][1], meta)
+ failure_value = member.GetProperty('on_failure')
+ if failure_value is None:
+ failure_value = 'enter.retval()'
+ failure_return = 'return %s;' % failure_value
+ success_return = 'return enter.SetResult(%s);' % invocation
elif rtype == 'void':
- body = '%s\n' % _MakeEnterLine(filenode, node, args[0], handle_errors,
- None, meta)
- body += 'if (enter.succeeded())\n'
- body += ' %s;' % invocation
+ body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0],
+ handle_errors, None, meta)
+ failure_return = 'return;'
+ success_return = '%s;' % invocation # We don't return anything for void.
else:
- value = member.GetProperty('on_failure')
- if value is None:
- value = _GetDefaultFailureValue(rtype)
- if value is None:
- raise TGenError('No default value for rtype %s' % rtype)
+ body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0],
+ handle_errors, None, meta)
+ failure_value = member.GetProperty('on_failure')
+ if failure_value is None:
+ failure_value = _GetDefaultFailureValue(rtype)
+ if failure_value is None:
+ raise TGenError('There is no default value for rtype %s. '
+ 'Maybe you should provide an on_failure attribute '
+ 'in the IDL file.' % rtype)
+ failure_return = 'return %s;' % failure_value
+ success_return = 'return %s;' % invocation
- body = '%s\n' % _MakeEnterLine(filenode, node, args[0], handle_errors,
- None, meta)
+ if member.GetProperty('always_set_output_parameters'):
+ body += 'if (enter.failed()) {\n'
+ for param in out_params:
+ body += ' memset(%s, 0, sizeof(*%s));\n' % (param, param)
+ body += ' %s\n' % failure_return
+ body += '}\n'
+ body += '%s' % success_return
+ meta.AddBuiltinInclude('string.h')
+ else:
body += 'if (enter.failed())\n'
- body += ' return %s;\n' % value
- body += 'return %s;' % invocation
+ body += ' %s\n' % failure_return
+ body += '%s' % success_return
return body
@@ -274,15 +360,17 @@
"""
cgen = CGen()
rtype, name, arrays, args = cgen.GetComponents(member, release, 'return')
+ body = 'VLOG(4) << \"%s::%s()\";\n' % (node.GetName(), member.GetName())
- if _IsTypeCheck(node, member):
- body = '%s\n' % _MakeEnterLine(filenode, node, args[0], False, None, meta)
+ if _IsTypeCheck(node, member, args):
+ body += '%s\n' % _MakeEnterLine(filenode, node, member, args[0], False,
+ None, meta)
body += 'return PP_FromBool(enter.succeeded());'
- elif member.GetName() == 'Create':
- body = _MakeCreateMemberBody(node, member, args)
+ elif member.GetName() == 'Create' or member.GetName() == 'CreateTrusted':
+ body += _MakeCreateMemberBody(node, member, args)
else:
- body = _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
- include_version, meta)
+ body += _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
+ include_version, meta)
signature = cgen.GetSignature(member, release, 'return', func_as_ptr=False,
include_version=include_version)
@@ -337,6 +425,9 @@
thunk_out = IDLOutFile(savename)
body, meta = self.GenerateBody(thunk_out, filenode, releases, options)
+ # TODO(teravest): How do we handle repeated values?
+ if filenode.GetProperty('thunk_include'):
+ meta.AddInclude(filenode.GetProperty('thunk_include'))
self.WriteHead(thunk_out, filenode, releases, options, meta)
thunk_out.Write('\n\n'.join(body))
self.WriteTail(thunk_out, filenode, releases, options)
@@ -360,6 +451,10 @@
else:
out.Write('// %s,\n// %s\n\n' % (from_text, modified_text))
+ if meta.BuiltinIncludes():
+ for include in sorted(meta.BuiltinIncludes()):
+ out.Write('#include <%s>\n' % include)
+ out.Write('\n')
# TODO(teravest): Don't emit includes we don't need.
includes = ['ppapi/c/pp_errors.h',
@@ -370,7 +465,7 @@
'ppapi/thunk/thunk.h']
includes.append(_GetHeaderFileName(filenode))
for api in meta.Apis():
- includes.append('ppapi/thunk/%s.h' % api.lower())
+ includes.append('%s' % api.lower())
for i in meta.Includes():
includes.append(i)
for include in sorted(includes):
diff --git a/ppapi/generators/test_gen_pnacl/test_interfaces.idl b/ppapi/generators/test_gen_pnacl/test_interfaces.idl
index 78c21eb..f487a76 100644
--- a/ppapi/generators/test_gen_pnacl/test_interfaces.idl
+++ b/ppapi/generators/test_gen_pnacl/test_interfaces.idl
@@ -37,11 +37,11 @@
};
/*
- * static __attribute__((pnaclcall)) int32_t
- * Pnacl_M15_PPB_Iface_struct_wrap_foo1(int32_t a, struct some_struct b) {
+ * static int32_t
+ * Pnacl_M15_PPB_Iface_struct_wrap_foo1(int32_t a, struct some_struct* b) {
* const struct PPB_Iface_struct_wrap_2_0 *iface =
* Pnacl_WrapperInfo_PPB_Iface_struct_wrap_2_0.real_iface;
- * return iface->foo1(a, b);
+ * return iface->foo1(a, *b);
* }
*/
[version=2.0]
@@ -50,11 +50,11 @@
};
/*
- * static __attribute__((pnaclcall)) int32_t
- * Pnacl_M15_PPB_Iface_union_wrap_foo1(int32_t a, union some_union b) {
+ * static int32_t
+ * Pnacl_M15_PPB_Iface_union_wrap_foo1(int32_t a, union some_union* b) {
* const struct PPB_Iface_union_wrap_2_0 *iface =
* Pnacl_WrapperInfo_PPB_Iface_union_wrap_2_0.real_iface;
- * return iface->foo1(a, b);
+ * return iface->foo1(a, *b);
* }
*/
[version=2.0]
@@ -70,18 +70,19 @@
/*
- * static __attribute__((pnaclcall))
- * int32_t Pnacl_M13_PPB_SomeWrap_foo1(struct some_struct a) {
+ * static
+ * int32_t Pnacl_M13_PPB_SomeWrap_foo1(struct some_struct* a) {
* const struct PPB_SomeWrap_0_0 *iface =
* Pnacl_WrapperInfo_PPB_SomeWrap_0_0.real_iface;
- * return iface->foo1(a);
+ * return iface->foo1(*a);
* }
*
- * static __attribute__((pnaclcall))
- * struct some_struct Pnacl_M13_PPB_SomeWrap_foo2(int32_t a) {
+ * static
+ * void Pnacl_M13_PPB_SomeWrap_foo2(struct some_struct* _struct_result,
+ * int32_t a) {
* const struct PPB_SomeWrap_0_0 *iface =
* Pnacl_WrapperInfo_PPB_SomeWrap_0_0.real_iface;
- * return iface->foo2(a);
+ * *_struct_result = iface->foo2(a);
* }
*/
[version=0.0]
@@ -105,32 +106,36 @@
* static int32_t Pnacl_M13_PPP_SomeWrap_foo1(struct some_struct a) {
* const struct PPP_SomeWrap_0_0 *iface =
* Pnacl_WrapperInfo_PPP_SomeWrap_0_0.real_iface;
- * int32_t (__attribute__((pnaclcall)) *temp_fp)(struct some_struct a) =
- * ((int32_t (__attribute__((pnaclcall)) *)(struct some_struct a))iface->foo1);
- * return temp_fp(a);
+ * int32_t (*temp_fp)(struct some_struct* a) =
+ * ((int32_t (*)(struct some_struct* a))iface->foo1);
+ * return temp_fp(&a);
* }
*
* static struct some_struct Pnacl_M13_PPP_SomeWrap_foo2(int32_t a) {
* const struct PPP_SomeWrap_0_0 *iface =
* Pnacl_WrapperInfo_PPP_SomeWrap_0_0.real_iface;
- * struct some_struct (__attribute__((pnaclcall)) *temp_fp)(int32_t a) =
- * ((struct some_struct (__attribute__((pnaclcall)) *)(int32_t a))iface->foo2);
- * return temp_fp(a);
+ * void (*temp_fp)(struct some_struct* _struct_result, int32_t a) =
+ * ((void (*)(struct some_struct* _struct_result, int32_t a))iface->foo2);
+ * struct some_struct _struct_result;
+ * temp_fp(&_struct_result, a);
+ * return _struct_result;
* }
*
* static struct some_struct Pnacl_M14_PPP_SomeWrap_foo2(int32_t a) {
* const struct PPP_SomeWrap_1_0 *iface =
* Pnacl_WrapperInfo_PPP_SomeWrap_1_0.real_iface;
- * struct some_struct (__attribute__((pnaclcall)) *temp_fp)(int32_t a) =
- * ((struct some_struct (__attribute__((pnaclcall)) *)(int32_t a))iface->foo2);
- * return temp_fp(a);
+ * void (*temp_fp)(struct some_struct* _struct_result, int32_t a) =
+ * ((void (*)(struct some_struct* _struct_result, int32_t a))iface->foo2);
+ * struct some_struct _struct_result;
+ * temp_fp(&_struct_result, a);
+ * return _struct_result;
* }
*
* static int32_t Pnacl_M14_PPP_SomeWrap_foo1(const struct some_struct a[]) {
* const struct PPP_SomeWrap_1_0 *iface =
* Pnacl_WrapperInfo_PPP_SomeWrap_1_0.real_iface;
- * int32_t (__attribute__((pnaclcall)) *temp_fp)(const struct some_struct a[]) =
- * ((int32_t (__attribute__((pnaclcall)) *)(const struct some_struct a[]))iface->foo1);
+ * int32_t (*temp_fp)(const struct some_struct a[]) =
+ * ((int32_t (*)(const struct some_struct a[]))iface->foo1);
* return temp_fp(a);
* }
*/
diff --git a/ppapi/host/dispatch_host_message.h b/ppapi/host/dispatch_host_message.h
index b9e57dc..2498725 100644
--- a/ppapi/host/dispatch_host_message.h
+++ b/ppapi/host/dispatch_host_message.h
@@ -22,42 +22,42 @@
template <class ObjT, class Method>
inline int32_t DispatchResourceCall(ObjT* obj, Method method,
HostMessageContext* context,
- const Tuple0& arg) {
+ Tuple0& arg) {
return (obj->*method)(context);
}
template <class ObjT, class Method, class A>
inline int32_t DispatchResourceCall(ObjT* obj, Method method,
HostMessageContext* context,
- const Tuple1<A>& arg) {
+ Tuple1<A>& arg) {
return (obj->*method)(context, arg.a);
}
template<class ObjT, class Method, class A, class B>
inline int32_t DispatchResourceCall(ObjT* obj, Method method,
HostMessageContext* context,
- const Tuple2<A, B>& arg) {
+ Tuple2<A, B>& arg) {
return (obj->*method)(context, arg.a, arg.b);
}
template<class ObjT, class Method, class A, class B, class C>
inline int32_t DispatchResourceCall(ObjT* obj, Method method,
HostMessageContext* context,
- const Tuple3<A, B, C>& arg) {
+ Tuple3<A, B, C>& arg) {
return (obj->*method)(context, arg.a, arg.b, arg.c);
}
template<class ObjT, class Method, class A, class B, class C, class D>
inline int32_t DispatchResourceCall(ObjT* obj, Method method,
HostMessageContext* context,
- const Tuple4<A, B, C, D>& arg) {
+ Tuple4<A, B, C, D>& arg) {
return (obj->*method)(context, arg.a, arg.b, arg.c, arg.d);
}
template<class ObjT, class Method, class A, class B, class C, class D, class E>
inline int32_t DispatchResourceCall(ObjT* obj, Method method,
HostMessageContext* context,
- const Tuple5<A, B, C, D, E>& arg) {
+ Tuple5<A, B, C, D, E>& arg) {
return (obj->*method)(context, arg.a, arg.b, arg.c, arg.d, arg.e);
}
diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc
index 87dfb11..0b24e10 100644
--- a/ppapi/host/ppapi_host.cc
+++ b/ppapi/host/ppapi_host.cc
@@ -77,6 +77,9 @@
void PpapiHost::SendReply(const ReplyMessageContext& context,
const IPC::Message& msg) {
+ TRACE_EVENT2("ppapi proxy", "PpapiHost::SendReply",
+ "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(msg.type()));
if (context.sync_reply_msg) {
PpapiHostMsg_ResourceSyncCall::WriteReplyParams(context.sync_reply_msg,
context.params, msg);
@@ -88,6 +91,9 @@
void PpapiHost::SendUnsolicitedReply(PP_Resource resource,
const IPC::Message& msg) {
+ TRACE_EVENT2("ppapi proxy", "PpapiHost::SendUnsolicitedReply",
+ "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(msg.type()));
DCHECK(resource); // If this fails, host is probably pending.
proxy::ResourceMessageReplyParams params(resource, 0);
Send(new PpapiPluginMsg_ResourceReply(params, msg));
@@ -115,6 +121,9 @@
void PpapiHost::OnHostMsgResourceCall(
const proxy::ResourceMessageCallParams& params,
const IPC::Message& nested_msg) {
+ TRACE_EVENT2("ppapi proxy", "PpapiHost::OnHostMsgResourceCall",
+ "Class", IPC_MESSAGE_ID_CLASS(nested_msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(nested_msg.type()));
HostMessageContext context(params);
HandleResourceCall(params, nested_msg, &context);
}
@@ -123,6 +132,9 @@
const proxy::ResourceMessageCallParams& params,
const IPC::Message& nested_msg,
IPC::Message* reply_msg) {
+ TRACE_EVENT2("ppapi proxy", "PpapiHost::OnHostMsgResourceSyncCall",
+ "Class", IPC_MESSAGE_ID_CLASS(nested_msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(nested_msg.type()));
// Sync messages should always have callback set because they always expect
// a reply from the host.
DCHECK(params.has_callback());
@@ -153,6 +165,9 @@
const proxy::ResourceMessageCallParams& params,
PP_Instance instance,
const IPC::Message& nested_msg) {
+ TRACE_EVENT2("ppapi proxy", "PpapiHost::OnHostMsgResourceCreated",
+ "Class", IPC_MESSAGE_ID_CLASS(nested_msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(nested_msg.type()));
if (resources_.size() >= kMaxResourcesPerPlugin)
return;
@@ -197,6 +212,12 @@
NOTREACHED();
return;
}
+ // Invoking the HostResource destructor might result in looking up the
+ // PP_Resource in resources_. std::map is not well specified as to whether the
+ // element will be there or not. Therefore, we delay destruction of the
+ // HostResource until after we've made sure the map no longer contains
+ // |resource|.
+ linked_ptr<ResourceHost> delete_at_end_of_scope(found->second);
resources_.erase(found);
}
diff --git a/ppapi/host/resource_message_filter.cc b/ppapi/host/resource_message_filter.cc
index 887c184..ac9d324 100644
--- a/ppapi/host/resource_message_filter.cc
+++ b/ppapi/host/resource_message_filter.cc
@@ -17,9 +17,8 @@
ResourceMessageFilter::ResourceMessageFilter()
: reply_thread_message_loop_proxy_(
- MessageLoop::current()->message_loop_proxy()),
- resource_host_(NULL) {
-}
+ base::MessageLoop::current()->message_loop_proxy()),
+ resource_host_(NULL) {}
ResourceMessageFilter::ResourceMessageFilter(
scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy)
diff --git a/ppapi/host/resource_message_filter_unittest.cc b/ppapi/host/resource_message_filter_unittest.cc
index 3e4c0e0..7087866 100644
--- a/ppapi/host/resource_message_filter_unittest.cc
+++ b/ppapi/host/resource_message_filter_unittest.cc
@@ -51,7 +51,7 @@
const IPC::Message& last_handled_msg() const { return last_handled_msg_; }
const IPC::Message& last_reply_msg() const { return last_reply_msg_; }
- MessageLoop* last_reply_message_loop() const {
+ base::MessageLoop* last_reply_message_loop() const {
return last_reply_message_loop_;
}
@@ -74,7 +74,7 @@
virtual void SendReply(const ReplyMessageContext& context,
const IPC::Message& msg) OVERRIDE {
last_reply_msg_ = msg;
- last_reply_message_loop_ = MessageLoop::current();
+ last_reply_message_loop_ = base::MessageLoop::current();
g_handler_completion.Signal();
}
@@ -84,7 +84,7 @@
IPC::Message last_handled_msg_;
IPC::Message last_reply_msg_;
- MessageLoop* last_reply_message_loop_;
+ base::MessageLoop* last_reply_message_loop_;
};
// Dummy message filter which simply stores a copy of messages it handles.
@@ -108,7 +108,7 @@
}
const IPC::Message& last_handled_msg() const { return last_handled_msg_; }
- MessageLoop* last_message_loop() const { return last_message_loop_; }
+ base::MessageLoop* last_message_loop() const { return last_message_loop_; }
virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
const IPC::Message& msg) OVERRIDE {
@@ -121,7 +121,7 @@
const IPC::Message& msg,
HostMessageContext* context) OVERRIDE {
last_handled_msg_ = msg;
- last_message_loop_ = MessageLoop::current();
+ last_message_loop_ = base::MessageLoop::current();
if (msg.type() == msg_type_) {
context->reply_msg = IPC::Message(0, reply_msg_type_,
IPC::Message::PRIORITY_NORMAL);
@@ -136,7 +136,7 @@
uint32 reply_msg_type_;
IPC::Message last_handled_msg_;
- MessageLoop* last_message_loop_;
+ base::MessageLoop* last_message_loop_;
};
} // namespace
diff --git a/ppapi/native_client/chrome_main.scons b/ppapi/native_client/chrome_main.scons
index 3cf97ae..115d44a 100644
--- a/ppapi/native_client/chrome_main.scons
+++ b/ppapi/native_client/chrome_main.scons
@@ -56,7 +56,6 @@
# Disabled by Brad Chen 4 Sep to try to green Chromium
# nacl_integration tests
#'tests/nacl_browser/fault_injection/nacl.scons',
- 'tests/nacl_browser/pnacl_client_translator/nacl.scons',
]
ppapi_scons_files['untrusted_scons_files'] = [
diff --git a/ppapi/native_client/native_client.gyp b/ppapi/native_client/native_client.gyp
index 825d120..fdbb936 100644
--- a/ppapi/native_client/native_client.gyp
+++ b/ppapi/native_client/native_client.gyp
@@ -114,57 +114,27 @@
'-lgio',
'-Wl,--end-group',
'-lm',
+ '-Wl,<(NACL_RODATA_FLAG)=<(NACL_IRT_DATA_START)',
+ '-Wl,-Ttext-segment=<(NACL_IRT_TEXT_START)',
],
- # See http://code.google.com/p/nativeclient/issues/detail?id=2691.
- # The PNaCl linker (gold) does not implement the "-Ttext-segment"
- # option. However, with the linker for x86, the "-Ttext" option
- # does not affect the executable's base address.
- # TODO(olonho): simplify flags handling and avoid duplication
- # with NaCl logic.
'conditions': [
- ['target_arch!="arm"',
- {
- 'link_flags': [
- '-Wl,--section-start,.rodata=<(NACL_IRT_DATA_START)',
- '-Wl,-Ttext-segment=<(NACL_IRT_TEXT_START)',
- ]
- }, { # target_arch == "arm"
- # TODO(mcgrathr): This knowledge really belongs in
- # native_client/src/untrusted/irt/irt.gyp instead of here.
- # But that builds libirt_browser.a as bitcode, so a native
- # object does not fit happily there.
- 'sources': [
- '../../native_client/src/untrusted/irt/aeabi_read_tp.S',
- ],
- 'link_flags': [
- '-Wl,--section-start,.rodata=<(NACL_IRT_DATA_START)',
- '-Wl,-Ttext=<(NACL_IRT_TEXT_START)',
- '--pnacl-allow-native',
- '-arch', 'arm',
- '-Wt,-mtls-use-call',
- '-Wl,--pnacl-irt-link',
- ],
- },
- ],
- # untrusted.gypi and build_nexe.py currently build
- # both x86-32 and x86-64 whenever target_arch is some
- # flavor of x86. However, on non-windows platforms
- # we only need one architecture.
- ['OS!="win" and target_arch=="ia32"',
- {
- 'enable_x86_64': 0
- }
- ],
- ['OS!="win" and target_arch=="x64"',
- {
- 'enable_x86_32': 0
- }
- ]
- ],
- 'sources': [
+ # untrusted.gypi and build_nexe.py currently build
+ # both x86-32 and x86-64 whenever target_arch is some
+ # flavor of x86. However, on non-windows platforms
+ # we only need one architecture.
+ ['OS!="win" and target_arch=="ia32"',
+ {
+ 'enable_x86_64': 0
+ }
+ ],
+ ['OS!="win" and target_arch=="x64"',
+ {
+ 'enable_x86_32': 0
+ }
+ ]
],
'extra_args': [
- '--strip-debug',
+ '--strip-all',
],
# TODO(bradchen): get rid of extra_deps64 and extra_deps32
# once native_client/build/untrusted.gypi no longer needs them.
diff --git a/ppapi/native_client/src/trusted/plugin/file_downloader.cc b/ppapi/native_client/src/trusted/plugin/file_downloader.cc
index 4eae623..ce7fe30 100644
--- a/ppapi/native_client/src/trusted/plugin/file_downloader.cc
+++ b/ppapi/native_client/src/trusted/plugin/file_downloader.cc
@@ -144,17 +144,38 @@
return true;
}
-int32_t FileDownloader::GetPOSIXFileDescriptor() {
- if (!streaming_to_file()) {
- return NACL_NO_FILE_DESC;
- }
- // Use the trusted interface to get the file descriptor.
- if (file_io_trusted_interface_ == NULL) {
- return NACL_NO_FILE_DESC;
- }
- int32_t file_desc = file_io_trusted_interface_->GetOSFileDescriptor(
- file_reader_.pp_resource());
+void FileDownloader::OpenFast(const nacl::string& url,
+ PP_FileHandle file_handle) {
+ PLUGIN_PRINTF(("FileDownloader::OpenFast (url=%s)\n", url.c_str()));
+ CHECK(instance_ != NULL);
+ open_time_ = NaClGetTimeOfDayMicroseconds();
+ status_code_ = NACL_HTTP_STATUS_OK;
+ url_to_open_ = url;
+ url_ = url;
+ mode_ = DOWNLOAD_NONE;
+ file_handle_ = file_handle;
+}
+int32_t FileDownloader::GetPOSIXFileDescriptor() {
+ int32_t file_desc = NACL_NO_FILE_DESC;
+ if (not_streaming() && file_handle_ != PP_kInvalidFileHandle) {
+#if NACL_WINDOWS
+ // On Windows, valid handles are 32 bit unsigned integers so this is safe.
+ file_desc = reinterpret_cast<uintptr_t>(file_handle_);
+#else
+ file_desc = file_handle_;
+#endif
+ } else {
+ if (!streaming_to_file()) {
+ return NACL_NO_FILE_DESC;
+ }
+ // Use the trusted interface to get the file descriptor.
+ if (file_io_trusted_interface_ == NULL) {
+ return NACL_NO_FILE_DESC;
+ }
+ file_desc = file_io_trusted_interface_->GetOSFileDescriptor(
+ file_reader_.pp_resource());
+ }
#if NACL_WINDOWS
// Convert the Windows HANDLE from Pepper to a POSIX file descriptor.
@@ -379,4 +400,8 @@
return mode_ == DOWNLOAD_STREAM;
}
+bool FileDownloader::not_streaming() const {
+ return mode_ == DOWNLOAD_NONE;
+}
+
} // namespace plugin
diff --git a/ppapi/native_client/src/trusted/plugin/file_downloader.h b/ppapi/native_client/src/trusted/plugin/file_downloader.h
index 3f1e2b6..a60c837 100644
--- a/ppapi/native_client/src/trusted/plugin/file_downloader.h
+++ b/ppapi/native_client/src/trusted/plugin/file_downloader.h
@@ -10,6 +10,7 @@
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/include/nacl_string.h"
#include "native_client/src/trusted/plugin/callback_source.h"
+#include "ppapi/c/private/pp_file_handle.h"
#include "ppapi/c/trusted/ppb_file_io_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
#include "ppapi/cpp/file_io.h"
@@ -24,7 +25,8 @@
typedef enum {
DOWNLOAD_TO_FILE = 0,
DOWNLOAD_TO_BUFFER,
- DOWNLOAD_STREAM
+ DOWNLOAD_STREAM,
+ DOWNLOAD_NONE
} DownloadMode;
typedef enum {
@@ -46,10 +48,11 @@
FileDownloader()
: instance_(NULL),
file_open_notify_callback_(pp::BlockUntilComplete()),
+ file_handle_(PP_kInvalidFileHandle),
file_io_trusted_interface_(NULL),
url_loader_trusted_interface_(NULL),
open_time_(-1),
- mode_(DOWNLOAD_TO_FILE),
+ mode_(DOWNLOAD_NONE),
url_scheme_(SCHEME_OTHER),
data_stream_callback_source_(NULL) {}
~FileDownloader() {}
@@ -81,6 +84,10 @@
const pp::CompletionCallback& callback,
StreamCallbackSource* stream_callback_source);
+ // Bypasses downloading and takes a handle to the open file. To get the fd,
+ // call GetPOSIXFileDescriptor().
+ void OpenFast(const nacl::string& url, PP_FileHandle file_handle);
+
// If downloading and opening succeeded, this returns a valid read-only
// POSIX file descriptor. On failure, the return value is an invalid
// descriptor. The file descriptor is owned by this instance, so the
@@ -122,6 +129,7 @@
bool streaming_to_file() const;
bool streaming_to_buffer() const;
bool streaming_to_user() const;
+ bool not_streaming() const;
int status_code() const { return status_code_; }
@@ -151,6 +159,7 @@
nacl::string url_;
pp::CompletionCallback file_open_notify_callback_;
pp::FileIO file_reader_;
+ PP_FileHandle file_handle_;
const PPB_FileIOTrusted* file_io_trusted_interface_;
const PPB_URLLoaderTrusted* url_loader_trusted_interface_;
pp::URLLoader url_loader_;
diff --git a/ppapi/native_client/src/trusted/plugin/json_manifest.cc b/ppapi/native_client/src/trusted/plugin/json_manifest.cc
index 730562f..d1f70ff 100644
--- a/ppapi/native_client/src/trusted/plugin/json_manifest.cc
+++ b/ppapi/native_client/src/trusted/plugin/json_manifest.cc
@@ -247,22 +247,24 @@
!IsValidPnaclTranslateSpec(property_value, property_name,
parent_key, &error_string)) {
error_info->SetReport(ERROR_MANIFEST_SCHEMA_VALIDATE,
- nacl::string("manifiest: ") + error_string);
+ nacl::string("manifest: ") + error_string);
return false;
}
}
- // TODO(elijahtaylor) add ISA resolver here if we expand ISAs to include
- // micro-architectures that can resolve to multiple valid sandboxes.
- bool has_isa = dictionary.isMember(sandbox_isa);
- bool has_portable = dictionary.isMember(kPortableKey);
+ if (!sandbox_isa.empty()) {
+ // TODO(elijahtaylor) add ISA resolver here if we expand ISAs to include
+ // micro-architectures that can resolve to multiple valid sandboxes.
+ bool has_isa = dictionary.isMember(sandbox_isa);
+ bool has_portable = dictionary.isMember(kPortableKey);
- if (!has_isa && !has_portable) {
- error_info->SetReport(
- ERROR_MANIFEST_PROGRAM_MISSING_ARCH,
- nacl::string("manifest: no version of ") + parent_key +
- " given for current arch and no portable version found.");
- return false;
+ if (!has_isa && !has_portable) {
+ error_info->SetReport(
+ ERROR_MANIFEST_PROGRAM_MISSING_ARCH,
+ nacl::string("manifest: no version of ") + parent_key +
+ " given for current arch and no portable version found.");
+ return false;
+ }
}
return true;
@@ -298,8 +300,12 @@
if (url == NULL || pnacl_options == NULL || error_info == NULL)
return false;
- if (!IsValidISADictionary(dictionary, parent_key, sandbox_isa, error_info))
+ if (!IsValidISADictionary(dictionary, parent_key, sandbox_isa, error_info)) {
+ error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL,
+ "architecture " + sandbox_isa +
+ " is not found for file " + parent_key);
return false;
+ }
*url = "";
@@ -434,7 +440,7 @@
nacl::string file_name = members[i];
if (!IsValidISADictionary(files[file_name],
file_name,
- sandbox_isa_,
+ nacl::string(),
error_info)) {
return false;
}
diff --git a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
index f915edd..3d29706 100644
--- a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
+++ b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
@@ -21,6 +21,7 @@
PP_Bool uses_irt,
PP_Bool uses_ppapi,
PP_Bool enable_ppapi_dev,
+ PP_Bool enable_dyncode_syscalls,
NaClHandle* result_socket);
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index e1f3ad9..de70eaf 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -381,6 +381,7 @@
bool should_report_uma,
bool uses_irt,
bool uses_ppapi,
+ bool enable_dyncode_syscalls,
ErrorInfo* error_info,
pp::CompletionCallback init_done_cb,
pp::CompletionCallback crash_cb) {
@@ -403,6 +404,7 @@
uses_irt,
uses_ppapi,
enable_dev_interfaces_,
+ enable_dyncode_syscalls,
crash_cb);
PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n",
service_runtime_started));
@@ -414,6 +416,7 @@
bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper,
ErrorInfo* error_info,
+ bool enable_dyncode_syscalls,
pp::CompletionCallback init_done_cb,
pp::CompletionCallback crash_cb) {
// Before forking a new sel_ldr process, ensure that we do not leak
@@ -425,6 +428,7 @@
true /* should_report_uma */,
true /* uses_irt */,
true /* uses_ppapi */,
+ enable_dyncode_syscalls,
error_info, init_done_cb, crash_cb)) {
return false;
}
@@ -491,6 +495,7 @@
false /* should_report_uma */,
false /* uses_irt */,
false /* uses_ppapi */,
+ false /* enable_dyncode_syscalls */,
error_info,
pp::BlockUntilComplete(),
pp::BlockUntilComplete())) {
@@ -677,7 +682,6 @@
return status;
}
-
Plugin::Plugin(PP_Instance pp_instance)
: pp::InstancePrivate(pp_instance),
scriptable_plugin_(NULL),
@@ -688,7 +692,6 @@
nacl_ready_state_(UNSENT),
nexe_error_reported_(false),
wrapper_factory_(NULL),
- last_error_string_(""),
enable_dev_interfaces_(false),
is_installed_(false),
init_time_(0),
@@ -861,6 +864,7 @@
NaClLog(4, "NexeFileDidOpen: invoking LoadNaClModule\n");
bool was_successful = LoadNaClModule(
wrapper.get(), &error_info,
+ true, /* enable_dyncode_syscalls */
callback_factory_.NewCallback(&Plugin::NexeFileDidOpenContinuation),
callback_factory_.NewCallback(&Plugin::NexeDidCrash));
@@ -981,6 +985,7 @@
ErrorInfo error_info;
bool was_successful = LoadNaClModule(
wrapper.get(), &error_info,
+ false, /* enable_dyncode_syscalls */
callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation),
callback_factory_.NewCallback(&Plugin::NexeDidCrash));
@@ -1203,15 +1208,20 @@
"the --enable-pnacl flag).");
}
} else {
- pp::CompletionCallback open_callback =
- callback_factory_.NewCallback(&Plugin::NexeFileDidOpen);
- // Will always call the callback on success or failure.
- CHECK(
- nexe_downloader_.Open(program_url,
- DOWNLOAD_TO_FILE,
- open_callback,
- true,
- &UpdateDownloadProgress));
+ // Try the fast path first. This will only block if the file is installed.
+ if (OpenURLFast(program_url, &nexe_downloader_)) {
+ NexeFileDidOpen(PP_OK);
+ } else {
+ pp::CompletionCallback open_callback =
+ callback_factory_.NewCallback(&Plugin::NexeFileDidOpen);
+ // Will always call the callback on success or failure.
+ CHECK(
+ nexe_downloader_.Open(program_url,
+ DOWNLOAD_TO_FILE,
+ open_callback,
+ true,
+ &UpdateDownloadProgress));
+ }
return;
}
}
@@ -1327,8 +1337,6 @@
FileDownloader* downloader = new FileDownloader();
downloader->Initialize(this);
url_downloaders_.insert(downloader);
- pp::CompletionCallback open_callback = callback_factory_.NewCallback(
- &Plugin::UrlDidOpenForStreamAsFile, downloader, callback);
// Untrusted loads are always relative to the page's origin.
CHECK(url_util_ != NULL);
pp::Var resolved_url =
@@ -1340,6 +1348,15 @@
plugin_base_url().c_str()));
return false;
}
+
+ // Try the fast path first. This will only block if the file is installed.
+ if (OpenURLFast(url, downloader)) {
+ UrlDidOpenForStreamAsFile(PP_OK, downloader, callback);
+ return true;
+ }
+
+ pp::CompletionCallback open_callback = callback_factory_.NewCallback(
+ &Plugin::UrlDidOpenForStreamAsFile, downloader, callback);
// If true, will always call the callback on success or failure.
return downloader->Open(url,
DOWNLOAD_TO_FILE,
@@ -1580,6 +1597,40 @@
}
}
+bool Plugin::OpenURLFast(const nacl::string& url,
+ FileDownloader* downloader) {
+ // Fast path only works for installed file URLs.
+ if (GetUrlScheme(url) != SCHEME_CHROME_EXTENSION)
+ return false;
+ // IMPORTANT: Make sure the document can request the given URL. If we don't
+ // check, a malicious app could probe the extension system. This enforces a
+ // same-origin policy which prevents the app from requesting resources from
+ // another app.
+ if (!DocumentCanRequest(url))
+ return false;
+
+ PP_NaClExecutableMetadata file_metadata;
+ PP_FileHandle file_handle =
+ nacl_interface()->OpenNaClExecutable(pp_instance(),
+ url.c_str(),
+ &file_metadata);
+ // We shouldn't hit this if the file URL is in an installed app.
+ if (file_handle == PP_kInvalidFileHandle)
+ return false;
+
+ // Release the PP_Var in the metadata struct.
+ pp::Module* module = pp::Module::Get();
+ const PPB_Var* var_interface =
+ static_cast<const PPB_Var*>(
+ module->GetBrowserInterface(PPB_VAR_INTERFACE));
+ var_interface->Release(file_metadata.file_path);
+
+ // FileDownloader takes ownership of the file handle.
+ // TODO(bbudge) Consume metadata once we have the final format.
+ downloader->OpenFast(url, file_handle);
+ return true;
+}
+
UrlSchemeType Plugin::GetUrlScheme(const std::string& url) {
CHECK(url_util_ != NULL);
PP_URLComponents_Dev comps;
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h
index b3b66a4..37bcfdd 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin.h
@@ -102,6 +102,7 @@
//
// Updates nacl_module_origin() and nacl_module_url().
bool LoadNaClModule(nacl::DescWrapper* wrapper, ErrorInfo* error_info,
+ bool enable_dyncode_syscalls,
pp::CompletionCallback init_done_cb,
pp::CompletionCallback crash_cb);
@@ -325,6 +326,7 @@
bool should_report_uma,
bool uses_irt,
bool uses_ppapi,
+ bool enable_dyncode_syscalls,
ErrorInfo* error_info,
pp::CompletionCallback init_done_cb,
pp::CompletionCallback crash_cb);
@@ -399,6 +401,11 @@
// to a LOG_FATAL this method will do nothing.
void CopyCrashLogToJsConsole();
+ // Open an app file by requesting a file descriptor from the browser. This
+ // method first checks that the url is for an installed file before making the
+ // request so it won't slow down non-installed file downloads.
+ bool OpenURLFast(const nacl::string& url, FileDownloader* downloader);
+
ScriptablePlugin* scriptable_plugin_;
int argc_;
diff --git a/ppapi/native_client/src/trusted/plugin/plugin_error.h b/ppapi/native_client/src/trusted/plugin/plugin_error.h
index 90c0284..f02ef83 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin_error.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin_error.h
@@ -109,7 +109,7 @@
}
void Reset() {
- SetReport(ERROR_UNKNOWN, "");
+ SetReport(ERROR_UNKNOWN, std::string());
}
void SetReport(PluginErrorCode error_code, const std::string& message) {
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
index d1b3b34..2947c51 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
@@ -41,7 +41,7 @@
}
// Convert a URL to a filename accepted by GetReadonlyPnaclFd.
-// Must be kept in sync with pnacl_file_host.cc.
+// Must be kept in sync with chrome/browser/nacl_host/nacl_file_host.
nacl::string PnaclUrls::PnaclComponentURLToFilename(
const nacl::string& full_url) {
// strip componentID.
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 a7d3f24..ff0982e 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
@@ -224,9 +224,7 @@
}
PLUGIN_PRINTF(("PnaclTranslateThread done with chunks\n"));
// Finish llc.
- if(!llc_subprocess_->InvokeSrpcMethod("StreamEnd",
- "",
- ¶ms)) {
+ if (!llc_subprocess_->InvokeSrpcMethod("StreamEnd", std::string(), ¶ms)) {
PLUGIN_PRINTF(("PnaclTranslateThread StreamEnd failed\n"));
if (llc_subprocess_->srpc_client()->GetLastError() ==
NACL_SRPC_RESULT_APP_ERROR) {
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
index b625dcd..cb828dd 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h"
#include "native_client/src/trusted/plugin/nacl_entry_points.h"
@@ -11,14 +12,16 @@
namespace plugin {
bool SelLdrLauncherChrome::Start(const char* url) {
- return Start(0, url, true, true, false);
+ NACL_NOTREACHED();
+ return false;
}
bool SelLdrLauncherChrome::Start(PP_Instance instance,
const char* url,
bool uses_irt,
bool uses_ppapi,
- bool enable_ppapi_dev) {
+ bool enable_ppapi_dev,
+ bool enable_dyncode_syscalls) {
if (!launch_nacl_process)
return false;
// send a synchronous message to the browser process
@@ -27,6 +30,7 @@
PP_FromBool(uses_irt),
PP_FromBool(uses_ppapi),
PP_FromBool(enable_ppapi_dev),
+ PP_FromBool(enable_dyncode_syscalls),
&channel_) != PP_NACL_OK) {
return false;
}
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
index ebcd52f..8ccf5c1 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
@@ -17,7 +17,8 @@
const char* url,
bool uses_irt,
bool uses_ppapi,
- bool enable_ppapi_dev);
+ bool enable_ppapi_dev,
+ bool enable_dyncode_syscalls);
};
} // namespace plugin
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 00f64c7..ba21a49 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -107,7 +107,7 @@
plugin::WeakRefCallOnMainThread(
anchor_,
0, /* delay in ms */
- ALLOW_THIS_IN_INITIALIZER_LIST(this),
+ this,
&plugin::PluginReverseInterface::Log_MainThreadContinuation,
continuation);
}
@@ -119,7 +119,7 @@
plugin::WeakRefCallOnMainThread(
anchor_,
0, /* delay in ms */
- ALLOW_THIS_IN_INITIALIZER_LIST(this),
+ this,
&plugin::PluginReverseInterface::PostMessage_MainThreadContinuation,
continuation);
}
@@ -573,7 +573,7 @@
plugin::WeakRefCallOnMainThread(
anchor_,
0, /* delay in ms */
- ALLOW_THIS_IN_INITIALIZER_LIST(this),
+ this,
&plugin::PluginReverseInterface::QuotaRequest_MainThreadContinuation,
continuation);
// Wait for the main thread to request quota and signal completion.
@@ -714,6 +714,7 @@
bool uses_irt,
bool uses_ppapi,
bool enable_ppapi_dev,
+ bool enable_dyncode_syscalls,
pp::CompletionCallback crash_cb) {
NaClLog(4, "ServiceRuntime::Start (nacl_desc=%p)\n",
reinterpret_cast<void*>(nacl_desc));
@@ -730,7 +731,8 @@
url.c_str(),
uses_irt,
uses_ppapi,
- enable_ppapi_dev);
+ enable_ppapi_dev,
+ enable_dyncode_syscalls);
if (!started) {
NaClLog(LOG_ERROR, "ServiceRuntime::Start (start failed)\n");
error_info->SetReport(ERROR_SEL_LDR_LAUNCH,
@@ -846,7 +848,7 @@
if (NULL != subprocess_.get()) {
return subprocess_->GetCrashLogOutput();
} else {
- return "";
+ return std::string();
}
}
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h
index f11346e..a7eca38 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.h
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h
@@ -239,6 +239,7 @@
bool uses_irt,
bool uses_ppapi,
bool enable_ppapi_dev,
+ bool enable_dyncode_syscalls,
pp::CompletionCallback crash_cb);
// Starts the application channel to the nexe.
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
index 7c67da4..becb973 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
@@ -17,6 +17,7 @@
'out_newlib64': '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_translate/lib-x86-64/libpnacl_irt_shim.a',
'build_glibc': 0,
'build_newlib': 1,
+ 'force_arm_pnacl': 1,
'sources': [
'pnacl_shim.c',
'shim_entry.c',
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 ec71ae4..d14866b 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
@@ -12,7 +12,6 @@
#include "ppapi/c/dev/ppb_crypto_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/c/dev/ppb_device_ref_dev.h"
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
#include "ppapi/c/dev/ppb_file_chooser_dev.h"
#include "ppapi/c/dev/ppb_find_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
@@ -44,8 +43,9 @@
#include "ppapi/c/dev/ppp_video_decoder_dev.h"
#include "ppapi/c/dev/ppp_widget_dev.h"
#include "ppapi/c/dev/ppp_zoom_dev.h"
-#include "ppapi/c/extensions/dev/ppb_alarms_dev.h"
-#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h"
#include "ppapi/c/ppb_audio.h"
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/ppb_console.h"
@@ -77,6 +77,7 @@
#include "ppapi/c/ppp_messaging.h"
#include "ppapi/c/ppp_mouse_lock.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
+#include "ppapi/c/private/ppb_file_io_private.h"
#include "ppapi/c/private/ppb_file_ref_private.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/c/private/ppb_flash_clipboard.h"
@@ -98,6 +99,8 @@
#include "ppapi/c/private/ppb_tcp_socket_private.h"
#include "ppapi/c/private/ppb_udp_socket_private.h"
#include "ppapi/c/private/ppb_uma_private.h"
+#include "ppapi/c/private/ppb_video_destination_private.h"
+#include "ppapi/c/private/ppb_video_source_private.h"
#include "ppapi/c/private/ppb_x509_certificate_private.h"
#include "ppapi/c/private/ppp_content_decryptor_private.h"
#include "ppapi/c/private/ppp_flash_browser_operations.h"
@@ -113,10 +116,6 @@
#include "ppapi/c/trusted/ppb_image_data_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
-
-/* The PNaCl PPAPI shims are only needed on x86-64 and arm. */
-#if defined(__x86_64__) || defined(__arm__)
-
/* Use local strcmp to avoid dependency on libc. */
static int mystrcmp(const char* s1, const char *s2) {
while (1) {
@@ -139,10 +138,12 @@
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_0;
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;
@@ -163,6 +164,7 @@
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Var_1_1;
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_WebSocket_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Graphics3D_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_InputEvent_0_1;
@@ -188,7 +190,6 @@
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_DeviceRef_Dev_0_1;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6;
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;
@@ -198,7 +199,6 @@
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_Printing_Dev_0_6;
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;
@@ -206,6 +206,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;
@@ -233,6 +234,7 @@
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_FileIO_Private_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_4;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_5;
@@ -265,6 +267,8 @@
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UMA_Private_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1;
+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;
@@ -273,6 +277,7 @@
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;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1;
/* END Declarations for all Wrapper Infos. */
/* Not generating wrapper methods for PPB_Audio_1_0 */
@@ -283,54 +288,46 @@
/* Begin wrapper methods for PPB_Console_1_0 */
-static __attribute__((pnaclcall))
-void Pnacl_M25_PPB_Console_Log(PP_Instance instance, PP_LogLevel level, struct PP_Var value) {
+static void Pnacl_M25_PPB_Console_Log(PP_Instance instance, PP_LogLevel level, struct PP_Var* value) {
const struct PPB_Console_1_0 *iface = Pnacl_WrapperInfo_PPB_Console_1_0.real_iface;
- iface->Log(instance, level, value);
+ iface->Log(instance, level, *value);
}
-static __attribute__((pnaclcall))
-void Pnacl_M25_PPB_Console_LogWithSource(PP_Instance instance, PP_LogLevel level, struct PP_Var source, struct PP_Var value) {
+static void Pnacl_M25_PPB_Console_LogWithSource(PP_Instance instance, PP_LogLevel level, struct PP_Var* source, struct PP_Var* value) {
const struct PPB_Console_1_0 *iface = Pnacl_WrapperInfo_PPB_Console_1_0.real_iface;
- iface->LogWithSource(instance, level, source, value);
+ iface->LogWithSource(instance, level, *source, *value);
}
/* End wrapper methods for PPB_Console_1_0 */
/* Begin wrapper methods for PPB_Core_1_0 */
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Core_AddRefResource(PP_Resource resource) {
+static void Pnacl_M14_PPB_Core_AddRefResource(PP_Resource resource) {
const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface;
iface->AddRefResource(resource);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Core_ReleaseResource(PP_Resource resource) {
+static void Pnacl_M14_PPB_Core_ReleaseResource(PP_Resource resource) {
const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface;
iface->ReleaseResource(resource);
}
-static __attribute__((pnaclcall))
-PP_Time Pnacl_M14_PPB_Core_GetTime(void) {
+static PP_Time Pnacl_M14_PPB_Core_GetTime(void) {
const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface;
return iface->GetTime();
}
-static __attribute__((pnaclcall))
-PP_TimeTicks Pnacl_M14_PPB_Core_GetTimeTicks(void) {
+static PP_TimeTicks Pnacl_M14_PPB_Core_GetTimeTicks(void) {
const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface;
return iface->GetTimeTicks();
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Core_CallOnMainThread(int32_t delay_in_milliseconds, struct PP_CompletionCallback callback, int32_t result) {
+static void Pnacl_M14_PPB_Core_CallOnMainThread(int32_t delay_in_milliseconds, struct PP_CompletionCallback* callback, int32_t result) {
const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface;
- iface->CallOnMainThread(delay_in_milliseconds, callback, result);
+ iface->CallOnMainThread(delay_in_milliseconds, *callback, result);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_Core_IsMainThread(void) {
+static PP_Bool Pnacl_M14_PPB_Core_IsMainThread(void) {
const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface;
return iface->IsMainThread();
}
@@ -339,62 +336,52 @@
/* Begin wrapper methods for PPB_FileIO_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_FileIO_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M14_PPB_FileIO_Create(PP_Instance instance) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_FileIO_IsFileIO(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_FileIO_IsFileIO(PP_Resource resource) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
return iface->IsFileIO(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIO_Open(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileIO_Open(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
- return iface->Open(file_io, file_ref, open_flags, callback);
+ return iface->Open(file_io, file_ref, open_flags, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIO_Query(PP_Resource file_io, struct PP_FileInfo* info, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileIO_Query(PP_Resource file_io, struct PP_FileInfo* info, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
- return iface->Query(file_io, info, callback);
+ return iface->Query(file_io, info, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIO_Touch(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileIO_Touch(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
- return iface->Touch(file_io, last_access_time, last_modified_time, callback);
+ return iface->Touch(file_io, last_access_time, last_modified_time, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIO_Read(PP_Resource file_io, int64_t offset, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileIO_Read(PP_Resource file_io, int64_t offset, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
- return iface->Read(file_io, offset, buffer, bytes_to_read, callback);
+ return iface->Read(file_io, offset, buffer, bytes_to_read, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIO_Write(PP_Resource file_io, int64_t offset, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileIO_Write(PP_Resource file_io, int64_t offset, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
- return iface->Write(file_io, offset, buffer, bytes_to_write, callback);
+ return iface->Write(file_io, offset, buffer, bytes_to_write, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIO_SetLength(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileIO_SetLength(PP_Resource file_io, int64_t length, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
- return iface->SetLength(file_io, length, callback);
+ return iface->SetLength(file_io, length, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIO_Flush(PP_Resource file_io, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileIO_Flush(PP_Resource file_io, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
- return iface->Flush(file_io, callback);
+ return iface->Flush(file_io, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_FileIO_Close(PP_Resource file_io) {
+static void Pnacl_M14_PPB_FileIO_Close(PP_Resource file_io) {
const struct PPB_FileIO_1_0 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_0.real_iface;
iface->Close(file_io);
}
@@ -403,160 +390,199 @@
/* Begin wrapper methods for PPB_FileIO_1_1 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M25_PPB_FileIO_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M25_PPB_FileIO_Create(PP_Instance instance) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M25_PPB_FileIO_IsFileIO(PP_Resource resource) {
+static PP_Bool Pnacl_M25_PPB_FileIO_IsFileIO(PP_Resource resource) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
return iface->IsFileIO(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_FileIO_Open(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_FileIO_Open(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
- return iface->Open(file_io, file_ref, open_flags, callback);
+ return iface->Open(file_io, file_ref, open_flags, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_FileIO_Query(PP_Resource file_io, struct PP_FileInfo* info, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_FileIO_Query(PP_Resource file_io, struct PP_FileInfo* info, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
- return iface->Query(file_io, info, callback);
+ return iface->Query(file_io, info, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_FileIO_Touch(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_FileIO_Touch(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
- return iface->Touch(file_io, last_access_time, last_modified_time, callback);
+ return iface->Touch(file_io, last_access_time, last_modified_time, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_FileIO_Read(PP_Resource file_io, int64_t offset, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_FileIO_Read(PP_Resource file_io, int64_t offset, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
- return iface->Read(file_io, offset, buffer, bytes_to_read, callback);
+ return iface->Read(file_io, offset, buffer, bytes_to_read, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_FileIO_Write(PP_Resource file_io, int64_t offset, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_FileIO_Write(PP_Resource file_io, int64_t offset, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
- return iface->Write(file_io, offset, buffer, bytes_to_write, callback);
+ return iface->Write(file_io, offset, buffer, bytes_to_write, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_FileIO_SetLength(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_FileIO_SetLength(PP_Resource file_io, int64_t length, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
- return iface->SetLength(file_io, length, callback);
+ return iface->SetLength(file_io, length, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_FileIO_Flush(PP_Resource file_io, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_FileIO_Flush(PP_Resource file_io, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
- return iface->Flush(file_io, callback);
+ return iface->Flush(file_io, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M25_PPB_FileIO_Close(PP_Resource file_io) {
+static void Pnacl_M25_PPB_FileIO_Close(PP_Resource file_io) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
iface->Close(file_io);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_FileIO_ReadToArray(PP_Resource file_io, int64_t offset, int32_t max_read_length, struct PP_ArrayOutput* output, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_FileIO_ReadToArray(PP_Resource file_io, int64_t offset, int32_t max_read_length, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
const struct PPB_FileIO_1_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_1_1.real_iface;
- return iface->ReadToArray(file_io, offset, max_read_length, output, callback);
+ return iface->ReadToArray(file_io, offset, max_read_length, output, *callback);
}
/* End wrapper methods for PPB_FileIO_1_1 */
/* Begin wrapper methods for PPB_FileRef_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_FileRef_Create(PP_Resource file_system, const char* path) {
+static PP_Resource Pnacl_M14_PPB_FileRef_Create(PP_Resource file_system, const char* path) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
return iface->Create(file_system, path);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_FileRef_IsFileRef(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_FileRef_IsFileRef(PP_Resource resource) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
return iface->IsFileRef(resource);
}
-static __attribute__((pnaclcall))
-PP_FileSystemType Pnacl_M14_PPB_FileRef_GetFileSystemType(PP_Resource file_ref) {
+static PP_FileSystemType Pnacl_M14_PPB_FileRef_GetFileSystemType(PP_Resource file_ref) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
return iface->GetFileSystemType(file_ref);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M14_PPB_FileRef_GetName(PP_Resource file_ref) {
+static void Pnacl_M14_PPB_FileRef_GetName(struct PP_Var* _struct_result, PP_Resource file_ref) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
- return iface->GetName(file_ref);
+ *_struct_result = iface->GetName(file_ref);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M14_PPB_FileRef_GetPath(PP_Resource file_ref) {
+static void Pnacl_M14_PPB_FileRef_GetPath(struct PP_Var* _struct_result, PP_Resource file_ref) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
- return iface->GetPath(file_ref);
+ *_struct_result = iface->GetPath(file_ref);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_FileRef_GetParent(PP_Resource file_ref) {
+static PP_Resource Pnacl_M14_PPB_FileRef_GetParent(PP_Resource file_ref) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
return iface->GetParent(file_ref);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileRef_MakeDirectory(PP_Resource directory_ref, PP_Bool make_ancestors, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileRef_MakeDirectory(PP_Resource directory_ref, PP_Bool make_ancestors, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
- return iface->MakeDirectory(directory_ref, make_ancestors, callback);
+ return iface->MakeDirectory(directory_ref, make_ancestors, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileRef_Touch(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileRef_Touch(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
- return iface->Touch(file_ref, last_access_time, last_modified_time, callback);
+ return iface->Touch(file_ref, last_access_time, last_modified_time, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileRef_Delete(PP_Resource file_ref, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileRef_Delete(PP_Resource file_ref, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
- return iface->Delete(file_ref, callback);
+ return iface->Delete(file_ref, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileRef_Rename(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileRef_Rename(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_0 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_0.real_iface;
- return iface->Rename(file_ref, new_file_ref, callback);
+ return iface->Rename(file_ref, new_file_ref, *callback);
}
/* End wrapper methods for PPB_FileRef_1_0 */
+/* Begin wrapper methods for PPB_FileRef_1_1 */
+
+static PP_Resource Pnacl_M28_PPB_FileRef_Create(PP_Resource file_system, const char* path) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->Create(file_system, path);
+}
+
+static PP_Bool Pnacl_M28_PPB_FileRef_IsFileRef(PP_Resource resource) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->IsFileRef(resource);
+}
+
+static PP_FileSystemType Pnacl_M28_PPB_FileRef_GetFileSystemType(PP_Resource file_ref) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->GetFileSystemType(file_ref);
+}
+
+static void Pnacl_M28_PPB_FileRef_GetName(struct PP_Var* _struct_result, PP_Resource file_ref) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ *_struct_result = iface->GetName(file_ref);
+}
+
+static void Pnacl_M28_PPB_FileRef_GetPath(struct PP_Var* _struct_result, PP_Resource file_ref) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ *_struct_result = iface->GetPath(file_ref);
+}
+
+static PP_Resource Pnacl_M28_PPB_FileRef_GetParent(PP_Resource file_ref) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->GetParent(file_ref);
+}
+
+static int32_t Pnacl_M28_PPB_FileRef_MakeDirectory(PP_Resource directory_ref, PP_Bool make_ancestors, struct PP_CompletionCallback* callback) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->MakeDirectory(directory_ref, make_ancestors, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_FileRef_Touch(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback* callback) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->Touch(file_ref, last_access_time, last_modified_time, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_FileRef_Delete(PP_Resource file_ref, struct PP_CompletionCallback* callback) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->Delete(file_ref, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_FileRef_Rename(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback* callback) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->Rename(file_ref, new_file_ref, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_FileRef_Query(PP_Resource file_ref, struct PP_FileInfo* info, struct PP_CompletionCallback* callback) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->Query(file_ref, info, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_FileRef_ReadDirectoryEntries(PP_Resource file_ref, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
+ const struct PPB_FileRef_1_1 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_1.real_iface;
+ return iface->ReadDirectoryEntries(file_ref, *output, *callback);
+}
+
+/* End wrapper methods for PPB_FileRef_1_1 */
+
/* Begin wrapper methods for PPB_FileSystem_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_FileSystem_Create(PP_Instance instance, PP_FileSystemType type) {
+static PP_Resource Pnacl_M14_PPB_FileSystem_Create(PP_Instance instance, PP_FileSystemType type) {
const struct PPB_FileSystem_1_0 *iface = Pnacl_WrapperInfo_PPB_FileSystem_1_0.real_iface;
return iface->Create(instance, type);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_FileSystem_IsFileSystem(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_FileSystem_IsFileSystem(PP_Resource resource) {
const struct PPB_FileSystem_1_0 *iface = Pnacl_WrapperInfo_PPB_FileSystem_1_0.real_iface;
return iface->IsFileSystem(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileSystem_Open(PP_Resource file_system, int64_t expected_size, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_FileSystem_Open(PP_Resource file_system, int64_t expected_size, struct PP_CompletionCallback* callback) {
const struct PPB_FileSystem_1_0 *iface = Pnacl_WrapperInfo_PPB_FileSystem_1_0.real_iface;
- return iface->Open(file_system, expected_size, callback);
+ return iface->Open(file_system, expected_size, *callback);
}
-static __attribute__((pnaclcall))
-PP_FileSystemType Pnacl_M14_PPB_FileSystem_GetType(PP_Resource file_system) {
+static PP_FileSystemType Pnacl_M14_PPB_FileSystem_GetType(PP_Resource file_system) {
const struct PPB_FileSystem_1_0 *iface = Pnacl_WrapperInfo_PPB_FileSystem_1_0.real_iface;
return iface->GetType(file_system);
}
@@ -569,98 +595,132 @@
/* Begin wrapper methods for PPB_Graphics2D_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_Graphics2D_Create(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque) {
+static PP_Resource Pnacl_M14_PPB_Graphics2D_Create(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque) {
const struct PPB_Graphics2D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_0.real_iface;
return iface->Create(instance, size, is_always_opaque);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_Graphics2D_IsGraphics2D(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_Graphics2D_IsGraphics2D(PP_Resource resource) {
const struct PPB_Graphics2D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_0.real_iface;
return iface->IsGraphics2D(resource);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_Graphics2D_Describe(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opqaue) {
+static PP_Bool Pnacl_M14_PPB_Graphics2D_Describe(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opaque) {
const struct PPB_Graphics2D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_0.real_iface;
- return iface->Describe(graphics_2d, size, is_always_opqaue);
+ return iface->Describe(graphics_2d, size, is_always_opaque);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Graphics2D_PaintImageData(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect) {
+static void Pnacl_M14_PPB_Graphics2D_PaintImageData(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect) {
const struct PPB_Graphics2D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_0.real_iface;
iface->PaintImageData(graphics_2d, image_data, top_left, src_rect);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Graphics2D_Scroll(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount) {
+static void Pnacl_M14_PPB_Graphics2D_Scroll(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount) {
const struct PPB_Graphics2D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_0.real_iface;
iface->Scroll(graphics_2d, clip_rect, amount);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Graphics2D_ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) {
+static void Pnacl_M14_PPB_Graphics2D_ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) {
const struct PPB_Graphics2D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_0.real_iface;
iface->ReplaceContents(graphics_2d, image_data);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_Graphics2D_Flush(PP_Resource graphics_2d, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_Graphics2D_Flush(PP_Resource graphics_2d, struct PP_CompletionCallback* callback) {
const struct PPB_Graphics2D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_0.real_iface;
- return iface->Flush(graphics_2d, callback);
+ return iface->Flush(graphics_2d, *callback);
}
/* End wrapper methods for PPB_Graphics2D_1_0 */
+/* Begin wrapper methods for PPB_Graphics2D_1_1 */
+
+static PP_Resource Pnacl_M27_PPB_Graphics2D_Create(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque) {
+ const struct PPB_Graphics2D_1_1 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_1.real_iface;
+ return iface->Create(instance, size, is_always_opaque);
+}
+
+static PP_Bool Pnacl_M27_PPB_Graphics2D_IsGraphics2D(PP_Resource resource) {
+ const struct PPB_Graphics2D_1_1 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_1.real_iface;
+ return iface->IsGraphics2D(resource);
+}
+
+static PP_Bool Pnacl_M27_PPB_Graphics2D_Describe(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opaque) {
+ const struct PPB_Graphics2D_1_1 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_1.real_iface;
+ return iface->Describe(graphics_2d, size, is_always_opaque);
+}
+
+static void Pnacl_M27_PPB_Graphics2D_PaintImageData(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect) {
+ const struct PPB_Graphics2D_1_1 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_1.real_iface;
+ iface->PaintImageData(graphics_2d, image_data, top_left, src_rect);
+}
+
+static void Pnacl_M27_PPB_Graphics2D_Scroll(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount) {
+ const struct PPB_Graphics2D_1_1 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_1.real_iface;
+ iface->Scroll(graphics_2d, clip_rect, amount);
+}
+
+static void Pnacl_M27_PPB_Graphics2D_ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) {
+ const struct PPB_Graphics2D_1_1 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_1.real_iface;
+ iface->ReplaceContents(graphics_2d, image_data);
+}
+
+static int32_t Pnacl_M27_PPB_Graphics2D_Flush(PP_Resource graphics_2d, struct PP_CompletionCallback* callback) {
+ const struct PPB_Graphics2D_1_1 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_1.real_iface;
+ return iface->Flush(graphics_2d, *callback);
+}
+
+static PP_Bool Pnacl_M27_PPB_Graphics2D_SetScale(PP_Resource resource, float scale) {
+ const struct PPB_Graphics2D_1_1 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_1.real_iface;
+ return iface->SetScale(resource, scale);
+}
+
+static float Pnacl_M27_PPB_Graphics2D_GetScale(PP_Resource resource) {
+ const struct PPB_Graphics2D_1_1 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_1.real_iface;
+ return iface->GetScale(resource);
+}
+
+/* End wrapper methods for PPB_Graphics2D_1_1 */
+
/* Begin wrapper methods for PPB_Graphics3D_1_0 */
-static __attribute__((pnaclcall))
-int32_t Pnacl_M15_PPB_Graphics3D_GetAttribMaxValue(PP_Resource instance, int32_t attribute, int32_t* value) {
+static int32_t Pnacl_M15_PPB_Graphics3D_GetAttribMaxValue(PP_Resource instance, int32_t attribute, int32_t* value) {
const struct PPB_Graphics3D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3D_1_0.real_iface;
return iface->GetAttribMaxValue(instance, attribute, value);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M15_PPB_Graphics3D_Create(PP_Instance instance, PP_Resource share_context, const int32_t attrib_list[]) {
+static PP_Resource Pnacl_M15_PPB_Graphics3D_Create(PP_Instance instance, PP_Resource share_context, const int32_t attrib_list[]) {
const struct PPB_Graphics3D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3D_1_0.real_iface;
return iface->Create(instance, share_context, attrib_list);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M15_PPB_Graphics3D_IsGraphics3D(PP_Resource resource) {
+static PP_Bool Pnacl_M15_PPB_Graphics3D_IsGraphics3D(PP_Resource resource) {
const struct PPB_Graphics3D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3D_1_0.real_iface;
return iface->IsGraphics3D(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M15_PPB_Graphics3D_GetAttribs(PP_Resource context, int32_t attrib_list[]) {
+static int32_t Pnacl_M15_PPB_Graphics3D_GetAttribs(PP_Resource context, int32_t attrib_list[]) {
const struct PPB_Graphics3D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3D_1_0.real_iface;
return iface->GetAttribs(context, attrib_list);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M15_PPB_Graphics3D_SetAttribs(PP_Resource context, const int32_t attrib_list[]) {
+static int32_t Pnacl_M15_PPB_Graphics3D_SetAttribs(PP_Resource context, const int32_t attrib_list[]) {
const struct PPB_Graphics3D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3D_1_0.real_iface;
return iface->SetAttribs(context, attrib_list);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M15_PPB_Graphics3D_GetError(PP_Resource context) {
+static int32_t Pnacl_M15_PPB_Graphics3D_GetError(PP_Resource context) {
const struct PPB_Graphics3D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3D_1_0.real_iface;
return iface->GetError(context);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M15_PPB_Graphics3D_ResizeBuffers(PP_Resource context, int32_t width, int32_t height) {
+static int32_t Pnacl_M15_PPB_Graphics3D_ResizeBuffers(PP_Resource context, int32_t width, int32_t height) {
const struct PPB_Graphics3D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3D_1_0.real_iface;
return iface->ResizeBuffers(context, width, height);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M15_PPB_Graphics3D_SwapBuffers(PP_Resource context, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M15_PPB_Graphics3D_SwapBuffers(PP_Resource context, struct PP_CompletionCallback* callback) {
const struct PPB_Graphics3D_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3D_1_0.real_iface;
- return iface->SwapBuffers(context, callback);
+ return iface->SwapBuffers(context, *callback);
}
/* End wrapper methods for PPB_Graphics3D_1_0 */
@@ -671,32 +731,27 @@
/* Begin wrapper methods for PPB_MouseInputEvent_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M13_PPB_MouseInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, const struct PP_Point* mouse_position, int32_t click_count) {
+static PP_Resource Pnacl_M13_PPB_MouseInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, const struct PP_Point* mouse_position, int32_t click_count) {
const struct PPB_MouseInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0.real_iface;
return iface->Create(instance, type, time_stamp, modifiers, mouse_button, mouse_position, click_count);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M13_PPB_MouseInputEvent_IsMouseInputEvent(PP_Resource resource) {
+static PP_Bool Pnacl_M13_PPB_MouseInputEvent_IsMouseInputEvent(PP_Resource resource) {
const struct PPB_MouseInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0.real_iface;
return iface->IsMouseInputEvent(resource);
}
-static __attribute__((pnaclcall))
-PP_InputEvent_MouseButton Pnacl_M13_PPB_MouseInputEvent_GetButton(PP_Resource mouse_event) {
+static PP_InputEvent_MouseButton Pnacl_M13_PPB_MouseInputEvent_GetButton(PP_Resource mouse_event) {
const struct PPB_MouseInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0.real_iface;
return iface->GetButton(mouse_event);
}
-static __attribute__((pnaclcall))
-struct PP_Point Pnacl_M13_PPB_MouseInputEvent_GetPosition(PP_Resource mouse_event) {
+static void Pnacl_M13_PPB_MouseInputEvent_GetPosition(struct PP_Point* _struct_result, PP_Resource mouse_event) {
const struct PPB_MouseInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0.real_iface;
- return iface->GetPosition(mouse_event);
+ *_struct_result = iface->GetPosition(mouse_event);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M13_PPB_MouseInputEvent_GetClickCount(PP_Resource mouse_event) {
+static int32_t Pnacl_M13_PPB_MouseInputEvent_GetClickCount(PP_Resource mouse_event) {
const struct PPB_MouseInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0.real_iface;
return iface->GetClickCount(mouse_event);
}
@@ -705,72 +760,61 @@
/* Begin wrapper methods for PPB_MouseInputEvent_1_1 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_MouseInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, const struct PP_Point* mouse_position, int32_t click_count, const struct PP_Point* mouse_movement) {
+static PP_Resource Pnacl_M14_PPB_MouseInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, const struct PP_Point* mouse_position, int32_t click_count, const struct PP_Point* mouse_movement) {
const struct PPB_MouseInputEvent_1_1 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1.real_iface;
return iface->Create(instance, type, time_stamp, modifiers, mouse_button, mouse_position, click_count, mouse_movement);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_MouseInputEvent_IsMouseInputEvent(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_MouseInputEvent_IsMouseInputEvent(PP_Resource resource) {
const struct PPB_MouseInputEvent_1_1 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1.real_iface;
return iface->IsMouseInputEvent(resource);
}
-static __attribute__((pnaclcall))
-PP_InputEvent_MouseButton Pnacl_M14_PPB_MouseInputEvent_GetButton(PP_Resource mouse_event) {
+static PP_InputEvent_MouseButton Pnacl_M14_PPB_MouseInputEvent_GetButton(PP_Resource mouse_event) {
const struct PPB_MouseInputEvent_1_1 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1.real_iface;
return iface->GetButton(mouse_event);
}
-static __attribute__((pnaclcall))
-struct PP_Point Pnacl_M14_PPB_MouseInputEvent_GetPosition(PP_Resource mouse_event) {
+static void Pnacl_M14_PPB_MouseInputEvent_GetPosition(struct PP_Point* _struct_result, PP_Resource mouse_event) {
const struct PPB_MouseInputEvent_1_1 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1.real_iface;
- return iface->GetPosition(mouse_event);
+ *_struct_result = iface->GetPosition(mouse_event);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_MouseInputEvent_GetClickCount(PP_Resource mouse_event) {
+static int32_t Pnacl_M14_PPB_MouseInputEvent_GetClickCount(PP_Resource mouse_event) {
const struct PPB_MouseInputEvent_1_1 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1.real_iface;
return iface->GetClickCount(mouse_event);
}
-static __attribute__((pnaclcall))
-struct PP_Point Pnacl_M14_PPB_MouseInputEvent_GetMovement(PP_Resource mouse_event) {
+static void Pnacl_M14_PPB_MouseInputEvent_GetMovement(struct PP_Point* _struct_result, PP_Resource mouse_event) {
const struct PPB_MouseInputEvent_1_1 *iface = Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1.real_iface;
- return iface->GetMovement(mouse_event);
+ *_struct_result = iface->GetMovement(mouse_event);
}
/* End wrapper methods for PPB_MouseInputEvent_1_1 */
/* Begin wrapper methods for PPB_WheelInputEvent_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M13_PPB_WheelInputEvent_Create(PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, const struct PP_FloatPoint* wheel_delta, const struct PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) {
+static PP_Resource Pnacl_M13_PPB_WheelInputEvent_Create(PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, const struct PP_FloatPoint* wheel_delta, const struct PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) {
const struct PPB_WheelInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0.real_iface;
return iface->Create(instance, time_stamp, modifiers, wheel_delta, wheel_ticks, scroll_by_page);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M13_PPB_WheelInputEvent_IsWheelInputEvent(PP_Resource resource) {
+static PP_Bool Pnacl_M13_PPB_WheelInputEvent_IsWheelInputEvent(PP_Resource resource) {
const struct PPB_WheelInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0.real_iface;
return iface->IsWheelInputEvent(resource);
}
-static __attribute__((pnaclcall))
-struct PP_FloatPoint Pnacl_M13_PPB_WheelInputEvent_GetDelta(PP_Resource wheel_event) {
+static void Pnacl_M13_PPB_WheelInputEvent_GetDelta(struct PP_FloatPoint* _struct_result, PP_Resource wheel_event) {
const struct PPB_WheelInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0.real_iface;
- return iface->GetDelta(wheel_event);
+ *_struct_result = iface->GetDelta(wheel_event);
}
-static __attribute__((pnaclcall))
-struct PP_FloatPoint Pnacl_M13_PPB_WheelInputEvent_GetTicks(PP_Resource wheel_event) {
+static void Pnacl_M13_PPB_WheelInputEvent_GetTicks(struct PP_FloatPoint* _struct_result, PP_Resource wheel_event) {
const struct PPB_WheelInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0.real_iface;
- return iface->GetTicks(wheel_event);
+ *_struct_result = iface->GetTicks(wheel_event);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M13_PPB_WheelInputEvent_GetScrollByPage(PP_Resource wheel_event) {
+static PP_Bool Pnacl_M13_PPB_WheelInputEvent_GetScrollByPage(PP_Resource wheel_event) {
const struct PPB_WheelInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0.real_iface;
return iface->GetScrollByPage(wheel_event);
}
@@ -779,68 +823,58 @@
/* Begin wrapper methods for PPB_KeyboardInputEvent_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M13_PPB_KeyboardInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, uint32_t key_code, struct PP_Var character_text) {
+static PP_Resource Pnacl_M13_PPB_KeyboardInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, uint32_t key_code, struct PP_Var* character_text) {
const struct PPB_KeyboardInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0.real_iface;
- return iface->Create(instance, type, time_stamp, modifiers, key_code, character_text);
+ return iface->Create(instance, type, time_stamp, modifiers, key_code, *character_text);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M13_PPB_KeyboardInputEvent_IsKeyboardInputEvent(PP_Resource resource) {
+static PP_Bool Pnacl_M13_PPB_KeyboardInputEvent_IsKeyboardInputEvent(PP_Resource resource) {
const struct PPB_KeyboardInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0.real_iface;
return iface->IsKeyboardInputEvent(resource);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M13_PPB_KeyboardInputEvent_GetKeyCode(PP_Resource key_event) {
+static uint32_t Pnacl_M13_PPB_KeyboardInputEvent_GetKeyCode(PP_Resource key_event) {
const struct PPB_KeyboardInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0.real_iface;
return iface->GetKeyCode(key_event);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M13_PPB_KeyboardInputEvent_GetCharacterText(PP_Resource character_event) {
+static void Pnacl_M13_PPB_KeyboardInputEvent_GetCharacterText(struct PP_Var* _struct_result, PP_Resource character_event) {
const struct PPB_KeyboardInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0.real_iface;
- return iface->GetCharacterText(character_event);
+ *_struct_result = iface->GetCharacterText(character_event);
}
/* End wrapper methods for PPB_KeyboardInputEvent_1_0 */
/* Begin wrapper methods for PPB_TouchInputEvent_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M13_PPB_TouchInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers) {
+static PP_Resource Pnacl_M13_PPB_TouchInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers) {
const struct PPB_TouchInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0.real_iface;
return iface->Create(instance, type, time_stamp, modifiers);
}
-static __attribute__((pnaclcall))
-void Pnacl_M13_PPB_TouchInputEvent_AddTouchPoint(PP_Resource touch_event, PP_TouchListType list, const struct PP_TouchPoint* point) {
+static void Pnacl_M13_PPB_TouchInputEvent_AddTouchPoint(PP_Resource touch_event, PP_TouchListType list, const struct PP_TouchPoint* point) {
const struct PPB_TouchInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0.real_iface;
iface->AddTouchPoint(touch_event, list, point);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M13_PPB_TouchInputEvent_IsTouchInputEvent(PP_Resource resource) {
+static PP_Bool Pnacl_M13_PPB_TouchInputEvent_IsTouchInputEvent(PP_Resource resource) {
const struct PPB_TouchInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0.real_iface;
return iface->IsTouchInputEvent(resource);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M13_PPB_TouchInputEvent_GetTouchCount(PP_Resource resource, PP_TouchListType list) {
+static uint32_t Pnacl_M13_PPB_TouchInputEvent_GetTouchCount(PP_Resource resource, PP_TouchListType list) {
const struct PPB_TouchInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0.real_iface;
return iface->GetTouchCount(resource, list);
}
-static __attribute__((pnaclcall))
-struct PP_TouchPoint Pnacl_M13_PPB_TouchInputEvent_GetTouchByIndex(PP_Resource resource, PP_TouchListType list, uint32_t index) {
+static void Pnacl_M13_PPB_TouchInputEvent_GetTouchByIndex(struct PP_TouchPoint* _struct_result, PP_Resource resource, PP_TouchListType list, uint32_t index) {
const struct PPB_TouchInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0.real_iface;
- return iface->GetTouchByIndex(resource, list, index);
+ *_struct_result = iface->GetTouchByIndex(resource, list, index);
}
-static __attribute__((pnaclcall))
-struct PP_TouchPoint Pnacl_M13_PPB_TouchInputEvent_GetTouchById(PP_Resource resource, PP_TouchListType list, uint32_t touch_id) {
+static void Pnacl_M13_PPB_TouchInputEvent_GetTouchById(struct PP_TouchPoint* _struct_result, PP_Resource resource, PP_TouchListType list, uint32_t touch_id) {
const struct PPB_TouchInputEvent_1_0 *iface = Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0.real_iface;
- return iface->GetTouchById(resource, list, touch_id);
+ *_struct_result = iface->GetTouchById(resource, list, touch_id);
}
/* End wrapper methods for PPB_TouchInputEvent_1_0 */
@@ -849,44 +883,37 @@
/* Begin wrapper methods for PPB_MessageLoop_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M25_PPB_MessageLoop_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M25_PPB_MessageLoop_Create(PP_Instance instance) {
const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M25_PPB_MessageLoop_GetForMainThread(void) {
+static PP_Resource Pnacl_M25_PPB_MessageLoop_GetForMainThread(void) {
const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
return iface->GetForMainThread();
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M25_PPB_MessageLoop_GetCurrent(void) {
+static PP_Resource Pnacl_M25_PPB_MessageLoop_GetCurrent(void) {
const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
return iface->GetCurrent();
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_MessageLoop_AttachToCurrentThread(PP_Resource message_loop) {
+static int32_t Pnacl_M25_PPB_MessageLoop_AttachToCurrentThread(PP_Resource message_loop) {
const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
return iface->AttachToCurrentThread(message_loop);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_MessageLoop_Run(PP_Resource message_loop) {
+static int32_t Pnacl_M25_PPB_MessageLoop_Run(PP_Resource message_loop) {
const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
return iface->Run(message_loop);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_MessageLoop_PostWork(PP_Resource message_loop, struct PP_CompletionCallback callback, int64_t delay_ms) {
+static int32_t Pnacl_M25_PPB_MessageLoop_PostWork(PP_Resource message_loop, struct PP_CompletionCallback* callback, int64_t delay_ms) {
const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
- return iface->PostWork(message_loop, callback, delay_ms);
+ return iface->PostWork(message_loop, *callback, delay_ms);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_MessageLoop_PostQuit(PP_Resource message_loop, PP_Bool should_destroy) {
+static int32_t Pnacl_M25_PPB_MessageLoop_PostQuit(PP_Resource message_loop, PP_Bool should_destroy) {
const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface;
return iface->PostQuit(message_loop, should_destroy);
}
@@ -895,10 +922,9 @@
/* Begin wrapper methods for PPB_Messaging_1_0 */
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Messaging_PostMessage(PP_Instance instance, struct PP_Var message) {
+static void Pnacl_M14_PPB_Messaging_PostMessage(PP_Instance instance, struct PP_Var* message) {
const struct PPB_Messaging_1_0 *iface = Pnacl_WrapperInfo_PPB_Messaging_1_0.real_iface;
- iface->PostMessage(instance, message);
+ iface->PostMessage(instance, *message);
}
/* End wrapper methods for PPB_Messaging_1_0 */
@@ -907,14 +933,12 @@
/* Begin wrapper methods for PPB_MouseLock_1_0 */
-static __attribute__((pnaclcall))
-int32_t Pnacl_M16_PPB_MouseLock_LockMouse(PP_Instance instance, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M16_PPB_MouseLock_LockMouse(PP_Instance instance, struct PP_CompletionCallback* callback) {
const struct PPB_MouseLock_1_0 *iface = Pnacl_WrapperInfo_PPB_MouseLock_1_0.real_iface;
- return iface->LockMouse(instance, callback);
+ return iface->LockMouse(instance, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M16_PPB_MouseLock_UnlockMouse(PP_Instance instance) {
+static void Pnacl_M16_PPB_MouseLock_UnlockMouse(PP_Instance instance) {
const struct PPB_MouseLock_1_0 *iface = Pnacl_WrapperInfo_PPB_MouseLock_1_0.real_iface;
iface->UnlockMouse(instance);
}
@@ -923,62 +947,52 @@
/* Begin wrapper methods for PPB_URLLoader_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_URLLoader_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M14_PPB_URLLoader_Create(PP_Instance instance) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_URLLoader_IsURLLoader(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_URLLoader_IsURLLoader(PP_Resource resource) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
return iface->IsURLLoader(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_URLLoader_Open(PP_Resource loader, PP_Resource request_info, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_URLLoader_Open(PP_Resource loader, PP_Resource request_info, struct PP_CompletionCallback* callback) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
- return iface->Open(loader, request_info, callback);
+ return iface->Open(loader, request_info, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_URLLoader_FollowRedirect(PP_Resource loader, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_URLLoader_FollowRedirect(PP_Resource loader, struct PP_CompletionCallback* callback) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
- return iface->FollowRedirect(loader, callback);
+ return iface->FollowRedirect(loader, *callback);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_URLLoader_GetUploadProgress(PP_Resource loader, int64_t* bytes_sent, int64_t* total_bytes_to_be_sent) {
+static PP_Bool Pnacl_M14_PPB_URLLoader_GetUploadProgress(PP_Resource loader, int64_t* bytes_sent, int64_t* total_bytes_to_be_sent) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
return iface->GetUploadProgress(loader, bytes_sent, total_bytes_to_be_sent);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_URLLoader_GetDownloadProgress(PP_Resource loader, int64_t* bytes_received, int64_t* total_bytes_to_be_received) {
+static PP_Bool Pnacl_M14_PPB_URLLoader_GetDownloadProgress(PP_Resource loader, int64_t* bytes_received, int64_t* total_bytes_to_be_received) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
return iface->GetDownloadProgress(loader, bytes_received, total_bytes_to_be_received);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_URLLoader_GetResponseInfo(PP_Resource loader) {
+static PP_Resource Pnacl_M14_PPB_URLLoader_GetResponseInfo(PP_Resource loader) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
return iface->GetResponseInfo(loader);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_URLLoader_ReadResponseBody(PP_Resource loader, void* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_URLLoader_ReadResponseBody(PP_Resource loader, void* buffer, int32_t bytes_to_read, struct PP_CompletionCallback* callback) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
- return iface->ReadResponseBody(loader, buffer, bytes_to_read, callback);
+ return iface->ReadResponseBody(loader, buffer, bytes_to_read, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_URLLoader_FinishStreamingToFile(PP_Resource loader, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_URLLoader_FinishStreamingToFile(PP_Resource loader, struct PP_CompletionCallback* callback) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
- return iface->FinishStreamingToFile(loader, callback);
+ return iface->FinishStreamingToFile(loader, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_URLLoader_Close(PP_Resource loader) {
+static void Pnacl_M14_PPB_URLLoader_Close(PP_Resource loader) {
const struct PPB_URLLoader_1_0 *iface = Pnacl_WrapperInfo_PPB_URLLoader_1_0.real_iface;
iface->Close(loader);
}
@@ -987,32 +1001,27 @@
/* Begin wrapper methods for PPB_URLRequestInfo_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_URLRequestInfo_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M14_PPB_URLRequestInfo_Create(PP_Instance instance) {
const struct PPB_URLRequestInfo_1_0 *iface = Pnacl_WrapperInfo_PPB_URLRequestInfo_1_0.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_URLRequestInfo_IsURLRequestInfo(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_URLRequestInfo_IsURLRequestInfo(PP_Resource resource) {
const struct PPB_URLRequestInfo_1_0 *iface = Pnacl_WrapperInfo_PPB_URLRequestInfo_1_0.real_iface;
return iface->IsURLRequestInfo(resource);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_URLRequestInfo_SetProperty(PP_Resource request, PP_URLRequestProperty property, struct PP_Var value) {
+static PP_Bool Pnacl_M14_PPB_URLRequestInfo_SetProperty(PP_Resource request, PP_URLRequestProperty property, struct PP_Var* value) {
const struct PPB_URLRequestInfo_1_0 *iface = Pnacl_WrapperInfo_PPB_URLRequestInfo_1_0.real_iface;
- return iface->SetProperty(request, property, value);
+ return iface->SetProperty(request, property, *value);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_URLRequestInfo_AppendDataToBody(PP_Resource request, const void* data, uint32_t len) {
+static PP_Bool Pnacl_M14_PPB_URLRequestInfo_AppendDataToBody(PP_Resource request, const void* data, uint32_t len) {
const struct PPB_URLRequestInfo_1_0 *iface = Pnacl_WrapperInfo_PPB_URLRequestInfo_1_0.real_iface;
return iface->AppendDataToBody(request, data, len);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_URLRequestInfo_AppendFileToBody(PP_Resource request, PP_Resource file_ref, int64_t start_offset, int64_t number_of_bytes, PP_Time expected_last_modified_time) {
+static PP_Bool Pnacl_M14_PPB_URLRequestInfo_AppendFileToBody(PP_Resource request, PP_Resource file_ref, int64_t start_offset, int64_t number_of_bytes, PP_Time expected_last_modified_time) {
const struct PPB_URLRequestInfo_1_0 *iface = Pnacl_WrapperInfo_PPB_URLRequestInfo_1_0.real_iface;
return iface->AppendFileToBody(request, file_ref, start_offset, number_of_bytes, expected_last_modified_time);
}
@@ -1021,20 +1030,17 @@
/* Begin wrapper methods for PPB_URLResponseInfo_1_0 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_URLResponseInfo_IsURLResponseInfo(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_URLResponseInfo_IsURLResponseInfo(PP_Resource resource) {
const struct PPB_URLResponseInfo_1_0 *iface = Pnacl_WrapperInfo_PPB_URLResponseInfo_1_0.real_iface;
return iface->IsURLResponseInfo(resource);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M14_PPB_URLResponseInfo_GetProperty(PP_Resource response, PP_URLResponseProperty property) {
+static void Pnacl_M14_PPB_URLResponseInfo_GetProperty(struct PP_Var* _struct_result, PP_Resource response, PP_URLResponseProperty property) {
const struct PPB_URLResponseInfo_1_0 *iface = Pnacl_WrapperInfo_PPB_URLResponseInfo_1_0.real_iface;
- return iface->GetProperty(response, property);
+ *_struct_result = iface->GetProperty(response, property);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_URLResponseInfo_GetBodyAsFileRef(PP_Resource response) {
+static PP_Resource Pnacl_M14_PPB_URLResponseInfo_GetBodyAsFileRef(PP_Resource response) {
const struct PPB_URLResponseInfo_1_0 *iface = Pnacl_WrapperInfo_PPB_URLResponseInfo_1_0.real_iface;
return iface->GetBodyAsFileRef(response);
}
@@ -1043,174 +1049,150 @@
/* Begin wrapper methods for PPB_Var_1_0 */
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Var_AddRef(struct PP_Var var) {
+static void Pnacl_M14_PPB_Var_AddRef(struct PP_Var* var) {
const struct PPB_Var_1_0 *iface = Pnacl_WrapperInfo_PPB_Var_1_0.real_iface;
- iface->AddRef(var);
+ iface->AddRef(*var);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_Var_Release(struct PP_Var var) {
+static void Pnacl_M14_PPB_Var_Release(struct PP_Var* var) {
const struct PPB_Var_1_0 *iface = Pnacl_WrapperInfo_PPB_Var_1_0.real_iface;
- iface->Release(var);
+ iface->Release(*var);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M14_PPB_Var_VarFromUtf8(PP_Module module, const char* data, uint32_t len) {
+static void Pnacl_M14_PPB_Var_VarFromUtf8(struct PP_Var* _struct_result, PP_Module module, const char* data, uint32_t len) {
const struct PPB_Var_1_0 *iface = Pnacl_WrapperInfo_PPB_Var_1_0.real_iface;
- return iface->VarFromUtf8(module, data, len);
+ *_struct_result = iface->VarFromUtf8(module, data, len);
}
-static __attribute__((pnaclcall))
-const char* Pnacl_M14_PPB_Var_VarToUtf8(struct PP_Var var, uint32_t* len) {
+static const char* Pnacl_M14_PPB_Var_VarToUtf8(struct PP_Var* var, uint32_t* len) {
const struct PPB_Var_1_0 *iface = Pnacl_WrapperInfo_PPB_Var_1_0.real_iface;
- return iface->VarToUtf8(var, len);
+ return iface->VarToUtf8(*var, len);
}
/* End wrapper methods for PPB_Var_1_0 */
/* Begin wrapper methods for PPB_Var_1_1 */
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_Var_AddRef(struct PP_Var var) {
+static void Pnacl_M18_PPB_Var_AddRef(struct PP_Var* var) {
const struct PPB_Var_1_1 *iface = Pnacl_WrapperInfo_PPB_Var_1_1.real_iface;
- iface->AddRef(var);
+ iface->AddRef(*var);
}
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_Var_Release(struct PP_Var var) {
+static void Pnacl_M18_PPB_Var_Release(struct PP_Var* var) {
const struct PPB_Var_1_1 *iface = Pnacl_WrapperInfo_PPB_Var_1_1.real_iface;
- iface->Release(var);
+ iface->Release(*var);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M18_PPB_Var_VarFromUtf8(const char* data, uint32_t len) {
+static void Pnacl_M18_PPB_Var_VarFromUtf8(struct PP_Var* _struct_result, const char* data, uint32_t len) {
const struct PPB_Var_1_1 *iface = Pnacl_WrapperInfo_PPB_Var_1_1.real_iface;
- return iface->VarFromUtf8(data, len);
+ *_struct_result = iface->VarFromUtf8(data, len);
}
-static __attribute__((pnaclcall))
-const char* Pnacl_M18_PPB_Var_VarToUtf8(struct PP_Var var, uint32_t* len) {
+static const char* Pnacl_M18_PPB_Var_VarToUtf8(struct PP_Var* var, uint32_t* len) {
const struct PPB_Var_1_1 *iface = Pnacl_WrapperInfo_PPB_Var_1_1.real_iface;
- return iface->VarToUtf8(var, len);
+ return iface->VarToUtf8(*var, len);
}
/* End wrapper methods for PPB_Var_1_1 */
/* Begin wrapper methods for PPB_VarArrayBuffer_1_0 */
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M18_PPB_VarArrayBuffer_Create(uint32_t size_in_bytes) {
+static void Pnacl_M18_PPB_VarArrayBuffer_Create(struct PP_Var* _struct_result, uint32_t size_in_bytes) {
const struct PPB_VarArrayBuffer_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0.real_iface;
- return iface->Create(size_in_bytes);
+ *_struct_result = iface->Create(size_in_bytes);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M18_PPB_VarArrayBuffer_ByteLength(struct PP_Var array, uint32_t* byte_length) {
+static PP_Bool Pnacl_M18_PPB_VarArrayBuffer_ByteLength(struct PP_Var* array, uint32_t* byte_length) {
const struct PPB_VarArrayBuffer_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0.real_iface;
- return iface->ByteLength(array, byte_length);
+ return iface->ByteLength(*array, byte_length);
}
-static __attribute__((pnaclcall))
-void* Pnacl_M18_PPB_VarArrayBuffer_Map(struct PP_Var array) {
+static void* Pnacl_M18_PPB_VarArrayBuffer_Map(struct PP_Var* array) {
const struct PPB_VarArrayBuffer_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0.real_iface;
- return iface->Map(array);
+ return iface->Map(*array);
}
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_VarArrayBuffer_Unmap(struct PP_Var array) {
+static void Pnacl_M18_PPB_VarArrayBuffer_Unmap(struct PP_Var* array) {
const struct PPB_VarArrayBuffer_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0.real_iface;
- iface->Unmap(array);
+ iface->Unmap(*array);
}
/* End wrapper methods for PPB_VarArrayBuffer_1_0 */
/* Not generating wrapper methods for PPB_View_1_0 */
+/* Not generating wrapper methods for PPB_View_1_1 */
+
/* Begin wrapper methods for PPB_WebSocket_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M18_PPB_WebSocket_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M18_PPB_WebSocket_Create(PP_Instance instance) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M18_PPB_WebSocket_IsWebSocket(PP_Resource resource) {
+static PP_Bool Pnacl_M18_PPB_WebSocket_IsWebSocket(PP_Resource resource) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
return iface->IsWebSocket(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_WebSocket_Connect(PP_Resource web_socket, struct PP_Var url, const struct PP_Var protocols[], uint32_t protocol_count, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M18_PPB_WebSocket_Connect(PP_Resource web_socket, struct PP_Var* url, const struct PP_Var protocols[], uint32_t protocol_count, struct PP_CompletionCallback* callback) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
- return iface->Connect(web_socket, url, protocols, protocol_count, callback);
+ return iface->Connect(web_socket, *url, protocols, protocol_count, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_WebSocket_Close(PP_Resource web_socket, uint16_t code, struct PP_Var reason, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M18_PPB_WebSocket_Close(PP_Resource web_socket, uint16_t code, struct PP_Var* reason, struct PP_CompletionCallback* callback) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
- return iface->Close(web_socket, code, reason, callback);
+ return iface->Close(web_socket, code, *reason, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_WebSocket_ReceiveMessage(PP_Resource web_socket, struct PP_Var* message, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M18_PPB_WebSocket_ReceiveMessage(PP_Resource web_socket, struct PP_Var* message, struct PP_CompletionCallback* callback) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
- return iface->ReceiveMessage(web_socket, message, callback);
+ return iface->ReceiveMessage(web_socket, message, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_WebSocket_SendMessage(PP_Resource web_socket, struct PP_Var message) {
+static int32_t Pnacl_M18_PPB_WebSocket_SendMessage(PP_Resource web_socket, struct PP_Var* message) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
- return iface->SendMessage(web_socket, message);
+ return iface->SendMessage(web_socket, *message);
}
-static __attribute__((pnaclcall))
-uint64_t Pnacl_M18_PPB_WebSocket_GetBufferedAmount(PP_Resource web_socket) {
+static uint64_t Pnacl_M18_PPB_WebSocket_GetBufferedAmount(PP_Resource web_socket) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
return iface->GetBufferedAmount(web_socket);
}
-static __attribute__((pnaclcall))
-uint16_t Pnacl_M18_PPB_WebSocket_GetCloseCode(PP_Resource web_socket) {
+static uint16_t Pnacl_M18_PPB_WebSocket_GetCloseCode(PP_Resource web_socket) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
return iface->GetCloseCode(web_socket);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M18_PPB_WebSocket_GetCloseReason(PP_Resource web_socket) {
+static void Pnacl_M18_PPB_WebSocket_GetCloseReason(struct PP_Var* _struct_result, PP_Resource web_socket) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
- return iface->GetCloseReason(web_socket);
+ *_struct_result = iface->GetCloseReason(web_socket);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M18_PPB_WebSocket_GetCloseWasClean(PP_Resource web_socket) {
+static PP_Bool Pnacl_M18_PPB_WebSocket_GetCloseWasClean(PP_Resource web_socket) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
return iface->GetCloseWasClean(web_socket);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M18_PPB_WebSocket_GetExtensions(PP_Resource web_socket) {
+static void Pnacl_M18_PPB_WebSocket_GetExtensions(struct PP_Var* _struct_result, PP_Resource web_socket) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
- return iface->GetExtensions(web_socket);
+ *_struct_result = iface->GetExtensions(web_socket);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M18_PPB_WebSocket_GetProtocol(PP_Resource web_socket) {
+static void Pnacl_M18_PPB_WebSocket_GetProtocol(struct PP_Var* _struct_result, PP_Resource web_socket) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
- return iface->GetProtocol(web_socket);
+ *_struct_result = iface->GetProtocol(web_socket);
}
-static __attribute__((pnaclcall))
-PP_WebSocketReadyState Pnacl_M18_PPB_WebSocket_GetReadyState(PP_Resource web_socket) {
+static PP_WebSocketReadyState Pnacl_M18_PPB_WebSocket_GetReadyState(PP_Resource web_socket) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
return iface->GetReadyState(web_socket);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M18_PPB_WebSocket_GetURL(PP_Resource web_socket) {
+static void Pnacl_M18_PPB_WebSocket_GetURL(struct PP_Var* _struct_result, PP_Resource web_socket) {
const struct PPB_WebSocket_1_0 *iface = Pnacl_WrapperInfo_PPB_WebSocket_1_0.real_iface;
- return iface->GetURL(web_socket);
+ *_struct_result = iface->GetURL(web_socket);
}
/* End wrapper methods for PPB_WebSocket_1_0 */
@@ -1227,8 +1209,9 @@
static void Pnacl_M14_PPP_Messaging_HandleMessage(PP_Instance instance, struct PP_Var message) {
const struct PPP_Messaging_1_0 *iface = Pnacl_WrapperInfo_PPP_Messaging_1_0.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, struct PP_Var message) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, struct PP_Var message))iface->HandleMessage);
- temp_fp(instance, message);
+ void (*temp_fp)(PP_Instance instance, struct PP_Var* message) =
+ ((void (*)(PP_Instance instance, struct PP_Var* message))iface->HandleMessage);
+ temp_fp(instance, &message);
}
/* End wrapper methods for PPP_Messaging_1_0 */
@@ -1237,26 +1220,22 @@
/* Begin wrapper methods for PPB_AudioTrusted_0_6 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_AudioTrusted_CreateTrusted(PP_Instance instance) {
+static PP_Resource Pnacl_M14_PPB_AudioTrusted_CreateTrusted(PP_Instance instance) {
const struct PPB_AudioTrusted_0_6 *iface = Pnacl_WrapperInfo_PPB_AudioTrusted_0_6.real_iface;
return iface->CreateTrusted(instance);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_AudioTrusted_Open(PP_Resource audio, PP_Resource config, struct PP_CompletionCallback create_callback) {
+static int32_t Pnacl_M14_PPB_AudioTrusted_Open(PP_Resource audio, PP_Resource config, struct PP_CompletionCallback* create_callback) {
const struct PPB_AudioTrusted_0_6 *iface = Pnacl_WrapperInfo_PPB_AudioTrusted_0_6.real_iface;
- return iface->Open(audio, config, create_callback);
+ return iface->Open(audio, config, *create_callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_AudioTrusted_GetSyncSocket(PP_Resource audio, int* sync_socket) {
+static int32_t Pnacl_M14_PPB_AudioTrusted_GetSyncSocket(PP_Resource audio, int* sync_socket) {
const struct PPB_AudioTrusted_0_6 *iface = Pnacl_WrapperInfo_PPB_AudioTrusted_0_6.real_iface;
return iface->GetSyncSocket(audio, sync_socket);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_AudioTrusted_GetSharedMemory(PP_Resource audio, int* shm_handle, uint32_t* shm_size) {
+static int32_t Pnacl_M14_PPB_AudioTrusted_GetSharedMemory(PP_Resource audio, int* shm_handle, uint32_t* shm_size) {
const struct PPB_AudioTrusted_0_6 *iface = Pnacl_WrapperInfo_PPB_AudioTrusted_0_6.real_iface;
return iface->GetSharedMemory(audio, shm_handle, shm_size);
}
@@ -1265,26 +1244,22 @@
/* Begin wrapper methods for PPB_BrokerTrusted_0_2 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_BrokerTrusted_CreateTrusted(PP_Instance instance) {
+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 __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_BrokerTrusted_IsBrokerTrusted(PP_Resource resource) {
+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 __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_BrokerTrusted_Connect(PP_Resource broker, struct PP_CompletionCallback connect_callback) {
+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);
+ return iface->Connect(broker, *connect_callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_BrokerTrusted_GetHandle(PP_Resource broker, int32_t* handle) {
+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);
}
@@ -1293,32 +1268,27 @@
/* Begin wrapper methods for PPB_BrokerTrusted_0_3 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M25_PPB_BrokerTrusted_CreateTrusted(PP_Instance instance) {
+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 __attribute__((pnaclcall))
-PP_Bool Pnacl_M25_PPB_BrokerTrusted_IsBrokerTrusted(PP_Resource resource) {
+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 __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_BrokerTrusted_Connect(PP_Resource broker, struct PP_CompletionCallback connect_callback) {
+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);
+ return iface->Connect(broker, *connect_callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_BrokerTrusted_GetHandle(PP_Resource broker, int32_t* handle) {
+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);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M25_PPB_BrokerTrusted_IsAllowed(PP_Resource broker) {
+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);
}
@@ -1327,50 +1297,42 @@
/* Begin wrapper methods for PPB_BrowserFont_Trusted_1_0 */
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_PPB_BrowserFont_Trusted_GetFontFamilies(PP_Instance instance) {
+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;
- return iface->GetFontFamilies(instance);
+ *_struct_result = iface->GetFontFamilies(instance);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M19_PPB_BrowserFont_Trusted_Create(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description* description) {
+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 __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_BrowserFont_Trusted_IsFont(PP_Resource resource) {
+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 __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_BrowserFont_Trusted_Describe(PP_Resource font, struct PP_BrowserFont_Trusted_Description* description, struct PP_BrowserFont_Trusted_Metrics* metrics) {
+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 __attribute__((pnaclcall))
-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) {
+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 __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_BrowserFont_Trusted_MeasureText(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text) {
+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 __attribute__((pnaclcall))
-uint32_t Pnacl_M19_PPB_BrowserFont_Trusted_CharacterOffsetForPixel(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text, int32_t pixel_position) {
+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 __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_BrowserFont_Trusted_PixelOffsetForCharacter(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text, uint32_t char_offset) {
+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);
}
@@ -1381,128 +1343,110 @@
/* Begin wrapper methods for PPB_CharSet_Trusted_1_0 */
-static __attribute__((pnaclcall))
-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) {
+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 __attribute__((pnaclcall))
-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) {
+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 __attribute__((pnaclcall))
-struct PP_Var Pnacl_M18_PPB_CharSet_Trusted_GetDefaultCharSet(PP_Instance instance) {
+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;
- return iface->GetDefaultCharSet(instance);
+ *_struct_result = iface->GetDefaultCharSet(instance);
}
/* End wrapper methods for PPB_CharSet_Trusted_1_0 */
/* Begin wrapper methods for PPB_FileChooserTrusted_0_5 */
-static __attribute__((pnaclcall))
-int32_t Pnacl_M16_PPB_FileChooserTrusted_ShowWithoutUserGesture(PP_Resource chooser, PP_Bool save_as, struct PP_Var suggested_file_name, struct PP_CompletionCallback callback) {
+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);
+ 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 __attribute__((pnaclcall))
-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) {
+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);
+ 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 __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIOTrusted_GetOSFileDescriptor(PP_Resource file_io) {
+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 __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIOTrusted_WillWrite(PP_Resource file_io, int64_t offset, int32_t bytes_to_write, struct PP_CompletionCallback callback) {
+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);
+ return iface->WillWrite(file_io, offset, bytes_to_write, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_FileIOTrusted_WillSetLength(PP_Resource file_io, int64_t length, struct PP_CompletionCallback 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);
+ return iface->WillSetLength(file_io, length, *callback);
}
/* End wrapper methods for PPB_FileIOTrusted_0_4 */
/* Begin wrapper methods for PPB_Graphics3DTrusted_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M16_PPB_Graphics3DTrusted_CreateRaw(PP_Instance instance_id, PP_Resource share_context, const int32_t attrib_list[]) {
+static PP_Resource Pnacl_M16_PPB_Graphics3DTrusted_CreateRaw(PP_Instance instance_id, PP_Resource share_context, const int32_t attrib_list[]) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
return iface->CreateRaw(instance_id, share_context, attrib_list);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_InitCommandBuffer(PP_Resource context_id) {
+static PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_InitCommandBuffer(PP_Resource context_id) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
return iface->InitCommandBuffer(context_id);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_SetGetBuffer(PP_Resource context, int32_t transfer_buffer_id) {
+static PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_SetGetBuffer(PP_Resource context, int32_t transfer_buffer_id) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
return iface->SetGetBuffer(context, transfer_buffer_id);
}
-static __attribute__((pnaclcall))
-struct PP_Graphics3DTrustedState Pnacl_M16_PPB_Graphics3DTrusted_GetState(PP_Resource context) {
+static void Pnacl_M16_PPB_Graphics3DTrusted_GetState(struct PP_Graphics3DTrustedState* _struct_result, PP_Resource context) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
- return iface->GetState(context);
+ *_struct_result = iface->GetState(context);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M16_PPB_Graphics3DTrusted_CreateTransferBuffer(PP_Resource context, uint32_t size) {
+static int32_t Pnacl_M16_PPB_Graphics3DTrusted_CreateTransferBuffer(PP_Resource context, uint32_t size) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
return iface->CreateTransferBuffer(context, size);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_DestroyTransferBuffer(PP_Resource context, int32_t id) {
+static PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_DestroyTransferBuffer(PP_Resource context, int32_t id) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
return iface->DestroyTransferBuffer(context, id);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_GetTransferBuffer(PP_Resource context, int32_t id, int* shm_handle, uint32_t* shm_size) {
+static PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_GetTransferBuffer(PP_Resource context, int32_t id, int* shm_handle, uint32_t* shm_size) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
return iface->GetTransferBuffer(context, id, shm_handle, shm_size);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_Flush(PP_Resource context, int32_t put_offset) {
+static PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_Flush(PP_Resource context, int32_t put_offset) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
return iface->Flush(context, put_offset);
}
-static __attribute__((pnaclcall))
-struct PP_Graphics3DTrustedState Pnacl_M16_PPB_Graphics3DTrusted_FlushSync(PP_Resource context, int32_t put_offset) {
+static void Pnacl_M16_PPB_Graphics3DTrusted_FlushSync(struct PP_Graphics3DTrustedState* _struct_result, PP_Resource context, int32_t put_offset) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
- return iface->FlushSync(context, put_offset);
+ *_struct_result = iface->FlushSync(context, put_offset);
}
-static __attribute__((pnaclcall))
-struct PP_Graphics3DTrustedState Pnacl_M16_PPB_Graphics3DTrusted_FlushSyncFast(PP_Resource context, int32_t put_offset, int32_t last_known_get) {
+static void Pnacl_M16_PPB_Graphics3DTrusted_FlushSyncFast(struct PP_Graphics3DTrustedState* _struct_result, PP_Resource context, int32_t put_offset, int32_t last_known_get) {
const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
- return iface->FlushSyncFast(context, put_offset, last_known_get);
+ *_struct_result = iface->FlushSyncFast(context, put_offset, last_known_get);
}
/* End wrapper methods for PPB_Graphics3DTrusted_1_0 */
@@ -1513,50 +1457,42 @@
/* Begin wrapper methods for PPB_AudioInput_Dev_0_2 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M19_PPB_AudioInput_Dev_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M19_PPB_AudioInput_Dev_Create(PP_Instance instance) {
const struct PPB_AudioInput_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_AudioInput_Dev_IsAudioInput(PP_Resource resource) {
+static PP_Bool Pnacl_M19_PPB_AudioInput_Dev_IsAudioInput(PP_Resource resource) {
const struct PPB_AudioInput_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2.real_iface;
return iface->IsAudioInput(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_AudioInput_Dev_EnumerateDevices(PP_Resource audio_input, PP_Resource* devices, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M19_PPB_AudioInput_Dev_EnumerateDevices(PP_Resource audio_input, PP_Resource* devices, struct PP_CompletionCallback* callback) {
const struct PPB_AudioInput_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2.real_iface;
- return iface->EnumerateDevices(audio_input, devices, callback);
+ return iface->EnumerateDevices(audio_input, devices, *callback);
}
-static __attribute__((pnaclcall))
-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 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);
+ return iface->Open(audio_input, device_ref, config, audio_input_callback, user_data, *callback);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M19_PPB_AudioInput_Dev_GetCurrentConfig(PP_Resource audio_input) {
+static PP_Resource Pnacl_M19_PPB_AudioInput_Dev_GetCurrentConfig(PP_Resource audio_input) {
const struct PPB_AudioInput_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2.real_iface;
return iface->GetCurrentConfig(audio_input);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_AudioInput_Dev_StartCapture(PP_Resource audio_input) {
+static PP_Bool Pnacl_M19_PPB_AudioInput_Dev_StartCapture(PP_Resource audio_input) {
const struct PPB_AudioInput_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2.real_iface;
return iface->StartCapture(audio_input);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_AudioInput_Dev_StopCapture(PP_Resource audio_input) {
+static PP_Bool Pnacl_M19_PPB_AudioInput_Dev_StopCapture(PP_Resource audio_input) {
const struct PPB_AudioInput_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2.real_iface;
return iface->StopCapture(audio_input);
}
-static __attribute__((pnaclcall))
-void Pnacl_M19_PPB_AudioInput_Dev_Close(PP_Resource audio_input) {
+static void Pnacl_M19_PPB_AudioInput_Dev_Close(PP_Resource audio_input) {
const struct PPB_AudioInput_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2.real_iface;
iface->Close(audio_input);
}
@@ -1565,56 +1501,47 @@
/* Begin wrapper methods for PPB_AudioInput_Dev_0_3 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M25_PPB_AudioInput_Dev_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M25_PPB_AudioInput_Dev_Create(PP_Instance instance) {
const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M25_PPB_AudioInput_Dev_IsAudioInput(PP_Resource resource) {
+static PP_Bool Pnacl_M25_PPB_AudioInput_Dev_IsAudioInput(PP_Resource resource) {
const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
return iface->IsAudioInput(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_AudioInput_Dev_EnumerateDevices(PP_Resource audio_input, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_AudioInput_Dev_EnumerateDevices(PP_Resource audio_input, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
- return iface->EnumerateDevices(audio_input, output, callback);
+ return iface->EnumerateDevices(audio_input, *output, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_AudioInput_Dev_MonitorDeviceChange(PP_Resource audio_input, PP_MonitorDeviceChangeCallback callback, void* user_data) {
+static int32_t Pnacl_M25_PPB_AudioInput_Dev_MonitorDeviceChange(PP_Resource audio_input, PP_MonitorDeviceChangeCallback callback, void* user_data) {
const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
return iface->MonitorDeviceChange(audio_input, callback, user_data);
}
-static __attribute__((pnaclcall))
-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 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);
+ return iface->Open(audio_input, device_ref, config, audio_input_callback, user_data, *callback);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M25_PPB_AudioInput_Dev_GetCurrentConfig(PP_Resource audio_input) {
+static PP_Resource Pnacl_M25_PPB_AudioInput_Dev_GetCurrentConfig(PP_Resource audio_input) {
const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
return iface->GetCurrentConfig(audio_input);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M25_PPB_AudioInput_Dev_StartCapture(PP_Resource audio_input) {
+static PP_Bool Pnacl_M25_PPB_AudioInput_Dev_StartCapture(PP_Resource audio_input) {
const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
return iface->StartCapture(audio_input);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M25_PPB_AudioInput_Dev_StopCapture(PP_Resource audio_input) {
+static PP_Bool Pnacl_M25_PPB_AudioInput_Dev_StopCapture(PP_Resource audio_input) {
const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
return iface->StopCapture(audio_input);
}
-static __attribute__((pnaclcall))
-void Pnacl_M25_PPB_AudioInput_Dev_Close(PP_Resource audio_input) {
+static void Pnacl_M25_PPB_AudioInput_Dev_Close(PP_Resource audio_input) {
const struct PPB_AudioInput_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3.real_iface;
iface->Close(audio_input);
}
@@ -1629,70 +1556,41 @@
/* Begin wrapper methods for PPB_DeviceRef_Dev_0_1 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M18_PPB_DeviceRef_Dev_IsDeviceRef(PP_Resource resource) {
+static PP_Bool Pnacl_M18_PPB_DeviceRef_Dev_IsDeviceRef(PP_Resource resource) {
const struct PPB_DeviceRef_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1.real_iface;
return iface->IsDeviceRef(resource);
}
-static __attribute__((pnaclcall))
-PP_DeviceType_Dev Pnacl_M18_PPB_DeviceRef_Dev_GetType(PP_Resource device_ref) {
+static PP_DeviceType_Dev Pnacl_M18_PPB_DeviceRef_Dev_GetType(PP_Resource device_ref) {
const struct PPB_DeviceRef_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1.real_iface;
return iface->GetType(device_ref);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M18_PPB_DeviceRef_Dev_GetName(PP_Resource device_ref) {
+static void Pnacl_M18_PPB_DeviceRef_Dev_GetName(struct PP_Var* _struct_result, PP_Resource device_ref) {
const struct PPB_DeviceRef_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1.real_iface;
- return iface->GetName(device_ref);
+ *_struct_result = iface->GetName(device_ref);
}
/* End wrapper methods for PPB_DeviceRef_Dev_0_1 */
-/* Begin wrapper methods for PPB_DirectoryReader_Dev_0_6 */
-
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M27_PPB_DirectoryReader_Dev_Create(PP_Resource directory_ref) {
- const struct PPB_DirectoryReader_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6.real_iface;
- return iface->Create(directory_ref);
-}
-
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M27_PPB_DirectoryReader_Dev_IsDirectoryReader(PP_Resource resource) {
- const struct PPB_DirectoryReader_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6.real_iface;
- return iface->IsDirectoryReader(resource);
-}
-
-static __attribute__((pnaclcall))
-int32_t Pnacl_M27_PPB_DirectoryReader_Dev_ReadEntries(PP_Resource directory_reader, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
- const struct PPB_DirectoryReader_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6.real_iface;
- return iface->ReadEntries(directory_reader, output, callback);
-}
-
-/* End wrapper methods for PPB_DirectoryReader_Dev_0_6 */
-
/* Begin wrapper methods for PPB_FileChooser_Dev_0_5 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M16_PPB_FileChooser_Dev_Create(PP_Instance instance, PP_FileChooserMode_Dev mode, struct PP_Var accept_types) {
+static PP_Resource Pnacl_M16_PPB_FileChooser_Dev_Create(PP_Instance instance, PP_FileChooserMode_Dev mode, struct PP_Var* accept_types) {
const struct PPB_FileChooser_Dev_0_5 *iface = Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5.real_iface;
- return iface->Create(instance, mode, accept_types);
+ return iface->Create(instance, mode, *accept_types);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M16_PPB_FileChooser_Dev_IsFileChooser(PP_Resource resource) {
+static PP_Bool Pnacl_M16_PPB_FileChooser_Dev_IsFileChooser(PP_Resource resource) {
const struct PPB_FileChooser_Dev_0_5 *iface = Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5.real_iface;
return iface->IsFileChooser(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M16_PPB_FileChooser_Dev_Show(PP_Resource chooser, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M16_PPB_FileChooser_Dev_Show(PP_Resource chooser, struct PP_CompletionCallback* callback) {
const struct PPB_FileChooser_Dev_0_5 *iface = Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5.real_iface;
- return iface->Show(chooser, callback);
+ return iface->Show(chooser, *callback);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M16_PPB_FileChooser_Dev_GetNextChosenFile(PP_Resource chooser) {
+static PP_Resource Pnacl_M16_PPB_FileChooser_Dev_GetNextChosenFile(PP_Resource chooser) {
const struct PPB_FileChooser_Dev_0_5 *iface = Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5.real_iface;
return iface->GetNextChosenFile(chooser);
}
@@ -1701,22 +1599,19 @@
/* Begin wrapper methods for PPB_FileChooser_Dev_0_6 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M19_PPB_FileChooser_Dev_Create(PP_Instance instance, PP_FileChooserMode_Dev mode, struct PP_Var accept_types) {
+static PP_Resource Pnacl_M19_PPB_FileChooser_Dev_Create(PP_Instance instance, PP_FileChooserMode_Dev mode, struct PP_Var* accept_types) {
const struct PPB_FileChooser_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6.real_iface;
- return iface->Create(instance, mode, accept_types);
+ return iface->Create(instance, mode, *accept_types);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_FileChooser_Dev_IsFileChooser(PP_Resource resource) {
+static PP_Bool Pnacl_M19_PPB_FileChooser_Dev_IsFileChooser(PP_Resource resource) {
const struct PPB_FileChooser_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6.real_iface;
return iface->IsFileChooser(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_FileChooser_Dev_Show(PP_Resource chooser, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M19_PPB_FileChooser_Dev_Show(PP_Resource chooser, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
const struct PPB_FileChooser_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6.real_iface;
- return iface->Show(chooser, output, callback);
+ return iface->Show(chooser, *output, *callback);
}
/* End wrapper methods for PPB_FileChooser_Dev_0_6 */
@@ -1725,50 +1620,42 @@
/* Begin wrapper methods for PPB_Font_Dev_0_6 */
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M14_PPB_Font_Dev_GetFontFamilies(PP_Instance instance) {
+static void Pnacl_M14_PPB_Font_Dev_GetFontFamilies(struct PP_Var* _struct_result, PP_Instance instance) {
const struct PPB_Font_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_Font_Dev_0_6.real_iface;
- return iface->GetFontFamilies(instance);
+ *_struct_result = iface->GetFontFamilies(instance);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_Font_Dev_Create(PP_Instance instance, const struct PP_FontDescription_Dev* description) {
+static PP_Resource Pnacl_M14_PPB_Font_Dev_Create(PP_Instance instance, const struct PP_FontDescription_Dev* description) {
const struct PPB_Font_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_Font_Dev_0_6.real_iface;
return iface->Create(instance, description);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_Font_Dev_IsFont(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_Font_Dev_IsFont(PP_Resource resource) {
const struct PPB_Font_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_Font_Dev_0_6.real_iface;
return iface->IsFont(resource);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_Font_Dev_Describe(PP_Resource font, struct PP_FontDescription_Dev* description, struct PP_FontMetrics_Dev* metrics) {
+static PP_Bool Pnacl_M14_PPB_Font_Dev_Describe(PP_Resource font, struct PP_FontDescription_Dev* description, struct PP_FontMetrics_Dev* metrics) {
const struct PPB_Font_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_Font_Dev_0_6.real_iface;
return iface->Describe(font, description, metrics);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_Font_Dev_DrawTextAt(PP_Resource font, PP_Resource image_data, const struct PP_TextRun_Dev* text, const struct PP_Point* position, uint32_t color, const struct PP_Rect* clip, PP_Bool image_data_is_opaque) {
+static PP_Bool Pnacl_M14_PPB_Font_Dev_DrawTextAt(PP_Resource font, PP_Resource image_data, const struct PP_TextRun_Dev* text, const struct PP_Point* position, uint32_t color, const struct PP_Rect* clip, PP_Bool image_data_is_opaque) {
const struct PPB_Font_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_Font_Dev_0_6.real_iface;
return iface->DrawTextAt(font, image_data, text, position, color, clip, image_data_is_opaque);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_Font_Dev_MeasureText(PP_Resource font, const struct PP_TextRun_Dev* text) {
+static int32_t Pnacl_M14_PPB_Font_Dev_MeasureText(PP_Resource font, const struct PP_TextRun_Dev* text) {
const struct PPB_Font_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_Font_Dev_0_6.real_iface;
return iface->MeasureText(font, text);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M14_PPB_Font_Dev_CharacterOffsetForPixel(PP_Resource font, const struct PP_TextRun_Dev* text, int32_t pixel_position) {
+static uint32_t Pnacl_M14_PPB_Font_Dev_CharacterOffsetForPixel(PP_Resource font, const struct PP_TextRun_Dev* text, int32_t pixel_position) {
const struct PPB_Font_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_Font_Dev_0_6.real_iface;
return iface->CharacterOffsetForPixel(font, text, pixel_position);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_Font_Dev_PixelOffsetForCharacter(PP_Resource font, const struct PP_TextRun_Dev* text, uint32_t char_offset) {
+static int32_t Pnacl_M14_PPB_Font_Dev_PixelOffsetForCharacter(PP_Resource font, const struct PP_TextRun_Dev* text, uint32_t char_offset) {
const struct PPB_Font_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_Font_Dev_0_6.real_iface;
return iface->PixelOffsetForCharacter(font, text, char_offset);
}
@@ -1779,38 +1666,32 @@
/* Begin wrapper methods for PPB_IMEInputEvent_Dev_0_1 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent(PP_Resource resource) {
+static PP_Bool Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent(PP_Resource resource) {
const struct PPB_IMEInputEvent_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1.real_iface;
return iface->IsIMEInputEvent(resource);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M16_PPB_IMEInputEvent_Dev_GetText(PP_Resource ime_event) {
+static void Pnacl_M16_PPB_IMEInputEvent_Dev_GetText(struct PP_Var* _struct_result, PP_Resource ime_event) {
const struct PPB_IMEInputEvent_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1.real_iface;
- return iface->GetText(ime_event);
+ *_struct_result = iface->GetText(ime_event);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M16_PPB_IMEInputEvent_Dev_GetSegmentNumber(PP_Resource ime_event) {
+static uint32_t Pnacl_M16_PPB_IMEInputEvent_Dev_GetSegmentNumber(PP_Resource ime_event) {
const struct PPB_IMEInputEvent_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1.real_iface;
return iface->GetSegmentNumber(ime_event);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M16_PPB_IMEInputEvent_Dev_GetSegmentOffset(PP_Resource ime_event, uint32_t index) {
+static uint32_t Pnacl_M16_PPB_IMEInputEvent_Dev_GetSegmentOffset(PP_Resource ime_event, uint32_t index) {
const struct PPB_IMEInputEvent_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1.real_iface;
return iface->GetSegmentOffset(ime_event, index);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M16_PPB_IMEInputEvent_Dev_GetTargetSegment(PP_Resource ime_event) {
+static int32_t Pnacl_M16_PPB_IMEInputEvent_Dev_GetTargetSegment(PP_Resource ime_event) {
const struct PPB_IMEInputEvent_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1.real_iface;
return iface->GetTargetSegment(ime_event);
}
-static __attribute__((pnaclcall))
-void Pnacl_M16_PPB_IMEInputEvent_Dev_GetSelection(PP_Resource ime_event, uint32_t* start, uint32_t* end) {
+static void Pnacl_M16_PPB_IMEInputEvent_Dev_GetSelection(PP_Resource ime_event, uint32_t* start, uint32_t* end) {
const struct PPB_IMEInputEvent_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1.real_iface;
iface->GetSelection(ime_event, start, end);
}
@@ -1819,44 +1700,37 @@
/* Begin wrapper methods for PPB_IMEInputEvent_Dev_0_2 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M21_PPB_IMEInputEvent_Dev_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, struct PP_Var text, uint32_t segment_number, const uint32_t segment_offsets[], int32_t target_segment, uint32_t selection_start, uint32_t selection_end) {
+static PP_Resource Pnacl_M21_PPB_IMEInputEvent_Dev_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, struct PP_Var* text, uint32_t segment_number, const uint32_t segment_offsets[], int32_t target_segment, uint32_t selection_start, uint32_t selection_end) {
const struct PPB_IMEInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2.real_iface;
- return iface->Create(instance, type, time_stamp, text, segment_number, segment_offsets, target_segment, selection_start, selection_end);
+ return iface->Create(instance, type, time_stamp, *text, segment_number, segment_offsets, target_segment, selection_start, selection_end);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M21_PPB_IMEInputEvent_Dev_IsIMEInputEvent(PP_Resource resource) {
+static PP_Bool Pnacl_M21_PPB_IMEInputEvent_Dev_IsIMEInputEvent(PP_Resource resource) {
const struct PPB_IMEInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2.real_iface;
return iface->IsIMEInputEvent(resource);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M21_PPB_IMEInputEvent_Dev_GetText(PP_Resource ime_event) {
+static void Pnacl_M21_PPB_IMEInputEvent_Dev_GetText(struct PP_Var* _struct_result, PP_Resource ime_event) {
const struct PPB_IMEInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2.real_iface;
- return iface->GetText(ime_event);
+ *_struct_result = iface->GetText(ime_event);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M21_PPB_IMEInputEvent_Dev_GetSegmentNumber(PP_Resource ime_event) {
+static uint32_t Pnacl_M21_PPB_IMEInputEvent_Dev_GetSegmentNumber(PP_Resource ime_event) {
const struct PPB_IMEInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2.real_iface;
return iface->GetSegmentNumber(ime_event);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M21_PPB_IMEInputEvent_Dev_GetSegmentOffset(PP_Resource ime_event, uint32_t index) {
+static uint32_t Pnacl_M21_PPB_IMEInputEvent_Dev_GetSegmentOffset(PP_Resource ime_event, uint32_t index) {
const struct PPB_IMEInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2.real_iface;
return iface->GetSegmentOffset(ime_event, index);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M21_PPB_IMEInputEvent_Dev_GetTargetSegment(PP_Resource ime_event) {
+static int32_t Pnacl_M21_PPB_IMEInputEvent_Dev_GetTargetSegment(PP_Resource ime_event) {
const struct PPB_IMEInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2.real_iface;
return iface->GetTargetSegment(ime_event);
}
-static __attribute__((pnaclcall))
-void Pnacl_M21_PPB_IMEInputEvent_Dev_GetSelection(PP_Resource ime_event, uint32_t* start, uint32_t* end) {
+static void Pnacl_M21_PPB_IMEInputEvent_Dev_GetSelection(PP_Resource ime_event, uint32_t* start, uint32_t* end) {
const struct PPB_IMEInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2.real_iface;
iface->GetSelection(ime_event, start, end);
}
@@ -1867,20 +1741,16 @@
/* Not generating wrapper methods for PPB_Memory_Dev_0_1 */
-/* Not generating wrapper methods for PPB_Printing_Dev_0_6 */
-
/* Begin wrapper methods for PPB_Printing_Dev_0_7 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M23_PPB_Printing_Dev_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M23_PPB_Printing_Dev_Create(PP_Instance instance) {
const struct PPB_Printing_Dev_0_7 *iface = Pnacl_WrapperInfo_PPB_Printing_Dev_0_7.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M23_PPB_Printing_Dev_GetDefaultPrintSettings(PP_Resource resource, struct PP_PrintSettings_Dev* print_settings, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M23_PPB_Printing_Dev_GetDefaultPrintSettings(PP_Resource resource, struct PP_PrintSettings_Dev* print_settings, struct PP_CompletionCallback* callback) {
const struct PPB_Printing_Dev_0_7 *iface = Pnacl_WrapperInfo_PPB_Printing_Dev_0_7.real_iface;
- return iface->GetDefaultPrintSettings(resource, print_settings, callback);
+ return iface->GetDefaultPrintSettings(resource, print_settings, *callback);
}
/* End wrapper methods for PPB_Printing_Dev_0_7 */
@@ -1895,102 +1765,136 @@
/* Begin wrapper methods for PPB_Testing_Dev_0_9 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_Testing_Dev_ReadImageData(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left) {
+static PP_Bool Pnacl_M17_PPB_Testing_Dev_ReadImageData(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left) {
const struct PPB_Testing_Dev_0_9 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_9.real_iface;
return iface->ReadImageData(device_context_2d, image, top_left);
}
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_Testing_Dev_RunMessageLoop(PP_Instance instance) {
+static void Pnacl_M17_PPB_Testing_Dev_RunMessageLoop(PP_Instance instance) {
const struct PPB_Testing_Dev_0_9 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_9.real_iface;
iface->RunMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_Testing_Dev_QuitMessageLoop(PP_Instance instance) {
+static void Pnacl_M17_PPB_Testing_Dev_QuitMessageLoop(PP_Instance instance) {
const struct PPB_Testing_Dev_0_9 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_9.real_iface;
iface->QuitMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M17_PPB_Testing_Dev_GetLiveObjectsForInstance(PP_Instance instance) {
+static uint32_t Pnacl_M17_PPB_Testing_Dev_GetLiveObjectsForInstance(PP_Instance instance) {
const struct PPB_Testing_Dev_0_9 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_9.real_iface;
return iface->GetLiveObjectsForInstance(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess(void) {
+static PP_Bool Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess(void) {
const struct PPB_Testing_Dev_0_9 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_9.real_iface;
return iface->IsOutOfProcess();
}
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_Testing_Dev_SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
+static void Pnacl_M17_PPB_Testing_Dev_SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
const struct PPB_Testing_Dev_0_9 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_9.real_iface;
iface->SimulateInputEvent(instance, input_event);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M17_PPB_Testing_Dev_GetDocumentURL(PP_Instance instance, struct PP_URLComponents_Dev* components) {
+static void Pnacl_M17_PPB_Testing_Dev_GetDocumentURL(struct PP_Var* _struct_result, PP_Instance instance, struct PP_URLComponents_Dev* components) {
const struct PPB_Testing_Dev_0_9 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_9.real_iface;
- return iface->GetDocumentURL(instance, components);
+ *_struct_result = iface->GetDocumentURL(instance, components);
}
/* End wrapper methods for PPB_Testing_Dev_0_9 */
/* Begin wrapper methods for PPB_Testing_Dev_0_91 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M18_PPB_Testing_Dev_ReadImageData(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left) {
+static PP_Bool Pnacl_M18_PPB_Testing_Dev_ReadImageData(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left) {
const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface;
return iface->ReadImageData(device_context_2d, image, top_left);
}
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_Testing_Dev_RunMessageLoop(PP_Instance instance) {
+static void Pnacl_M18_PPB_Testing_Dev_RunMessageLoop(PP_Instance instance) {
const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface;
iface->RunMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_Testing_Dev_QuitMessageLoop(PP_Instance instance) {
+static void Pnacl_M18_PPB_Testing_Dev_QuitMessageLoop(PP_Instance instance) {
const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface;
iface->QuitMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M18_PPB_Testing_Dev_GetLiveObjectsForInstance(PP_Instance instance) {
+static uint32_t Pnacl_M18_PPB_Testing_Dev_GetLiveObjectsForInstance(PP_Instance instance) {
const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface;
return iface->GetLiveObjectsForInstance(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess(void) {
+static PP_Bool Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess(void) {
const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface;
return iface->IsOutOfProcess();
}
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_Testing_Dev_SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
+static void Pnacl_M18_PPB_Testing_Dev_SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface;
iface->SimulateInputEvent(instance, input_event);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M18_PPB_Testing_Dev_GetDocumentURL(PP_Instance instance, struct PP_URLComponents_Dev* components) {
+static void Pnacl_M18_PPB_Testing_Dev_GetDocumentURL(struct PP_Var* _struct_result, PP_Instance instance, struct PP_URLComponents_Dev* components) {
const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface;
- return iface->GetDocumentURL(instance, components);
+ *_struct_result = iface->GetDocumentURL(instance, components);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M18_PPB_Testing_Dev_GetLiveVars(struct PP_Var live_vars[], uint32_t array_size) {
+static uint32_t Pnacl_M18_PPB_Testing_Dev_GetLiveVars(struct PP_Var live_vars[], uint32_t array_size) {
const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface;
return iface->GetLiveVars(live_vars, array_size);
}
/* End wrapper methods for PPB_Testing_Dev_0_91 */
+/* Begin wrapper methods for PPB_Testing_Dev_0_92 */
+
+static PP_Bool Pnacl_M28_PPB_Testing_Dev_ReadImageData(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left) {
+ const struct PPB_Testing_Dev_0_92 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_92.real_iface;
+ return iface->ReadImageData(device_context_2d, image, top_left);
+}
+
+static void Pnacl_M28_PPB_Testing_Dev_RunMessageLoop(PP_Instance instance) {
+ const struct PPB_Testing_Dev_0_92 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_92.real_iface;
+ iface->RunMessageLoop(instance);
+}
+
+static void Pnacl_M28_PPB_Testing_Dev_QuitMessageLoop(PP_Instance instance) {
+ const struct PPB_Testing_Dev_0_92 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_92.real_iface;
+ iface->QuitMessageLoop(instance);
+}
+
+static uint32_t Pnacl_M28_PPB_Testing_Dev_GetLiveObjectsForInstance(PP_Instance instance) {
+ const struct PPB_Testing_Dev_0_92 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_92.real_iface;
+ return iface->GetLiveObjectsForInstance(instance);
+}
+
+static PP_Bool Pnacl_M28_PPB_Testing_Dev_IsOutOfProcess(void) {
+ const struct PPB_Testing_Dev_0_92 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_92.real_iface;
+ return iface->IsOutOfProcess();
+}
+
+static void Pnacl_M28_PPB_Testing_Dev_SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
+ const struct PPB_Testing_Dev_0_92 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_92.real_iface;
+ iface->SimulateInputEvent(instance, input_event);
+}
+
+static void Pnacl_M28_PPB_Testing_Dev_GetDocumentURL(struct PP_Var* _struct_result, PP_Instance instance, struct PP_URLComponents_Dev* components) {
+ const struct PPB_Testing_Dev_0_92 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_92.real_iface;
+ *_struct_result = iface->GetDocumentURL(instance, components);
+}
+
+static uint32_t Pnacl_M28_PPB_Testing_Dev_GetLiveVars(struct PP_Var live_vars[], uint32_t array_size) {
+ const struct PPB_Testing_Dev_0_92 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_92.real_iface;
+ return iface->GetLiveVars(live_vars, array_size);
+}
+
+static void Pnacl_M28_PPB_Testing_Dev_SetMinimumArrayBufferSizeForShmem(PP_Instance instance, uint32_t threshold) {
+ const struct PPB_Testing_Dev_0_92 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_92.real_iface;
+ iface->SetMinimumArrayBufferSizeForShmem(instance, threshold);
+}
+
+/* End wrapper methods for PPB_Testing_Dev_0_92 */
+
/* Not generating wrapper methods for PPB_TextInput_Dev_0_1 */
/* Not generating wrapper methods for PPB_TextInput_Dev_0_2 */
@@ -1999,216 +1903,188 @@
/* Begin wrapper methods for PPB_TrueTypeFont_Dev_0_1 */
-static __attribute__((pnaclcall))
-int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetFontFamilies(PP_Instance instance, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetFontFamilies(PP_Instance instance, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
- return iface->GetFontFamilies(instance, output, callback);
+ return iface->GetFontFamilies(instance, *output, *callback);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M26_PPB_TrueTypeFont_Dev_Create(PP_Instance instance, const struct PP_TrueTypeFontDesc_Dev* desc) {
+static int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetFontsInFamily(PP_Instance instance, struct PP_Var* family, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
+ const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
+ return iface->GetFontsInFamily(instance, *family, *output, *callback);
+}
+
+static PP_Resource Pnacl_M26_PPB_TrueTypeFont_Dev_Create(PP_Instance instance, const struct PP_TrueTypeFontDesc_Dev* desc) {
const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
return iface->Create(instance, desc);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M26_PPB_TrueTypeFont_Dev_IsFont(PP_Resource resource) {
+static PP_Bool Pnacl_M26_PPB_TrueTypeFont_Dev_IsTrueTypeFont(PP_Resource resource) {
const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
- return iface->IsFont(resource);
+ return iface->IsTrueTypeFont(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_Describe(PP_Resource font, struct PP_TrueTypeFontDesc_Dev* desc, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_Describe(PP_Resource font, struct PP_TrueTypeFontDesc_Dev* desc, struct PP_CompletionCallback* callback) {
const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
- return iface->Describe(font, desc, callback);
+ return iface->Describe(font, desc, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetTableTags(PP_Resource font, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetTableTags(PP_Resource font, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
- return iface->GetTableTags(font, output, callback);
+ return iface->GetTableTags(font, *output, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetTable(PP_Resource font, uint32_t table, int32_t offset, int32_t max_data_length, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M26_PPB_TrueTypeFont_Dev_GetTable(PP_Resource font, uint32_t table, int32_t offset, int32_t max_data_length, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
const struct PPB_TrueTypeFont_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1.real_iface;
- return iface->GetTable(font, table, offset, max_data_length, output, callback);
+ return iface->GetTable(font, table, offset, max_data_length, *output, *callback);
}
/* End wrapper methods for PPB_TrueTypeFont_Dev_0_1 */
/* Begin wrapper methods for PPB_URLUtil_Dev_0_6 */
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M17_PPB_URLUtil_Dev_Canonicalize(struct PP_Var url, struct PP_URLComponents_Dev* components) {
+static void Pnacl_M17_PPB_URLUtil_Dev_Canonicalize(struct PP_Var* _struct_result, struct PP_Var* url, struct PP_URLComponents_Dev* components) {
const struct PPB_URLUtil_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6.real_iface;
- return iface->Canonicalize(url, components);
+ *_struct_result = iface->Canonicalize(*url, components);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M17_PPB_URLUtil_Dev_ResolveRelativeToURL(struct PP_Var base_url, struct PP_Var relative_string, struct PP_URLComponents_Dev* components) {
+static void Pnacl_M17_PPB_URLUtil_Dev_ResolveRelativeToURL(struct PP_Var* _struct_result, struct PP_Var* base_url, struct PP_Var* relative_string, struct PP_URLComponents_Dev* components) {
const struct PPB_URLUtil_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6.real_iface;
- return iface->ResolveRelativeToURL(base_url, relative_string, components);
+ *_struct_result = iface->ResolveRelativeToURL(*base_url, *relative_string, components);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M17_PPB_URLUtil_Dev_ResolveRelativeToDocument(PP_Instance instance, struct PP_Var relative_string, struct PP_URLComponents_Dev* components) {
+static void Pnacl_M17_PPB_URLUtil_Dev_ResolveRelativeToDocument(struct PP_Var* _struct_result, PP_Instance instance, struct PP_Var* relative_string, struct PP_URLComponents_Dev* components) {
const struct PPB_URLUtil_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6.real_iface;
- return iface->ResolveRelativeToDocument(instance, relative_string, components);
+ *_struct_result = iface->ResolveRelativeToDocument(instance, *relative_string, components);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_URLUtil_Dev_IsSameSecurityOrigin(struct PP_Var url_a, struct PP_Var url_b) {
+static PP_Bool Pnacl_M17_PPB_URLUtil_Dev_IsSameSecurityOrigin(struct PP_Var* url_a, struct PP_Var* url_b) {
const struct PPB_URLUtil_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6.real_iface;
- return iface->IsSameSecurityOrigin(url_a, url_b);
+ return iface->IsSameSecurityOrigin(*url_a, *url_b);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_URLUtil_Dev_DocumentCanRequest(PP_Instance instance, struct PP_Var url) {
+static PP_Bool Pnacl_M17_PPB_URLUtil_Dev_DocumentCanRequest(PP_Instance instance, struct PP_Var* url) {
const struct PPB_URLUtil_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6.real_iface;
- return iface->DocumentCanRequest(instance, url);
+ return iface->DocumentCanRequest(instance, *url);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_URLUtil_Dev_DocumentCanAccessDocument(PP_Instance active, PP_Instance target) {
+static PP_Bool Pnacl_M17_PPB_URLUtil_Dev_DocumentCanAccessDocument(PP_Instance active, PP_Instance target) {
const struct PPB_URLUtil_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6.real_iface;
return iface->DocumentCanAccessDocument(active, target);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M17_PPB_URLUtil_Dev_GetDocumentURL(PP_Instance instance, struct PP_URLComponents_Dev* components) {
+static void Pnacl_M17_PPB_URLUtil_Dev_GetDocumentURL(struct PP_Var* _struct_result, PP_Instance instance, struct PP_URLComponents_Dev* components) {
const struct PPB_URLUtil_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6.real_iface;
- return iface->GetDocumentURL(instance, components);
+ *_struct_result = iface->GetDocumentURL(instance, components);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M17_PPB_URLUtil_Dev_GetPluginInstanceURL(PP_Instance instance, struct PP_URLComponents_Dev* components) {
+static void Pnacl_M17_PPB_URLUtil_Dev_GetPluginInstanceURL(struct PP_Var* _struct_result, PP_Instance instance, struct PP_URLComponents_Dev* components) {
const struct PPB_URLUtil_Dev_0_6 *iface = Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6.real_iface;
- return iface->GetPluginInstanceURL(instance, components);
+ *_struct_result = iface->GetPluginInstanceURL(instance, components);
}
/* End wrapper methods for PPB_URLUtil_Dev_0_6 */
/* Begin wrapper methods for PPB_VarArray_Dev_0_1 */
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M27_PPB_VarArray_Dev_Create(void) {
+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;
- return iface->Create();
+ *_struct_result = iface->Create();
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M27_PPB_VarArray_Dev_Get(struct PP_Var array, uint32_t index) {
+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;
- return iface->Get(array, index);
+ *_struct_result = iface->Get(*array, index);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M27_PPB_VarArray_Dev_Set(struct PP_Var array, uint32_t index, struct PP_Var value) {
+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);
+ return iface->Set(*array, index, *value);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M27_PPB_VarArray_Dev_GetLength(struct PP_Var array) {
+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);
+ return iface->GetLength(*array);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M27_PPB_VarArray_Dev_SetLength(struct PP_Var array, uint32_t length) {
+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);
+ return iface->SetLength(*array, length);
}
/* End wrapper methods for PPB_VarArray_Dev_0_1 */
/* Begin wrapper methods for PPB_VarDictionary_Dev_0_1 */
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M27_PPB_VarDictionary_Dev_Create(void) {
+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;
- return iface->Create();
+ *_struct_result = iface->Create();
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M27_PPB_VarDictionary_Dev_Get(struct PP_Var dict, struct PP_Var key) {
+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;
- return iface->Get(dict, key);
+ *_struct_result = iface->Get(*dict, *key);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M27_PPB_VarDictionary_Dev_Set(struct PP_Var dict, struct PP_Var key, struct PP_Var value) {
+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);
+ return iface->Set(*dict, *key, *value);
}
-static __attribute__((pnaclcall))
-void Pnacl_M27_PPB_VarDictionary_Dev_Delete(struct PP_Var dict, struct PP_Var key) {
+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);
+ iface->Delete(*dict, *key);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M27_PPB_VarDictionary_Dev_HasKey(struct PP_Var dict, struct PP_Var 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);
+ return iface->HasKey(*dict, *key);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M27_PPB_VarDictionary_Dev_GetKeys(struct PP_Var dict) {
+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;
- return iface->GetKeys(dict);
+ *_struct_result = iface->GetKeys(*dict);
}
/* End wrapper methods for PPB_VarDictionary_Dev_0_1 */
/* Begin wrapper methods for PPB_VideoCapture_Dev_0_2 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M19_PPB_VideoCapture_Dev_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M19_PPB_VideoCapture_Dev_Create(PP_Instance instance) {
const struct PPB_VideoCapture_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_VideoCapture_Dev_IsVideoCapture(PP_Resource video_capture) {
+static PP_Bool Pnacl_M19_PPB_VideoCapture_Dev_IsVideoCapture(PP_Resource video_capture) {
const struct PPB_VideoCapture_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2.real_iface;
return iface->IsVideoCapture(video_capture);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_VideoCapture_Dev_EnumerateDevices(PP_Resource video_capture, PP_Resource* devices, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M19_PPB_VideoCapture_Dev_EnumerateDevices(PP_Resource video_capture, PP_Resource* devices, struct PP_CompletionCallback* callback) {
const struct PPB_VideoCapture_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2.real_iface;
- return iface->EnumerateDevices(video_capture, devices, callback);
+ return iface->EnumerateDevices(video_capture, devices, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_VideoCapture_Dev_Open(PP_Resource video_capture, PP_Resource device_ref, const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, uint32_t buffer_count, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M19_PPB_VideoCapture_Dev_Open(PP_Resource video_capture, PP_Resource device_ref, const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, uint32_t buffer_count, struct PP_CompletionCallback* callback) {
const struct PPB_VideoCapture_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2.real_iface;
- return iface->Open(video_capture, device_ref, requested_info, buffer_count, callback);
+ return iface->Open(video_capture, device_ref, requested_info, buffer_count, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_VideoCapture_Dev_StartCapture(PP_Resource video_capture) {
+static int32_t Pnacl_M19_PPB_VideoCapture_Dev_StartCapture(PP_Resource video_capture) {
const struct PPB_VideoCapture_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2.real_iface;
return iface->StartCapture(video_capture);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_VideoCapture_Dev_ReuseBuffer(PP_Resource video_capture, uint32_t buffer) {
+static int32_t Pnacl_M19_PPB_VideoCapture_Dev_ReuseBuffer(PP_Resource video_capture, uint32_t buffer) {
const struct PPB_VideoCapture_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2.real_iface;
return iface->ReuseBuffer(video_capture, buffer);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_VideoCapture_Dev_StopCapture(PP_Resource video_capture) {
+static int32_t Pnacl_M19_PPB_VideoCapture_Dev_StopCapture(PP_Resource video_capture) {
const struct PPB_VideoCapture_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2.real_iface;
return iface->StopCapture(video_capture);
}
-static __attribute__((pnaclcall))
-void Pnacl_M19_PPB_VideoCapture_Dev_Close(PP_Resource video_capture) {
+static void Pnacl_M19_PPB_VideoCapture_Dev_Close(PP_Resource video_capture) {
const struct PPB_VideoCapture_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2.real_iface;
iface->Close(video_capture);
}
@@ -2217,56 +2093,47 @@
/* Begin wrapper methods for PPB_VideoCapture_Dev_0_3 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M25_PPB_VideoCapture_Dev_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M25_PPB_VideoCapture_Dev_Create(PP_Instance instance) {
const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M25_PPB_VideoCapture_Dev_IsVideoCapture(PP_Resource video_capture) {
+static PP_Bool Pnacl_M25_PPB_VideoCapture_Dev_IsVideoCapture(PP_Resource video_capture) {
const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
return iface->IsVideoCapture(video_capture);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_VideoCapture_Dev_EnumerateDevices(PP_Resource video_capture, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_VideoCapture_Dev_EnumerateDevices(PP_Resource video_capture, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
- return iface->EnumerateDevices(video_capture, output, callback);
+ return iface->EnumerateDevices(video_capture, *output, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_VideoCapture_Dev_MonitorDeviceChange(PP_Resource video_capture, PP_MonitorDeviceChangeCallback callback, void* user_data) {
+static int32_t Pnacl_M25_PPB_VideoCapture_Dev_MonitorDeviceChange(PP_Resource video_capture, PP_MonitorDeviceChangeCallback callback, void* user_data) {
const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
return iface->MonitorDeviceChange(video_capture, callback, user_data);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_VideoCapture_Dev_Open(PP_Resource video_capture, PP_Resource device_ref, const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, uint32_t buffer_count, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M25_PPB_VideoCapture_Dev_Open(PP_Resource video_capture, PP_Resource device_ref, const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, uint32_t buffer_count, struct PP_CompletionCallback* callback) {
const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
- return iface->Open(video_capture, device_ref, requested_info, buffer_count, callback);
+ return iface->Open(video_capture, device_ref, requested_info, buffer_count, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_VideoCapture_Dev_StartCapture(PP_Resource video_capture) {
+static int32_t Pnacl_M25_PPB_VideoCapture_Dev_StartCapture(PP_Resource video_capture) {
const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
return iface->StartCapture(video_capture);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_VideoCapture_Dev_ReuseBuffer(PP_Resource video_capture, uint32_t buffer) {
+static int32_t Pnacl_M25_PPB_VideoCapture_Dev_ReuseBuffer(PP_Resource video_capture, uint32_t buffer) {
const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
return iface->ReuseBuffer(video_capture, buffer);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M25_PPB_VideoCapture_Dev_StopCapture(PP_Resource video_capture) {
+static int32_t Pnacl_M25_PPB_VideoCapture_Dev_StopCapture(PP_Resource video_capture) {
const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
return iface->StopCapture(video_capture);
}
-static __attribute__((pnaclcall))
-void Pnacl_M25_PPB_VideoCapture_Dev_Close(PP_Resource video_capture) {
+static void Pnacl_M25_PPB_VideoCapture_Dev_Close(PP_Resource video_capture) {
const struct PPB_VideoCapture_Dev_0_3 *iface = Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3.real_iface;
iface->Close(video_capture);
}
@@ -2275,50 +2142,42 @@
/* Begin wrapper methods for PPB_VideoDecoder_Dev_0_16 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_VideoDecoder_Dev_Create(PP_Instance instance, PP_Resource context, PP_VideoDecoder_Profile profile) {
+static PP_Resource Pnacl_M14_PPB_VideoDecoder_Dev_Create(PP_Instance instance, PP_Resource context, PP_VideoDecoder_Profile profile) {
const struct PPB_VideoDecoder_Dev_0_16 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16.real_iface;
return iface->Create(instance, context, profile);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_VideoDecoder_Dev_IsVideoDecoder(PP_Resource resource) {
+static PP_Bool Pnacl_M14_PPB_VideoDecoder_Dev_IsVideoDecoder(PP_Resource resource) {
const struct PPB_VideoDecoder_Dev_0_16 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16.real_iface;
return iface->IsVideoDecoder(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_VideoDecoder_Dev_Decode(PP_Resource video_decoder, const struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_VideoDecoder_Dev_Decode(PP_Resource video_decoder, const struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer, struct PP_CompletionCallback* callback) {
const struct PPB_VideoDecoder_Dev_0_16 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16.real_iface;
- return iface->Decode(video_decoder, bitstream_buffer, callback);
+ return iface->Decode(video_decoder, bitstream_buffer, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_VideoDecoder_Dev_AssignPictureBuffers(PP_Resource video_decoder, uint32_t no_of_buffers, const struct PP_PictureBuffer_Dev buffers[]) {
+static void Pnacl_M14_PPB_VideoDecoder_Dev_AssignPictureBuffers(PP_Resource video_decoder, uint32_t no_of_buffers, const struct PP_PictureBuffer_Dev buffers[]) {
const struct PPB_VideoDecoder_Dev_0_16 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16.real_iface;
iface->AssignPictureBuffers(video_decoder, no_of_buffers, buffers);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_VideoDecoder_Dev_ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) {
+static void Pnacl_M14_PPB_VideoDecoder_Dev_ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) {
const struct PPB_VideoDecoder_Dev_0_16 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16.real_iface;
iface->ReusePictureBuffer(video_decoder, picture_buffer_id);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_VideoDecoder_Dev_Flush(PP_Resource video_decoder, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_VideoDecoder_Dev_Flush(PP_Resource video_decoder, struct PP_CompletionCallback* callback) {
const struct PPB_VideoDecoder_Dev_0_16 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16.real_iface;
- return iface->Flush(video_decoder, callback);
+ return iface->Flush(video_decoder, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_VideoDecoder_Dev_Reset(PP_Resource video_decoder, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_VideoDecoder_Dev_Reset(PP_Resource video_decoder, struct PP_CompletionCallback* callback) {
const struct PPB_VideoDecoder_Dev_0_16 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16.real_iface;
- return iface->Reset(video_decoder, callback);
+ return iface->Reset(video_decoder, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M14_PPB_VideoDecoder_Dev_Destroy(PP_Resource video_decoder) {
+static void Pnacl_M14_PPB_VideoDecoder_Dev_Destroy(PP_Resource video_decoder) {
const struct PPB_VideoDecoder_Dev_0_16 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16.real_iface;
iface->Destroy(video_decoder);
}
@@ -2345,8 +2204,11 @@
static struct PP_Var Pnacl_M13_PPP_Selection_Dev_GetSelectedText(PP_Instance instance, PP_Bool html) {
const struct PPP_Selection_Dev_0_3 *iface = Pnacl_WrapperInfo_PPP_Selection_Dev_0_3.real_iface;
- struct PP_Var (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_Bool html) = ((struct PP_Var (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_Bool html))iface->GetSelectedText);
- return temp_fp(instance, html);
+ void (*temp_fp)(struct PP_Var* _struct_result, PP_Instance instance, PP_Bool html) =
+ ((void (*)(struct PP_Var* _struct_result, PP_Instance instance, PP_Bool html))iface->GetSelectedText);
+ struct PP_Var _struct_result;
+ temp_fp(&_struct_result, instance, html);
+ return _struct_result;
}
/* End wrapper methods for PPP_Selection_Dev_0_3 */
@@ -2367,470 +2229,405 @@
/* Begin wrapper methods for PPB_ContentDecryptor_Private_0_6 */
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_NeedKey(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var init_data) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_NeedKey(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* session_id, struct PP_Var* init_data) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
- iface->NeedKey(instance, key_system, session_id, init_data);
+ iface->NeedKey(instance, *key_system, *session_id, *init_data);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_KeyAdded(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_KeyAdded(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* session_id) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
- iface->KeyAdded(instance, key_system, session_id);
+ iface->KeyAdded(instance, *key_system, *session_id);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var message, struct PP_Var default_url) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* session_id, struct PP_Var* message, struct PP_Var* default_url) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
- iface->KeyMessage(instance, key_system, session_id, message, default_url);
+ iface->KeyMessage(instance, *key_system, *session_id, *message, *default_url);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_KeyError(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, int32_t media_error, int32_t system_code) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_KeyError(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* session_id, int32_t media_error, int32_t system_code) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
- iface->KeyError(instance, key_system, session_id, media_error, system_code);
+ iface->KeyError(instance, *key_system, *session_id, media_error, system_code);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverBlock(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverBlock(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
iface->DeliverBlock(instance, decrypted_block, decrypted_block_info);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderInitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderInitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
iface->DecoderInitializeDone(instance, decoder_type, request_id, success);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderDeinitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderDeinitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
iface->DecoderDeinitializeDone(instance, decoder_type, request_id);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderResetDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderResetDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
iface->DecoderResetDone(instance, decoder_type, request_id);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverFrame(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverFrame(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
iface->DeliverFrame(instance, decrypted_frame, decrypted_frame_info);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverSamples(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info) {
+static void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverSamples(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info) {
const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface;
iface->DeliverSamples(instance, audio_frames, decrypted_block_info);
}
/* End wrapper methods for PPB_ContentDecryptor_Private_0_6 */
+/* Begin wrapper methods for PPB_FileIO_Private_0_1 */
+
+static int32_t Pnacl_M28_PPB_FileIO_Private_RequestOSFileHandle(PP_Resource file_io, PP_FileHandle* handle, struct PP_CompletionCallback* callback) {
+ const struct PPB_FileIO_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_Private_0_1.real_iface;
+ return iface->RequestOSFileHandle(file_io, handle, *callback);
+}
+
+/* End wrapper methods for PPB_FileIO_Private_0_1 */
+
/* Begin wrapper methods for PPB_FileRefPrivate_0_1 */
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M15_PPB_FileRefPrivate_GetAbsolutePath(PP_Resource file_ref) {
+static void Pnacl_M15_PPB_FileRefPrivate_GetAbsolutePath(struct PP_Var* _struct_result, PP_Resource file_ref) {
const struct PPB_FileRefPrivate_0_1 *iface = Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1.real_iface;
- return iface->GetAbsolutePath(file_ref);
+ *_struct_result = iface->GetAbsolutePath(file_ref);
}
/* End wrapper methods for PPB_FileRefPrivate_0_1 */
/* Begin wrapper methods for PPB_Flash_12_4 */
-static __attribute__((pnaclcall))
-void Pnacl_M21_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
+static void Pnacl_M21_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
iface->SetInstanceAlwaysOnTop(instance, on_top);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M21_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
+static PP_Bool Pnacl_M21_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M21_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
+static void Pnacl_M21_PPB_Flash_GetProxyForURL(struct PP_Var* _struct_result, PP_Instance instance, const char* url) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
- return iface->GetProxyForURL(instance, url);
+ *_struct_result = iface->GetProxyForURL(instance, url);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M21_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
+static int32_t Pnacl_M21_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
return iface->Navigate(request_info, target, from_user_action);
}
-static __attribute__((pnaclcall))
-void Pnacl_M21_PPB_Flash_RunMessageLoop(PP_Instance instance) {
+static void Pnacl_M21_PPB_Flash_RunMessageLoop(PP_Instance instance) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
iface->RunMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-void Pnacl_M21_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
+static void Pnacl_M21_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
iface->QuitMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-double Pnacl_M21_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
+static double Pnacl_M21_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
return iface->GetLocalTimeZoneOffset(instance, t);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M21_PPB_Flash_GetCommandLineArgs(PP_Module module) {
+static void Pnacl_M21_PPB_Flash_GetCommandLineArgs(struct PP_Var* _struct_result, PP_Module module) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
- return iface->GetCommandLineArgs(module);
+ *_struct_result = iface->GetCommandLineArgs(module);
}
-static __attribute__((pnaclcall))
-void Pnacl_M21_PPB_Flash_PreloadFontWin(const void* logfontw) {
+static void Pnacl_M21_PPB_Flash_PreloadFontWin(const void* logfontw) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
iface->PreloadFontWin(logfontw);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M21_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
+static PP_Bool Pnacl_M21_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
return iface->IsRectTopmost(instance, rect);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M21_PPB_Flash_InvokePrinting(PP_Instance instance) {
+static int32_t Pnacl_M21_PPB_Flash_InvokePrinting(PP_Instance instance) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
return iface->InvokePrinting(instance);
}
-static __attribute__((pnaclcall))
-void Pnacl_M21_PPB_Flash_UpdateActivity(PP_Instance instance) {
+static void Pnacl_M21_PPB_Flash_UpdateActivity(PP_Instance instance) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
iface->UpdateActivity(instance);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M21_PPB_Flash_GetDeviceID(PP_Instance instance) {
+static void Pnacl_M21_PPB_Flash_GetDeviceID(struct PP_Var* _struct_result, PP_Instance instance) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
- return iface->GetDeviceID(instance);
+ *_struct_result = iface->GetDeviceID(instance);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M21_PPB_Flash_GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
+static int32_t Pnacl_M21_PPB_Flash_GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
return iface->GetSettingInt(instance, setting);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M21_PPB_Flash_GetSetting(PP_Instance instance, PP_FlashSetting setting) {
+static void Pnacl_M21_PPB_Flash_GetSetting(struct PP_Var* _struct_result, PP_Instance instance, PP_FlashSetting setting) {
const struct PPB_Flash_12_4 *iface = Pnacl_WrapperInfo_PPB_Flash_12_4.real_iface;
- return iface->GetSetting(instance, setting);
+ *_struct_result = iface->GetSetting(instance, setting);
}
/* End wrapper methods for PPB_Flash_12_4 */
/* Begin wrapper methods for PPB_Flash_12_5 */
-static __attribute__((pnaclcall))
-void Pnacl_M22_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
+static void Pnacl_M22_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
iface->SetInstanceAlwaysOnTop(instance, on_top);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M22_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
+static PP_Bool Pnacl_M22_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M22_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
+static void Pnacl_M22_PPB_Flash_GetProxyForURL(struct PP_Var* _struct_result, PP_Instance instance, const char* url) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
- return iface->GetProxyForURL(instance, url);
+ *_struct_result = iface->GetProxyForURL(instance, url);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M22_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
+static int32_t Pnacl_M22_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
return iface->Navigate(request_info, target, from_user_action);
}
-static __attribute__((pnaclcall))
-void Pnacl_M22_PPB_Flash_RunMessageLoop(PP_Instance instance) {
+static void Pnacl_M22_PPB_Flash_RunMessageLoop(PP_Instance instance) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
iface->RunMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-void Pnacl_M22_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
+static void Pnacl_M22_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
iface->QuitMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-double Pnacl_M22_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
+static double Pnacl_M22_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
return iface->GetLocalTimeZoneOffset(instance, t);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M22_PPB_Flash_GetCommandLineArgs(PP_Module module) {
+static void Pnacl_M22_PPB_Flash_GetCommandLineArgs(struct PP_Var* _struct_result, PP_Module module) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
- return iface->GetCommandLineArgs(module);
+ *_struct_result = iface->GetCommandLineArgs(module);
}
-static __attribute__((pnaclcall))
-void Pnacl_M22_PPB_Flash_PreloadFontWin(const void* logfontw) {
+static void Pnacl_M22_PPB_Flash_PreloadFontWin(const void* logfontw) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
iface->PreloadFontWin(logfontw);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M22_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
+static PP_Bool Pnacl_M22_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
return iface->IsRectTopmost(instance, rect);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M22_PPB_Flash_InvokePrinting(PP_Instance instance) {
+static int32_t Pnacl_M22_PPB_Flash_InvokePrinting(PP_Instance instance) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
return iface->InvokePrinting(instance);
}
-static __attribute__((pnaclcall))
-void Pnacl_M22_PPB_Flash_UpdateActivity(PP_Instance instance) {
+static void Pnacl_M22_PPB_Flash_UpdateActivity(PP_Instance instance) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
iface->UpdateActivity(instance);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M22_PPB_Flash_GetDeviceID(PP_Instance instance) {
+static void Pnacl_M22_PPB_Flash_GetDeviceID(struct PP_Var* _struct_result, PP_Instance instance) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
- return iface->GetDeviceID(instance);
+ *_struct_result = iface->GetDeviceID(instance);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M22_PPB_Flash_GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
+static int32_t Pnacl_M22_PPB_Flash_GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
return iface->GetSettingInt(instance, setting);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M22_PPB_Flash_GetSetting(PP_Instance instance, PP_FlashSetting setting) {
+static void Pnacl_M22_PPB_Flash_GetSetting(struct PP_Var* _struct_result, PP_Instance instance, PP_FlashSetting setting) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
- return iface->GetSetting(instance, setting);
+ *_struct_result = iface->GetSetting(instance, setting);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M22_PPB_Flash_SetCrashData(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value) {
+static PP_Bool Pnacl_M22_PPB_Flash_SetCrashData(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var* value) {
const struct PPB_Flash_12_5 *iface = Pnacl_WrapperInfo_PPB_Flash_12_5.real_iface;
- return iface->SetCrashData(instance, key, value);
+ return iface->SetCrashData(instance, key, *value);
}
/* End wrapper methods for PPB_Flash_12_5 */
/* Begin wrapper methods for PPB_Flash_12_6 */
-static __attribute__((pnaclcall))
-void Pnacl_M24_0_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
+static void Pnacl_M24_0_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
iface->SetInstanceAlwaysOnTop(instance, on_top);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_0_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
+static PP_Bool Pnacl_M24_0_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_0_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
+static void Pnacl_M24_0_PPB_Flash_GetProxyForURL(struct PP_Var* _struct_result, PP_Instance instance, const char* url) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
- return iface->GetProxyForURL(instance, url);
+ *_struct_result = iface->GetProxyForURL(instance, url);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M24_0_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
+static int32_t Pnacl_M24_0_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
return iface->Navigate(request_info, target, from_user_action);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_0_PPB_Flash_RunMessageLoop(PP_Instance instance) {
+static void Pnacl_M24_0_PPB_Flash_RunMessageLoop(PP_Instance instance) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
iface->RunMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_0_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
+static void Pnacl_M24_0_PPB_Flash_QuitMessageLoop(PP_Instance instance) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
iface->QuitMessageLoop(instance);
}
-static __attribute__((pnaclcall))
-double Pnacl_M24_0_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
+static double Pnacl_M24_0_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
return iface->GetLocalTimeZoneOffset(instance, t);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_0_PPB_Flash_GetCommandLineArgs(PP_Module module) {
+static void Pnacl_M24_0_PPB_Flash_GetCommandLineArgs(struct PP_Var* _struct_result, PP_Module module) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
- return iface->GetCommandLineArgs(module);
+ *_struct_result = iface->GetCommandLineArgs(module);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_0_PPB_Flash_PreloadFontWin(const void* logfontw) {
+static void Pnacl_M24_0_PPB_Flash_PreloadFontWin(const void* logfontw) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
iface->PreloadFontWin(logfontw);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_0_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
+static PP_Bool Pnacl_M24_0_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
return iface->IsRectTopmost(instance, rect);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M24_0_PPB_Flash_InvokePrinting(PP_Instance instance) {
+static int32_t Pnacl_M24_0_PPB_Flash_InvokePrinting(PP_Instance instance) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
return iface->InvokePrinting(instance);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_0_PPB_Flash_UpdateActivity(PP_Instance instance) {
+static void Pnacl_M24_0_PPB_Flash_UpdateActivity(PP_Instance instance) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
iface->UpdateActivity(instance);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_0_PPB_Flash_GetDeviceID(PP_Instance instance) {
+static void Pnacl_M24_0_PPB_Flash_GetDeviceID(struct PP_Var* _struct_result, PP_Instance instance) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
- return iface->GetDeviceID(instance);
+ *_struct_result = iface->GetDeviceID(instance);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M24_0_PPB_Flash_GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
+static int32_t Pnacl_M24_0_PPB_Flash_GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
return iface->GetSettingInt(instance, setting);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_0_PPB_Flash_GetSetting(PP_Instance instance, PP_FlashSetting setting) {
+static void Pnacl_M24_0_PPB_Flash_GetSetting(struct PP_Var* _struct_result, PP_Instance instance, PP_FlashSetting setting) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
- return iface->GetSetting(instance, setting);
+ *_struct_result = iface->GetSetting(instance, setting);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_0_PPB_Flash_SetCrashData(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value) {
+static PP_Bool Pnacl_M24_0_PPB_Flash_SetCrashData(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var* value) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
- return iface->SetCrashData(instance, key, value);
+ return iface->SetCrashData(instance, key, *value);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M24_0_PPB_Flash_EnumerateVideoCaptureDevices(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices) {
+static int32_t Pnacl_M24_0_PPB_Flash_EnumerateVideoCaptureDevices(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput* devices) {
const struct PPB_Flash_12_6 *iface = Pnacl_WrapperInfo_PPB_Flash_12_6.real_iface;
- return iface->EnumerateVideoCaptureDevices(instance, video_capture, devices);
+ return iface->EnumerateVideoCaptureDevices(instance, video_capture, *devices);
}
/* End wrapper methods for PPB_Flash_12_6 */
/* Begin wrapper methods for PPB_Flash_13_0 */
-static __attribute__((pnaclcall))
-void Pnacl_M24_1_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
+static void Pnacl_M24_1_PPB_Flash_SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
iface->SetInstanceAlwaysOnTop(instance, on_top);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_1_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
+static PP_Bool Pnacl_M24_1_PPB_Flash_DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
return iface->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_1_PPB_Flash_GetProxyForURL(PP_Instance instance, const char* url) {
+static void Pnacl_M24_1_PPB_Flash_GetProxyForURL(struct PP_Var* _struct_result, PP_Instance instance, const char* url) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
- return iface->GetProxyForURL(instance, url);
+ *_struct_result = iface->GetProxyForURL(instance, url);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M24_1_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
+static int32_t Pnacl_M24_1_PPB_Flash_Navigate(PP_Resource request_info, const char* target, PP_Bool from_user_action) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
return iface->Navigate(request_info, target, from_user_action);
}
-static __attribute__((pnaclcall))
-double Pnacl_M24_1_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
+static double Pnacl_M24_1_PPB_Flash_GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
return iface->GetLocalTimeZoneOffset(instance, t);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_1_PPB_Flash_GetCommandLineArgs(PP_Module module) {
+static void Pnacl_M24_1_PPB_Flash_GetCommandLineArgs(struct PP_Var* _struct_result, PP_Module module) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
- return iface->GetCommandLineArgs(module);
+ *_struct_result = iface->GetCommandLineArgs(module);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_1_PPB_Flash_PreloadFontWin(const void* logfontw) {
+static void Pnacl_M24_1_PPB_Flash_PreloadFontWin(const void* logfontw) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
iface->PreloadFontWin(logfontw);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_1_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
+static PP_Bool Pnacl_M24_1_PPB_Flash_IsRectTopmost(PP_Instance instance, const struct PP_Rect* rect) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
return iface->IsRectTopmost(instance, rect);
}
-static __attribute__((pnaclcall))
-void Pnacl_M24_1_PPB_Flash_UpdateActivity(PP_Instance instance) {
+static void Pnacl_M24_1_PPB_Flash_UpdateActivity(PP_Instance instance) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
iface->UpdateActivity(instance);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_1_PPB_Flash_GetSetting(PP_Instance instance, PP_FlashSetting setting) {
+static void Pnacl_M24_1_PPB_Flash_GetSetting(struct PP_Var* _struct_result, PP_Instance instance, PP_FlashSetting setting) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
- return iface->GetSetting(instance, setting);
+ *_struct_result = iface->GetSetting(instance, setting);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_1_PPB_Flash_SetCrashData(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value) {
+static PP_Bool Pnacl_M24_1_PPB_Flash_SetCrashData(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var* value) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
- return iface->SetCrashData(instance, key, value);
+ return iface->SetCrashData(instance, key, *value);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M24_1_PPB_Flash_EnumerateVideoCaptureDevices(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices) {
+static int32_t Pnacl_M24_1_PPB_Flash_EnumerateVideoCaptureDevices(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput* devices) {
const struct PPB_Flash_13_0 *iface = Pnacl_WrapperInfo_PPB_Flash_13_0.real_iface;
- return iface->EnumerateVideoCaptureDevices(instance, video_capture, devices);
+ return iface->EnumerateVideoCaptureDevices(instance, video_capture, *devices);
}
/* End wrapper methods for PPB_Flash_13_0 */
/* Begin wrapper methods for PPB_Flash_Clipboard_4_0 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_Flash_Clipboard_IsFormatAvailable(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, PP_Flash_Clipboard_Format format) {
+static PP_Bool Pnacl_M19_PPB_Flash_Clipboard_IsFormatAvailable(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, PP_Flash_Clipboard_Format format) {
const struct PPB_Flash_Clipboard_4_0 *iface = Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0.real_iface;
return iface->IsFormatAvailable(instance_id, clipboard_type, format);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_PPB_Flash_Clipboard_ReadData(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, PP_Flash_Clipboard_Format format) {
+static void Pnacl_M19_PPB_Flash_Clipboard_ReadData(struct PP_Var* _struct_result, PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, PP_Flash_Clipboard_Format format) {
const struct PPB_Flash_Clipboard_4_0 *iface = Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0.real_iface;
- return iface->ReadData(instance_id, clipboard_type, format);
+ *_struct_result = iface->ReadData(instance_id, clipboard_type, format);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_Flash_Clipboard_WriteData(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t data_item_count, const PP_Flash_Clipboard_Format formats[], const struct PP_Var data_items[]) {
+static int32_t Pnacl_M19_PPB_Flash_Clipboard_WriteData(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t data_item_count, const PP_Flash_Clipboard_Format formats[], const struct PP_Var data_items[]) {
const struct PPB_Flash_Clipboard_4_0 *iface = Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0.real_iface;
return iface->WriteData(instance_id, clipboard_type, data_item_count, formats, data_items);
}
@@ -2839,26 +2636,22 @@
/* Begin wrapper methods for PPB_Flash_Clipboard_5_0 */
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M24_PPB_Flash_Clipboard_RegisterCustomFormat(PP_Instance instance_id, const char* format_name) {
+static uint32_t Pnacl_M24_PPB_Flash_Clipboard_RegisterCustomFormat(PP_Instance instance_id, const char* format_name) {
const struct PPB_Flash_Clipboard_5_0 *iface = Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0.real_iface;
return iface->RegisterCustomFormat(instance_id, format_name);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M24_PPB_Flash_Clipboard_IsFormatAvailable(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t format) {
+static PP_Bool Pnacl_M24_PPB_Flash_Clipboard_IsFormatAvailable(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t format) {
const struct PPB_Flash_Clipboard_5_0 *iface = Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0.real_iface;
return iface->IsFormatAvailable(instance_id, clipboard_type, format);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M24_PPB_Flash_Clipboard_ReadData(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t format) {
+static void Pnacl_M24_PPB_Flash_Clipboard_ReadData(struct PP_Var* _struct_result, PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t format) {
const struct PPB_Flash_Clipboard_5_0 *iface = Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0.real_iface;
- return iface->ReadData(instance_id, clipboard_type, format);
+ *_struct_result = iface->ReadData(instance_id, clipboard_type, format);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M24_PPB_Flash_Clipboard_WriteData(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t data_item_count, const uint32_t formats[], const struct PP_Var data_items[]) {
+static int32_t Pnacl_M24_PPB_Flash_Clipboard_WriteData(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t data_item_count, const uint32_t formats[], const struct PP_Var data_items[]) {
const struct PPB_Flash_Clipboard_5_0 *iface = Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0.real_iface;
return iface->WriteData(instance_id, clipboard_type, data_item_count, formats, data_items);
}
@@ -2867,16 +2660,14 @@
/* Begin wrapper methods for PPB_Flash_DeviceID_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M21_PPB_Flash_DeviceID_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M21_PPB_Flash_DeviceID_Create(PP_Instance instance) {
const struct PPB_Flash_DeviceID_1_0 *iface = Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M21_PPB_Flash_DeviceID_GetDeviceID(PP_Resource device_id, struct PP_Var* id, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M21_PPB_Flash_DeviceID_GetDeviceID(PP_Resource device_id, struct PP_Var* id, struct PP_CompletionCallback* callback) {
const struct PPB_Flash_DeviceID_1_0 *iface = Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0.real_iface;
- return iface->GetDeviceID(device_id, id, callback);
+ return iface->GetDeviceID(device_id, id, *callback);
}
/* End wrapper methods for PPB_Flash_DeviceID_1_0 */
@@ -2889,22 +2680,19 @@
/* Begin wrapper methods for PPB_Flash_Menu_0_2 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M14_PPB_Flash_Menu_Create(PP_Instance instance_id, const struct PP_Flash_Menu* menu_data) {
+static PP_Resource Pnacl_M14_PPB_Flash_Menu_Create(PP_Instance instance_id, const struct PP_Flash_Menu* menu_data) {
const struct PPB_Flash_Menu_0_2 *iface = Pnacl_WrapperInfo_PPB_Flash_Menu_0_2.real_iface;
return iface->Create(instance_id, menu_data);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M14_PPB_Flash_Menu_IsFlashMenu(PP_Resource resource_id) {
+static PP_Bool Pnacl_M14_PPB_Flash_Menu_IsFlashMenu(PP_Resource resource_id) {
const struct PPB_Flash_Menu_0_2 *iface = Pnacl_WrapperInfo_PPB_Flash_Menu_0_2.real_iface;
return iface->IsFlashMenu(resource_id);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M14_PPB_Flash_Menu_Show(PP_Resource menu_id, const struct PP_Point* location, int32_t* selected_id, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M14_PPB_Flash_Menu_Show(PP_Resource menu_id, const struct PP_Point* location, int32_t* selected_id, struct PP_CompletionCallback* callback) {
const struct PPB_Flash_Menu_0_2 *iface = Pnacl_WrapperInfo_PPB_Flash_Menu_0_2.real_iface;
- return iface->Show(menu_id, location, selected_id, callback);
+ return iface->Show(menu_id, location, selected_id, *callback);
}
/* End wrapper methods for PPB_Flash_Menu_0_2 */
@@ -2917,38 +2705,32 @@
/* Begin wrapper methods for PPB_HostResolver_Private_0_1 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M19_PPB_HostResolver_Private_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M19_PPB_HostResolver_Private_Create(PP_Instance instance) {
const struct PPB_HostResolver_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_HostResolver_Private_IsHostResolver(PP_Resource resource) {
+static PP_Bool Pnacl_M19_PPB_HostResolver_Private_IsHostResolver(PP_Resource resource) {
const struct PPB_HostResolver_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1.real_iface;
return iface->IsHostResolver(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_HostResolver_Private_Resolve(PP_Resource host_resolver, const char* host, uint16_t port, const struct PP_HostResolver_Private_Hint* hint, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M19_PPB_HostResolver_Private_Resolve(PP_Resource host_resolver, const char* host, uint16_t port, const struct PP_HostResolver_Private_Hint* hint, struct PP_CompletionCallback* callback) {
const struct PPB_HostResolver_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1.real_iface;
- return iface->Resolve(host_resolver, host, port, hint, callback);
+ return iface->Resolve(host_resolver, host, port, hint, *callback);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_PPB_HostResolver_Private_GetCanonicalName(PP_Resource host_resolver) {
+static void Pnacl_M19_PPB_HostResolver_Private_GetCanonicalName(struct PP_Var* _struct_result, PP_Resource host_resolver) {
const struct PPB_HostResolver_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1.real_iface;
- return iface->GetCanonicalName(host_resolver);
+ *_struct_result = iface->GetCanonicalName(host_resolver);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M19_PPB_HostResolver_Private_GetSize(PP_Resource host_resolver) {
+static uint32_t Pnacl_M19_PPB_HostResolver_Private_GetSize(PP_Resource host_resolver) {
const struct PPB_HostResolver_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1.real_iface;
return iface->GetSize(host_resolver);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_HostResolver_Private_GetNetAddress(PP_Resource host_resolver, uint32_t index, struct PP_NetAddress_Private* addr) {
+static PP_Bool Pnacl_M19_PPB_HostResolver_Private_GetNetAddress(PP_Resource host_resolver, uint32_t index, struct PP_NetAddress_Private* addr) {
const struct PPB_HostResolver_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1.real_iface;
return iface->GetNetAddress(host_resolver, index, addr);
}
@@ -2957,22 +2739,19 @@
/* Begin wrapper methods for PPB_Instance_Private_0_1 */
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M13_PPB_Instance_Private_GetWindowObject(PP_Instance instance) {
+static void Pnacl_M13_PPB_Instance_Private_GetWindowObject(struct PP_Var* _struct_result, PP_Instance instance) {
const struct PPB_Instance_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_Instance_Private_0_1.real_iface;
- return iface->GetWindowObject(instance);
+ *_struct_result = iface->GetWindowObject(instance);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M13_PPB_Instance_Private_GetOwnerElementObject(PP_Instance instance) {
+static void Pnacl_M13_PPB_Instance_Private_GetOwnerElementObject(struct PP_Var* _struct_result, PP_Instance instance) {
const struct PPB_Instance_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_Instance_Private_0_1.real_iface;
- return iface->GetOwnerElementObject(instance);
+ *_struct_result = iface->GetOwnerElementObject(instance);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M13_PPB_Instance_Private_ExecuteScript(PP_Instance instance, struct PP_Var script, struct PP_Var* exception) {
+static void Pnacl_M13_PPB_Instance_Private_ExecuteScript(struct PP_Var* _struct_result, PP_Instance instance, struct PP_Var* script, struct PP_Var* exception) {
const struct PPB_Instance_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_Instance_Private_0_1.real_iface;
- return iface->ExecuteScript(instance, script, exception);
+ *_struct_result = iface->ExecuteScript(instance, *script, exception);
}
/* End wrapper methods for PPB_Instance_Private_0_1 */
@@ -2981,32 +2760,27 @@
/* Begin wrapper methods for PPB_NetAddress_Private_0_1 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_NetAddress_Private_AreEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
+static PP_Bool Pnacl_M17_PPB_NetAddress_Private_AreEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
const struct PPB_NetAddress_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1.real_iface;
return iface->AreEqual(addr1, addr2);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_NetAddress_Private_AreHostsEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
+static PP_Bool Pnacl_M17_PPB_NetAddress_Private_AreHostsEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
const struct PPB_NetAddress_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1.real_iface;
return iface->AreHostsEqual(addr1, addr2);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M17_PPB_NetAddress_Private_Describe(PP_Module module, const struct PP_NetAddress_Private* addr, PP_Bool include_port) {
+static void Pnacl_M17_PPB_NetAddress_Private_Describe(struct PP_Var* _struct_result, PP_Module module, const struct PP_NetAddress_Private* addr, PP_Bool include_port) {
const struct PPB_NetAddress_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1.real_iface;
- return iface->Describe(module, addr, include_port);
+ *_struct_result = iface->Describe(module, addr, include_port);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_NetAddress_Private_ReplacePort(const struct PP_NetAddress_Private* src_addr, uint16_t port, struct PP_NetAddress_Private* addr_out) {
+static PP_Bool Pnacl_M17_PPB_NetAddress_Private_ReplacePort(const struct PP_NetAddress_Private* src_addr, uint16_t port, struct PP_NetAddress_Private* addr_out) {
const struct PPB_NetAddress_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1.real_iface;
return iface->ReplacePort(src_addr, port, addr_out);
}
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_NetAddress_Private_GetAnyAddress(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr) {
+static void Pnacl_M17_PPB_NetAddress_Private_GetAnyAddress(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr) {
const struct PPB_NetAddress_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1.real_iface;
iface->GetAnyAddress(is_ipv6, addr);
}
@@ -3015,50 +2789,42 @@
/* Begin wrapper methods for PPB_NetAddress_Private_1_0 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_0_PPB_NetAddress_Private_AreEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
+static PP_Bool Pnacl_M19_0_PPB_NetAddress_Private_AreEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
const struct PPB_NetAddress_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0.real_iface;
return iface->AreEqual(addr1, addr2);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_0_PPB_NetAddress_Private_AreHostsEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
+static PP_Bool Pnacl_M19_0_PPB_NetAddress_Private_AreHostsEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
const struct PPB_NetAddress_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0.real_iface;
return iface->AreHostsEqual(addr1, addr2);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_0_PPB_NetAddress_Private_Describe(PP_Module module, const struct PP_NetAddress_Private* addr, PP_Bool include_port) {
+static void Pnacl_M19_0_PPB_NetAddress_Private_Describe(struct PP_Var* _struct_result, PP_Module module, const struct PP_NetAddress_Private* addr, PP_Bool include_port) {
const struct PPB_NetAddress_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0.real_iface;
- return iface->Describe(module, addr, include_port);
+ *_struct_result = iface->Describe(module, addr, include_port);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_0_PPB_NetAddress_Private_ReplacePort(const struct PP_NetAddress_Private* src_addr, uint16_t port, struct PP_NetAddress_Private* addr_out) {
+static PP_Bool Pnacl_M19_0_PPB_NetAddress_Private_ReplacePort(const struct PP_NetAddress_Private* src_addr, uint16_t port, struct PP_NetAddress_Private* addr_out) {
const struct PPB_NetAddress_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0.real_iface;
return iface->ReplacePort(src_addr, port, addr_out);
}
-static __attribute__((pnaclcall))
-void Pnacl_M19_0_PPB_NetAddress_Private_GetAnyAddress(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr) {
+static void Pnacl_M19_0_PPB_NetAddress_Private_GetAnyAddress(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr) {
const struct PPB_NetAddress_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0.real_iface;
iface->GetAnyAddress(is_ipv6, addr);
}
-static __attribute__((pnaclcall))
-PP_NetAddressFamily_Private Pnacl_M19_0_PPB_NetAddress_Private_GetFamily(const struct PP_NetAddress_Private* addr) {
+static PP_NetAddressFamily_Private Pnacl_M19_0_PPB_NetAddress_Private_GetFamily(const struct PP_NetAddress_Private* addr) {
const struct PPB_NetAddress_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0.real_iface;
return iface->GetFamily(addr);
}
-static __attribute__((pnaclcall))
-uint16_t Pnacl_M19_0_PPB_NetAddress_Private_GetPort(const struct PP_NetAddress_Private* addr) {
+static uint16_t Pnacl_M19_0_PPB_NetAddress_Private_GetPort(const struct PP_NetAddress_Private* addr) {
const struct PPB_NetAddress_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0.real_iface;
return iface->GetPort(addr);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_0_PPB_NetAddress_Private_GetAddress(const struct PP_NetAddress_Private* addr, void* address, uint16_t address_size) {
+static PP_Bool Pnacl_M19_0_PPB_NetAddress_Private_GetAddress(const struct PP_NetAddress_Private* addr, void* address, uint16_t address_size) {
const struct PPB_NetAddress_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0.real_iface;
return iface->GetAddress(addr, address, address_size);
}
@@ -3067,68 +2833,57 @@
/* Begin wrapper methods for PPB_NetAddress_Private_1_1 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_1_PPB_NetAddress_Private_AreEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
+static PP_Bool Pnacl_M19_1_PPB_NetAddress_Private_AreEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
return iface->AreEqual(addr1, addr2);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_1_PPB_NetAddress_Private_AreHostsEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
+static PP_Bool Pnacl_M19_1_PPB_NetAddress_Private_AreHostsEqual(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
return iface->AreHostsEqual(addr1, addr2);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_1_PPB_NetAddress_Private_Describe(PP_Module module, const struct PP_NetAddress_Private* addr, PP_Bool include_port) {
+static void Pnacl_M19_1_PPB_NetAddress_Private_Describe(struct PP_Var* _struct_result, PP_Module module, const struct PP_NetAddress_Private* addr, PP_Bool include_port) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
- return iface->Describe(module, addr, include_port);
+ *_struct_result = iface->Describe(module, addr, include_port);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_1_PPB_NetAddress_Private_ReplacePort(const struct PP_NetAddress_Private* src_addr, uint16_t port, struct PP_NetAddress_Private* addr_out) {
+static PP_Bool Pnacl_M19_1_PPB_NetAddress_Private_ReplacePort(const struct PP_NetAddress_Private* src_addr, uint16_t port, struct PP_NetAddress_Private* addr_out) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
return iface->ReplacePort(src_addr, port, addr_out);
}
-static __attribute__((pnaclcall))
-void Pnacl_M19_1_PPB_NetAddress_Private_GetAnyAddress(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr) {
+static void Pnacl_M19_1_PPB_NetAddress_Private_GetAnyAddress(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
iface->GetAnyAddress(is_ipv6, addr);
}
-static __attribute__((pnaclcall))
-PP_NetAddressFamily_Private Pnacl_M19_1_PPB_NetAddress_Private_GetFamily(const struct PP_NetAddress_Private* addr) {
+static PP_NetAddressFamily_Private Pnacl_M19_1_PPB_NetAddress_Private_GetFamily(const struct PP_NetAddress_Private* addr) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
return iface->GetFamily(addr);
}
-static __attribute__((pnaclcall))
-uint16_t Pnacl_M19_1_PPB_NetAddress_Private_GetPort(const struct PP_NetAddress_Private* addr) {
+static uint16_t Pnacl_M19_1_PPB_NetAddress_Private_GetPort(const struct PP_NetAddress_Private* addr) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
return iface->GetPort(addr);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_1_PPB_NetAddress_Private_GetAddress(const struct PP_NetAddress_Private* addr, void* address, uint16_t address_size) {
+static PP_Bool Pnacl_M19_1_PPB_NetAddress_Private_GetAddress(const struct PP_NetAddress_Private* addr, void* address, uint16_t address_size) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
return iface->GetAddress(addr, address, address_size);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M19_1_PPB_NetAddress_Private_GetScopeID(const struct PP_NetAddress_Private* addr) {
+static uint32_t Pnacl_M19_1_PPB_NetAddress_Private_GetScopeID(const struct PP_NetAddress_Private* addr) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
return iface->GetScopeID(addr);
}
-static __attribute__((pnaclcall))
-void Pnacl_M19_1_PPB_NetAddress_Private_CreateFromIPv4Address(const uint8_t ip[4], uint16_t port, struct PP_NetAddress_Private* addr_out) {
+static void Pnacl_M19_1_PPB_NetAddress_Private_CreateFromIPv4Address(const uint8_t ip[4], uint16_t port, struct PP_NetAddress_Private* addr_out) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
iface->CreateFromIPv4Address(ip, port, addr_out);
}
-static __attribute__((pnaclcall))
-void Pnacl_M19_1_PPB_NetAddress_Private_CreateFromIPv6Address(const uint8_t ip[16], uint32_t scope_id, uint16_t port, struct PP_NetAddress_Private* addr_out) {
+static void Pnacl_M19_1_PPB_NetAddress_Private_CreateFromIPv6Address(const uint8_t ip[16], uint32_t scope_id, uint16_t port, struct PP_NetAddress_Private* addr_out) {
const struct PPB_NetAddress_Private_1_1 *iface = Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1.real_iface;
iface->CreateFromIPv6Address(ip, scope_id, port, addr_out);
}
@@ -3137,50 +2892,42 @@
/* Begin wrapper methods for PPB_NetworkList_Private_0_2 */
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_NetworkList_Private_IsNetworkList(PP_Resource resource) {
+static PP_Bool Pnacl_M19_PPB_NetworkList_Private_IsNetworkList(PP_Resource resource) {
const struct PPB_NetworkList_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2.real_iface;
return iface->IsNetworkList(resource);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M19_PPB_NetworkList_Private_GetCount(PP_Resource resource) {
+static uint32_t Pnacl_M19_PPB_NetworkList_Private_GetCount(PP_Resource resource) {
const struct PPB_NetworkList_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2.real_iface;
return iface->GetCount(resource);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_PPB_NetworkList_Private_GetName(PP_Resource resource, uint32_t index) {
+static void Pnacl_M19_PPB_NetworkList_Private_GetName(struct PP_Var* _struct_result, PP_Resource resource, uint32_t index) {
const struct PPB_NetworkList_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2.real_iface;
- return iface->GetName(resource, index);
+ *_struct_result = iface->GetName(resource, index);
}
-static __attribute__((pnaclcall))
-PP_NetworkListType_Private Pnacl_M19_PPB_NetworkList_Private_GetType(PP_Resource resource, uint32_t index) {
+static PP_NetworkListType_Private Pnacl_M19_PPB_NetworkList_Private_GetType(PP_Resource resource, uint32_t index) {
const struct PPB_NetworkList_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2.real_iface;
return iface->GetType(resource, index);
}
-static __attribute__((pnaclcall))
-PP_NetworkListState_Private Pnacl_M19_PPB_NetworkList_Private_GetState(PP_Resource resource, uint32_t index) {
+static PP_NetworkListState_Private Pnacl_M19_PPB_NetworkList_Private_GetState(PP_Resource resource, uint32_t index) {
const struct PPB_NetworkList_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2.real_iface;
return iface->GetState(resource, index);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_NetworkList_Private_GetIpAddresses(PP_Resource resource, uint32_t index, struct PP_NetAddress_Private addresses[], uint32_t count) {
+static int32_t Pnacl_M19_PPB_NetworkList_Private_GetIpAddresses(PP_Resource resource, uint32_t index, struct PP_NetAddress_Private addresses[], uint32_t count) {
const struct PPB_NetworkList_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2.real_iface;
return iface->GetIpAddresses(resource, index, addresses, count);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_PPB_NetworkList_Private_GetDisplayName(PP_Resource resource, uint32_t index) {
+static void Pnacl_M19_PPB_NetworkList_Private_GetDisplayName(struct PP_Var* _struct_result, PP_Resource resource, uint32_t index) {
const struct PPB_NetworkList_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2.real_iface;
- return iface->GetDisplayName(resource, index);
+ *_struct_result = iface->GetDisplayName(resource, index);
}
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M19_PPB_NetworkList_Private_GetMTU(PP_Resource resource, uint32_t index) {
+static uint32_t Pnacl_M19_PPB_NetworkList_Private_GetMTU(PP_Resource resource, uint32_t index) {
const struct PPB_NetworkList_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_NetworkList_Private_0_2.real_iface;
return iface->GetMTU(resource, index);
}
@@ -3191,48 +2938,41 @@
/* Begin wrapper methods for PPB_Talk_Private_1_0 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M19_PPB_Talk_Private_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M19_PPB_Talk_Private_Create(PP_Instance instance) {
const struct PPB_Talk_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Talk_Private_1_0.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_Talk_Private_GetPermission(PP_Resource talk_resource, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M19_PPB_Talk_Private_GetPermission(PP_Resource talk_resource, struct PP_CompletionCallback* callback) {
const struct PPB_Talk_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Talk_Private_1_0.real_iface;
- return iface->GetPermission(talk_resource, callback);
+ return iface->GetPermission(talk_resource, *callback);
}
/* End wrapper methods for PPB_Talk_Private_1_0 */
/* Begin wrapper methods for PPB_TCPServerSocket_Private_0_1 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M18_PPB_TCPServerSocket_Private_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M18_PPB_TCPServerSocket_Private_Create(PP_Instance instance) {
const struct PPB_TCPServerSocket_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M18_PPB_TCPServerSocket_Private_IsTCPServerSocket(PP_Resource resource) {
+static PP_Bool Pnacl_M18_PPB_TCPServerSocket_Private_IsTCPServerSocket(PP_Resource resource) {
const struct PPB_TCPServerSocket_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1.real_iface;
return iface->IsTCPServerSocket(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_TCPServerSocket_Private_Listen(PP_Resource tcp_server_socket, const struct PP_NetAddress_Private* addr, int32_t backlog, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M18_PPB_TCPServerSocket_Private_Listen(PP_Resource tcp_server_socket, const struct PP_NetAddress_Private* addr, int32_t backlog, struct PP_CompletionCallback* callback) {
const struct PPB_TCPServerSocket_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1.real_iface;
- return iface->Listen(tcp_server_socket, addr, backlog, callback);
+ return iface->Listen(tcp_server_socket, addr, backlog, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M18_PPB_TCPServerSocket_Private_Accept(PP_Resource tcp_server_socket, PP_Resource* tcp_socket, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M18_PPB_TCPServerSocket_Private_Accept(PP_Resource tcp_server_socket, PP_Resource* tcp_socket, struct PP_CompletionCallback* callback) {
const struct PPB_TCPServerSocket_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1.real_iface;
- return iface->Accept(tcp_server_socket, tcp_socket, callback);
+ return iface->Accept(tcp_server_socket, tcp_socket, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_TCPServerSocket_Private_StopListening(PP_Resource tcp_server_socket) {
+static void Pnacl_M18_PPB_TCPServerSocket_Private_StopListening(PP_Resource tcp_server_socket) {
const struct PPB_TCPServerSocket_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1.real_iface;
iface->StopListening(tcp_server_socket);
}
@@ -3241,62 +2981,52 @@
/* Begin wrapper methods for PPB_TCPSocket_Private_0_3 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M17_PPB_TCPSocket_Private_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M17_PPB_TCPSocket_Private_Create(PP_Instance instance) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_TCPSocket_Private_IsTCPSocket(PP_Resource resource) {
+static PP_Bool Pnacl_M17_PPB_TCPSocket_Private_IsTCPSocket(PP_Resource resource) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
return iface->IsTCPSocket(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M17_PPB_TCPSocket_Private_Connect(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M17_PPB_TCPSocket_Private_Connect(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
- return iface->Connect(tcp_socket, host, port, callback);
+ return iface->Connect(tcp_socket, host, port, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M17_PPB_TCPSocket_Private_ConnectWithNetAddress(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M17_PPB_TCPSocket_Private_ConnectWithNetAddress(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
- return iface->ConnectWithNetAddress(tcp_socket, addr, callback);
+ return iface->ConnectWithNetAddress(tcp_socket, addr, *callback);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_TCPSocket_Private_GetLocalAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) {
+static PP_Bool Pnacl_M17_PPB_TCPSocket_Private_GetLocalAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
return iface->GetLocalAddress(tcp_socket, local_addr);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_TCPSocket_Private_GetRemoteAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) {
+static PP_Bool Pnacl_M17_PPB_TCPSocket_Private_GetRemoteAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
return iface->GetRemoteAddress(tcp_socket, remote_addr);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M17_PPB_TCPSocket_Private_SSLHandshake(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M17_PPB_TCPSocket_Private_SSLHandshake(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
- return iface->SSLHandshake(tcp_socket, server_name, server_port, callback);
+ return iface->SSLHandshake(tcp_socket, server_name, server_port, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M17_PPB_TCPSocket_Private_Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M17_PPB_TCPSocket_Private_Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
- return iface->Read(tcp_socket, buffer, bytes_to_read, callback);
+ return iface->Read(tcp_socket, buffer, bytes_to_read, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M17_PPB_TCPSocket_Private_Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M17_PPB_TCPSocket_Private_Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
- return iface->Write(tcp_socket, buffer, bytes_to_write, callback);
+ return iface->Write(tcp_socket, buffer, bytes_to_write, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_TCPSocket_Private_Disconnect(PP_Resource tcp_socket) {
+static void Pnacl_M17_PPB_TCPSocket_Private_Disconnect(PP_Resource tcp_socket) {
const struct PPB_TCPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3.real_iface;
iface->Disconnect(tcp_socket);
}
@@ -3305,74 +3035,62 @@
/* Begin wrapper methods for PPB_TCPSocket_Private_0_4 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M20_PPB_TCPSocket_Private_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M20_PPB_TCPSocket_Private_Create(PP_Instance instance) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M20_PPB_TCPSocket_Private_IsTCPSocket(PP_Resource resource) {
+static PP_Bool Pnacl_M20_PPB_TCPSocket_Private_IsTCPSocket(PP_Resource resource) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
return iface->IsTCPSocket(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_PPB_TCPSocket_Private_Connect(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M20_PPB_TCPSocket_Private_Connect(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
- return iface->Connect(tcp_socket, host, port, callback);
+ return iface->Connect(tcp_socket, host, port, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_PPB_TCPSocket_Private_ConnectWithNetAddress(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M20_PPB_TCPSocket_Private_ConnectWithNetAddress(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
- return iface->ConnectWithNetAddress(tcp_socket, addr, callback);
+ return iface->ConnectWithNetAddress(tcp_socket, addr, *callback);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M20_PPB_TCPSocket_Private_GetLocalAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) {
+static PP_Bool Pnacl_M20_PPB_TCPSocket_Private_GetLocalAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
return iface->GetLocalAddress(tcp_socket, local_addr);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M20_PPB_TCPSocket_Private_GetRemoteAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) {
+static PP_Bool Pnacl_M20_PPB_TCPSocket_Private_GetRemoteAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
return iface->GetRemoteAddress(tcp_socket, remote_addr);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_PPB_TCPSocket_Private_SSLHandshake(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M20_PPB_TCPSocket_Private_SSLHandshake(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
- return iface->SSLHandshake(tcp_socket, server_name, server_port, callback);
+ return iface->SSLHandshake(tcp_socket, server_name, server_port, *callback);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M20_PPB_TCPSocket_Private_GetServerCertificate(PP_Resource tcp_socket) {
+static PP_Resource Pnacl_M20_PPB_TCPSocket_Private_GetServerCertificate(PP_Resource tcp_socket) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
return iface->GetServerCertificate(tcp_socket);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M20_PPB_TCPSocket_Private_AddChainBuildingCertificate(PP_Resource tcp_socket, PP_Resource certificate, PP_Bool is_trusted) {
+static PP_Bool Pnacl_M20_PPB_TCPSocket_Private_AddChainBuildingCertificate(PP_Resource tcp_socket, PP_Resource certificate, PP_Bool is_trusted) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
return iface->AddChainBuildingCertificate(tcp_socket, certificate, is_trusted);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_PPB_TCPSocket_Private_Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M20_PPB_TCPSocket_Private_Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
- return iface->Read(tcp_socket, buffer, bytes_to_read, callback);
+ return iface->Read(tcp_socket, buffer, bytes_to_read, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M20_PPB_TCPSocket_Private_Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M20_PPB_TCPSocket_Private_Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
- return iface->Write(tcp_socket, buffer, bytes_to_write, callback);
+ return iface->Write(tcp_socket, buffer, bytes_to_write, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M20_PPB_TCPSocket_Private_Disconnect(PP_Resource tcp_socket) {
+static void Pnacl_M20_PPB_TCPSocket_Private_Disconnect(PP_Resource tcp_socket) {
const struct PPB_TCPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4.real_iface;
iface->Disconnect(tcp_socket);
}
@@ -3381,126 +3099,106 @@
/* Begin wrapper methods for PPB_TCPSocket_Private_0_5 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M27_PPB_TCPSocket_Private_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M27_PPB_TCPSocket_Private_Create(PP_Instance instance) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M27_PPB_TCPSocket_Private_IsTCPSocket(PP_Resource resource) {
+static PP_Bool Pnacl_M27_PPB_TCPSocket_Private_IsTCPSocket(PP_Resource resource) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
return iface->IsTCPSocket(resource);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M27_PPB_TCPSocket_Private_Connect(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M27_PPB_TCPSocket_Private_Connect(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
- return iface->Connect(tcp_socket, host, port, callback);
+ return iface->Connect(tcp_socket, host, port, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M27_PPB_TCPSocket_Private_ConnectWithNetAddress(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M27_PPB_TCPSocket_Private_ConnectWithNetAddress(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
- return iface->ConnectWithNetAddress(tcp_socket, addr, callback);
+ return iface->ConnectWithNetAddress(tcp_socket, addr, *callback);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M27_PPB_TCPSocket_Private_GetLocalAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) {
+static PP_Bool Pnacl_M27_PPB_TCPSocket_Private_GetLocalAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
return iface->GetLocalAddress(tcp_socket, local_addr);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M27_PPB_TCPSocket_Private_GetRemoteAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) {
+static PP_Bool Pnacl_M27_PPB_TCPSocket_Private_GetRemoteAddress(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
return iface->GetRemoteAddress(tcp_socket, remote_addr);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M27_PPB_TCPSocket_Private_SSLHandshake(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M27_PPB_TCPSocket_Private_SSLHandshake(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
- return iface->SSLHandshake(tcp_socket, server_name, server_port, callback);
+ return iface->SSLHandshake(tcp_socket, server_name, server_port, *callback);
}
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M27_PPB_TCPSocket_Private_GetServerCertificate(PP_Resource tcp_socket) {
+static PP_Resource Pnacl_M27_PPB_TCPSocket_Private_GetServerCertificate(PP_Resource tcp_socket) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
return iface->GetServerCertificate(tcp_socket);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M27_PPB_TCPSocket_Private_AddChainBuildingCertificate(PP_Resource tcp_socket, PP_Resource certificate, PP_Bool is_trusted) {
+static PP_Bool Pnacl_M27_PPB_TCPSocket_Private_AddChainBuildingCertificate(PP_Resource tcp_socket, PP_Resource certificate, PP_Bool is_trusted) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
return iface->AddChainBuildingCertificate(tcp_socket, certificate, is_trusted);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M27_PPB_TCPSocket_Private_Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M27_PPB_TCPSocket_Private_Read(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
- return iface->Read(tcp_socket, buffer, bytes_to_read, callback);
+ return iface->Read(tcp_socket, buffer, bytes_to_read, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M27_PPB_TCPSocket_Private_Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M27_PPB_TCPSocket_Private_Write(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
- return iface->Write(tcp_socket, buffer, bytes_to_write, callback);
+ return iface->Write(tcp_socket, buffer, bytes_to_write, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M27_PPB_TCPSocket_Private_Disconnect(PP_Resource tcp_socket) {
+static void Pnacl_M27_PPB_TCPSocket_Private_Disconnect(PP_Resource tcp_socket) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
iface->Disconnect(tcp_socket);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M27_PPB_TCPSocket_Private_SetOption(PP_Resource tcp_socket, PP_TCPSocketOption_Private name, struct PP_Var value, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M27_PPB_TCPSocket_Private_SetOption(PP_Resource tcp_socket, PP_TCPSocketOption_Private name, struct PP_Var* value, struct PP_CompletionCallback* callback) {
const struct PPB_TCPSocket_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5.real_iface;
- return iface->SetOption(tcp_socket, name, value, callback);
+ return iface->SetOption(tcp_socket, name, *value, *callback);
}
/* End wrapper methods for PPB_TCPSocket_Private_0_5 */
/* Begin wrapper methods for PPB_UDPSocket_Private_0_2 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M17_PPB_UDPSocket_Private_Create(PP_Instance instance_id) {
+static PP_Resource Pnacl_M17_PPB_UDPSocket_Private_Create(PP_Instance instance_id) {
const struct PPB_UDPSocket_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2.real_iface;
return iface->Create(instance_id);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_UDPSocket_Private_IsUDPSocket(PP_Resource resource_id) {
+static PP_Bool Pnacl_M17_PPB_UDPSocket_Private_IsUDPSocket(PP_Resource resource_id) {
const struct PPB_UDPSocket_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2.real_iface;
return iface->IsUDPSocket(resource_id);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M17_PPB_UDPSocket_Private_Bind(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M17_PPB_UDPSocket_Private_Bind(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback* callback) {
const struct PPB_UDPSocket_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2.real_iface;
- return iface->Bind(udp_socket, addr, callback);
+ return iface->Bind(udp_socket, addr, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M17_PPB_UDPSocket_Private_RecvFrom(PP_Resource udp_socket, char* buffer, int32_t num_bytes, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M17_PPB_UDPSocket_Private_RecvFrom(PP_Resource udp_socket, char* buffer, int32_t num_bytes, struct PP_CompletionCallback* callback) {
const struct PPB_UDPSocket_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2.real_iface;
- return iface->RecvFrom(udp_socket, buffer, num_bytes, callback);
+ return iface->RecvFrom(udp_socket, buffer, num_bytes, *callback);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M17_PPB_UDPSocket_Private_GetRecvFromAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
+static PP_Bool Pnacl_M17_PPB_UDPSocket_Private_GetRecvFromAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
const struct PPB_UDPSocket_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2.real_iface;
return iface->GetRecvFromAddress(udp_socket, addr);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M17_PPB_UDPSocket_Private_SendTo(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M17_PPB_UDPSocket_Private_SendTo(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback* callback) {
const struct PPB_UDPSocket_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2.real_iface;
- return iface->SendTo(udp_socket, buffer, num_bytes, addr, callback);
+ return iface->SendTo(udp_socket, buffer, num_bytes, addr, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M17_PPB_UDPSocket_Private_Close(PP_Resource udp_socket) {
+static void Pnacl_M17_PPB_UDPSocket_Private_Close(PP_Resource udp_socket) {
const struct PPB_UDPSocket_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2.real_iface;
iface->Close(udp_socket);
}
@@ -3509,50 +3207,42 @@
/* Begin wrapper methods for PPB_UDPSocket_Private_0_3 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M19_PPB_UDPSocket_Private_Create(PP_Instance instance_id) {
+static PP_Resource Pnacl_M19_PPB_UDPSocket_Private_Create(PP_Instance instance_id) {
const struct PPB_UDPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3.real_iface;
return iface->Create(instance_id);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_UDPSocket_Private_IsUDPSocket(PP_Resource resource_id) {
+static PP_Bool Pnacl_M19_PPB_UDPSocket_Private_IsUDPSocket(PP_Resource resource_id) {
const struct PPB_UDPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3.real_iface;
return iface->IsUDPSocket(resource_id);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_UDPSocket_Private_Bind(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M19_PPB_UDPSocket_Private_Bind(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback* callback) {
const struct PPB_UDPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3.real_iface;
- return iface->Bind(udp_socket, addr, callback);
+ return iface->Bind(udp_socket, addr, *callback);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_UDPSocket_Private_GetBoundAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
+static PP_Bool Pnacl_M19_PPB_UDPSocket_Private_GetBoundAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
const struct PPB_UDPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3.real_iface;
return iface->GetBoundAddress(udp_socket, addr);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_UDPSocket_Private_RecvFrom(PP_Resource udp_socket, char* buffer, int32_t num_bytes, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M19_PPB_UDPSocket_Private_RecvFrom(PP_Resource udp_socket, char* buffer, int32_t num_bytes, struct PP_CompletionCallback* callback) {
const struct PPB_UDPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3.real_iface;
- return iface->RecvFrom(udp_socket, buffer, num_bytes, callback);
+ return iface->RecvFrom(udp_socket, buffer, num_bytes, *callback);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_UDPSocket_Private_GetRecvFromAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
+static PP_Bool Pnacl_M19_PPB_UDPSocket_Private_GetRecvFromAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
const struct PPB_UDPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3.real_iface;
return iface->GetRecvFromAddress(udp_socket, addr);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M19_PPB_UDPSocket_Private_SendTo(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M19_PPB_UDPSocket_Private_SendTo(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback* callback) {
const struct PPB_UDPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3.real_iface;
- return iface->SendTo(udp_socket, buffer, num_bytes, addr, callback);
+ return iface->SendTo(udp_socket, buffer, num_bytes, addr, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M19_PPB_UDPSocket_Private_Close(PP_Resource udp_socket) {
+static void Pnacl_M19_PPB_UDPSocket_Private_Close(PP_Resource udp_socket) {
const struct PPB_UDPSocket_Private_0_3 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3.real_iface;
iface->Close(udp_socket);
}
@@ -3561,56 +3251,47 @@
/* Begin wrapper methods for PPB_UDPSocket_Private_0_4 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M23_PPB_UDPSocket_Private_Create(PP_Instance instance_id) {
+static PP_Resource Pnacl_M23_PPB_UDPSocket_Private_Create(PP_Instance instance_id) {
const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface;
return iface->Create(instance_id);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M23_PPB_UDPSocket_Private_IsUDPSocket(PP_Resource resource_id) {
+static PP_Bool Pnacl_M23_PPB_UDPSocket_Private_IsUDPSocket(PP_Resource resource_id) {
const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface;
return iface->IsUDPSocket(resource_id);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M23_PPB_UDPSocket_Private_SetSocketFeature(PP_Resource udp_socket, PP_UDPSocketFeature_Private name, struct PP_Var value) {
+static int32_t Pnacl_M23_PPB_UDPSocket_Private_SetSocketFeature(PP_Resource udp_socket, PP_UDPSocketFeature_Private name, struct PP_Var* value) {
const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface;
- return iface->SetSocketFeature(udp_socket, name, value);
+ return iface->SetSocketFeature(udp_socket, name, *value);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M23_PPB_UDPSocket_Private_Bind(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M23_PPB_UDPSocket_Private_Bind(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback* callback) {
const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface;
- return iface->Bind(udp_socket, addr, callback);
+ return iface->Bind(udp_socket, addr, *callback);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M23_PPB_UDPSocket_Private_GetBoundAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
+static PP_Bool Pnacl_M23_PPB_UDPSocket_Private_GetBoundAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface;
return iface->GetBoundAddress(udp_socket, addr);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M23_PPB_UDPSocket_Private_RecvFrom(PP_Resource udp_socket, char* buffer, int32_t num_bytes, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M23_PPB_UDPSocket_Private_RecvFrom(PP_Resource udp_socket, char* buffer, int32_t num_bytes, struct PP_CompletionCallback* callback) {
const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface;
- return iface->RecvFrom(udp_socket, buffer, num_bytes, callback);
+ return iface->RecvFrom(udp_socket, buffer, num_bytes, *callback);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M23_PPB_UDPSocket_Private_GetRecvFromAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
+static PP_Bool Pnacl_M23_PPB_UDPSocket_Private_GetRecvFromAddress(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) {
const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface;
return iface->GetRecvFromAddress(udp_socket, addr);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M23_PPB_UDPSocket_Private_SendTo(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M23_PPB_UDPSocket_Private_SendTo(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback* callback) {
const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface;
- return iface->SendTo(udp_socket, buffer, num_bytes, addr, callback);
+ return iface->SendTo(udp_socket, buffer, num_bytes, addr, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M23_PPB_UDPSocket_Private_Close(PP_Resource udp_socket) {
+static void Pnacl_M23_PPB_UDPSocket_Private_Close(PP_Resource udp_socket) {
const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface;
iface->Close(udp_socket);
}
@@ -3619,50 +3300,101 @@
/* Begin wrapper methods for PPB_UMA_Private_0_1 */
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_UMA_Private_HistogramCustomTimes(struct PP_Var name, int64_t sample, int64_t min, int64_t max, uint32_t bucket_count) {
+static void Pnacl_M18_PPB_UMA_Private_HistogramCustomTimes(struct PP_Var* name, int64_t sample, int64_t min, int64_t max, uint32_t bucket_count) {
const struct PPB_UMA_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_UMA_Private_0_1.real_iface;
- iface->HistogramCustomTimes(name, sample, min, max, bucket_count);
+ iface->HistogramCustomTimes(*name, sample, min, max, bucket_count);
}
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_UMA_Private_HistogramCustomCounts(struct PP_Var name, int32_t sample, int32_t min, int32_t max, uint32_t bucket_count) {
+static void Pnacl_M18_PPB_UMA_Private_HistogramCustomCounts(struct PP_Var* name, int32_t sample, int32_t min, int32_t max, uint32_t bucket_count) {
const struct PPB_UMA_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_UMA_Private_0_1.real_iface;
- iface->HistogramCustomCounts(name, sample, min, max, bucket_count);
+ iface->HistogramCustomCounts(*name, sample, min, max, bucket_count);
}
-static __attribute__((pnaclcall))
-void Pnacl_M18_PPB_UMA_Private_HistogramEnumeration(struct PP_Var name, int32_t sample, int32_t boundary_value) {
+static void Pnacl_M18_PPB_UMA_Private_HistogramEnumeration(struct PP_Var* name, int32_t sample, int32_t boundary_value) {
const struct PPB_UMA_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_UMA_Private_0_1.real_iface;
- iface->HistogramEnumeration(name, sample, boundary_value);
+ iface->HistogramEnumeration(*name, sample, boundary_value);
}
/* End wrapper methods for PPB_UMA_Private_0_1 */
+/* Begin wrapper methods for PPB_VideoDestination_Private_0_1 */
+
+static PP_Resource Pnacl_M28_PPB_VideoDestination_Private_Create(PP_Instance instance) {
+ const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface;
+ return iface->Create(instance);
+}
+
+static PP_Bool Pnacl_M28_PPB_VideoDestination_Private_IsVideoDestination(PP_Resource resource) {
+ const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface;
+ return iface->IsVideoDestination(resource);
+}
+
+static int32_t Pnacl_M28_PPB_VideoDestination_Private_Open(PP_Resource destination, struct PP_Var* stream_url, struct PP_CompletionCallback* callback) {
+ const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface;
+ return iface->Open(destination, *stream_url, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_VideoDestination_Private_PutFrame(PP_Resource destination, const struct PP_VideoFrame_Private* frame) {
+ const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface;
+ return iface->PutFrame(destination, frame);
+}
+
+static void Pnacl_M28_PPB_VideoDestination_Private_Close(PP_Resource destination) {
+ const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface;
+ iface->Close(destination);
+}
+
+/* End wrapper methods for PPB_VideoDestination_Private_0_1 */
+
+/* Begin wrapper methods for PPB_VideoSource_Private_0_1 */
+
+static PP_Resource Pnacl_M28_PPB_VideoSource_Private_Create(PP_Instance instance) {
+ const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface;
+ return iface->Create(instance);
+}
+
+static PP_Bool Pnacl_M28_PPB_VideoSource_Private_IsVideoSource(PP_Resource resource) {
+ const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface;
+ return iface->IsVideoSource(resource);
+}
+
+static int32_t Pnacl_M28_PPB_VideoSource_Private_Open(PP_Resource source, struct PP_Var* stream_url, struct PP_CompletionCallback* callback) {
+ const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface;
+ return iface->Open(source, *stream_url, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_VideoSource_Private_GetFrame(PP_Resource source, struct PP_VideoFrame_Private* frame, struct PP_CompletionCallback* callback) {
+ const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface;
+ return iface->GetFrame(source, frame, *callback);
+}
+
+static void Pnacl_M28_PPB_VideoSource_Private_Close(PP_Resource source) {
+ const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface;
+ iface->Close(source);
+}
+
+/* End wrapper methods for PPB_VideoSource_Private_0_1 */
+
/* Begin wrapper methods for PPB_X509Certificate_Private_0_1 */
-static __attribute__((pnaclcall))
-PP_Resource Pnacl_M19_PPB_X509Certificate_Private_Create(PP_Instance instance) {
+static PP_Resource Pnacl_M19_PPB_X509Certificate_Private_Create(PP_Instance instance) {
const struct PPB_X509Certificate_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1.real_iface;
return iface->Create(instance);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_X509Certificate_Private_IsX509CertificatePrivate(PP_Resource resource) {
+static PP_Bool Pnacl_M19_PPB_X509Certificate_Private_IsX509CertificatePrivate(PP_Resource resource) {
const struct PPB_X509Certificate_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1.real_iface;
return iface->IsX509CertificatePrivate(resource);
}
-static __attribute__((pnaclcall))
-PP_Bool Pnacl_M19_PPB_X509Certificate_Private_Initialize(PP_Resource resource, const char* bytes, uint32_t length) {
+static PP_Bool Pnacl_M19_PPB_X509Certificate_Private_Initialize(PP_Resource resource, const char* bytes, uint32_t length) {
const struct PPB_X509Certificate_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1.real_iface;
return iface->Initialize(resource, bytes, length);
}
-static __attribute__((pnaclcall))
-struct PP_Var Pnacl_M19_PPB_X509Certificate_Private_GetField(PP_Resource resource, PP_X509Certificate_Private_Field field) {
+static void Pnacl_M19_PPB_X509Certificate_Private_GetField(struct PP_Var* _struct_result, PP_Resource resource, PP_X509Certificate_Private_Field field) {
const struct PPB_X509Certificate_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1.real_iface;
- return iface->GetField(resource, field);
+ *_struct_result = iface->GetField(resource, field);
}
/* End wrapper methods for PPB_X509Certificate_Private_0_1 */
@@ -3671,55 +3403,64 @@
static void Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data) {
const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data))iface->GenerateKeyRequest);
- temp_fp(instance, key_system, type, init_data);
+ void (*temp_fp)(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* type, struct PP_Var* init_data) =
+ ((void (*)(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* type, struct PP_Var* init_data))iface->GenerateKeyRequest);
+ temp_fp(instance, &key_system, &type, &init_data);
}
static void Pnacl_M24_PPP_ContentDecryptor_Private_AddKey(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data) {
const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data))iface->AddKey);
- temp_fp(instance, session_id, key, init_data);
+ void (*temp_fp)(PP_Instance instance, struct PP_Var* session_id, struct PP_Var* key, struct PP_Var* init_data) =
+ ((void (*)(PP_Instance instance, struct PP_Var* session_id, struct PP_Var* key, struct PP_Var* init_data))iface->AddKey);
+ temp_fp(instance, &session_id, &key, &init_data);
}
static void Pnacl_M24_PPP_ContentDecryptor_Private_CancelKeyRequest(PP_Instance instance, struct PP_Var session_id) {
const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, struct PP_Var session_id) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, struct PP_Var session_id))iface->CancelKeyRequest);
- temp_fp(instance, session_id);
+ void (*temp_fp)(PP_Instance instance, struct PP_Var* session_id) =
+ ((void (*)(PP_Instance instance, struct PP_Var* session_id))iface->CancelKeyRequest);
+ temp_fp(instance, &session_id);
}
static void Pnacl_M24_PPP_ContentDecryptor_Private_Decrypt(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) {
const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info))iface->Decrypt);
+ void (*temp_fp)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) =
+ ((void (*)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info))iface->Decrypt);
temp_fp(instance, encrypted_block, encrypted_block_info);
}
static void Pnacl_M24_PPP_ContentDecryptor_Private_InitializeAudioDecoder(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data) {
const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data))iface->InitializeAudioDecoder);
+ void (*temp_fp)(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data) =
+ ((void (*)(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data))iface->InitializeAudioDecoder);
temp_fp(instance, decoder_config, codec_extra_data);
}
static void Pnacl_M24_PPP_ContentDecryptor_Private_InitializeVideoDecoder(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data) {
const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data))iface->InitializeVideoDecoder);
+ void (*temp_fp)(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data) =
+ ((void (*)(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data))iface->InitializeVideoDecoder);
temp_fp(instance, decoder_config, codec_extra_data);
}
static void Pnacl_M24_PPP_ContentDecryptor_Private_DeinitializeDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) {
const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))iface->DeinitializeDecoder);
+ void (*temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) =
+ ((void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))iface->DeinitializeDecoder);
temp_fp(instance, decoder_type, request_id);
}
static void Pnacl_M24_PPP_ContentDecryptor_Private_ResetDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) {
const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))iface->ResetDecoder);
+ void (*temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) =
+ ((void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))iface->ResetDecoder);
temp_fp(instance, decoder_type, request_id);
}
static void Pnacl_M24_PPP_ContentDecryptor_Private_DecryptAndDecode(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info) {
const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface;
- void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info))iface->DecryptAndDecode);
+ void (*temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info) =
+ ((void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info))iface->DecryptAndDecode);
temp_fp(instance, decoder_type, encrypted_buffer, encrypted_block_info);
}
@@ -3735,40 +3476,38 @@
static struct PP_Var Pnacl_M18_PPP_Instance_Private_GetInstanceObject(PP_Instance instance) {
const struct PPP_Instance_Private_0_1 *iface = Pnacl_WrapperInfo_PPP_Instance_Private_0_1.real_iface;
- struct PP_Var (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance) = ((struct PP_Var (__attribute__((pnaclcall)) *)(PP_Instance instance))iface->GetInstanceObject);
- return temp_fp(instance);
+ void (*temp_fp)(struct PP_Var* _struct_result, PP_Instance instance) =
+ ((void (*)(struct PP_Var* _struct_result, PP_Instance instance))iface->GetInstanceObject);
+ struct PP_Var _struct_result;
+ temp_fp(&_struct_result, instance);
+ return _struct_result;
}
/* End wrapper methods for PPP_Instance_Private_0_1 */
/* Begin wrapper methods for PPB_Ext_Alarms_Dev_0_1 */
-static __attribute__((pnaclcall))
-void Pnacl_M27_PPB_Ext_Alarms_Dev_Create(PP_Instance instance, struct PP_Var name, PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info) {
+static void Pnacl_M27_PPB_Ext_Alarms_Dev_Create(PP_Instance instance, struct PP_Var* name, PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info) {
const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
- iface->Create(instance, name, alarm_info);
+ iface->Create(instance, *name, alarm_info);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M27_PPB_Ext_Alarms_Dev_Get(PP_Instance instance, struct PP_Var name, PP_Ext_Alarms_Alarm_Dev* alarm, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M27_PPB_Ext_Alarms_Dev_Get(PP_Instance instance, struct PP_Var* name, PP_Ext_Alarms_Alarm_Dev* alarm, struct PP_CompletionCallback* callback) {
const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
- return iface->Get(instance, name, alarm, callback);
+ return iface->Get(instance, *name, alarm, *callback);
}
-static __attribute__((pnaclcall))
-int32_t Pnacl_M27_PPB_Ext_Alarms_Dev_GetAll(PP_Instance instance, PP_Ext_Alarms_Alarm_Dev_Array* alarms, struct PP_CompletionCallback callback) {
+static int32_t Pnacl_M27_PPB_Ext_Alarms_Dev_GetAll(PP_Instance instance, PP_Ext_Alarms_Alarm_Dev_Array* alarms, struct PP_CompletionCallback* callback) {
const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
- return iface->GetAll(instance, alarms, callback);
+ return iface->GetAll(instance, alarms, *callback);
}
-static __attribute__((pnaclcall))
-void Pnacl_M27_PPB_Ext_Alarms_Dev_Clear(PP_Instance instance, struct PP_Var name) {
+static void Pnacl_M27_PPB_Ext_Alarms_Dev_Clear(PP_Instance instance, struct PP_Var* name) {
const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
- iface->Clear(instance, name);
+ iface->Clear(instance, *name);
}
-static __attribute__((pnaclcall))
-void Pnacl_M27_PPB_Ext_Alarms_Dev_ClearAll(PP_Instance instance) {
+static void Pnacl_M27_PPB_Ext_Alarms_Dev_ClearAll(PP_Instance instance) {
const struct PPB_Ext_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1.real_iface;
iface->ClearAll(instance);
}
@@ -3777,20 +3516,97 @@
/* Begin wrapper methods for PPB_Ext_Events_Dev_0_1 */
-static __attribute__((pnaclcall))
-uint32_t Pnacl_M27_PPB_Ext_Events_Dev_AddListener(PP_Instance instance, struct PP_Ext_EventListener listener) {
+static uint32_t Pnacl_M27_PPB_Ext_Events_Dev_AddListener(PP_Instance instance, struct PP_Ext_EventListener* listener) {
const struct PPB_Ext_Events_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1.real_iface;
- return iface->AddListener(instance, listener);
+ return iface->AddListener(instance, *listener);
}
-static __attribute__((pnaclcall))
-void Pnacl_M27_PPB_Ext_Events_Dev_RemoveListener(PP_Instance instance, uint32_t listener_id) {
+static void Pnacl_M27_PPB_Ext_Events_Dev_RemoveListener(PP_Instance instance, uint32_t listener_id) {
const struct PPB_Ext_Events_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1.real_iface;
iface->RemoveListener(instance, listener_id);
}
/* End wrapper methods for PPB_Ext_Events_Dev_0_1 */
+/* Begin wrapper methods for PPB_Ext_Socket_Dev_0_1 */
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_Create(PP_Instance instance, PP_Ext_Socket_SocketType_Dev type, PP_Ext_Socket_CreateOptions_Dev options, PP_Ext_Socket_CreateInfo_Dev* create_info, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->Create(instance, type, options, create_info, *callback);
+}
+
+static void Pnacl_M28_PPB_Ext_Socket_Dev_Destroy(PP_Instance instance, struct PP_Var* socket_id) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ iface->Destroy(instance, *socket_id);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_Connect(PP_Instance instance, struct PP_Var* socket_id, struct PP_Var* hostname, struct PP_Var* port, struct PP_Var* result, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->Connect(instance, *socket_id, *hostname, *port, result, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_Bind(PP_Instance instance, struct PP_Var* socket_id, struct PP_Var* address, struct PP_Var* port, struct PP_Var* result, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->Bind(instance, *socket_id, *address, *port, result, *callback);
+}
+
+static void Pnacl_M28_PPB_Ext_Socket_Dev_Disconnect(PP_Instance instance, struct PP_Var* socket_id) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ iface->Disconnect(instance, *socket_id);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_Read(PP_Instance instance, struct PP_Var* socket_id, struct PP_Var* buffer_size, PP_Ext_Socket_ReadInfo_Dev* read_info, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->Read(instance, *socket_id, *buffer_size, read_info, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_Write(PP_Instance instance, struct PP_Var* socket_id, struct PP_Var* data, PP_Ext_Socket_WriteInfo_Dev* write_info, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->Write(instance, *socket_id, *data, write_info, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_RecvFrom(PP_Instance instance, struct PP_Var* socket_id, struct PP_Var* buffer_size, PP_Ext_Socket_RecvFromInfo_Dev* recv_from_info, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->RecvFrom(instance, *socket_id, *buffer_size, recv_from_info, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_SendTo(PP_Instance instance, struct PP_Var* socket_id, struct PP_Var* data, struct PP_Var* address, struct PP_Var* port, PP_Ext_Socket_WriteInfo_Dev* write_info, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->SendTo(instance, *socket_id, *data, *address, *port, write_info, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_Listen(PP_Instance instance, struct PP_Var* socket_id, struct PP_Var* address, struct PP_Var* port, struct PP_Var* backlog, struct PP_Var* result, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->Listen(instance, *socket_id, *address, *port, *backlog, result, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_Accept(PP_Instance instance, struct PP_Var* socket_id, PP_Ext_Socket_AcceptInfo_Dev* accept_info, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->Accept(instance, *socket_id, accept_info, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_SetKeepAlive(PP_Instance instance, struct PP_Var* socket_id, struct PP_Var* enable, struct PP_Var* delay, struct PP_Var* result, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->SetKeepAlive(instance, *socket_id, *enable, *delay, result, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_SetNoDelay(PP_Instance instance, struct PP_Var* socket_id, struct PP_Var* no_delay, struct PP_Var* result, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->SetNoDelay(instance, *socket_id, *no_delay, result, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_GetInfo(PP_Instance instance, struct PP_Var* socket_id, PP_Ext_Socket_SocketInfo_Dev* result, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->GetInfo(instance, *socket_id, result, *callback);
+}
+
+static int32_t Pnacl_M28_PPB_Ext_Socket_Dev_GetNetworkList(PP_Instance instance, PP_Ext_Socket_NetworkInterface_Dev_Array* result, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_Socket_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1.real_iface;
+ return iface->GetNetworkList(instance, result, *callback);
+}
+
+/* End wrapper methods for PPB_Ext_Socket_Dev_0_1 */
+
/* Not generating wrapper interface for PPB_Audio_1_0 */
/* Not generating wrapper interface for PPB_AudioConfig_1_0 */
@@ -3851,6 +3667,21 @@
.Rename = (int32_t (*)(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback))&Pnacl_M14_PPB_FileRef_Rename
};
+struct PPB_FileRef_1_1 Pnacl_Wrappers_PPB_FileRef_1_1 = {
+ .Create = (PP_Resource (*)(PP_Resource file_system, const char* path))&Pnacl_M28_PPB_FileRef_Create,
+ .IsFileRef = (PP_Bool (*)(PP_Resource resource))&Pnacl_M28_PPB_FileRef_IsFileRef,
+ .GetFileSystemType = (PP_FileSystemType (*)(PP_Resource file_ref))&Pnacl_M28_PPB_FileRef_GetFileSystemType,
+ .GetName = (struct PP_Var (*)(PP_Resource file_ref))&Pnacl_M28_PPB_FileRef_GetName,
+ .GetPath = (struct PP_Var (*)(PP_Resource file_ref))&Pnacl_M28_PPB_FileRef_GetPath,
+ .GetParent = (PP_Resource (*)(PP_Resource file_ref))&Pnacl_M28_PPB_FileRef_GetParent,
+ .MakeDirectory = (int32_t (*)(PP_Resource directory_ref, PP_Bool make_ancestors, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileRef_MakeDirectory,
+ .Touch = (int32_t (*)(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileRef_Touch,
+ .Delete = (int32_t (*)(PP_Resource file_ref, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileRef_Delete,
+ .Rename = (int32_t (*)(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileRef_Rename,
+ .Query = (int32_t (*)(PP_Resource file_ref, struct PP_FileInfo* info, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileRef_Query,
+ .ReadDirectoryEntries = (int32_t (*)(PP_Resource file_ref, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileRef_ReadDirectoryEntries
+};
+
struct PPB_FileSystem_1_0 Pnacl_Wrappers_PPB_FileSystem_1_0 = {
.Create = (PP_Resource (*)(PP_Instance instance, PP_FileSystemType type))&Pnacl_M14_PPB_FileSystem_Create,
.IsFileSystem = (PP_Bool (*)(PP_Resource resource))&Pnacl_M14_PPB_FileSystem_IsFileSystem,
@@ -3865,13 +3696,25 @@
struct PPB_Graphics2D_1_0 Pnacl_Wrappers_PPB_Graphics2D_1_0 = {
.Create = (PP_Resource (*)(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque))&Pnacl_M14_PPB_Graphics2D_Create,
.IsGraphics2D = (PP_Bool (*)(PP_Resource resource))&Pnacl_M14_PPB_Graphics2D_IsGraphics2D,
- .Describe = (PP_Bool (*)(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opqaue))&Pnacl_M14_PPB_Graphics2D_Describe,
+ .Describe = (PP_Bool (*)(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opaque))&Pnacl_M14_PPB_Graphics2D_Describe,
.PaintImageData = (void (*)(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect))&Pnacl_M14_PPB_Graphics2D_PaintImageData,
.Scroll = (void (*)(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount))&Pnacl_M14_PPB_Graphics2D_Scroll,
.ReplaceContents = (void (*)(PP_Resource graphics_2d, PP_Resource image_data))&Pnacl_M14_PPB_Graphics2D_ReplaceContents,
.Flush = (int32_t (*)(PP_Resource graphics_2d, struct PP_CompletionCallback callback))&Pnacl_M14_PPB_Graphics2D_Flush
};
+struct PPB_Graphics2D_1_1 Pnacl_Wrappers_PPB_Graphics2D_1_1 = {
+ .Create = (PP_Resource (*)(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque))&Pnacl_M27_PPB_Graphics2D_Create,
+ .IsGraphics2D = (PP_Bool (*)(PP_Resource resource))&Pnacl_M27_PPB_Graphics2D_IsGraphics2D,
+ .Describe = (PP_Bool (*)(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opaque))&Pnacl_M27_PPB_Graphics2D_Describe,
+ .PaintImageData = (void (*)(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect))&Pnacl_M27_PPB_Graphics2D_PaintImageData,
+ .Scroll = (void (*)(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount))&Pnacl_M27_PPB_Graphics2D_Scroll,
+ .ReplaceContents = (void (*)(PP_Resource graphics_2d, PP_Resource image_data))&Pnacl_M27_PPB_Graphics2D_ReplaceContents,
+ .Flush = (int32_t (*)(PP_Resource graphics_2d, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_Graphics2D_Flush,
+ .SetScale = (PP_Bool (*)(PP_Resource resource, float scale))&Pnacl_M27_PPB_Graphics2D_SetScale,
+ .GetScale = (float (*)(PP_Resource resource))&Pnacl_M27_PPB_Graphics2D_GetScale
+};
+
struct PPB_Graphics3D_1_0 Pnacl_Wrappers_PPB_Graphics3D_1_0 = {
.GetAttribMaxValue = (int32_t (*)(PP_Resource instance, int32_t attribute, int32_t* value))&Pnacl_M15_PPB_Graphics3D_GetAttribMaxValue,
.Create = (PP_Resource (*)(PP_Instance instance, PP_Resource share_context, const int32_t attrib_list[]))&Pnacl_M15_PPB_Graphics3D_Create,
@@ -4001,6 +3844,8 @@
/* Not generating wrapper interface for PPB_View_1_0 */
+/* Not generating wrapper interface for PPB_View_1_1 */
+
struct PPB_WebSocket_1_0 Pnacl_Wrappers_PPB_WebSocket_1_0 = {
.Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M18_PPB_WebSocket_Create,
.IsWebSocket = (PP_Bool (*)(PP_Resource resource))&Pnacl_M18_PPB_WebSocket_IsWebSocket,
@@ -4027,7 +3872,7 @@
/* Not generating wrapper interface for PPP_Instance_1_1 */
struct PPP_Messaging_1_0 Pnacl_Wrappers_PPP_Messaging_1_0 = {
- .HandleMessage = (void (*)(PP_Instance instance, struct PP_Var message))&Pnacl_M14_PPP_Messaging_HandleMessage
+ .HandleMessage = &Pnacl_M14_PPP_Messaging_HandleMessage
};
/* Not generating wrapper interface for PPP_MouseLock_1_0 */
@@ -4139,12 +3984,6 @@
.GetName = (struct PP_Var (*)(PP_Resource device_ref))&Pnacl_M18_PPB_DeviceRef_Dev_GetName
};
-struct PPB_DirectoryReader_Dev_0_6 Pnacl_Wrappers_PPB_DirectoryReader_Dev_0_6 = {
- .Create = (PP_Resource (*)(PP_Resource directory_ref))&Pnacl_M27_PPB_DirectoryReader_Dev_Create,
- .IsDirectoryReader = (PP_Bool (*)(PP_Resource resource))&Pnacl_M27_PPB_DirectoryReader_Dev_IsDirectoryReader,
- .ReadEntries = (int32_t (*)(PP_Resource directory_reader, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_DirectoryReader_Dev_ReadEntries
-};
-
struct PPB_FileChooser_Dev_0_5 Pnacl_Wrappers_PPB_FileChooser_Dev_0_5 = {
.Create = (PP_Resource (*)(PP_Instance instance, PP_FileChooserMode_Dev mode, struct PP_Var accept_types))&Pnacl_M16_PPB_FileChooser_Dev_Create,
.IsFileChooser = (PP_Bool (*)(PP_Resource resource))&Pnacl_M16_PPB_FileChooser_Dev_IsFileChooser,
@@ -4196,8 +4035,6 @@
/* Not generating wrapper interface for PPB_Memory_Dev_0_1 */
-/* Not generating wrapper interface for PPB_Printing_Dev_0_6 */
-
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
@@ -4232,6 +4069,18 @@
.GetLiveVars = (uint32_t (*)(struct PP_Var live_vars[], uint32_t array_size))&Pnacl_M18_PPB_Testing_Dev_GetLiveVars
};
+struct PPB_Testing_Dev_0_92 Pnacl_Wrappers_PPB_Testing_Dev_0_92 = {
+ .ReadImageData = (PP_Bool (*)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left))&Pnacl_M28_PPB_Testing_Dev_ReadImageData,
+ .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M28_PPB_Testing_Dev_RunMessageLoop,
+ .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M28_PPB_Testing_Dev_QuitMessageLoop,
+ .GetLiveObjectsForInstance = (uint32_t (*)(PP_Instance instance))&Pnacl_M28_PPB_Testing_Dev_GetLiveObjectsForInstance,
+ .IsOutOfProcess = (PP_Bool (*)(void))&Pnacl_M28_PPB_Testing_Dev_IsOutOfProcess,
+ .SimulateInputEvent = (void (*)(PP_Instance instance, PP_Resource input_event))&Pnacl_M28_PPB_Testing_Dev_SimulateInputEvent,
+ .GetDocumentURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M28_PPB_Testing_Dev_GetDocumentURL,
+ .GetLiveVars = (uint32_t (*)(struct PP_Var live_vars[], uint32_t array_size))&Pnacl_M28_PPB_Testing_Dev_GetLiveVars,
+ .SetMinimumArrayBufferSizeForShmem = (void (*)(PP_Instance instance, uint32_t threshold))&Pnacl_M28_PPB_Testing_Dev_SetMinimumArrayBufferSizeForShmem
+};
+
/* Not generating wrapper interface for PPB_TextInput_Dev_0_1 */
/* Not generating wrapper interface for PPB_TextInput_Dev_0_2 */
@@ -4240,8 +4089,9 @@
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,
.Create = (PP_Resource (*)(PP_Instance instance, const struct PP_TrueTypeFontDesc_Dev* desc))&Pnacl_M26_PPB_TrueTypeFont_Dev_Create,
- .IsFont = (PP_Bool (*)(PP_Resource resource))&Pnacl_M26_PPB_TrueTypeFont_Dev_IsFont,
+ .IsTrueTypeFont = (PP_Bool (*)(PP_Resource resource))&Pnacl_M26_PPB_TrueTypeFont_Dev_IsTrueTypeFont,
.Describe = (int32_t (*)(PP_Resource font, struct PP_TrueTypeFontDesc_Dev* desc, struct PP_CompletionCallback callback))&Pnacl_M26_PPB_TrueTypeFont_Dev_Describe,
.GetTableTags = (int32_t (*)(PP_Resource font, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M26_PPB_TrueTypeFont_Dev_GetTableTags,
.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
@@ -4326,7 +4176,7 @@
/* Not generating wrapper interface for PPP_Scrollbar_Dev_0_3 */
struct PPP_Selection_Dev_0_3 Pnacl_Wrappers_PPP_Selection_Dev_0_3 = {
- .GetSelectedText = (struct PP_Var (*)(PP_Instance instance, PP_Bool html))&Pnacl_M13_PPP_Selection_Dev_GetSelectedText
+ .GetSelectedText = &Pnacl_M13_PPP_Selection_Dev_GetSelectedText
};
/* Not generating wrapper interface for PPP_TextInput_Dev_0_1 */
@@ -4356,6 +4206,10 @@
.DeliverSamples = (void (*)(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M24_PPB_ContentDecryptor_Private_DeliverSamples
};
+struct PPB_FileIO_Private_0_1 Pnacl_Wrappers_PPB_FileIO_Private_0_1 = {
+ .RequestOSFileHandle = (int32_t (*)(PP_Resource file_io, PP_FileHandle* handle, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileIO_Private_RequestOSFileHandle
+};
+
struct PPB_FileRefPrivate_0_1 Pnacl_Wrappers_PPB_FileRefPrivate_0_1 = {
.GetAbsolutePath = (struct PP_Var (*)(PP_Resource file_ref))&Pnacl_M15_PPB_FileRefPrivate_GetAbsolutePath
};
@@ -4627,6 +4481,22 @@
.HistogramEnumeration = (void (*)(struct PP_Var name, int32_t sample, int32_t boundary_value))&Pnacl_M18_PPB_UMA_Private_HistogramEnumeration
};
+struct PPB_VideoDestination_Private_0_1 Pnacl_Wrappers_PPB_VideoDestination_Private_0_1 = {
+ .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M28_PPB_VideoDestination_Private_Create,
+ .IsVideoDestination = (PP_Bool (*)(PP_Resource resource))&Pnacl_M28_PPB_VideoDestination_Private_IsVideoDestination,
+ .Open = (int32_t (*)(PP_Resource destination, struct PP_Var stream_url, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_VideoDestination_Private_Open,
+ .PutFrame = (int32_t (*)(PP_Resource destination, const struct PP_VideoFrame_Private* frame))&Pnacl_M28_PPB_VideoDestination_Private_PutFrame,
+ .Close = (void (*)(PP_Resource destination))&Pnacl_M28_PPB_VideoDestination_Private_Close
+};
+
+struct PPB_VideoSource_Private_0_1 Pnacl_Wrappers_PPB_VideoSource_Private_0_1 = {
+ .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M28_PPB_VideoSource_Private_Create,
+ .IsVideoSource = (PP_Bool (*)(PP_Resource resource))&Pnacl_M28_PPB_VideoSource_Private_IsVideoSource,
+ .Open = (int32_t (*)(PP_Resource source, struct PP_Var stream_url, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_VideoSource_Private_Open,
+ .GetFrame = (int32_t (*)(PP_Resource source, struct PP_VideoFrame_Private* frame, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_VideoSource_Private_GetFrame,
+ .Close = (void (*)(PP_Resource source))&Pnacl_M28_PPB_VideoSource_Private_Close
+};
+
struct PPB_X509Certificate_Private_0_1 Pnacl_Wrappers_PPB_X509Certificate_Private_0_1 = {
.Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_X509Certificate_Private_Create,
.IsX509CertificatePrivate = (PP_Bool (*)(PP_Resource resource))&Pnacl_M19_PPB_X509Certificate_Private_IsX509CertificatePrivate,
@@ -4635,15 +4505,15 @@
};
struct PPP_ContentDecryptor_Private_0_6 Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_6 = {
- .GenerateKeyRequest = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data))&Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest,
- .AddKey = (void (*)(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data))&Pnacl_M24_PPP_ContentDecryptor_Private_AddKey,
- .CancelKeyRequest = (void (*)(PP_Instance instance, struct PP_Var session_id))&Pnacl_M24_PPP_ContentDecryptor_Private_CancelKeyRequest,
- .Decrypt = (void (*)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info))&Pnacl_M24_PPP_ContentDecryptor_Private_Decrypt,
- .InitializeAudioDecoder = (void (*)(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data))&Pnacl_M24_PPP_ContentDecryptor_Private_InitializeAudioDecoder,
- .InitializeVideoDecoder = (void (*)(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data))&Pnacl_M24_PPP_ContentDecryptor_Private_InitializeVideoDecoder,
- .DeinitializeDecoder = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M24_PPP_ContentDecryptor_Private_DeinitializeDecoder,
- .ResetDecoder = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M24_PPP_ContentDecryptor_Private_ResetDecoder,
- .DecryptAndDecode = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info))&Pnacl_M24_PPP_ContentDecryptor_Private_DecryptAndDecode
+ .GenerateKeyRequest = &Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest,
+ .AddKey = &Pnacl_M24_PPP_ContentDecryptor_Private_AddKey,
+ .CancelKeyRequest = &Pnacl_M24_PPP_ContentDecryptor_Private_CancelKeyRequest,
+ .Decrypt = &Pnacl_M24_PPP_ContentDecryptor_Private_Decrypt,
+ .InitializeAudioDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_InitializeAudioDecoder,
+ .InitializeVideoDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_InitializeVideoDecoder,
+ .DeinitializeDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_DeinitializeDecoder,
+ .ResetDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_ResetDecoder,
+ .DecryptAndDecode = &Pnacl_M24_PPP_ContentDecryptor_Private_DecryptAndDecode
};
/* Not generating wrapper interface for PPP_Flash_BrowserOperations_1_0 */
@@ -4653,7 +4523,7 @@
/* Not generating wrapper interface for PPP_Flash_BrowserOperations_1_3 */
struct PPP_Instance_Private_0_1 Pnacl_Wrappers_PPP_Instance_Private_0_1 = {
- .GetInstanceObject = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M18_PPP_Instance_Private_GetInstanceObject
+ .GetInstanceObject = &Pnacl_M18_PPP_Instance_Private_GetInstanceObject
};
struct PPB_Ext_Alarms_Dev_0_1 Pnacl_Wrappers_PPB_Ext_Alarms_Dev_0_1 = {
@@ -4669,6 +4539,24 @@
.RemoveListener = (void (*)(PP_Instance instance, uint32_t listener_id))&Pnacl_M27_PPB_Ext_Events_Dev_RemoveListener
};
+struct PPB_Ext_Socket_Dev_0_1 Pnacl_Wrappers_PPB_Ext_Socket_Dev_0_1 = {
+ .Create = (int32_t (*)(PP_Instance instance, PP_Ext_Socket_SocketType_Dev type, PP_Ext_Socket_CreateOptions_Dev options, PP_Ext_Socket_CreateInfo_Dev* create_info, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_Create,
+ .Destroy = (void (*)(PP_Instance instance, struct PP_Var socket_id))&Pnacl_M28_PPB_Ext_Socket_Dev_Destroy,
+ .Connect = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var hostname, struct PP_Var port, struct PP_Var* result, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_Connect,
+ .Bind = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var address, struct PP_Var port, struct PP_Var* result, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_Bind,
+ .Disconnect = (void (*)(PP_Instance instance, struct PP_Var socket_id))&Pnacl_M28_PPB_Ext_Socket_Dev_Disconnect,
+ .Read = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var buffer_size, PP_Ext_Socket_ReadInfo_Dev* read_info, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_Read,
+ .Write = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var data, PP_Ext_Socket_WriteInfo_Dev* write_info, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_Write,
+ .RecvFrom = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var buffer_size, PP_Ext_Socket_RecvFromInfo_Dev* recv_from_info, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_RecvFrom,
+ .SendTo = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var data, struct PP_Var address, struct PP_Var port, PP_Ext_Socket_WriteInfo_Dev* write_info, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_SendTo,
+ .Listen = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var address, struct PP_Var port, struct PP_Var backlog, struct PP_Var* result, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_Listen,
+ .Accept = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, PP_Ext_Socket_AcceptInfo_Dev* accept_info, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_Accept,
+ .SetKeepAlive = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var enable, struct PP_Var delay, struct PP_Var* result, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_SetKeepAlive,
+ .SetNoDelay = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, struct PP_Var no_delay, struct PP_Var* result, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_SetNoDelay,
+ .GetInfo = (int32_t (*)(PP_Instance instance, struct PP_Var socket_id, PP_Ext_Socket_SocketInfo_Dev* result, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_GetInfo,
+ .GetNetworkList = (int32_t (*)(PP_Instance instance, PP_Ext_Socket_NetworkInterface_Dev_Array* result, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_Socket_Dev_GetNetworkList
+};
+
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 */,
@@ -4717,6 +4605,12 @@
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_1 = {
+ .iface_macro = PPB_FILEREF_INTERFACE_1_1,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileRef_1_1,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileSystem_1_0 = {
.iface_macro = PPB_FILESYSTEM_INTERFACE_1_0,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileSystem_1_0,
@@ -4741,6 +4635,12 @@
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_1 = {
+ .iface_macro = PPB_GRAPHICS_2D_INTERFACE_1_1,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Graphics2D_1_1,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics3D_1_0 = {
.iface_macro = PPB_GRAPHICS_3D_INTERFACE_1_0,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Graphics3D_1_0,
@@ -4861,6 +4761,12 @@
.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 */,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0 = {
.iface_macro = PPB_WEBSOCKET_INTERFACE_1_0,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_WebSocket_1_0,
@@ -5011,12 +4917,6 @@
.real_iface = NULL
};
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6 = {
- .iface_macro = PPB_DIRECTORYREADER_DEV_INTERFACE_0_6,
- .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_DirectoryReader_Dev_0_6,
- .real_iface = NULL
-};
-
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5 = {
.iface_macro = PPB_FILECHOOSER_DEV_INTERFACE_0_5,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileChooser_Dev_0_5,
@@ -5071,12 +4971,6 @@
.real_iface = NULL
};
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_6 = {
- .iface_macro = PPB_PRINTING_DEV_INTERFACE_0_6,
- .wrapped_iface = NULL /* Still need slot for real_iface */,
- .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,
@@ -5119,6 +5013,12 @@
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_92 = {
+ .iface_macro = PPB_TESTING_DEV_INTERFACE_0_92,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_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 */,
@@ -5281,6 +5181,12 @@
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_Private_0_1 = {
+ .iface_macro = PPB_FILEIO_PRIVATE_INTERFACE_0_1,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileIO_Private_0_1,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1 = {
.iface_macro = PPB_FILEREFPRIVATE_INTERFACE_0_1,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileRefPrivate_0_1,
@@ -5473,6 +5379,18 @@
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1 = {
+ .iface_macro = PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoDestination_Private_0_1,
+ .real_iface = NULL
+};
+
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1 = {
+ .iface_macro = PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoSource_Private_0_1,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1 = {
.iface_macro = PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_X509Certificate_Private_0_1,
@@ -5521,6 +5439,12 @@
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1 = {
+ .iface_macro = PPB_EXT_SOCKET_DEV_INTERFACE_0_1,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Ext_Socket_Dev_0_1,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_Audio_1_0,
&Pnacl_WrapperInfo_PPB_AudioConfig_1_0,
@@ -5530,10 +5454,12 @@
&Pnacl_WrapperInfo_PPB_FileIO_1_0,
&Pnacl_WrapperInfo_PPB_FileIO_1_1,
&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,
@@ -5554,6 +5480,7 @@
&Pnacl_WrapperInfo_PPB_Var_1_1,
&Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0,
&Pnacl_WrapperInfo_PPB_View_1_0,
+ &Pnacl_WrapperInfo_PPB_View_1_1,
&Pnacl_WrapperInfo_PPB_WebSocket_1_0,
&Pnacl_WrapperInfo_PPB_AudioTrusted_0_6,
&Pnacl_WrapperInfo_PPB_BrokerTrusted_0_2,
@@ -5573,7 +5500,6 @@
&Pnacl_WrapperInfo_PPB_Crypto_Dev_0_1,
&Pnacl_WrapperInfo_PPB_CursorControl_Dev_0_4,
&Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1,
- &Pnacl_WrapperInfo_PPB_DirectoryReader_Dev_0_6,
&Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5,
&Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6,
&Pnacl_WrapperInfo_PPB_Find_Dev_0_3,
@@ -5583,7 +5509,6 @@
&Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2,
&Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_1,
&Pnacl_WrapperInfo_PPB_Memory_Dev_0_1,
- &Pnacl_WrapperInfo_PPB_Printing_Dev_0_6,
&Pnacl_WrapperInfo_PPB_Printing_Dev_0_7,
&Pnacl_WrapperInfo_PPB_ResourceArray_Dev_0_1,
&Pnacl_WrapperInfo_PPB_Scrollbar_Dev_0_5,
@@ -5591,6 +5516,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,
@@ -5606,6 +5532,7 @@
&Pnacl_WrapperInfo_PPB_Widget_Dev_0_4,
&Pnacl_WrapperInfo_PPB_Zoom_Dev_0_2,
&Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6,
+ &Pnacl_WrapperInfo_PPB_FileIO_Private_0_1,
&Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1,
&Pnacl_WrapperInfo_PPB_Flash_12_4,
&Pnacl_WrapperInfo_PPB_Flash_12_5,
@@ -5638,9 +5565,12 @@
&Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3,
&Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4,
&Pnacl_WrapperInfo_PPB_UMA_Private_0_1,
+ &Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1,
+ &Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1,
&Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1,
&Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1,
&Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1,
+ &Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_1,
NULL
};
@@ -5747,5 +5677,3 @@
return wrapper->real_iface;
}
}
-
-#endif
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_entry.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_entry.c
index d21ee74..e143c92 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_entry.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_entry.c
@@ -16,8 +16,6 @@
* See nacl_startup.h for the layout at the argument pointer.
*/
void _pnacl_wrapper_start(uint32_t *info) {
- /* The PNaCl PPAPI shims are only needed on x86-64. */
-#if defined(__x86_64__) || defined(__arm__)
Elf32_auxv_t *auxv = nacl_startup_auxv(info);
Elf32_auxv_t *entry = NULL;
@@ -50,7 +48,6 @@
* seems brittle (what if the bitcode link was separated from translation).
* Thus we always wrap _start, even if there is no IRT auxv entry.
*/
-#endif
/*
* Call the user entry point function. It should not return.
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c
index 0846988..2d8466c 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c
@@ -12,9 +12,6 @@
#include "native_client/src/untrusted/irt/irt_ppapi.h"
#include "ppapi/generators/pnacl_shim.h"
-/* The PNaCl PPAPI shims are only needed on x86-64 and arm. */
-#if defined(__x86_64__) || defined(__arm__)
-
/* Use local strcmp to avoid dependency on libc. */
static int mystrcmp(const char* s1, const char *s2) {
while((*s1 && *s2) && (*s1++ == *s2++));
@@ -109,5 +106,3 @@
}
return 0;
}
-
-#endif
diff --git a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py
index 30409a8..ee65a17 100755
--- a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py
+++ b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py
@@ -482,7 +482,7 @@
######################################################################
def UseWhitelistedChars(orig_basename, arch):
- """ Make the filename match the pattern expected by pnacl_file_host.
+ """ Make the filename match the pattern expected by nacl_file_host.
Currently, this assumes there is prefix "pnacl_public_" and
that the allowed chars are in the set [a-zA-Z0-9_].
@@ -499,7 +499,7 @@
""" Copy files from src_dir to dest_dir.
When copying, also rename the files such that they match the white-listing
- pattern in chrome/browser/nacl_host/pnacl_file_host.cc.
+ pattern in chrome/browser/nacl_host/nacl_file_host.cc.
"""
for (root, dirs, files) in os.walk(src_dir, followlinks=True):
for f in files:
diff --git a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp
index d73a29f..a4fbe53 100644
--- a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp
+++ b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp
@@ -13,7 +13,7 @@
'target_name': 'pnacl_support_extension',
'type': 'none',
'conditions': [
- ['disable_nacl==0 and disable_nacl_untrusted==0', {
+ ['disable_nacl==0 and disable_pnacl==0 and disable_nacl_untrusted==0', {
'dependencies': [
'../../../../../ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
'../../../../../native_client/tools.gyp:prep_toolchain',
diff --git a/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/nacl.scons b/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/nacl.scons
index 33ed844..898df47 100644
--- a/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/nacl.scons
+++ b/ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/nacl.scons
@@ -8,9 +8,6 @@
Import('env')
-# Enable untrusted exception handling (for exception_test).
-env['ENV']['NACL_UNTRUSTED_EXCEPTION_HANDLING'] = '1'
-
env.ComponentLibrary('testrunner_browser', ['test_runner_ppapi.c'])
dest_copy = env.Replicate('$STAGING_DIR', 'test_runner.html')
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad.pexe b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad.pexe
deleted file mode 100644
index 27fe62a..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad.pexe
+++ /dev/null
@@ -1 +0,0 @@
-BC this is not really a bitcode file.
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad2.pexe b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad2.pexe
deleted file mode 100644
index 41bc8b2..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad2.pexe
+++ /dev/null
@@ -1,36 +0,0 @@
-;; For now, we are using a .ll file as a "pexe". This is only a bad pexe
-;; in the sense that it shouldn't compile (missing instruction),
-;; not that it will crash LLC. Eventually we should make this into
-;; a bitcode file w/ the proper pexe metadata.
-
-;; To actually crash LLC (and do so reliably), perhaps we could add
-;; an SRPC method to LLC to ask it to crash itself.
-;; That seems much more reliable than trying to find a bitcode file that
-;; for version X will crash LLC, but for version Y it has been fixed.
-
-@.str = private unnamed_addr constant [12 x i8] c"Hello world\00", align 4
-
-define i32 @main(i32 %argc, i8** %argv) nounwind {
-entry:
- %argc_addr = alloca i32, align 4
- %argv_addr = alloca i8**, align 4
- %retval = alloca i32
- %0 = alloca i32
- %"alloca point" = bitcast i32 0 to i32
- store i32 %argc, i32* %argc_addr
- store i8** %argv, i8*** %argv_addr
- %1 = call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0)) nounwind
- store i32 0, i32* %0, align 4
-
-;; Intentionally comment this line out to make it fail to compile.
-;; %2 = load i32* %0, align 4
-
- store i32 %2, i32* %retval, align 4
- br label %return
-
-return: ; preds = %entry
- %retval1 = load i32* %retval
- ret i32 %retval1
-}
-
-declare i32 @puts(i8*)
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/nacl.scons b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/nacl.scons
deleted file mode 100644
index 126642b..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/nacl.scons
+++ /dev/null
@@ -1,62 +0,0 @@
-# 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.
-
-Import('env')
-
-# Browser tests for the pnacl translator. This requires starting with a pexe.
-if not (env.Bit('bitcode') and env.Bit('pnacl_generate_pexe')):
- Return()
-
-# The PNaCl coordinator cannot yet handle GLibC-based pexe.
-# The driver cannot build the pexe on x86-64 for now.
-# The bitcode link arbitrarily picks x86-32 as the ARCH, but the
-# glibc bitcode link line uses native x86-64 libs instead of bitcode
-# stubs, so there is a mismatch:
-# http://code.google.com/p/nativeclient/issues/detail?id=2451
-# Luckily, it can build the x86-32 pexe. That works, mostly because
-# the hello-world example doesn't depend on pso's, etc.
-if env.Bit('nacl_glibc') and env.Bit('target_x86_64'):
- Return()
-
-#### Test error handling.
-
-# We should add more cases, e.g., try a bad library to crash ld,
-# try a more malicious bitcode, try to exhaust resources, etc.
-# The current llc tests, don't actually crash LLC, they only
-# make llc exit w/ an abnormal status.
-
-program_fragment_obj = env.ComponentObject('program_fragment.cc')
-
-pnacl_bad_files = env.Replicate(
- '${STAGING_DIR}',
- ['pnacl_bad_doesnotexist.nmf',
- 'pnacl_bad_doesnotexist_pexe_only.nmf',
- # This one is just a text file that begins with "BC".
- 'bad.pexe',
- 'pnacl_bad_pexe.nmf',
- # This one is the hello world bitcode .ll w/ a missing instruction.
- 'bad2.pexe',
- 'pnacl_bad2_pexe.nmf',
- program_fragment_obj,
- 'pnacl_bad_pexe_undefined_syms.nmf',
- 'pnacl_bad_test.html',
- ])
-
-# Borrow bad load test harness.
-borrowed_file = '${STAGING_DIR}/ppapi_bad.js',
-
-node = env.PPAPIBrowserTester(
- 'pnacl_bad_test.out',
- url='pnacl_bad_test.html',
- # TODO(jvoung): list "nmfs" without clashing with Replicate.
- # Perhaps just use publish instead of Replicate.
- # There may also be an issue in that the scons manifest generator is picky
- # about nexes that don't exist.
- files=pnacl_bad_files + [borrowed_file],
- args=['--allow_404', '--prefer_portable_in_manifest'])
-
-env.AddNodeToTestSuite(node,
- ['chrome_browser_tests'],
- 'run_pnacl_bad_browser_test',
- is_broken=env.PPAPIBrowserTesterIsBroken())
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad2_pexe.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad2_pexe.nmf
deleted file mode 100644
index 7a1956e..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad2_pexe.nmf
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "non_existent.nexe"},
- "x86-64": {"url": "non_existent.nexe"},
- "arm": {"url": "non_existent.nexe"},
- "portable": {"pnacl-translate": {"url": "bad2.pexe"} }
- }
-}
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist.nmf
deleted file mode 100644
index c84136e..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist.nmf
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "non_existent.nexe"},
- "x86-64": {"url": "non_existent.nexe"},
- "arm": {"url": "non_existent.nexe"},
- "portable": {"pnacl-translate": {"url": "non_existent.pexe"} }
- }
-}
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist_pexe_only.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist_pexe_only.nmf
deleted file mode 100644
index 8448232..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist_pexe_only.nmf
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "program": {
- "portable": {"pnacl-translate": {"url": "non_existent.pexe"} }
- }
-}
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe.nmf
deleted file mode 100644
index 1ce311b..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe.nmf
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "non_existent.nexe"},
- "x86-64": {"url": "non_existent.nexe"},
- "arm": {"url": "non_existent.nexe"},
- "portable": {"pnacl-translate": {"url": "bad.pexe"} }
- }
-}
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe_undefined_syms.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe_undefined_syms.nmf
deleted file mode 100644
index 8fe0bed..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe_undefined_syms.nmf
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "non_existent.nexe"},
- "x86-64": {"url": "non_existent.nexe"},
- "arm": {"url": "non_existent.nexe"},
- "portable": {"pnacl-translate": {"url": "program_fragment.bc"} }
- }
-}
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html
deleted file mode 100644
index 2627d87..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html
+++ /dev/null
@@ -1,159 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
-<!--
- 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.
--->
-<head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
- <META HTTP-EQUIV="Expires" CONTENT="-1" />
- <script type="text/javascript" src="nacltest.js"></script>
- <script type="text/javascript" src="ppapi_bad.js"></script>
- <title>PNACL bad pexe/libraries Test</title>
- <style type="text/css">
- .naclModule { background-color: gray; margin: 2px 2px; }
- </style>
-</head>
-<body id="body">
-<script type="text/javascript">
-//<![CDATA[
-
-function declareTests(tester) {
- // 'bad_pexe' loads a manifest, then loads a pexe that is invalid.
- badLoadTest(
- tester,
- 'bad_pexe',
- 'pnacl_bad_pexe.nmf',
- 'NaCl module load failed: PnaclCoordinator: compile failed.');
-
- // 'bad_pexe' loads a manifest, then loads a pexe that is truncated.
- badLoadTest(
- tester,
- 'bad2_pexe',
- 'pnacl_bad2_pexe.nmf',
- 'NaCl module load failed: PnaclCoordinator: compile failed.');
-
- // 'bad_pexe_undefined' loads a manifest, then loads a pexe that compiles
- // but will result in undefined symbols, causing the link to fail.
- badLoadTest(
- tester,
- 'bad_pexe_undefined_syms',
- 'pnacl_bad_pexe_undefined_syms.nmf',
- 'NaCl module load failed: PnaclCoordinator: link failed.');
-
- // 'nonexistent_pexe loads a manifest, then tries to load a nonexistent pexe,
- // given both a nexe and a portable program to choose from.
- badLoadTest(
- tester,
- 'nonexistent_pexe',
- 'pnacl_bad_doesnotexist.nmf',
- 'NaCl module load failed: PnaclCoordinator: ' +
- 'pexe load failed (pp_error=-2).');
-
- // 'nonexistent_pexe_only' loads a manifest, then tries to load a nonexistent
- // pexe, given only a pexe to choose from.
- badLoadTest(
- tester,
- 'nonexistent_pexe_only',
- 'pnacl_bad_doesnotexist_pexe_only.nmf',
- 'NaCl module load failed: PnaclCoordinator: ' +
- 'pexe load failed (pp_error=-2).');
-
- tester.addAsyncTest('Test clean directory',
- // All that should be left after all tests run is empty directories.
- // This means we will need to update this test with a whitelist,
- // if we start adding metadata files or things like that.
- function(test_status) {
-
- var errorHandler = test_status.wrap(function() {
- test_status.fail('Unexpected failure in intermediate steps');
- });
-
- function toArray(list) {
- return Array.prototype.slice.call(list || [], 0);
- }
-
- function CheckDirectoriesRecursively(dir, doneCallback) {
- var dirReader = dir.createReader();
- var entries = [];
-
- var checkMoreEntries = test_status.wrap(function(entries) {
- // Done when it's actually an empty directory.
- if (entries.length == 0) {
- doneCallback();
- return;
- }
-
- var expected_callbacks = entries.length;
- var current_callbacks = 0;
- var nextCallback = test_status.wrap(function() {
- current_callbacks += 1;
- if (current_callbacks == expected_callbacks) {
- doneCallback();
- }
- });
-
- entries.forEach(test_status.wrap(function(entry, i) {
- if (entry.isDirectory) {
- CheckDirectoriesRecursively(entry, nextCallback);
- } else {
- test_status.fail('Found a left over file ' + entry.name);
- }
- }));
- });
-
- // Call the reader.readEntries() until no more results are returned.
- var readEntries = test_status.wrap(function() {
- dirReader.readEntries (
- test_status.wrap(function(results) {
- if (!results.length) {
- checkMoreEntries(entries);
- } else {
- entries = entries.concat(toArray(results));
- readEntries();
- }
- }), errorHandler);
- });
-
- readEntries(); // Start reading dirs.
- }
-
- var onInitFs = test_status.wrap(function(fs) {
- var doneCallback = test_status.wrap(function() {
- test_status.pass();
- });
- CheckDirectoriesRecursively(fs.root, doneCallback);
- });
-
- // Note: The file system has been prefixed as of Google Chrome 12:
- window.requestFileSystem =
- window.requestFileSystem || window.webkitRequestFileSystem;
- window.requestFileSystem(window.TEMPORARY,
- 1024*1024, onInitFs, errorHandler);
- }
- );
-}
-
-
-// The driver invoked when the body has finished loading.
-function runTests() {
- var tester = new Tester($('body'));
- tester.loadErrorsAreOK();
- declareTests(tester);
- tester.run();
-}
-//]]>
-</script>
-
-<!-- The tests will create and remove embeds from this div. -->
-<div id="embeds"></div>
-
-<script type="text/javascript">
-//<![CDATA[
-runTests();
-//]]>
-</script>
-</body>
-</html>
diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/program_fragment.cc b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/program_fragment.cc
deleted file mode 100644
index 8dafe92..0000000
--- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/program_fragment.cc
+++ /dev/null
@@ -1,10 +0,0 @@
-// 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.
-
-// Never defined. This will end badly when we try to link.
-extern void bar();
-
-void foo() {
- bar();
-}
diff --git a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.html b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.html
index f568459..7a0aafc 100644
--- a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.html
+++ b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.html
@@ -108,7 +108,9 @@
tester,
'bad_manifest_bad_files',
'ppapi_bad_manifest_bad_files.nmf',
- 'NaCl module load failed: manifest: no version of file.txt given for current arch and no portable version found.');
+ // Manifest loader expects either 'url' or 'pnacl-translate' key present.
+ // If neither is found, it complains about the last one.
+ 'NaCl module load failed: manifest: file.txt property \'unknown_arch\' does not have required key: \'pnacl-translate\'.');
// 'bad_manifest_nexe_arch' loads a manifest with no program entry for the
// user's architecture
diff --git a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_manifest_bad_files.nmf b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_manifest_bad_files.nmf
index 30bc7ad..588901b 100644
--- a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_manifest_bad_files.nmf
+++ b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_manifest_bad_files.nmf
@@ -6,7 +6,7 @@
},
"files": {
"file.txt": {
- "unknown_arch": {"url": "file.txt"}
+ "unknown_arch": {}
}
}
}
diff --git a/ppapi/native_client/tests/ppapi_browser/manifest/manifest.html b/ppapi/native_client/tests/ppapi_browser/manifest/manifest.html
index b2a7fa4..bab4000 100644
--- a/ppapi/native_client/tests/ppapi_browser/manifest/manifest.html
+++ b/ppapi/native_client/tests/ppapi_browser/manifest/manifest.html
@@ -34,6 +34,15 @@
1, // loadCount
undefined // lastError
);
+testProgressEventStateMachine(
+ tester,
+ 'arch_specific_files',
+ 2, // progressMinCount
+ 0, // errorCount
+ 0, // abortCount
+ 1, // loadCount
+ undefined // lastError
+);
function runTests() {
tester.waitFor($('topdir_static'), $('subdir_static'));
tester.run();
@@ -60,6 +69,16 @@
width=0 height=0
src="subdir/manifest_subdir.nmf"
type="application/x-nacl" />
+
+<!--
+// manifest_arch_specific refers to unused files that are not available on all
+// platforms.
+-->
+<embed id="arch_specific_files"
+ class="naclModule"
+ width=0 height=0
+ src="manifest_arch_specific.nmf"
+ type="application/x-nacl" />
<script type="text/javascript">
//<![CDATA[
diff --git a/ppapi/native_client/tests/ppapi_browser/manifest/manifest_arch_specific.nmf b/ppapi/native_client/tests/ppapi_browser/manifest/manifest_arch_specific.nmf
new file mode 100644
index 0000000..ae21be1
--- /dev/null
+++ b/ppapi/native_client/tests/ppapi_browser/manifest/manifest_arch_specific.nmf
@@ -0,0 +1,17 @@
+{
+ "program": {
+ "x86-32": {"url": "subdir/manifest_good_x86-32.nexe"},
+ "x86-64": {"url": "subdir/manifest_good_x86-64.nexe"},
+ "arm": {"url": "subdir/manifest_good_arm.nexe"},
+ "portable": {"pnacl-translate":
+ {"url": "subdir/manifest_good.pexe"}}
+ },
+ "files": {
+ "x86-32-specific": {
+ "x86-32": {"url": "subdir/manifest_good_x86-32.nexe"}
+ },
+ "x86-64-specific": {
+ "x86-64": {"url": "subdir/manifest_good_x86-64.nexe"}
+ }
+ }
+}
diff --git a/ppapi/native_client/tests/ppapi_browser/manifest/nacl.scons b/ppapi/native_client/tests/ppapi_browser/manifest/nacl.scons
index 3293e32..9e93beb 100644
--- a/ppapi/native_client/tests/ppapi_browser/manifest/nacl.scons
+++ b/ppapi/native_client/tests/ppapi_browser/manifest/nacl.scons
@@ -57,7 +57,9 @@
node = env.PPAPIBrowserTester(
'manifest_browser_test.out',
url='manifest.html',
- nmfs=['${TEST_DIR}/manifest_top.nmf', '${TEST_DIR}/manifest_subdir.nmf'],
+ nmfs=['${TEST_DIR}/manifest_top.nmf',
+ '${TEST_DIR}/manifest_subdir.nmf',
+ '${TEST_DIR}/manifest_arch_specific.nmf'],
files=env.ExtractPublishedFiles(manifest_good_target),
map_files=file_mapping)
diff --git a/ppapi/ppapi_c.target.darwin-arm.mk b/ppapi/ppapi_c.target.darwin-arm.mk
new file mode 100644
index 0000000..80ac9ba
--- /dev/null
+++ b/ppapi/ppapi_c.target.darwin-arm.mk
@@ -0,0 +1,124 @@
+# This file is generated by gyp; do not edit.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_CLASS := GYP
+LOCAL_MODULE := ppapi_ppapi_c_gyp
+LOCAL_MODULE_STEM := ppapi_c
+LOCAL_MODULE_SUFFIX := .stamp
+LOCAL_MODULE_TAGS := optional
+gyp_intermediate_dir := $(call local-intermediates-dir)
+gyp_shared_intermediate_dir := $(call intermediates-dir-for,GYP,shared)
+
+# Make sure our deps are built first.
+GYP_TARGET_DEPENDENCIES :=
+
+GYP_GENERATED_OUTPUTS :=
+
+# Make sure our deps and generated files are built first.
+LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
+
+LOCAL_GENERATED_SOURCES :=
+
+GYP_COPIED_SOURCE_ORIGIN_DIRS :=
+
+LOCAL_SRC_FILES :=
+
+
+# Flags passed to both C and C++ files.
+MY_CFLAGS := \
+ -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 \
+ -g \
+ -fomit-frame-pointer \
+ -fdata-sections \
+ -ffunction-sections
+
+MY_CFLAGS_C :=
+
+MY_DEFS := \
+ '-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=""' \
+ '-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+ '-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 := \
+ $(GYP_ABS_ANDROID_TOP_DIR)/frameworks/wilhelm/include \
+ $(GYP_ABS_ANDROID_TOP_DIR)/bionic \
+ $(GYP_ABS_ANDROID_TOP_DIR)/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 := \
+ -fno-rtti \
+ -fno-threadsafe-statics \
+ -fvisibility-inlines-hidden \
+ -Wsign-compare \
+ -Wno-abi \
+ -Wno-error=c++0x-compat \
+ -Wno-non-virtual-dtor \
+ -Wno-sign-promo
+
+### Rules for final target.
+# Add target alias to "gyp_all_modules" target.
+.PHONY: gyp_all_modules
+gyp_all_modules: ppapi_ppapi_c_gyp
+
+# Alias gyp target name.
+.PHONY: ppapi_c
+ppapi_c: ppapi_ppapi_c_gyp
+
+LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp
+LOCAL_UNINSTALLABLE_MODULE := true
+
+include $(BUILD_SYSTEM)/base_rules.mk
+
+$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(hide) echo "Gyp timestamp: $@"
+ $(hide) mkdir -p $(dir $@)
+ $(hide) touch $@
diff --git a/ppapi/ppapi_c.target.darwin-x86.mk b/ppapi/ppapi_c.target.darwin-x86.mk
new file mode 100644
index 0000000..1ab465e
--- /dev/null
+++ b/ppapi/ppapi_c.target.darwin-x86.mk
@@ -0,0 +1,125 @@
+# This file is generated by gyp; do not edit.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_CLASS := GYP
+LOCAL_MODULE := ppapi_ppapi_c_gyp
+LOCAL_MODULE_STEM := ppapi_c
+LOCAL_MODULE_SUFFIX := .stamp
+LOCAL_MODULE_TAGS := optional
+gyp_intermediate_dir := $(call local-intermediates-dir)
+gyp_shared_intermediate_dir := $(call intermediates-dir-for,GYP,shared)
+
+# Make sure our deps are built first.
+GYP_TARGET_DEPENDENCIES :=
+
+GYP_GENERATED_OUTPUTS :=
+
+# Make sure our deps and generated files are built first.
+LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
+
+LOCAL_GENERATED_SOURCES :=
+
+GYP_COPIED_SOURCE_ORIGIN_DIRS :=
+
+LOCAL_SRC_FILES :=
+
+
+# Flags passed to both C and C++ files.
+MY_CFLAGS := \
+ --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 \
+ -g \
+ -fomit-frame-pointer \
+ -fdata-sections \
+ -ffunction-sections
+
+MY_CFLAGS_C :=
+
+MY_DEFS := \
+ '-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=""' \
+ '-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+ '-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 := \
+ $(GYP_ABS_ANDROID_TOP_DIR)/frameworks/wilhelm/include \
+ $(GYP_ABS_ANDROID_TOP_DIR)/bionic \
+ $(GYP_ABS_ANDROID_TOP_DIR)/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 := \
+ -fno-rtti \
+ -fno-threadsafe-statics \
+ -fvisibility-inlines-hidden \
+ -Wsign-compare \
+ -Wno-error=c++0x-compat \
+ -Wno-non-virtual-dtor \
+ -Wno-sign-promo
+
+### Rules for final target.
+# Add target alias to "gyp_all_modules" target.
+.PHONY: gyp_all_modules
+gyp_all_modules: ppapi_ppapi_c_gyp
+
+# Alias gyp target name.
+.PHONY: ppapi_c
+ppapi_c: ppapi_ppapi_c_gyp
+
+LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp
+LOCAL_UNINSTALLABLE_MODULE := true
+
+include $(BUILD_SYSTEM)/base_rules.mk
+
+$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(hide) echo "Gyp timestamp: $@"
+ $(hide) mkdir -p $(dir $@)
+ $(hide) touch $@
diff --git a/ppapi/ppapi_c.target.linux-arm.mk b/ppapi/ppapi_c.target.linux-arm.mk
index 9c4d194..80ac9ba 100644
--- a/ppapi/ppapi_c.target.linux-arm.mk
+++ b/ppapi/ppapi_c.target.linux-arm.mk
@@ -61,7 +61,6 @@
MY_CFLAGS_C :=
MY_DEFS := \
- '-DUSE_SKIA' \
'-D_FILE_OFFSET_BITS=64' \
'-DUSE_LINUX_BREAKPAD' \
'-DNO_TCMALLOC' \
@@ -69,7 +68,6 @@
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
'-DUSE_PROPRIETARY_CODECS' \
- '-DENABLE_PEPPER_THREADING' \
'-DENABLE_GPU=1' \
'-DUSE_OPENSSL=1' \
'-DENABLE_EGLIMAGE=1' \
diff --git a/ppapi/ppapi_c.target.linux-x86.mk b/ppapi/ppapi_c.target.linux-x86.mk
index d1b943d..1ab465e 100644
--- a/ppapi/ppapi_c.target.linux-x86.mk
+++ b/ppapi/ppapi_c.target.linux-x86.mk
@@ -42,6 +42,7 @@
-march=pentium4 \
-msse2 \
-mfpmath=sse \
+ -fuse-ld=gold \
-ffunction-sections \
-funwind-tables \
-g \
@@ -62,7 +63,6 @@
MY_CFLAGS_C :=
MY_DEFS := \
- '-DUSE_SKIA' \
'-D_FILE_OFFSET_BITS=64' \
'-DUSE_LINUX_BREAKPAD' \
'-DNO_TCMALLOC' \
@@ -70,7 +70,6 @@
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
'-DUSE_PROPRIETARY_CODECS' \
- '-DENABLE_PEPPER_THREADING' \
'-DENABLE_GPU=1' \
'-DUSE_OPENSSL=1' \
'-DENABLE_EGLIMAGE=1' \
diff --git a/ppapi/ppapi_internal.gyp b/ppapi/ppapi_internal.gyp
index dadddab..6d75638 100644
--- a/ppapi/ppapi_internal.gyp
+++ b/ppapi/ppapi_internal.gyp
@@ -113,6 +113,7 @@
'../ipc/ipc.gyp:ipc',
'../skia/skia.gyp:skia',
'../third_party/icu/icu.gyp:icuuc',
+ '../third_party/icu/icu.gyp:icui18n',
# TODO(ananta) : The WebKit dependency needs to move to a new target for NACL.
'<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
'../ui/surface/surface.gyp:surface',
@@ -151,6 +152,7 @@
'../ipc/ipc.gyp:ipc',
'../skia/skia.gyp:skia',
'../third_party/icu/icu.gyp:icuuc',
+ '../third_party/icu/icu.gyp:icui18n',
# TODO(ananta) : The WebKit dependency needs to move to a new target for NACL.
'<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
'../ui/surface/surface.gyp:surface',
diff --git a/ppapi/ppapi_ipc.gypi b/ppapi/ppapi_ipc.gypi
index 616d8e5..f833472 100644
--- a/ppapi/ppapi_ipc.gypi
+++ b/ppapi/ppapi_ipc.gypi
@@ -18,6 +18,8 @@
'proxy/ppapi_messages.h',
'proxy/ppapi_param_traits.cc',
'proxy/ppapi_param_traits.h',
+ 'proxy/raw_var_data.cc',
+ 'proxy/raw_var_data.h',
'proxy/resource_message_params.cc',
'proxy/resource_message_params.h',
'proxy/serialized_flash_menu.cc',
diff --git a/ppapi/ppapi_ipc_untrusted.gyp b/ppapi/ppapi_ipc_untrusted.gyp
index fd55a58..45ffd0f 100644
--- a/ppapi/ppapi_ipc_untrusted.gyp
+++ b/ppapi/ppapi_ipc_untrusted.gyp
@@ -23,11 +23,6 @@
'nlib_target': 'libppapi_ipc_untrusted.a',
'build_glibc': 0,
'build_newlib': 1,
- 'defines': [
- # Enable threading for the untrusted side of the proxy.
- # TODO(bbudge) remove when this is the default.
- 'ENABLE_PEPPER_THREADING',
- ],
},
'include_dirs': [
'..',
diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi
index 838bbc6..51be328 100644
--- a/ppapi/ppapi_proxy.gypi
+++ b/ppapi/ppapi_proxy.gypi
@@ -32,11 +32,11 @@
'proxy/connection.h',
'proxy/device_enumeration_resource_helper.cc',
'proxy/device_enumeration_resource_helper.h',
- 'proxy/directory_reader_resource.cc',
- 'proxy/directory_reader_resource.h',
'proxy/dispatcher.cc',
'proxy/dispatcher.h',
'proxy/enter_proxy.h',
+ 'proxy/extensions_common_resource.cc',
+ 'proxy/extensions_common_resource.h',
'proxy/graphics_2d_resource.cc',
'proxy/graphics_2d_resource.h',
'proxy/file_chooser_resource.cc',
@@ -57,6 +57,8 @@
'proxy/flash_resource.h',
'proxy/file_io_resource.cc',
'proxy/file_io_resource.h',
+ 'proxy/file_system_resource.cc',
+ 'proxy/file_system_resource.h',
'proxy/gamepad_resource.cc',
'proxy/gamepad_resource.h',
'proxy/host_dispatcher.cc',
@@ -69,6 +71,9 @@
'proxy/interface_list.h',
'proxy/interface_proxy.cc',
'proxy/interface_proxy.h',
+ 'proxy/locking_resource_releaser.h',
+ 'proxy/pdf_resource.cc',
+ 'proxy/pdf_resource.h',
'proxy/plugin_array_buffer_var.cc',
'proxy/plugin_array_buffer_var.h',
'proxy/plugin_dispatcher.cc',
@@ -100,8 +105,6 @@
'proxy/ppb_core_proxy.h',
'proxy/ppb_file_ref_proxy.cc',
'proxy/ppb_file_ref_proxy.h',
- 'proxy/ppb_file_system_proxy.cc',
- 'proxy/ppb_file_system_proxy.h',
'proxy/ppb_flash_message_loop_proxy.cc',
'proxy/ppb_flash_message_loop_proxy.h',
'proxy/ppb_graphics_3d_proxy.cc',
@@ -178,6 +181,10 @@
'proxy/var_serialization_rules.h',
'proxy/video_capture_resource.cc',
'proxy/video_capture_resource.h',
+ 'proxy/video_destination_resource.cc',
+ 'proxy/video_destination_resource.h',
+ 'proxy/video_source_resource.cc',
+ 'proxy/video_source_resource.h',
'proxy/websocket_resource.cc',
'proxy/websocket_resource.h',
],
@@ -204,6 +211,7 @@
'proxy/flash_resource.cc',
'proxy/host_dispatcher.cc',
'proxy/host_var_serialization_rules.cc',
+ 'proxy/pdf_resource.cc',
'proxy/ppb_broker_proxy.cc',
'proxy/ppb_buffer_proxy.cc',
'proxy/ppb_flash_message_loop_proxy.cc',
@@ -218,6 +226,8 @@
'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_proxy_untrusted.gyp b/ppapi/ppapi_proxy_untrusted.gyp
index 49fae82..2b87d7b 100644
--- a/ppapi/ppapi_proxy_untrusted.gyp
+++ b/ppapi/ppapi_proxy_untrusted.gyp
@@ -22,11 +22,6 @@
'nlib_target': 'libppapi_proxy_untrusted.a',
'build_glibc': 0,
'build_newlib': 1,
- 'defines': [
- # Enable threading for the untrusted side of the proxy.
- # TODO(bbudge) remove when this is the default.
- 'ENABLE_PEPPER_THREADING',
- ],
},
'include_dirs': [
'..',
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index 3b81c00..daa04bc 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -44,6 +44,8 @@
'shared_impl/platform_file.h',
'shared_impl/ppapi_globals.cc',
'shared_impl/ppapi_globals.h',
+ 'shared_impl/ppapi_nacl_channel_args.cc',
+ 'shared_impl/ppapi_nacl_channel_args.h',
'shared_impl/ppapi_permissions.cc',
'shared_impl/ppapi_permissions.h',
'shared_impl/ppapi_preferences.cc',
@@ -132,6 +134,7 @@
'thunk/enter.cc',
'thunk/enter.h',
+ 'thunk/extensions_common_api.h',
'thunk/ppb_audio_api.h',
'thunk/ppb_audio_config_api.h',
'thunk/ppb_audio_config_thunk.cc',
@@ -152,11 +155,13 @@
'thunk/ppb_cursor_control_thunk.cc',
'thunk/ppb_device_ref_api.h',
'thunk/ppb_device_ref_dev_thunk.cc',
- 'thunk/ppb_directory_reader_api.h',
- 'thunk/ppb_directory_reader_thunk.cc',
+ 'thunk/ppb_ext_alarms_thunk.cc',
+ 'thunk/ppb_ext_socket_thunk.cc',
'thunk/ppb_file_chooser_api.h',
- 'thunk/ppb_file_chooser_thunk.cc',
+ 'thunk/ppb_file_chooser_dev_thunk.cc',
+ 'thunk/ppb_file_chooser_trusted_thunk.cc',
'thunk/ppb_file_io_api.h',
+ 'thunk/ppb_file_io_private_thunk.cc',
'thunk/ppb_file_io_thunk.cc',
'thunk/ppb_file_io_trusted_thunk.cc',
'thunk/ppb_file_ref_api.h',
@@ -186,6 +191,7 @@
'thunk/ppb_gamepad_thunk.cc',
'thunk/ppb_gles_chromium_texture_mapping_thunk.cc',
'thunk/ppb_graphics_2d_api.h',
+ 'thunk/ppb_graphics_2d_dev_thunk.cc',
'thunk/ppb_graphics_2d_thunk.cc',
'thunk/ppb_graphics_3d_api.h',
'thunk/ppb_graphics_3d_thunk.cc',
@@ -204,14 +210,14 @@
'thunk/ppb_messaging_thunk.cc',
'thunk/ppb_mouse_cursor_thunk.cc',
'thunk/ppb_mouse_lock_thunk.cc',
- 'thunk/ppb_network_list_private_api.h',
+ '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_pdf_api.h',
'thunk/ppb_pdf_thunk.cc',
'thunk/ppb_printing_api.h',
- 'thunk/ppb_printing_thunk.cc',
+ 'thunk/ppb_printing_dev_thunk.cc',
'thunk/ppb_resource_array_api.h',
'thunk/ppb_resource_array_dev_thunk.cc',
'thunk/ppb_scrollbar_api.h',
@@ -225,11 +231,12 @@
'thunk/ppb_text_input_thunk.cc',
'thunk/ppb_truetype_font_api.h',
'thunk/ppb_truetype_font_singleton_api.h',
- 'thunk/ppb_truetype_font_thunk.cc',
+ 'thunk/ppb_truetype_font_dev_thunk.cc',
'thunk/ppb_udp_socket_private_api.h',
'thunk/ppb_udp_socket_private_thunk.cc',
'thunk/ppb_url_loader_api.h',
'thunk/ppb_url_loader_thunk.cc',
+ 'thunk/ppb_url_loader_trusted_thunk.cc',
'thunk/ppb_url_request_info_api.h',
'thunk/ppb_url_request_info_thunk.cc',
'thunk/ppb_url_response_info_api.h',
@@ -241,6 +248,10 @@
'thunk/ppb_video_capture_thunk.cc',
'thunk/ppb_video_decoder_api.h',
'thunk/ppb_video_decoder_thunk.cc',
+ 'thunk/ppb_video_destination_private_api.h',
+ 'thunk/ppb_video_destination_private_thunk.cc',
+ 'thunk/ppb_video_source_private_api.h',
+ 'thunk/ppb_video_source_private_thunk.cc',
'thunk/ppb_view_api.h',
'thunk/ppb_view_dev_thunk.cc',
'thunk/ppb_view_thunk.cc',
@@ -250,7 +261,7 @@
'thunk/ppb_widget_dev_thunk.cc',
'thunk/ppb_x509_certificate_private_api.h',
'thunk/ppb_x509_certificate_private_thunk.cc',
- 'thunk/ppb_zoom_thunk.cc',
+ 'thunk/ppb_zoom_dev_thunk.cc',
'thunk/thunk.h',
],
'defines': [
@@ -277,7 +288,6 @@
'thunk/ppb_buffer_trusted_thunk.cc',
'thunk/ppb_content_decryptor_private_thunk.cc',
'thunk/ppb_char_set_thunk.cc',
- 'thunk/ppb_directory_reader_thunk.cc',
'thunk/ppb_file_io_trusted_thunk.cc',
'thunk/ppb_flash_clipboard_thunk.cc',
'thunk/ppb_flash_device_id_thunk.cc',
@@ -292,12 +302,15 @@
'thunk/ppb_gles_chromium_texture_mapping_thunk.cc',
'thunk/ppb_graphics_3d_trusted_thunk.cc',
'thunk/ppb_image_data_trusted_thunk.cc',
+ 'thunk/ppb_pdf_thunk.cc',
'thunk/ppb_scrollbar_thunk.cc',
'thunk/ppb_talk_private_thunk.cc',
'thunk/ppb_transport_thunk.cc',
'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
new file mode 100644
index 0000000..7e2f377
--- /dev/null
+++ b/ppapi/ppapi_shared.target.darwin-arm.mk
@@ -0,0 +1,317 @@
+# This file is generated by gyp; do not edit.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_MODULE := ppapi_ppapi_shared_gyp
+LOCAL_MODULE_SUFFIX := .a
+LOCAL_MODULE_TAGS := optional
+gyp_intermediate_dir := $(call local-intermediates-dir)
+gyp_shared_intermediate_dir := $(call intermediates-dir-for,GYP,shared)
+
+# Make sure our deps are built first.
+GYP_TARGET_DEPENDENCIES := \
+ $(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp \
+ $(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_gyp)/skia_skia_gyp.a \
+ $(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp
+
+GYP_GENERATED_OUTPUTS :=
+
+# Make sure our deps and generated files are built first.
+LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
+
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_GENERATED_SOURCES :=
+
+GYP_COPIED_SOURCE_ORIGIN_DIRS :=
+
+LOCAL_SRC_FILES := \
+ ppapi/shared_impl/array_var.cc \
+ ppapi/shared_impl/array_writer.cc \
+ ppapi/shared_impl/callback_tracker.cc \
+ ppapi/shared_impl/dictionary_var.cc \
+ ppapi/shared_impl/file_io_state_manager.cc \
+ ppapi/shared_impl/file_path.cc \
+ ppapi/shared_impl/file_type_conversion.cc \
+ ppapi/shared_impl/flash_clipboard_format_registry.cc \
+ ppapi/shared_impl/host_resource.cc \
+ ppapi/shared_impl/id_assignment.cc \
+ ppapi/shared_impl/platform_file.cc \
+ ppapi/shared_impl/ppapi_globals.cc \
+ ppapi/shared_impl/ppapi_nacl_channel_args.cc \
+ ppapi/shared_impl/ppapi_permissions.cc \
+ ppapi/shared_impl/ppapi_preferences.cc \
+ ppapi/shared_impl/ppapi_switches.cc \
+ ppapi/shared_impl/ppb_audio_config_shared.cc \
+ ppapi/shared_impl/ppb_audio_shared.cc \
+ ppapi/shared_impl/ppb_crypto_shared.cc \
+ ppapi/shared_impl/ppb_device_ref_shared.cc \
+ ppapi/shared_impl/ppb_file_ref_shared.cc \
+ ppapi/shared_impl/ppb_gamepad_shared.cc \
+ ppapi/shared_impl/ppb_graphics_3d_shared.cc \
+ ppapi/shared_impl/ppb_image_data_shared.cc \
+ ppapi/shared_impl/ppb_input_event_shared.cc \
+ ppapi/shared_impl/ppb_instance_shared.cc \
+ ppapi/shared_impl/ppb_memory_shared.cc \
+ ppapi/shared_impl/ppb_message_loop_shared.cc \
+ ppapi/shared_impl/ppb_network_list_private_shared.cc \
+ ppapi/shared_impl/ppb_opengles2_shared.cc \
+ ppapi/shared_impl/ppb_resource_array_shared.cc \
+ ppapi/shared_impl/ppb_trace_event_impl.cc \
+ ppapi/shared_impl/ppb_url_util_shared.cc \
+ ppapi/shared_impl/ppb_var_shared.cc \
+ ppapi/shared_impl/ppb_video_decoder_shared.cc \
+ ppapi/shared_impl/ppb_view_shared.cc \
+ ppapi/shared_impl/ppp_instance_combined.cc \
+ ppapi/shared_impl/proxy_lock.cc \
+ ppapi/shared_impl/resource.cc \
+ ppapi/shared_impl/resource_tracker.cc \
+ ppapi/shared_impl/scoped_pp_resource.cc \
+ ppapi/shared_impl/scoped_pp_var.cc \
+ ppapi/shared_impl/thread_aware_callback.cc \
+ ppapi/shared_impl/time_conversion.cc \
+ ppapi/shared_impl/tracked_callback.cc \
+ ppapi/shared_impl/url_request_info_data.cc \
+ ppapi/shared_impl/url_response_info_data.cc \
+ ppapi/shared_impl/var.cc \
+ ppapi/shared_impl/var_tracker.cc \
+ ppapi/shared_impl/var_value_conversions.cc \
+ ppapi/shared_impl/private/net_address_private_impl.cc \
+ ppapi/shared_impl/private/ppb_char_set_shared.cc \
+ ppapi/shared_impl/private/ppb_tcp_server_socket_shared.cc \
+ ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc \
+ ppapi/shared_impl/private/tcp_socket_private_impl.cc \
+ ppapi/thunk/enter.cc \
+ ppapi/thunk/ppb_audio_config_thunk.cc \
+ ppapi/thunk/ppb_audio_input_dev_thunk.cc \
+ ppapi/thunk/ppb_audio_thunk.cc \
+ ppapi/thunk/ppb_audio_trusted_thunk.cc \
+ ppapi/thunk/ppb_broker_thunk.cc \
+ ppapi/thunk/ppb_browser_font_trusted_thunk.cc \
+ ppapi/thunk/ppb_buffer_thunk.cc \
+ ppapi/thunk/ppb_buffer_trusted_thunk.cc \
+ ppapi/thunk/ppb_char_set_thunk.cc \
+ ppapi/thunk/ppb_console_thunk.cc \
+ ppapi/thunk/ppb_content_decryptor_private_thunk.cc \
+ ppapi/thunk/ppb_cursor_control_thunk.cc \
+ ppapi/thunk/ppb_device_ref_dev_thunk.cc \
+ ppapi/thunk/ppb_ext_alarms_thunk.cc \
+ ppapi/thunk/ppb_ext_socket_thunk.cc \
+ ppapi/thunk/ppb_file_chooser_dev_thunk.cc \
+ ppapi/thunk/ppb_file_chooser_trusted_thunk.cc \
+ ppapi/thunk/ppb_file_io_private_thunk.cc \
+ ppapi/thunk/ppb_file_io_thunk.cc \
+ ppapi/thunk/ppb_file_io_trusted_thunk.cc \
+ ppapi/thunk/ppb_file_ref_thunk.cc \
+ ppapi/thunk/ppb_file_system_thunk.cc \
+ ppapi/thunk/ppb_find_dev_thunk.cc \
+ ppapi/thunk/ppb_flash_clipboard_thunk.cc \
+ ppapi/thunk/ppb_flash_device_id_thunk.cc \
+ ppapi/thunk/ppb_flash_file_fileref_thunk.cc \
+ ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc \
+ ppapi/thunk/ppb_flash_font_file_thunk.cc \
+ ppapi/thunk/ppb_flash_fullscreen_thunk.cc \
+ ppapi/thunk/ppb_flash_menu_thunk.cc \
+ ppapi/thunk/ppb_flash_message_loop_thunk.cc \
+ ppapi/thunk/ppb_flash_print_thunk.cc \
+ ppapi/thunk/ppb_flash_thunk.cc \
+ ppapi/thunk/ppb_fullscreen_thunk.cc \
+ ppapi/thunk/ppb_gamepad_thunk.cc \
+ ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc \
+ 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_graphics_3d_trusted_thunk.cc \
+ ppapi/thunk/ppb_host_resolver_private_thunk.cc \
+ ppapi/thunk/ppb_image_data_thunk.cc \
+ ppapi/thunk/ppb_image_data_trusted_thunk.cc \
+ ppapi/thunk/ppb_input_event_thunk.cc \
+ ppapi/thunk/ppb_instance_private_thunk.cc \
+ ppapi/thunk/ppb_instance_thunk.cc \
+ ppapi/thunk/ppb_messaging_thunk.cc \
+ ppapi/thunk/ppb_mouse_cursor_thunk.cc \
+ ppapi/thunk/ppb_mouse_lock_thunk.cc \
+ ppapi/thunk/ppb_network_list_private_thunk.cc \
+ ppapi/thunk/ppb_network_monitor_private_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_private_thunk.cc \
+ ppapi/thunk/ppb_text_input_thunk.cc \
+ ppapi/thunk/ppb_truetype_font_dev_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 \
+ ppapi/thunk/ppb_url_request_info_thunk.cc \
+ ppapi/thunk/ppb_url_response_info_thunk.cc \
+ ppapi/thunk/ppb_url_util_thunk.cc \
+ ppapi/thunk/ppb_var_array_thunk.cc \
+ ppapi/thunk/ppb_var_dictionary_thunk.cc \
+ ppapi/thunk/ppb_video_capture_thunk.cc \
+ ppapi/thunk/ppb_video_decoder_thunk.cc \
+ ppapi/thunk/ppb_video_destination_private_thunk.cc \
+ ppapi/thunk/ppb_video_source_private_thunk.cc \
+ ppapi/thunk/ppb_view_dev_thunk.cc \
+ ppapi/thunk/ppb_view_thunk.cc \
+ ppapi/thunk/ppb_websocket_thunk.cc \
+ ppapi/thunk/ppb_widget_dev_thunk.cc \
+ ppapi/thunk/ppb_x509_certificate_private_thunk.cc \
+ ppapi/thunk/ppb_zoom_dev_thunk.cc
+
+
+# Flags passed to both C and C++ files.
+MY_CFLAGS := \
+ -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 \
+ -g \
+ -fomit-frame-pointer \
+ -fdata-sections \
+ -ffunction-sections
+
+MY_CFLAGS_C :=
+
+MY_DEFS := \
+ '-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_NDK' \
+ '-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=""' \
+ '-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+ '-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_PATH) \
+ $(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)/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/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 \
+ $(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/common \
+ $(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
+ $(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
+ $(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
+ $(LOCAL_PATH)/third_party/npapi \
+ $(LOCAL_PATH)/third_party/npapi/bindings \
+ $(LOCAL_PATH)/v8/include \
+ $(GYP_ABS_ANDROID_TOP_DIR)/frameworks/wilhelm/include \
+ $(GYP_ABS_ANDROID_TOP_DIR)/bionic \
+ $(GYP_ABS_ANDROID_TOP_DIR)/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 := \
+ -fno-rtti \
+ -fno-threadsafe-statics \
+ -fvisibility-inlines-hidden \
+ -Wsign-compare \
+ -Wno-abi \
+ -Wno-error=c++0x-compat \
+ -Wno-non-virtual-dtor \
+ -Wno-sign-promo
+
+### Rules for final target.
+
+LOCAL_LDFLAGS := \
+ -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,--gc-sections \
+ -Wl,-O1 \
+ -Wl,--as-needed
+
+
+LOCAL_STATIC_LIBRARIES := \
+ skia_skia_gyp
+
+# Enable grouping to fix circular references
+LOCAL_GROUP_STATIC_LIBRARIES := true
+
+LOCAL_SHARED_LIBRARIES := \
+ libstlport \
+ libdl
+
+# Add target alias to "gyp_all_modules" target.
+.PHONY: gyp_all_modules
+gyp_all_modules: ppapi_ppapi_shared_gyp
+
+# Alias gyp target name.
+.PHONY: ppapi_shared
+ppapi_shared: ppapi_ppapi_shared_gyp
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/ppapi/ppapi_shared.target.darwin-x86.mk b/ppapi/ppapi_shared.target.darwin-x86.mk
new file mode 100644
index 0000000..8fff62d
--- /dev/null
+++ b/ppapi/ppapi_shared.target.darwin-x86.mk
@@ -0,0 +1,316 @@
+# This file is generated by gyp; do not edit.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_MODULE := ppapi_ppapi_shared_gyp
+LOCAL_MODULE_SUFFIX := .a
+LOCAL_MODULE_TAGS := optional
+gyp_intermediate_dir := $(call local-intermediates-dir)
+gyp_shared_intermediate_dir := $(call intermediates-dir-for,GYP,shared)
+
+# Make sure our deps are built first.
+GYP_TARGET_DEPENDENCIES := \
+ $(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp \
+ $(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_gyp)/skia_skia_gyp.a \
+ $(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp
+
+GYP_GENERATED_OUTPUTS :=
+
+# Make sure our deps and generated files are built first.
+LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
+
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_GENERATED_SOURCES :=
+
+GYP_COPIED_SOURCE_ORIGIN_DIRS :=
+
+LOCAL_SRC_FILES := \
+ ppapi/shared_impl/array_var.cc \
+ ppapi/shared_impl/array_writer.cc \
+ ppapi/shared_impl/callback_tracker.cc \
+ ppapi/shared_impl/dictionary_var.cc \
+ ppapi/shared_impl/file_io_state_manager.cc \
+ ppapi/shared_impl/file_path.cc \
+ ppapi/shared_impl/file_type_conversion.cc \
+ ppapi/shared_impl/flash_clipboard_format_registry.cc \
+ ppapi/shared_impl/host_resource.cc \
+ ppapi/shared_impl/id_assignment.cc \
+ ppapi/shared_impl/platform_file.cc \
+ ppapi/shared_impl/ppapi_globals.cc \
+ ppapi/shared_impl/ppapi_nacl_channel_args.cc \
+ ppapi/shared_impl/ppapi_permissions.cc \
+ ppapi/shared_impl/ppapi_preferences.cc \
+ ppapi/shared_impl/ppapi_switches.cc \
+ ppapi/shared_impl/ppb_audio_config_shared.cc \
+ ppapi/shared_impl/ppb_audio_shared.cc \
+ ppapi/shared_impl/ppb_crypto_shared.cc \
+ ppapi/shared_impl/ppb_device_ref_shared.cc \
+ ppapi/shared_impl/ppb_file_ref_shared.cc \
+ ppapi/shared_impl/ppb_gamepad_shared.cc \
+ ppapi/shared_impl/ppb_graphics_3d_shared.cc \
+ ppapi/shared_impl/ppb_image_data_shared.cc \
+ ppapi/shared_impl/ppb_input_event_shared.cc \
+ ppapi/shared_impl/ppb_instance_shared.cc \
+ ppapi/shared_impl/ppb_memory_shared.cc \
+ ppapi/shared_impl/ppb_message_loop_shared.cc \
+ ppapi/shared_impl/ppb_network_list_private_shared.cc \
+ ppapi/shared_impl/ppb_opengles2_shared.cc \
+ ppapi/shared_impl/ppb_resource_array_shared.cc \
+ ppapi/shared_impl/ppb_trace_event_impl.cc \
+ ppapi/shared_impl/ppb_url_util_shared.cc \
+ ppapi/shared_impl/ppb_var_shared.cc \
+ ppapi/shared_impl/ppb_video_decoder_shared.cc \
+ ppapi/shared_impl/ppb_view_shared.cc \
+ ppapi/shared_impl/ppp_instance_combined.cc \
+ ppapi/shared_impl/proxy_lock.cc \
+ ppapi/shared_impl/resource.cc \
+ ppapi/shared_impl/resource_tracker.cc \
+ ppapi/shared_impl/scoped_pp_resource.cc \
+ ppapi/shared_impl/scoped_pp_var.cc \
+ ppapi/shared_impl/thread_aware_callback.cc \
+ ppapi/shared_impl/time_conversion.cc \
+ ppapi/shared_impl/tracked_callback.cc \
+ ppapi/shared_impl/url_request_info_data.cc \
+ ppapi/shared_impl/url_response_info_data.cc \
+ ppapi/shared_impl/var.cc \
+ ppapi/shared_impl/var_tracker.cc \
+ ppapi/shared_impl/var_value_conversions.cc \
+ ppapi/shared_impl/private/net_address_private_impl.cc \
+ ppapi/shared_impl/private/ppb_char_set_shared.cc \
+ ppapi/shared_impl/private/ppb_tcp_server_socket_shared.cc \
+ ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc \
+ ppapi/shared_impl/private/tcp_socket_private_impl.cc \
+ ppapi/thunk/enter.cc \
+ ppapi/thunk/ppb_audio_config_thunk.cc \
+ ppapi/thunk/ppb_audio_input_dev_thunk.cc \
+ ppapi/thunk/ppb_audio_thunk.cc \
+ ppapi/thunk/ppb_audio_trusted_thunk.cc \
+ ppapi/thunk/ppb_broker_thunk.cc \
+ ppapi/thunk/ppb_browser_font_trusted_thunk.cc \
+ ppapi/thunk/ppb_buffer_thunk.cc \
+ ppapi/thunk/ppb_buffer_trusted_thunk.cc \
+ ppapi/thunk/ppb_char_set_thunk.cc \
+ ppapi/thunk/ppb_console_thunk.cc \
+ ppapi/thunk/ppb_content_decryptor_private_thunk.cc \
+ ppapi/thunk/ppb_cursor_control_thunk.cc \
+ ppapi/thunk/ppb_device_ref_dev_thunk.cc \
+ ppapi/thunk/ppb_ext_alarms_thunk.cc \
+ ppapi/thunk/ppb_ext_socket_thunk.cc \
+ ppapi/thunk/ppb_file_chooser_dev_thunk.cc \
+ ppapi/thunk/ppb_file_chooser_trusted_thunk.cc \
+ ppapi/thunk/ppb_file_io_private_thunk.cc \
+ ppapi/thunk/ppb_file_io_thunk.cc \
+ ppapi/thunk/ppb_file_io_trusted_thunk.cc \
+ ppapi/thunk/ppb_file_ref_thunk.cc \
+ ppapi/thunk/ppb_file_system_thunk.cc \
+ ppapi/thunk/ppb_find_dev_thunk.cc \
+ ppapi/thunk/ppb_flash_clipboard_thunk.cc \
+ ppapi/thunk/ppb_flash_device_id_thunk.cc \
+ ppapi/thunk/ppb_flash_file_fileref_thunk.cc \
+ ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc \
+ ppapi/thunk/ppb_flash_font_file_thunk.cc \
+ ppapi/thunk/ppb_flash_fullscreen_thunk.cc \
+ ppapi/thunk/ppb_flash_menu_thunk.cc \
+ ppapi/thunk/ppb_flash_message_loop_thunk.cc \
+ ppapi/thunk/ppb_flash_print_thunk.cc \
+ ppapi/thunk/ppb_flash_thunk.cc \
+ ppapi/thunk/ppb_fullscreen_thunk.cc \
+ ppapi/thunk/ppb_gamepad_thunk.cc \
+ ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc \
+ 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_graphics_3d_trusted_thunk.cc \
+ ppapi/thunk/ppb_host_resolver_private_thunk.cc \
+ ppapi/thunk/ppb_image_data_thunk.cc \
+ ppapi/thunk/ppb_image_data_trusted_thunk.cc \
+ ppapi/thunk/ppb_input_event_thunk.cc \
+ ppapi/thunk/ppb_instance_private_thunk.cc \
+ ppapi/thunk/ppb_instance_thunk.cc \
+ ppapi/thunk/ppb_messaging_thunk.cc \
+ ppapi/thunk/ppb_mouse_cursor_thunk.cc \
+ ppapi/thunk/ppb_mouse_lock_thunk.cc \
+ ppapi/thunk/ppb_network_list_private_thunk.cc \
+ ppapi/thunk/ppb_network_monitor_private_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_private_thunk.cc \
+ ppapi/thunk/ppb_text_input_thunk.cc \
+ ppapi/thunk/ppb_truetype_font_dev_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 \
+ ppapi/thunk/ppb_url_request_info_thunk.cc \
+ ppapi/thunk/ppb_url_response_info_thunk.cc \
+ ppapi/thunk/ppb_url_util_thunk.cc \
+ ppapi/thunk/ppb_var_array_thunk.cc \
+ ppapi/thunk/ppb_var_dictionary_thunk.cc \
+ ppapi/thunk/ppb_video_capture_thunk.cc \
+ ppapi/thunk/ppb_video_decoder_thunk.cc \
+ ppapi/thunk/ppb_video_destination_private_thunk.cc \
+ ppapi/thunk/ppb_video_source_private_thunk.cc \
+ ppapi/thunk/ppb_view_dev_thunk.cc \
+ ppapi/thunk/ppb_view_thunk.cc \
+ ppapi/thunk/ppb_websocket_thunk.cc \
+ ppapi/thunk/ppb_widget_dev_thunk.cc \
+ ppapi/thunk/ppb_x509_certificate_private_thunk.cc \
+ ppapi/thunk/ppb_zoom_dev_thunk.cc
+
+
+# Flags passed to both C and C++ files.
+MY_CFLAGS := \
+ --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 \
+ -g \
+ -fomit-frame-pointer \
+ -fdata-sections \
+ -ffunction-sections
+
+MY_CFLAGS_C :=
+
+MY_DEFS := \
+ '-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_NDK' \
+ '-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=""' \
+ '-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+ '-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_PATH) \
+ $(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)/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/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 \
+ $(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/common \
+ $(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
+ $(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
+ $(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
+ $(LOCAL_PATH)/third_party/npapi \
+ $(LOCAL_PATH)/third_party/npapi/bindings \
+ $(LOCAL_PATH)/v8/include \
+ $(GYP_ABS_ANDROID_TOP_DIR)/frameworks/wilhelm/include \
+ $(GYP_ABS_ANDROID_TOP_DIR)/bionic \
+ $(GYP_ABS_ANDROID_TOP_DIR)/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 := \
+ -fno-rtti \
+ -fno-threadsafe-statics \
+ -fvisibility-inlines-hidden \
+ -Wsign-compare \
+ -Wno-error=c++0x-compat \
+ -Wno-non-virtual-dtor \
+ -Wno-sign-promo
+
+### Rules for final target.
+
+LOCAL_LDFLAGS := \
+ -Wl,-z,now \
+ -Wl,-z,relro \
+ -Wl,-z,noexecstack \
+ -fPIC \
+ -m32 \
+ -fuse-ld=gold \
+ -nostdlib \
+ -Wl,--no-undefined \
+ -Wl,--exclude-libs=ALL \
+ -Wl,--gc-sections \
+ -Wl,-O1 \
+ -Wl,--as-needed
+
+
+LOCAL_STATIC_LIBRARIES := \
+ skia_skia_gyp
+
+# Enable grouping to fix circular references
+LOCAL_GROUP_STATIC_LIBRARIES := true
+
+LOCAL_SHARED_LIBRARIES := \
+ libstlport \
+ libdl
+
+# Add target alias to "gyp_all_modules" target.
+.PHONY: gyp_all_modules
+gyp_all_modules: ppapi_ppapi_shared_gyp
+
+# Alias gyp target name.
+.PHONY: ppapi_shared
+ppapi_shared: ppapi_ppapi_shared_gyp
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/ppapi/ppapi_shared.target.linux-arm.mk b/ppapi/ppapi_shared.target.linux-arm.mk
index cc0e0fa..7e2f377 100644
--- a/ppapi/ppapi_shared.target.linux-arm.mk
+++ b/ppapi/ppapi_shared.target.linux-arm.mk
@@ -38,6 +38,7 @@
ppapi/shared_impl/id_assignment.cc \
ppapi/shared_impl/platform_file.cc \
ppapi/shared_impl/ppapi_globals.cc \
+ ppapi/shared_impl/ppapi_nacl_channel_args.cc \
ppapi/shared_impl/ppapi_permissions.cc \
ppapi/shared_impl/ppapi_preferences.cc \
ppapi/shared_impl/ppapi_switches.cc \
@@ -94,8 +95,11 @@
ppapi/thunk/ppb_content_decryptor_private_thunk.cc \
ppapi/thunk/ppb_cursor_control_thunk.cc \
ppapi/thunk/ppb_device_ref_dev_thunk.cc \
- ppapi/thunk/ppb_directory_reader_thunk.cc \
- ppapi/thunk/ppb_file_chooser_thunk.cc \
+ ppapi/thunk/ppb_ext_alarms_thunk.cc \
+ ppapi/thunk/ppb_ext_socket_thunk.cc \
+ ppapi/thunk/ppb_file_chooser_dev_thunk.cc \
+ ppapi/thunk/ppb_file_chooser_trusted_thunk.cc \
+ ppapi/thunk/ppb_file_io_private_thunk.cc \
ppapi/thunk/ppb_file_io_thunk.cc \
ppapi/thunk/ppb_file_io_trusted_thunk.cc \
ppapi/thunk/ppb_file_ref_thunk.cc \
@@ -114,6 +118,7 @@
ppapi/thunk/ppb_fullscreen_thunk.cc \
ppapi/thunk/ppb_gamepad_thunk.cc \
ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc \
+ 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_graphics_3d_trusted_thunk.cc \
@@ -129,16 +134,17 @@
ppapi/thunk/ppb_network_list_private_thunk.cc \
ppapi/thunk/ppb_network_monitor_private_thunk.cc \
ppapi/thunk/ppb_pdf_thunk.cc \
- ppapi/thunk/ppb_printing_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_private_thunk.cc \
ppapi/thunk/ppb_text_input_thunk.cc \
- ppapi/thunk/ppb_truetype_font_thunk.cc \
+ ppapi/thunk/ppb_truetype_font_dev_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 \
ppapi/thunk/ppb_url_request_info_thunk.cc \
ppapi/thunk/ppb_url_response_info_thunk.cc \
ppapi/thunk/ppb_url_util_thunk.cc \
@@ -146,12 +152,14 @@
ppapi/thunk/ppb_var_dictionary_thunk.cc \
ppapi/thunk/ppb_video_capture_thunk.cc \
ppapi/thunk/ppb_video_decoder_thunk.cc \
+ ppapi/thunk/ppb_video_destination_private_thunk.cc \
+ ppapi/thunk/ppb_video_source_private_thunk.cc \
ppapi/thunk/ppb_view_dev_thunk.cc \
ppapi/thunk/ppb_view_thunk.cc \
ppapi/thunk/ppb_websocket_thunk.cc \
ppapi/thunk/ppb_widget_dev_thunk.cc \
ppapi/thunk/ppb_x509_certificate_private_thunk.cc \
- ppapi/thunk/ppb_zoom_thunk.cc
+ ppapi/thunk/ppb_zoom_dev_thunk.cc
# Flags passed to both C and C++ files.
@@ -190,7 +198,6 @@
MY_CFLAGS_C :=
MY_DEFS := \
- '-DUSE_SKIA' \
'-D_FILE_OFFSET_BITS=64' \
'-DUSE_LINUX_BREAKPAD' \
'-DNO_TCMALLOC' \
@@ -198,7 +205,6 @@
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
'-DUSE_PROPRIETARY_CODECS' \
- '-DENABLE_PEPPER_THREADING' \
'-DENABLE_GPU=1' \
'-DUSE_OPENSSL=1' \
'-DENABLE_EGLIMAGE=1' \
@@ -228,9 +234,10 @@
# Include paths placed before CFLAGS/CPPFLAGS
LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH) \
+ $(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) \
$(LOCAL_PATH)/third_party/khronos \
$(LOCAL_PATH)/gpu \
$(LOCAL_PATH)/skia/config \
@@ -241,6 +248,7 @@
$(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/pathops \
$(LOCAL_PATH)/third_party/skia/include/pipe \
$(LOCAL_PATH)/third_party/skia/include/ports \
$(LOCAL_PATH)/third_party/skia/include/utils \
@@ -249,7 +257,6 @@
$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
- $(gyp_shared_intermediate_dir)/webcore_headers \
$(LOCAL_PATH)/third_party/npapi \
$(LOCAL_PATH)/third_party/npapi/bindings \
$(LOCAL_PATH)/v8/include \
@@ -284,9 +291,9 @@
-Wl,--no-undefined \
-Wl,--exclude-libs=ALL \
-Wl,--icf=safe \
+ -Wl,--gc-sections \
-Wl,-O1 \
- -Wl,--as-needed \
- -Wl,--gc-sections
+ -Wl,--as-needed
LOCAL_STATIC_LIBRARIES := \
diff --git a/ppapi/ppapi_shared.target.linux-x86.mk b/ppapi/ppapi_shared.target.linux-x86.mk
index affd212..8fff62d 100644
--- a/ppapi/ppapi_shared.target.linux-x86.mk
+++ b/ppapi/ppapi_shared.target.linux-x86.mk
@@ -38,6 +38,7 @@
ppapi/shared_impl/id_assignment.cc \
ppapi/shared_impl/platform_file.cc \
ppapi/shared_impl/ppapi_globals.cc \
+ ppapi/shared_impl/ppapi_nacl_channel_args.cc \
ppapi/shared_impl/ppapi_permissions.cc \
ppapi/shared_impl/ppapi_preferences.cc \
ppapi/shared_impl/ppapi_switches.cc \
@@ -94,8 +95,11 @@
ppapi/thunk/ppb_content_decryptor_private_thunk.cc \
ppapi/thunk/ppb_cursor_control_thunk.cc \
ppapi/thunk/ppb_device_ref_dev_thunk.cc \
- ppapi/thunk/ppb_directory_reader_thunk.cc \
- ppapi/thunk/ppb_file_chooser_thunk.cc \
+ ppapi/thunk/ppb_ext_alarms_thunk.cc \
+ ppapi/thunk/ppb_ext_socket_thunk.cc \
+ ppapi/thunk/ppb_file_chooser_dev_thunk.cc \
+ ppapi/thunk/ppb_file_chooser_trusted_thunk.cc \
+ ppapi/thunk/ppb_file_io_private_thunk.cc \
ppapi/thunk/ppb_file_io_thunk.cc \
ppapi/thunk/ppb_file_io_trusted_thunk.cc \
ppapi/thunk/ppb_file_ref_thunk.cc \
@@ -114,6 +118,7 @@
ppapi/thunk/ppb_fullscreen_thunk.cc \
ppapi/thunk/ppb_gamepad_thunk.cc \
ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc \
+ 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_graphics_3d_trusted_thunk.cc \
@@ -129,16 +134,17 @@
ppapi/thunk/ppb_network_list_private_thunk.cc \
ppapi/thunk/ppb_network_monitor_private_thunk.cc \
ppapi/thunk/ppb_pdf_thunk.cc \
- ppapi/thunk/ppb_printing_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_private_thunk.cc \
ppapi/thunk/ppb_text_input_thunk.cc \
- ppapi/thunk/ppb_truetype_font_thunk.cc \
+ ppapi/thunk/ppb_truetype_font_dev_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 \
ppapi/thunk/ppb_url_request_info_thunk.cc \
ppapi/thunk/ppb_url_response_info_thunk.cc \
ppapi/thunk/ppb_url_util_thunk.cc \
@@ -146,12 +152,14 @@
ppapi/thunk/ppb_var_dictionary_thunk.cc \
ppapi/thunk/ppb_video_capture_thunk.cc \
ppapi/thunk/ppb_video_decoder_thunk.cc \
+ ppapi/thunk/ppb_video_destination_private_thunk.cc \
+ ppapi/thunk/ppb_video_source_private_thunk.cc \
ppapi/thunk/ppb_view_dev_thunk.cc \
ppapi/thunk/ppb_view_thunk.cc \
ppapi/thunk/ppb_websocket_thunk.cc \
ppapi/thunk/ppb_widget_dev_thunk.cc \
ppapi/thunk/ppb_x509_certificate_private_thunk.cc \
- ppapi/thunk/ppb_zoom_thunk.cc
+ ppapi/thunk/ppb_zoom_dev_thunk.cc
# Flags passed to both C and C++ files.
@@ -171,6 +179,7 @@
-march=pentium4 \
-msse2 \
-mfpmath=sse \
+ -fuse-ld=gold \
-ffunction-sections \
-funwind-tables \
-g \
@@ -191,7 +200,6 @@
MY_CFLAGS_C :=
MY_DEFS := \
- '-DUSE_SKIA' \
'-D_FILE_OFFSET_BITS=64' \
'-DUSE_LINUX_BREAKPAD' \
'-DNO_TCMALLOC' \
@@ -199,7 +207,6 @@
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
'-DUSE_PROPRIETARY_CODECS' \
- '-DENABLE_PEPPER_THREADING' \
'-DENABLE_GPU=1' \
'-DUSE_OPENSSL=1' \
'-DENABLE_EGLIMAGE=1' \
@@ -229,9 +236,10 @@
# Include paths placed before CFLAGS/CPPFLAGS
LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH) \
+ $(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) \
$(LOCAL_PATH)/third_party/khronos \
$(LOCAL_PATH)/gpu \
$(LOCAL_PATH)/skia/config \
@@ -242,6 +250,7 @@
$(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/pathops \
$(LOCAL_PATH)/third_party/skia/include/pipe \
$(LOCAL_PATH)/third_party/skia/include/ports \
$(LOCAL_PATH)/third_party/skia/include/utils \
@@ -250,7 +259,6 @@
$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
$(LOCAL_PATH)/third_party/WebKit/Source/Platform/chromium \
- $(gyp_shared_intermediate_dir)/webcore_headers \
$(LOCAL_PATH)/third_party/npapi \
$(LOCAL_PATH)/third_party/npapi/bindings \
$(LOCAL_PATH)/v8/include \
@@ -278,12 +286,13 @@
-Wl,-z,noexecstack \
-fPIC \
-m32 \
+ -fuse-ld=gold \
-nostdlib \
-Wl,--no-undefined \
-Wl,--exclude-libs=ALL \
+ -Wl,--gc-sections \
-Wl,-O1 \
- -Wl,--as-needed \
- -Wl,--gc-sections
+ -Wl,--as-needed
LOCAL_STATIC_LIBRARIES := \
diff --git a/ppapi/ppapi_shared_untrusted.gyp b/ppapi/ppapi_shared_untrusted.gyp
index e085f60..2c0f8bd 100644
--- a/ppapi/ppapi_shared_untrusted.gyp
+++ b/ppapi/ppapi_shared_untrusted.gyp
@@ -23,11 +23,6 @@
'nlib_target': 'libppapi_shared_untrusted.a',
'build_glibc': 0,
'build_newlib': 1,
- 'defines': [
- # Enable threading for the untrusted side of the proxy.
- # TODO(bbudge) remove when this is the default.
- 'ENABLE_PEPPER_THREADING',
- ],
},
'include_dirs': [
'..',
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi
index 1d61391..07a5b5c 100644
--- a/ppapi/ppapi_sources.gypi
+++ b/ppapi/ppapi_sources.gypi
@@ -64,7 +64,6 @@
'c/dev/ppb_char_set_dev.h',
'c/dev/ppb_cursor_control_dev.h',
'c/dev/ppb_device_ref_dev.h',
- 'c/dev/ppb_directory_reader_dev.h',
'c/dev/ppb_file_chooser_dev.h',
'c/dev/ppb_find_dev.h',
'c/dev/ppb_font_dev.h',
@@ -94,6 +93,7 @@
# Private interfaces.
'c/private/pp_file_handle.h',
'c/private/pp_private_font_charset.h',
+ 'c/private/pp_video_frame_private.h',
'c/private/ppb_content_decryptor_private.h',
'c/private/ppb_flash.h',
'c/private/ppb_flash_clipboard.h',
@@ -115,6 +115,8 @@
'c/private/ppb_tcp_server_socket_private.h',
'c/private/ppb_tcp_socket_private.h',
'c/private/ppb_udp_socket_private.h',
+ 'c/private/ppb_video_destination_private.h',
+ 'c/private/ppb_video_source_private.h',
'c/private/ppb_x509_certificate_private.h',
'c/private/ppp_content_decryptor_private.h',
@@ -136,8 +138,9 @@
'c/trusted/ppp_broker.h',
# Extensions dev interfaces.
- 'c/extensions/dev/ppb_alarms_dev.h',
- 'c/extensions/dev/ppb_events_dev.h',
+ 'c/extensions/dev/ppb_ext_alarms_dev.h',
+ 'c/extensions/dev/ppb_ext_events_dev.h',
+ 'c/extensions/dev/ppb_ext_socket_dev.h',
],
'cpp_source_files': [
'cpp/array_output.cc',
@@ -149,6 +152,8 @@
'cpp/completion_callback.h',
'cpp/core.cc',
'cpp/core.h',
+ 'cpp/directory_entry.cc',
+ 'cpp/directory_entry.h',
'cpp/file_io.cc',
'cpp/file_io.h',
'cpp/file_ref.cc',
@@ -215,10 +220,6 @@
'cpp/dev/cursor_control_dev.h',
'cpp/dev/device_ref_dev.cc',
'cpp/dev/device_ref_dev.h',
- 'cpp/dev/directory_entry_dev.cc',
- 'cpp/dev/directory_entry_dev.h',
- 'cpp/dev/directory_reader_dev.cc',
- 'cpp/dev/directory_reader_dev.h',
'cpp/dev/file_chooser_dev.cc',
'cpp/dev/file_chooser_dev.h',
'cpp/dev/find_dev.cc',
@@ -273,6 +274,8 @@
# Private interfaces.
'cpp/private/content_decryptor_private.cc',
'cpp/private/content_decryptor_private.h',
+ 'cpp/private/file_io_private.cc',
+ 'cpp/private/file_io_private.h',
'cpp/private/flash.cc',
'cpp/private/flash.h',
'cpp/private/flash_clipboard.cc',
@@ -299,6 +302,8 @@
'cpp/private/network_list_private.h',
'cpp/private/network_monitor_private.cc',
'cpp/private/network_monitor_private.h',
+ 'cpp/private/pass_file_handle.cc',
+ 'cpp/private/pass_file_handle.h',
'cpp/private/pdf.cc',
'cpp/private/pdf.h',
'cpp/private/tcp_server_socket_private.cc',
@@ -309,6 +314,12 @@
'cpp/private/udp_socket_private.h',
'cpp/private/var_private.cc',
'cpp/private/var_private.h',
+ 'cpp/private/video_destination_private.cc',
+ 'cpp/private/video_destination_private.h',
+ 'cpp/private/video_frame_private.cc',
+ 'cpp/private/video_frame_private.h',
+ 'cpp/private/video_source_private.cc',
+ 'cpp/private/video_source_private.h',
'cpp/private/x509_certificate_private.cc',
'cpp/private/x509_certificate_private.h',
@@ -334,6 +345,8 @@
'cpp/extensions/dev/alarms_dev.h',
'cpp/extensions/dev/events_dev.cc',
'cpp/extensions/dev/events_dev.h',
+ 'cpp/extensions/dev/socket_dev.cc',
+ 'cpp/extensions/dev/socket_dev.h',
# Utility sources.
'utility/completion_callback_factory.h',
@@ -376,8 +389,6 @@
'tests/test_core.h',
'tests/test_cursor_control.cc',
'tests/test_cursor_control.h',
- 'tests/test_directory_reader.cc',
- 'tests/test_directory_reader.h',
'tests/test_empty.cc',
'tests/test_empty.h',
'tests/test_file_io.cc',
@@ -426,6 +437,8 @@
'tests/test_tcp_server_socket_private.h',
'tests/test_tcp_socket_private.cc',
'tests/test_tcp_socket_private.h',
+ 'tests/test_truetype_font.cc',
+ 'tests/test_truetype_font.h',
'tests/test_udp_socket_private.cc',
'tests/test_udp_socket_private.h',
'tests/test_url_loader.cc',
@@ -477,6 +490,8 @@
'tests/test_flash.h',
'tests/test_flash_clipboard.cc',
'tests/test_flash_clipboard.h',
+ 'tests/test_flash_device_id.cc',
+ 'tests/test_flash_device_id.h',
'tests/test_flash_file.cc',
'tests/test_flash_file.h',
'tests/test_flash_fullscreen.cc',
@@ -485,6 +500,8 @@
'tests/test_flash_message_loop.h',
'tests/test_net_address_private.cc',
'tests/test_net_address_private.h',
+ 'tests/test_pdf.cc',
+ 'tests/test_pdf.h',
'tests/test_resource_array.cc',
'tests/test_resource_array.h',
'tests/test_struct_sizes.c',
diff --git a/ppapi/ppapi_tests.gypi b/ppapi/ppapi_tests.gypi
index a400e98..f1cb93e 100644
--- a/ppapi/ppapi_tests.gypi
+++ b/ppapi/ppapi_tests.gypi
@@ -151,6 +151,7 @@
'proxy/flash_resource_unittest.cc',
'proxy/mock_resource.cc',
'proxy/mock_resource.h',
+ 'proxy/pdf_resource_unittest.cc',
'proxy/plugin_dispatcher_unittest.cc',
'proxy/plugin_resource_tracker_unittest.cc',
'proxy/plugin_var_tracker_unittest.cc',
@@ -159,6 +160,7 @@
'proxy/ppp_instance_proxy_unittest.cc',
'proxy/ppp_messaging_proxy_unittest.cc',
'proxy/printing_resource_unittest.cc',
+ 'proxy/raw_var_data_unittest.cc',
'proxy/serialized_var_unittest.cc',
'proxy/websocket_resource_unittest.cc',
'shared_impl/resource_tracker_unittest.cc',
@@ -351,6 +353,16 @@
],
},
{
+ 'target_name': 'ppapi_example_scaling',
+ 'dependencies': [
+ 'ppapi_example_skeleton',
+ 'ppapi.gyp:ppapi_cpp',
+ ],
+ 'sources': [
+ 'examples/scaling/scaling.cc',
+ ],
+ },
+ {
'target_name': 'ppapi_example_scroll',
'dependencies': [
'ppapi_example_skeleton',
diff --git a/ppapi/ppapi_untrusted.gyp b/ppapi/ppapi_untrusted.gyp
index 339cd24..3e19759 100644
--- a/ppapi/ppapi_untrusted.gyp
+++ b/ppapi/ppapi_untrusted.gyp
@@ -62,11 +62,21 @@
'native_client/native_client.gyp:ppapi_lib',
],
'variables': {
+ # This is user code (vs IRT code), so tls accesses do not
+ # need to be indirect through a function call.
+ 'newlib_tls_flags=': [],
# TODO(bradnelson): Remove this compile flag once new nacl_rev is
# above 9362.
'compile_flags': [
'-DGL_GLEXT_PROTOTYPES',
],
+ # Speed up pnacl linking by not generating debug info for tests.
+ # We compile with --strip-all under extra_args so debug info is
+ # discarded anyway. Remove this and the --strip-all flag if
+ # debug info is really needed.
+ 'compile_flags!': [
+ '-g',
+ ],
'defines': [
'GL_GLEXT_PROTOTYPES',
],
@@ -81,6 +91,12 @@
'-lppapi',
'-pthread',
],
+ 'link_flags!': [
+ '-O3',
+ ],
+ 'translate_flags': [
+ '-O0',
+ ],
# TODO(bradchen): get rid of extra_deps64 and extra_deps32
# once native_client/build/untrusted.gypi no longer needs them.
'extra_deps_newlib64': [
@@ -116,18 +132,6 @@
],
},
'conditions': [
- ['target_arch!="arm"', {
- # This is user code (vs IRT code), so tls accesses do not
- # need to be indirect through a function call.
- # For PNaCl, the -mtls-use-call flag is localized to the
- # IRT's translation command, so it is unnecessary to
- # counteract that flag here.
- 'variables': {
- 'gcc_compile_flags': [
- '-mno-tls-use-call',
- ],
- },
- }],
['target_arch!="arm" and disable_glibc==0', {
'variables': {
'build_glibc': 1,
diff --git a/ppapi/proxy/audio_input_resource.cc b/ppapi/proxy/audio_input_resource.cc
index 5f700ec..487df29 100644
--- a/ppapi/proxy/audio_input_resource.cc
+++ b/ppapi/proxy/audio_input_resource.cc
@@ -31,7 +31,7 @@
shared_memory_size_(0),
audio_input_callback_(NULL),
user_data_(NULL),
- ALLOW_THIS_IN_INITIALIZER_LIST(enumeration_helper_(this)) {
+ enumeration_helper_(this) {
SendCreate(RENDERER, PpapiHostMsg_AudioInput_Create());
}
@@ -217,7 +217,10 @@
shared_memory_size_ = shared_memory_size;
if (!shared_memory_->Map(shared_memory_size_)) {
- PpapiGlobals::Get()->LogWithSource(pp_instance(), PP_LOGLEVEL_WARNING, "",
+ PpapiGlobals::Get()->LogWithSource(
+ pp_instance(),
+ PP_LOGLEVEL_WARNING,
+ std::string(),
"Failed to map shared memory for PPB_AudioInput_Shared.");
}
diff --git a/ppapi/proxy/browser_font_resource_trusted.cc b/ppapi/proxy/browser_font_resource_trusted.cc
index ae3b07d..e9ee4fe 100644
--- a/ppapi/proxy/browser_font_resource_trusted.cc
+++ b/ppapi/proxy/browser_font_resource_trusted.cc
@@ -44,9 +44,9 @@
const char kCommonScript[] = "Zyyy";
string16 GetFontFromMap(
- const webkit_glue::WebPreferences::ScriptFontFamilyMap& map,
+ const webkit_glue::ScriptFontFamilyMap& map,
const std::string& script) {
- webkit_glue::WebPreferences::ScriptFontFamilyMap::const_iterator it =
+ webkit_glue::ScriptFontFamilyMap::const_iterator it =
map.find(script);
if (it != map.end())
return it->second;
diff --git a/ppapi/proxy/device_enumeration_resource_helper.cc b/ppapi/proxy/device_enumeration_resource_helper.cc
index 2729406..e8d63e1 100644
--- a/ppapi/proxy/device_enumeration_resource_helper.cc
+++ b/ppapi/proxy/device_enumeration_resource_helper.cc
@@ -184,7 +184,7 @@
CHECK(monitor_callback_.get());
- scoped_array<PP_Resource> elements;
+ scoped_ptr<PP_Resource[]> elements;
uint32_t size = devices.size();
if (size > 0) {
elements.reset(new PP_Resource[size]);
diff --git a/ppapi/proxy/device_enumeration_resource_helper_unittest.cc b/ppapi/proxy/device_enumeration_resource_helper_unittest.cc
index 330bca3..56c09d7 100644
--- a/ppapi/proxy/device_enumeration_resource_helper_unittest.cc
+++ b/ppapi/proxy/device_enumeration_resource_helper_unittest.cc
@@ -14,6 +14,7 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "ppapi/shared_impl/ppb_device_ref_shared.h"
+#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_device_ref_api.h"
@@ -37,7 +38,7 @@
bool CompareDeviceRef(PluginVarTracker* var_tracker,
PP_Resource resource,
const DeviceRefData& expected) {
- thunk::EnterResource<thunk::PPB_DeviceRef_API> enter(resource, true);
+ thunk::EnterResourceNoLock<thunk::PPB_DeviceRef_API> enter(resource, true);
if (enter.failed())
return false;
@@ -66,7 +67,7 @@
public:
TestResource(Connection connection, PP_Instance instance)
: PluginResource(connection, instance),
- ALLOW_THIS_IN_INITIALIZER_LIST(device_enumeration_(this)) {
+ device_enumeration_(this) {
}
virtual ~TestResource() {}
@@ -189,6 +190,7 @@
static void MonitorDeviceChangeCallback(void* user_data,
uint32_t device_count,
const PP_Resource devices[]) {
+ ProxyAutoLock lock;
TestMonitorDeviceChange* helper =
static_cast<TestMonitorDeviceChange*>(user_data);
CHECK(!helper->called_);
@@ -218,6 +220,8 @@
} // namespace
TEST_F(DeviceEnumerationResourceHelperTest, EnumerateDevices) {
+ ProxyAutoLock lock;
+
scoped_refptr<TestResource> resource(
new TestResource(GetConnection(this), pp_instance()));
DeviceEnumerationResourceHelper& device_enumeration =
@@ -252,11 +256,13 @@
data_item.id = "id_2";
data.push_back(data_item);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply(data))));
-
+ {
+ ProxyAutoUnlock unlock;
+ ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+ PpapiPluginMsg_ResourceReply(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply(data))));
+ }
EXPECT_TRUE(callback.called());
EXPECT_EQ(PP_OK, callback.result());
EXPECT_EQ(2U, output.count());
@@ -265,6 +271,8 @@
}
TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) {
+ ProxyAutoLock lock;
+
scoped_refptr<TestResource> resource(
new TestResource(GetConnection(this), pp_instance()));
DeviceEnumerationResourceHelper& device_enumeration =
@@ -293,12 +301,15 @@
helper.SetExpectedResult(data);
- // Synthesize a response with no device.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id, data))));
+ {
+ ProxyAutoUnlock unlock;
+ // Synthesize a response with no device.
+ ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+ PpapiPluginMsg_ResourceReply(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id, data))));
+ }
EXPECT_TRUE(helper.called() && helper.same_as_expected());
DeviceRefData data_item;
@@ -313,12 +324,15 @@
helper.SetExpectedResult(data);
- // Synthesize a response with some devices.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id, data))));
+ {
+ ProxyAutoUnlock unlock;
+ // Synthesize a response with some devices.
+ ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+ PpapiPluginMsg_ResourceReply(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id, data))));
+ }
EXPECT_TRUE(helper.called() && helper.same_as_expected());
TestMonitorDeviceChange helper2(&var_tracker());
@@ -340,24 +354,30 @@
helper.SetExpectedResult(data);
helper2.SetExpectedResult(data);
- // |helper2| should receive the result while |helper| shouldn't.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id2, data))));
+ {
+ ProxyAutoUnlock unlock;
+ // |helper2| should receive the result while |helper| shouldn't.
+ ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+ PpapiPluginMsg_ResourceReply(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id2, data))));
+ }
EXPECT_TRUE(helper2.called() && helper2.same_as_expected());
EXPECT_FALSE(helper.called());
helper.SetExpectedResult(data);
helper2.SetExpectedResult(data);
- // Even if a message with |callback_id| arrives. |helper| shouldn't receive
- // the result.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id, data))));
+ {
+ ProxyAutoUnlock unlock;
+ // Even if a message with |callback_id| arrives. |helper| shouldn't receive
+ // the result.
+ ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+ PpapiPluginMsg_ResourceReply(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id, data))));
+ }
EXPECT_FALSE(helper2.called());
EXPECT_FALSE(helper.called());
@@ -373,12 +393,15 @@
sink().ClearMessages();
helper2.SetExpectedResult(data);
- // |helper2| shouldn't receive any result any more.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id2, data))));
+ {
+ ProxyAutoUnlock unlock;
+ // |helper2| shouldn't receive any result any more.
+ ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
+ PpapiPluginMsg_ResourceReply(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id2, data))));
+ }
EXPECT_FALSE(helper2.called());
}
diff --git a/ppapi/proxy/directory_reader_resource.cc b/ppapi/proxy/directory_reader_resource.cc
deleted file mode 100644
index 17826d0..0000000
--- a/ppapi/proxy/directory_reader_resource.cc
+++ /dev/null
@@ -1,108 +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/proxy/directory_reader_resource.h"
-
-#include "base/bind.h"
-#include "ipc/ipc_message.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/proxy/dispatch_reply_message.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_file_ref_proxy.h"
-#include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/resource_tracker.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_file_ref_api.h"
-
-using ppapi::proxy::PPB_FileRef_Proxy;
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-void ReleaseEntries(const std::vector<PP_DirectoryEntry_Dev>& entries) {
- ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker();
- for (std::vector<PP_DirectoryEntry_Dev>::const_iterator it = entries.begin();
- it != entries.end(); ++it)
- tracker->ReleaseResource(it->file_ref);
-}
-
-} // namespace
-
-DirectoryReaderResource::DirectoryReaderResource(
- Connection connection,
- PP_Instance instance,
- PP_Resource directory_ref)
- : PluginResource(connection, instance) {
- directory_resource_ =
- PpapiGlobals::Get()->GetResourceTracker()->GetResource(directory_ref);
-}
-
-DirectoryReaderResource::~DirectoryReaderResource() {
-}
-
-thunk::PPB_DirectoryReader_API*
-DirectoryReaderResource::AsPPB_DirectoryReader_API() {
- return this;
-}
-
-int32_t DirectoryReaderResource::ReadEntries(
- const PP_ArrayOutput& output,
- scoped_refptr<TrackedCallback> callback) {
- if (TrackedCallback::IsPending(callback_))
- return PP_ERROR_INPROGRESS;
-
- callback_ = callback;
-
- if (!sent_create_to_renderer())
- SendCreate(RENDERER, PpapiHostMsg_DirectoryReader_Create());
-
- PpapiHostMsg_DirectoryReader_GetEntries msg(
- directory_resource_->host_resource());
- Call<PpapiPluginMsg_DirectoryReader_GetEntriesReply>(
- RENDERER, msg,
- base::Bind(&DirectoryReaderResource::OnPluginMsgGetEntriesReply,
- this, output));
- return PP_OK_COMPLETIONPENDING;
-}
-
-void DirectoryReaderResource::OnPluginMsgGetEntriesReply(
- const PP_ArrayOutput& output,
- const ResourceMessageReplyParams& params,
- const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos,
- const std::vector<PP_FileType>& file_types) {
- CHECK_EQ(infos.size(), file_types.size());
-
- std::vector<PP_DirectoryEntry_Dev> entries;
- for (std::vector<ppapi::PPB_FileRef_CreateInfo>::size_type i = 0;
- i < infos.size(); ++i) {
- PP_DirectoryEntry_Dev entry;
- entry.file_ref = PPB_FileRef_Proxy::DeserializeFileRef(infos[i]);
- entry.file_type = file_types[i];
- entries.push_back(entry);
- }
-
- if (!TrackedCallback::IsPending(callback_)) {
- ReleaseEntries(entries);
- entries.clear();
- return;
- }
-
- ArrayWriter writer(output);
- if (!writer.is_valid()) {
- ReleaseEntries(entries);
- entries.clear();
- callback_->Run(PP_ERROR_FAILED);
- return;
- }
-
- writer.StoreVector(entries);
- entries.clear();
- callback_->Run(params.result());
-}
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/ppapi/proxy/directory_reader_resource.h b/ppapi/proxy/directory_reader_resource.h
deleted file mode 100644
index e532414..0000000
--- a/ppapi/proxy/directory_reader_resource.h
+++ /dev/null
@@ -1,58 +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.
-
-#ifndef PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_
-#define PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "ppapi/proxy/plugin_resource.h"
-#include "ppapi/proxy/ppapi_proxy_export.h"
-#include "ppapi/shared_impl/array_writer.h"
-#include "ppapi/shared_impl/ppb_file_ref_shared.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/thunk/ppb_directory_reader_api.h"
-
-namespace ppapi {
-
-class TrackedCallback;
-
-namespace proxy {
-
-class PPAPI_PROXY_EXPORT DirectoryReaderResource
- : public PluginResource,
- public NON_EXPORTED_BASE(thunk::PPB_DirectoryReader_API) {
- public:
- DirectoryReaderResource(Connection connection,
- PP_Instance instance,
- PP_Resource directory_ref);
- virtual ~DirectoryReaderResource();
-
- // Resource overrides.
- virtual thunk::PPB_DirectoryReader_API* AsPPB_DirectoryReader_API() OVERRIDE;
-
- // PPB_DirectoryReader_API.
- virtual int32_t ReadEntries(
- const PP_ArrayOutput& output,
- scoped_refptr<TrackedCallback> callback) OVERRIDE;
-
- private:
- void OnPluginMsgGetEntriesReply(
- const PP_ArrayOutput& output,
- const ResourceMessageReplyParams& params,
- const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos,
- const std::vector<PP_FileType>& file_types);
-
- scoped_refptr<Resource> directory_resource_;
- scoped_refptr<TrackedCallback> callback_;
-
- DISALLOW_COPY_AND_ASSIGN(DirectoryReaderResource);
-};
-
-} // namespace proxy
-} // namespace ppapi
-
-#endif // PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_
diff --git a/ppapi/proxy/enter_proxy.h b/ppapi/proxy/enter_proxy.h
index 3832a13..4ad67b1 100644
--- a/ppapi/proxy/enter_proxy.h
+++ b/ppapi/proxy/enter_proxy.h
@@ -151,6 +151,23 @@
RunCallback(PP_ERROR_BADRESOURCE);
}
+ // For callbacks that take three extra parameters as a closure.
+ template<class CallbackFactory, typename Method, typename A, typename B,
+ typename C>
+ EnterHostFromHostResourceForceCallback(
+ const HostResource& host_resource,
+ CallbackFactory& factory,
+ Method method,
+ const A& a,
+ const B& b,
+ const C& c)
+ : EnterHostFromHostResource<ResourceT>(host_resource,
+ factory.NewOptionalCallback(method, a, b, c)),
+ needs_running_(true) {
+ if (this->failed())
+ RunCallback(PP_ERROR_BADRESOURCE);
+ }
+
~EnterHostFromHostResourceForceCallback() {
if (needs_running_) {
NOTREACHED() << "Should always call SetResult except in the "
diff --git a/ppapi/proxy/extensions_common_resource.cc b/ppapi/proxy/extensions_common_resource.cc
new file mode 100644
index 0000000..ab030ef
--- /dev/null
+++ b/ppapi/proxy/extensions_common_resource.cc
@@ -0,0 +1,105 @@
+// 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/extensions_common_resource.h"
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/shared_impl/var_value_conversions.h"
+
+namespace ppapi {
+namespace proxy {
+
+ExtensionsCommonResource::ExtensionsCommonResource(Connection connection,
+ PP_Instance instance)
+ : PluginResource(connection, instance) {
+ SendCreate(RENDERER, PpapiHostMsg_ExtensionsCommon_Create());
+}
+
+ExtensionsCommonResource::~ExtensionsCommonResource() {
+}
+
+thunk::ExtensionsCommon_API*
+ExtensionsCommonResource::AsExtensionsCommon_API() {
+ return this;
+}
+
+int32_t ExtensionsCommonResource::Call(
+ const std::string& request_name,
+ const std::vector<PP_Var>& input_args,
+ const std::vector<PP_Var*>& output_args,
+ scoped_refptr<TrackedCallback> callback) {
+ // TODO(yzshen): CreateValueFromVar() doesn't generate null fields for
+ // dictionary values. That is the expected behavior for most APIs. If later we
+ // want to support APIs that require to preserve null fields in dictionaries,
+ // we should change the behavior to always preserve null fields at the plugin
+ // side, and figure out whether they should be stripped at the renderer side.
+ scoped_ptr<base::ListValue> input_args_value(
+ CreateListValueFromVarVector(input_args));
+ if (!input_args_value.get()) {
+ LOG(WARNING) << "Failed to convert PP_Var input arguments.";
+ return PP_ERROR_BADARGUMENT;
+ }
+
+ PluginResource::Call<PpapiPluginMsg_ExtensionsCommon_CallReply>(
+ RENDERER,
+ PpapiHostMsg_ExtensionsCommon_Call(request_name, *input_args_value),
+ base::Bind(&ExtensionsCommonResource::OnPluginMsgCallReply,
+ base::Unretained(this), output_args, callback));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+void ExtensionsCommonResource::Post(const std::string& request_name,
+ const std::vector<PP_Var>& args) {
+ scoped_ptr<base::ListValue> args_value(CreateListValueFromVarVector(args));
+ if (!args_value.get()) {
+ LOG(WARNING) << "Failed to convert PP_Var input arguments.";
+ return;
+ }
+
+ PluginResource::Post(
+ RENDERER, PpapiHostMsg_ExtensionsCommon_Post(request_name, *args_value));
+}
+
+void ExtensionsCommonResource::OnPluginMsgCallReply(
+ const std::vector<PP_Var*>& output_args,
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params,
+ const base::ListValue& output) {
+ // |output_args| may be invalid and shouldn't be accessed if the callback has
+ // been called.
+ if (!TrackedCallback::IsPending(callback))
+ return;
+
+ int32_t result = params.result();
+ if (result == PP_OK) {
+ // If the size doesn't match, something must be really wrong.
+ CHECK_EQ(output_args.size(), output.GetSize());
+
+ std::vector<PP_Var> output_vars;
+ if (CreateVarVectorFromListValue(output, &output_vars)) {
+ DCHECK_EQ(output_args.size(), output_vars.size());
+ std::vector<PP_Var>::const_iterator src_iter = output_vars.begin();
+ std::vector<PP_Var*>::const_iterator dest_iter = output_args.begin();
+ for (; src_iter != output_vars.end() && dest_iter != output_args.end();
+ ++src_iter, ++dest_iter) {
+ **dest_iter = *src_iter;
+ }
+ } else {
+ result = PP_ERROR_FAILED;
+ }
+ }
+
+ callback->Run(result);
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/extensions_common_resource.h b/ppapi/proxy/extensions_common_resource.h
new file mode 100644
index 0000000..83a2667
--- /dev/null
+++ b/ppapi/proxy/extensions_common_resource.h
@@ -0,0 +1,52 @@
+// 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_EXTENSIONS_COMMON_RESOURCE_H_
+#define PPAPI_PROXY_EXTENSIONS_COMMON_RESOURCE_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/thunk/extensions_common_api.h"
+
+namespace base {
+class ListValue;
+}
+
+namespace ppapi {
+namespace proxy {
+
+class ResourceMessageReplyParams;
+
+class ExtensionsCommonResource : public PluginResource,
+ public thunk::ExtensionsCommon_API {
+ public:
+ ExtensionsCommonResource(Connection connection, PP_Instance instance);
+ virtual ~ExtensionsCommonResource();
+
+ // Resource overrides.
+ virtual thunk::ExtensionsCommon_API* AsExtensionsCommon_API() OVERRIDE;
+
+ // ExtensionsCommon_API implementation.
+ virtual int32_t Call(const std::string& request_name,
+ const std::vector<PP_Var>& input_args,
+ const std::vector<PP_Var*>& output_args,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
+ virtual void Post(const std::string& request_name,
+ const std::vector<PP_Var>& args) OVERRIDE;
+
+ private:
+ void OnPluginMsgCallReply(const std::vector<PP_Var*>& output_args,
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params,
+ const base::ListValue& output);
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionsCommonResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_EXTENSIONS_COMMON_RESOURCE_H_
diff --git a/ppapi/proxy/file_chooser_resource_unittest.cc b/ppapi/proxy/file_chooser_resource_unittest.cc
index 49c95da..3ff1022 100644
--- a/ppapi/proxy/file_chooser_resource_unittest.cc
+++ b/ppapi/proxy/file_chooser_resource_unittest.cc
@@ -6,10 +6,10 @@
#include "ppapi/c/dev/ppb_file_chooser_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/file_chooser_resource.h"
+#include "ppapi/proxy/locking_resource_releaser.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "ppapi/shared_impl/proxy_lock.h"
-#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/shared_impl/scoped_pp_var.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/thunk.h"
@@ -67,7 +67,7 @@
TEST_F(FileChooserResourceTest, Show) {
const PPB_FileChooser_Dev_0_6* chooser_iface =
thunk::GetPPB_FileChooser_Dev_0_6_Thunk();
- ScopedPPResource res(ScopedPPResource::PassRef(),
+ LockingResourceReleaser res(
chooser_iface->Create(pp_instance(), PP_FILECHOOSERMODE_OPEN,
PP_MakeUndefined()));
@@ -77,7 +77,7 @@
output.user_data = &dest;
int32_t result = chooser_iface->Show(
- res, output, PP_MakeCompletionCallback(&DoNothingCallback, NULL));
+ res.get(), output, PP_MakeCompletionCallback(&DoNothingCallback, NULL));
ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
// Should have sent a "show" message.
@@ -105,7 +105,7 @@
// Should have populated our vector.
ASSERT_EQ(1u, dest.size());
- ScopedPPResource dest_deletor(dest[0]); // Ensure it's cleaned up.
+ LockingResourceReleaser dest_deletor(dest[0]); // Ensure it's cleaned up.
const PPB_FileRef_1_0* file_ref_iface = thunk::GetPPB_FileRef_1_0_Thunk();
EXPECT_EQ(PP_FILESYSTEMTYPE_EXTERNAL,
diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc
index 77105a1..7d98356 100644
--- a/ppapi/proxy/file_io_resource.cc
+++ b/ppapi/proxy/file_io_resource.cc
@@ -224,6 +224,23 @@
return PP_OK_COMPLETIONPENDING;
}
+int32_t FileIOResource::RequestOSFileHandle(
+ PP_FileHandle* handle,
+ scoped_refptr<TrackedCallback> callback) {
+ int32_t rv = state_manager_.CheckOperationState(
+ FileIOStateManager::OPERATION_EXCLUSIVE, true);
+ if (rv != PP_OK)
+ return rv;
+
+ Call<PpapiPluginMsg_FileIO_RequestOSFileHandleReply>(RENDERER,
+ PpapiHostMsg_FileIO_RequestOSFileHandle(),
+ base::Bind(&FileIOResource::OnPluginMsgRequestOSFileHandleComplete, this,
+ callback, handle));
+
+ state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
+ return PP_OK_COMPLETIONPENDING;
+}
+
void FileIOResource::OnPluginMsgGeneralComplete(
scoped_refptr<TrackedCallback> callback,
const ResourceMessageReplyParams& params) {
@@ -286,6 +303,28 @@
callback->Run(result);
}
+void FileIOResource::OnPluginMsgRequestOSFileHandleComplete(
+ scoped_refptr<TrackedCallback> callback,
+ PP_FileHandle* output_handle,
+ const ResourceMessageReplyParams& params) {
+ DCHECK(state_manager_.get_pending_operation() ==
+ FileIOStateManager::OPERATION_EXCLUSIVE);
+
+ if (!TrackedCallback::IsPending(callback)) {
+ state_manager_.SetOperationFinished();
+ return;
+ }
+
+ int32_t result = params.result();
+ IPC::PlatformFileForTransit transit_file;
+ if (!params.TakeFileHandleAtIndex(0, &transit_file))
+ result = PP_ERROR_FAILED;
+ *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file);
+
+ // End the operation now. The callback may perform another file operation.
+ state_manager_.SetOperationFinished();
+ callback->Run(result);
+}
+
} // namespace proxy
} // namespace ppapi
-
diff --git a/ppapi/proxy/file_io_resource.h b/ppapi/proxy/file_io_resource.h
index f5a1aa8..a2b928d 100644
--- a/ppapi/proxy/file_io_resource.h
+++ b/ppapi/proxy/file_io_resource.h
@@ -7,6 +7,7 @@
#include <string>
+#include "ppapi/c/private/pp_file_handle.h"
#include "ppapi/proxy/connection.h"
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
@@ -55,6 +56,9 @@
virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual void Close() OVERRIDE;
virtual int32_t GetOSFileDescriptor() OVERRIDE;
+ virtual int32_t RequestOSFileHandle(
+ PP_FileHandle* handle,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual int32_t WillWrite(int64_t offset,
int32_t bytes_to_write,
scoped_refptr<TrackedCallback> callback) OVERRIDE;
@@ -82,6 +86,10 @@
PP_ArrayOutput array_output,
const ResourceMessageReplyParams& params,
const std::string& data);
+ void OnPluginMsgRequestOSFileHandleComplete(
+ scoped_refptr<TrackedCallback> callback,
+ PP_FileHandle* output_handle,
+ const ResourceMessageReplyParams& params);
FileIOStateManager state_manager_;
@@ -92,4 +100,3 @@
} // namespace ppapi
#endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_
-
diff --git a/ppapi/proxy/file_system_resource.cc b/ppapi/proxy/file_system_resource.cc
new file mode 100644
index 0000000..6d8e641
--- /dev/null
+++ b/ppapi/proxy/file_system_resource.cc
@@ -0,0 +1,60 @@
+// 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/file_system_resource.h"
+
+#include "base/bind.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+
+using ppapi::thunk::PPB_FileSystem_API;
+
+namespace ppapi {
+namespace proxy {
+
+FileSystemResource::FileSystemResource(Connection connection,
+ PP_Instance instance,
+ PP_FileSystemType type)
+ : PluginResource(connection, instance),
+ type_(type),
+ called_open_(false) {
+ DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID);
+ SendCreate(RENDERER, PpapiHostMsg_FileSystem_Create(type_));
+}
+
+FileSystemResource::~FileSystemResource() {
+}
+
+PPB_FileSystem_API* FileSystemResource::AsPPB_FileSystem_API() {
+ return this;
+}
+
+int32_t FileSystemResource::Open(int64_t expected_size,
+ scoped_refptr<TrackedCallback> callback) {
+ if (called_open_)
+ return PP_ERROR_FAILED;
+ called_open_ = true;
+
+ Call<PpapiPluginMsg_FileSystem_OpenReply>(RENDERER,
+ PpapiHostMsg_FileSystem_Open(expected_size),
+ base::Bind(&FileSystemResource::OpenComplete,
+ this,
+ callback));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+PP_FileSystemType FileSystemResource::GetType() {
+ return type_;
+}
+
+void FileSystemResource::OpenComplete(
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params) {
+ callback->Run(params.result());
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/file_system_resource.h b/ppapi/proxy/file_system_resource.h
new file mode 100644
index 0000000..ffd1234
--- /dev/null
+++ b/ppapi/proxy/file_system_resource.h
@@ -0,0 +1,55 @@
+// 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_FILE_SYSTEM_RESOURCE_H_
+#define PPAPI_PROXY_FILE_SYSTEM_RESOURCE_H_
+
+#include <string>
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_file_info.h"
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/thunk/ppb_file_system_api.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT FileSystemResource
+ : public PluginResource,
+ public NON_EXPORTED_BASE(thunk::PPB_FileSystem_API) {
+ public:
+ FileSystemResource(Connection connection,
+ PP_Instance instance,
+ PP_FileSystemType type);
+ virtual ~FileSystemResource();
+
+ // Resource overrides.
+ virtual thunk::PPB_FileSystem_API* AsPPB_FileSystem_API() OVERRIDE;
+
+ // PPB_FileSystem_API implementation.
+ virtual int32_t Open(int64_t expected_size,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
+ virtual PP_FileSystemType GetType() OVERRIDE;
+
+ private:
+ // Called when the host has responded to our open request.
+ void OpenComplete(scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params);
+
+ PP_FileSystemType type_;
+ bool called_open_;
+
+ DISALLOW_COPY_AND_ASSIGN(FileSystemResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_FILE_SYSTEM_RESOURCE_H_
diff --git a/ppapi/proxy/flash_resource.cc b/ppapi/proxy/flash_resource.cc
index 1fc45b1..23b3f20 100644
--- a/ppapi/proxy/flash_resource.cc
+++ b/ppapi/proxy/flash_resource.cc
@@ -7,6 +7,7 @@
#include <cmath>
#include "base/containers/mru_cache.h"
+#include "base/debug/crash_logging.h"
#include "base/lazy_instance.h"
#include "base/time.h"
#include "ppapi/c/pp_errors.h"
@@ -83,14 +84,18 @@
PP_Bool FlashResource::SetCrashData(PP_Instance instance,
PP_FlashCrashKey key,
PP_Var value) {
+ StringVar* url_string_var(StringVar::FromPPVar(value));
+ if (!url_string_var)
+ return PP_FALSE;
switch (key) {
case PP_FLASHCRASHKEY_URL: {
- StringVar* url_string_var(StringVar::FromPPVar(value));
- if (!url_string_var)
- return PP_FALSE;
PluginGlobals::Get()->SetActiveURL(url_string_var->value());
return PP_TRUE;
}
+ case PP_FLASHCRASHKEY_RESOURCE_URL: {
+ base::debug::SetCrashKeyValue("subresource_url", url_string_var->value());
+ return PP_TRUE;
+ }
}
return PP_FALSE;
}
diff --git a/ppapi/proxy/flash_resource_unittest.cc b/ppapi/proxy/flash_resource_unittest.cc
index ab22077..1a5e7c6 100644
--- a/ppapi/proxy/flash_resource_unittest.cc
+++ b/ppapi/proxy/flash_resource_unittest.cc
@@ -5,9 +5,9 @@
#include "ppapi/c/dev/ppb_video_capture_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_flash.h"
+#include "ppapi/proxy/locking_resource_releaser.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
-#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/thunk/thunk.h"
namespace ppapi {
@@ -43,7 +43,7 @@
sink().AddFilter(&enumerate_video_devices_handler);
// Set up the arguments to the call.
- ScopedPPResource video_capture(ScopedPPResource::PassRef(),
+ LockingResourceReleaser video_capture(
::ppapi::thunk::GetPPB_VideoCapture_Dev_0_3_Thunk()->Create(
pp_instance()));
std::vector<PP_Resource> unused;
diff --git a/ppapi/proxy/graphics_2d_resource.cc b/ppapi/proxy/graphics_2d_resource.cc
index b07db46..3bad2e4 100644
--- a/ppapi/proxy/graphics_2d_resource.cc
+++ b/ppapi/proxy/graphics_2d_resource.cc
@@ -93,35 +93,30 @@
"Graphics2DResource.PaintImageData: Bad image resource.");
return;
}
- enter_image.object()->SetUsedInReplaceContents();
+ enter_image.object()->SetIsCandidateForReuse();
Post(RENDERER, PpapiHostMsg_Graphics2D_ReplaceContents(
image_object->host_resource()));
}
-bool Graphics2DResource::SetScale(float scale) {
+PP_Bool Graphics2DResource::SetScale(float scale) {
if (scale <= 0.0f)
- return false;
+ return PP_FALSE;
Post(RENDERER, PpapiHostMsg_Graphics2D_Dev_SetScale(scale));
scale_ = scale;
- return true;
+ return PP_TRUE;
}
float Graphics2DResource::GetScale() {
return scale_;
}
-int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback,
- PP_Resource* old_image_data) {
+int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) {
// If host is not even created, return failure immediately. This can happen
// when failed to initialize (in constructor).
if (!sent_create_to_renderer())
return PP_ERROR_FAILED;
- // We don't support this feature, it's for in-renderer only.
- if (old_image_data)
- *old_image_data = 0;
-
if (TrackedCallback::IsPending(current_flush_callback_))
return PP_ERROR_INPROGRESS; // Can't have >1 flush pending.
current_flush_callback_ = callback;
diff --git a/ppapi/proxy/graphics_2d_resource.h b/ppapi/proxy/graphics_2d_resource.h
index 01309dc..b7ec30c 100644
--- a/ppapi/proxy/graphics_2d_resource.h
+++ b/ppapi/proxy/graphics_2d_resource.h
@@ -38,10 +38,9 @@
virtual void Scroll(const PP_Rect* clip_rect,
const PP_Point* amount) OVERRIDE;
virtual void ReplaceContents(PP_Resource image_data) OVERRIDE;
- virtual bool SetScale(float scale) OVERRIDE;
+ virtual PP_Bool SetScale(float scale) OVERRIDE;
virtual float GetScale() OVERRIDE;
- virtual int32_t Flush(scoped_refptr<TrackedCallback> callback,
- PP_Resource* old_image_data) OVERRIDE;
+ virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual bool ReadImageData(PP_Resource image,
const PP_Point* top_left) OVERRIDE;
diff --git a/ppapi/proxy/handle_converter.cc b/ppapi/proxy/handle_converter.cc
index ef4102c..4c7d282 100644
--- a/ppapi/proxy/handle_converter.cc
+++ b/ppapi/proxy/handle_converter.cc
@@ -44,18 +44,28 @@
WriteHandle((*handle_index)++, handle, msg);
}
+void HandleWriter(int* handle_index,
+ IPC::Message* m,
+ const ppapi::proxy::SerializedHandle& handle) {
+ WriteHandle((*handle_index)++, handle, m);
+}
+
void ConvertHandlesInParam(const ppapi::proxy::SerializedVar& var,
Handles* handles,
IPC::Message* msg,
int* handle_index) {
- ppapi::proxy::SerializedHandle *handle = var.GetPluginShmemHandle();
- if (handle) {
- handles->push_back(*handle);
- if (msg) {
- var.WriteRawVarHeader(msg);
- WriteHandle((*handle_index)++, *handle, msg);
- }
- }
+ if (!var.raw_var_data())
+ return;
+
+ std::vector<ppapi::proxy::SerializedHandle*> var_handles =
+ var.raw_var_data()->GetHandles();
+ if (var_handles.empty())
+ return;
+
+ for (size_t i = 0; i < var_handles.size(); ++i)
+ handles->push_back(*var_handles[i]);
+ if (msg)
+ var.raw_var_data()->Write(msg, base::Bind(&HandleWriter, handle_index));
}
// For PpapiMsg_ResourceReply and the reply to PpapiHostMsg_ResourceSyncCall,
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index ac8a6d4..bf5bb4b 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -12,7 +12,6 @@
#include "ppapi/c/dev/ppb_crypto_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/c/dev/ppb_device_ref_dev.h"
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
#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"
@@ -32,6 +31,8 @@
#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"
+#include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h"
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/ppb_audio.h"
#include "ppapi/c/ppb_console.h"
@@ -57,6 +58,7 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
+#include "ppapi/c/private/ppb_file_io_private.h"
#include "ppapi/c/private/ppb_file_ref_private.h"
#include "ppapi/c/private/ppb_flash_clipboard.h"
#include "ppapi/c/private/ppb_flash_file.h"
@@ -76,6 +78,8 @@
#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
#include "ppapi/c/private/ppb_tcp_socket_private.h"
#include "ppapi/c/private/ppb_udp_socket_private.h"
+#include "ppapi/c/private/ppb_video_destination_private.h"
+#include "ppapi/c/private/ppb_video_source_private.h"
#include "ppapi/c/private/ppb_x509_certificate_private.h"
#include "ppapi/c/private/ppp_content_decryptor_private.h"
#include "ppapi/c/trusted/ppb_broker_trusted.h"
@@ -90,7 +94,6 @@
#include "ppapi/proxy/ppb_buffer_proxy.h"
#include "ppapi/proxy/ppb_core_proxy.h"
#include "ppapi/proxy/ppb_file_ref_proxy.h"
-#include "ppapi/proxy/ppb_file_system_proxy.h"
#include "ppapi/proxy/ppb_flash_message_loop_proxy.h"
#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
#include "ppapi/proxy/ppb_image_data_proxy.h"
diff --git a/ppapi/proxy/locking_resource_releaser.h b/ppapi/proxy/locking_resource_releaser.h
new file mode 100644
index 0000000..d390ac4
--- /dev/null
+++ b/ppapi/proxy/locking_resource_releaser.h
@@ -0,0 +1,41 @@
+// 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_LOCKING_RESOURCE_RELEASER_H_
+#define PPAPI_PROXY_LOCKING_RESOURCE_RELEASER_H_
+
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+
+namespace ppapi {
+namespace proxy {
+
+// LockingResourceReleaser is a simple RAII class for releasing a resource at
+// the end of scope. This acquires the ProxyLock before releasing the resource.
+// It is for use in unit tests. Most proxy or implementation code should use
+// ScopedPPResource instead. Unit tests sometimes can't use ScopedPPResource
+// because it asserts that the ProxyLock is already held.
+class LockingResourceReleaser {
+ public:
+ explicit LockingResourceReleaser(PP_Resource resource)
+ : resource_(resource) {
+ }
+ ~LockingResourceReleaser() {
+ ProxyAutoLock lock;
+ PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(resource_);
+ }
+
+ PP_Resource get() { return resource_; }
+
+ private:
+ PP_Resource resource_;
+
+ DISALLOW_COPY_AND_ASSIGN(LockingResourceReleaser);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_LOCKING_RESOURCE_RELEASER_H_
diff --git a/ppapi/proxy/pdf_resource.cc b/ppapi/proxy/pdf_resource.cc
new file mode 100644
index 0000000..a5b5d8c
--- /dev/null
+++ b/ppapi/proxy/pdf_resource.cc
@@ -0,0 +1,204 @@
+// 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/pdf_resource.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "base/command_line.h"
+#include "base/metrics/histogram.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppb_image_data_proxy.h"
+#include "ppapi/shared_impl/var.h"
+#include "third_party/icu/public/i18n/unicode/usearch.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+// TODO(raymes): This is just copied from render_thread_impl.cc. We should have
+// generic code somewhere to get the locale in the plugin.
+std::string GetLocale() {
+ // The browser process should have passed the locale to the plugin via the
+ // --lang command line flag.
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
+ const std::string& lang = parsed_command_line.GetSwitchValueASCII("lang");
+ DCHECK(!lang.empty());
+ return lang;
+}
+
+} // namespace
+
+PDFResource::PDFResource(Connection connection, PP_Instance instance)
+ : PluginResource(connection, instance) {
+ SendCreate(RENDERER, PpapiHostMsg_PDF_Create());
+}
+
+PDFResource::~PDFResource() {
+}
+
+thunk::PPB_PDF_API* PDFResource::AsPPB_PDF_API() {
+ return this;
+}
+
+PP_Var PDFResource::GetLocalizedString(PP_ResourceString string_id) {
+ std::string localized_string;
+ int32_t result = SyncCall<PpapiPluginMsg_PDF_GetLocalizedStringReply>(
+ RENDERER, PpapiHostMsg_PDF_GetLocalizedString(string_id),
+ &localized_string);
+ if (result != PP_OK)
+ return PP_MakeUndefined();
+ return ppapi::StringVar::StringToPPVar(localized_string);
+}
+
+void PDFResource::SearchString(const unsigned short* input_string,
+ const unsigned short* input_term,
+ bool case_sensitive,
+ PP_PrivateFindResult** results, int* count) {
+ if (locale_.empty())
+ locale_ = GetLocale();
+ const char16* string = reinterpret_cast<const char16*>(input_string);
+ const char16* term = reinterpret_cast<const char16*>(input_term);
+
+ UErrorCode status = U_ZERO_ERROR;
+ UStringSearch* searcher = usearch_open(term, -1, string, -1, locale_.c_str(),
+ 0, &status);
+ DCHECK(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING ||
+ status == U_USING_DEFAULT_WARNING);
+ UCollationStrength strength = case_sensitive ? UCOL_TERTIARY : UCOL_PRIMARY;
+
+ UCollator* collator = usearch_getCollator(searcher);
+ if (ucol_getStrength(collator) != strength) {
+ ucol_setStrength(collator, strength);
+ usearch_reset(searcher);
+ }
+
+ status = U_ZERO_ERROR;
+ int match_start = usearch_first(searcher, &status);
+ DCHECK(status == U_ZERO_ERROR);
+
+ std::vector<PP_PrivateFindResult> pp_results;
+ while (match_start != USEARCH_DONE) {
+ size_t matched_length = usearch_getMatchedLength(searcher);
+ PP_PrivateFindResult result;
+ result.start_index = match_start;
+ result.length = matched_length;
+ pp_results.push_back(result);
+ match_start = usearch_next(searcher, &status);
+ DCHECK(status == U_ZERO_ERROR);
+ }
+
+ *count = pp_results.size();
+ if (*count) {
+ *results = reinterpret_cast<PP_PrivateFindResult*>(malloc(
+ *count * sizeof(PP_PrivateFindResult)));
+ memcpy(*results, &pp_results[0], *count * sizeof(PP_PrivateFindResult));
+ } else {
+ *results = NULL;
+ }
+
+ usearch_close(searcher);
+}
+
+void PDFResource::DidStartLoading() {
+ Post(RENDERER, PpapiHostMsg_PDF_DidStartLoading());
+}
+
+void PDFResource::DidStopLoading() {
+ Post(RENDERER, PpapiHostMsg_PDF_DidStopLoading());
+}
+
+void PDFResource::SetContentRestriction(int restrictions) {
+ Post(RENDERER, PpapiHostMsg_PDF_SetContentRestriction(restrictions));
+}
+
+void PDFResource::HistogramPDFPageCount(int count) {
+ UMA_HISTOGRAM_COUNTS_10000("PDF.PageCount", count);
+}
+
+void PDFResource::UserMetricsRecordAction(const PP_Var& action) {
+ scoped_refptr<ppapi::StringVar> action_str(
+ ppapi::StringVar::FromPPVar(action));
+ if (action_str) {
+ Post(RENDERER,
+ PpapiHostMsg_PDF_UserMetricsRecordAction(action_str->value()));
+ }
+}
+
+void PDFResource::HasUnsupportedFeature() {
+ Post(RENDERER, PpapiHostMsg_PDF_HasUnsupportedFeature());
+}
+
+void PDFResource::Print() {
+ Post(RENDERER, PpapiHostMsg_PDF_Print());
+}
+
+void PDFResource::SaveAs() {
+ Post(RENDERER, PpapiHostMsg_PDF_SaveAs());
+}
+
+PP_Bool PDFResource::IsFeatureEnabled(PP_PDFFeature feature) {
+ PP_Bool result = PP_FALSE;
+ switch (feature) {
+ case PP_PDFFEATURE_HIDPI:
+ result = PP_TRUE;
+ break;
+ case PP_PDFFEATURE_PRINTING:
+ // TODO(raymes): Use PrintWebViewHelper::IsPrintingEnabled.
+ result = PP_FALSE;
+ break;
+ }
+ return result;
+}
+
+PP_Resource PDFResource::GetResourceImageForScale(PP_ResourceImage image_id,
+ float scale) {
+ IPC::Message reply;
+ ResourceMessageReplyParams reply_params;
+ int32_t result = GenericSyncCall(
+ RENDERER, PpapiHostMsg_PDF_GetResourceImage(image_id, scale), &reply,
+ &reply_params);
+ if (result != PP_OK)
+ return 0;
+
+ HostResource resource;
+ std::string image_data_desc;
+ int fd;
+ if (!UnpackMessage<PpapiPluginMsg_PDF_GetResourceImageReply>(
+ reply, &resource, &image_data_desc, &fd)) {
+ return 0;
+ }
+
+ if (resource.is_null() || image_data_desc.size() != sizeof(PP_ImageDataDesc))
+ return 0;
+
+ // We serialize the PP_ImageDataDesc just by copying to a string.
+ PP_ImageDataDesc desc;
+ memcpy(&desc, image_data_desc.data(), sizeof(PP_ImageDataDesc));
+
+#if defined(OS_ANDROID)
+ // This is compiled into android for tests only.
+ return 0;
+#elif defined(OS_WIN) || defined(OS_MACOSX)
+ base::SharedMemoryHandle handle;
+ if (!reply_params.TakeSharedMemoryHandleAtIndex(0, &handle))
+ return 0;
+ return (new ImageData(resource, desc, handle))->GetReference();
+#elif defined(OS_LINUX)
+ return (new ImageData(resource, desc, fd))->GetReference();
+#else
+#error Not implemented.
+#endif
+}
+
+PP_Resource PDFResource::GetResourceImage(PP_ResourceImage image_id) {
+ return GetResourceImageForScale(image_id, 1.0f);
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/pdf_resource.h b/ppapi/proxy/pdf_resource.h
new file mode 100644
index 0000000..704e1d4
--- /dev/null
+++ b/ppapi/proxy/pdf_resource.h
@@ -0,0 +1,67 @@
+// 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_PDF_RESOURCE_H_
+#define PPAPI_PROXY_PDF_RESOURCE_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/c/private/ppb_flash.h"
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/thunk/ppb_pdf_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class PluginDispatcher;
+
+class PPAPI_PROXY_EXPORT PDFResource
+ : public PluginResource,
+ public thunk::PPB_PDF_API {
+ public:
+ PDFResource(Connection connection, PP_Instance instance);
+ virtual ~PDFResource();
+
+ // For unittesting with a given locale.
+ void SetLocaleForTest(const std::string& locale) {
+ locale_ = locale;
+ }
+
+ // Resource override.
+ virtual thunk::PPB_PDF_API* AsPPB_PDF_API() OVERRIDE;
+
+ // PPB_PDF_API implementation.
+ PP_Var GetLocalizedString(PP_ResourceString string_id) OVERRIDE;
+ virtual void SearchString(const unsigned short* input_string,
+ const unsigned short* input_term,
+ bool case_sensitive,
+ PP_PrivateFindResult** results,
+ int* count) OVERRIDE;
+ virtual void DidStartLoading() OVERRIDE;
+ virtual void DidStopLoading() OVERRIDE;
+ virtual void SetContentRestriction(int restrictions) OVERRIDE;
+ virtual void HistogramPDFPageCount(int count) OVERRIDE;
+ virtual void UserMetricsRecordAction(const PP_Var& action) OVERRIDE;
+ virtual void HasUnsupportedFeature() OVERRIDE;
+ virtual void Print() OVERRIDE;
+ virtual void SaveAs() OVERRIDE;
+ virtual PP_Bool IsFeatureEnabled(PP_PDFFeature feature) OVERRIDE;
+ virtual PP_Resource GetResourceImageForScale(PP_ResourceImage image_id,
+ float scale) OVERRIDE;
+ virtual PP_Resource GetResourceImage(PP_ResourceImage image_id) OVERRIDE;
+
+ private:
+ std::string locale_;
+
+ DISALLOW_COPY_AND_ASSIGN(PDFResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_PDF_RESOURCE_H_
diff --git a/ppapi/proxy/pdf_resource_unittest.cc b/ppapi/proxy/pdf_resource_unittest.cc
new file mode 100644
index 0000000..fa79f00
--- /dev/null
+++ b/ppapi/proxy/pdf_resource_unittest.cc
@@ -0,0 +1,210 @@
+// 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.
+
+#include <cstring>
+
+#include "base/utf_string_conversions.h"
+#include "ppapi/c/dev/ppb_memory_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_image_data.h"
+#include "ppapi/proxy/pdf_resource.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppapi_proxy_test.h"
+#include "ppapi/proxy/ppb_image_data_proxy.h"
+#include "ppapi/proxy/serialized_handle.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+typedef PluginProxyTest PDFResourceTest;
+
+} // namespace
+
+TEST_F(PDFResourceTest, GetLocalizedString) {
+ const PPB_PDF* pdf_iface = thunk::GetPPB_PDF_Thunk();
+
+ std::string expected_string = "hello";
+ PpapiPluginMsg_PDF_GetLocalizedStringReply reply_msg(expected_string);
+ ResourceSyncCallHandler handler(
+ &sink(),
+ PpapiHostMsg_PDF_GetLocalizedString::ID,
+ PP_OK,
+ reply_msg);
+ sink().AddFilter(&handler);
+
+ PP_Var var = pdf_iface->GetLocalizedString(
+ pp_instance(), PP_RESOURCESTRING_PDFGETPASSWORD);
+
+ {
+ ProxyAutoLock lock;
+ ScopedPPVar release_var(ScopedPPVar::PassRef(), var);
+ StringVar* string_var = StringVar::FromPPVar(var);
+ ASSERT_TRUE(string_var != NULL);
+ std::string actual_string = string_var->value();
+
+ ASSERT_EQ(PpapiHostMsg_PDF_GetLocalizedString::ID,
+ handler.last_handled_msg().type());
+ ASSERT_EQ(expected_string, actual_string);
+ }
+
+ // Remove the filter or it will be destroyed before the sink() is destroyed.
+ sink().RemoveFilter(&handler);
+}
+
+TEST_F(PDFResourceTest, SearchString) {
+ ProxyAutoLock lock;
+ // Instantiate a resource explicitly so we can specify the locale.
+ scoped_refptr<PDFResource> pdf_resource(
+ new PDFResource(Connection(&sink(), &sink()), pp_instance()));
+ pdf_resource->SetLocaleForTest("en-US");
+
+ string16 input;
+ string16 term;
+ UTF8ToUTF16("abcdefabcdef", 12, &input);
+ UTF8ToUTF16("bc", 2, &term);
+
+ PP_PrivateFindResult* results;
+ int count = 0;
+ pdf_resource->SearchString(
+ reinterpret_cast<const unsigned short*>(input.c_str()),
+ reinterpret_cast<const unsigned short*>(term.c_str()),
+ true,
+ &results,
+ &count);
+
+ ASSERT_EQ(2, count);
+ ASSERT_EQ(1, results[0].start_index);
+ ASSERT_EQ(2, results[0].length);
+ ASSERT_EQ(7, results[1].start_index);
+ ASSERT_EQ(2, results[1].length);
+
+ const PPB_Memory_Dev* memory_iface = thunk::GetPPB_Memory_Dev_0_1_Thunk();
+ memory_iface->MemFree(results);
+}
+
+TEST_F(PDFResourceTest, DidStartLoading) {
+ const PPB_PDF* pdf_iface = thunk::GetPPB_PDF_Thunk();
+
+ pdf_iface->DidStartLoading(pp_instance());
+
+ ResourceMessageCallParams params;
+ IPC::Message msg;
+ ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+ PpapiHostMsg_PDF_DidStartLoading::ID, ¶ms, &msg));
+}
+
+TEST_F(PDFResourceTest, DidStopLoading) {
+ const PPB_PDF* pdf_iface = thunk::GetPPB_PDF_Thunk();
+
+ pdf_iface->DidStopLoading(pp_instance());
+
+ ResourceMessageCallParams params;
+ IPC::Message msg;
+ ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+ PpapiHostMsg_PDF_DidStopLoading::ID, ¶ms, &msg));
+}
+
+TEST_F(PDFResourceTest, SetContentRestriction) {
+ const PPB_PDF* pdf_iface = thunk::GetPPB_PDF_Thunk();
+
+ int restrictions = 5;
+ pdf_iface->SetContentRestriction(pp_instance(), restrictions);
+
+ ResourceMessageCallParams params;
+ IPC::Message msg;
+ ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+ PpapiHostMsg_PDF_SetContentRestriction::ID, ¶ms, &msg));
+}
+
+TEST_F(PDFResourceTest, HasUnsupportedFeature) {
+ const PPB_PDF* pdf_iface = thunk::GetPPB_PDF_Thunk();
+
+ pdf_iface->HasUnsupportedFeature(pp_instance());
+
+ ResourceMessageCallParams params;
+ IPC::Message msg;
+ ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+ PpapiHostMsg_PDF_HasUnsupportedFeature::ID, ¶ms, &msg));
+}
+
+TEST_F(PDFResourceTest, Print) {
+ const PPB_PDF* pdf_iface = thunk::GetPPB_PDF_Thunk();
+
+ pdf_iface->Print(pp_instance());
+
+ ResourceMessageCallParams params;
+ IPC::Message msg;
+ ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+ PpapiHostMsg_PDF_Print::ID, ¶ms, &msg));
+}
+
+TEST_F(PDFResourceTest, SaveAs) {
+ const PPB_PDF* pdf_iface = thunk::GetPPB_PDF_Thunk();
+
+ pdf_iface->SaveAs(pp_instance());
+
+ ResourceMessageCallParams params;
+ IPC::Message msg;
+ ASSERT_TRUE(sink().GetFirstResourceCallMatching(
+ PpapiHostMsg_PDF_SaveAs::ID, ¶ms, &msg));
+}
+
+TEST_F(PDFResourceTest, GetResourceImageForScale) {
+ const PPB_PDF* pdf_iface = thunk::GetPPB_PDF_Thunk();
+
+ HostResource expected_resource;
+ expected_resource.SetHostResource(pp_instance(), 5);
+ PP_ImageDataDesc expected_desc = {
+ PP_IMAGEDATAFORMAT_BGRA_PREMUL,
+ { 5, 10 },
+ 20,
+ };
+ std::string image_data_desc;
+ image_data_desc.resize(sizeof(PP_ImageDataDesc));
+ memcpy(&image_data_desc[0], &expected_desc, sizeof(PP_ImageDataDesc));
+ SerializedHandle serialized_handle(SerializedHandle::SHARED_MEMORY);
+ PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(expected_resource,
+ image_data_desc,
+ 0);
+ ResourceSyncCallHandler handler(
+ &sink(),
+ PpapiHostMsg_PDF_GetResourceImage::ID,
+ PP_OK,
+ reply_msg);
+ handler.set_serialized_handle(&serialized_handle);
+ sink().AddFilter(&handler);
+
+ PP_Resource resource = pdf_iface->GetResourceImageForScale(pp_instance(),
+ PP_RESOURCEIMAGE_PDF_BUTTON_FTP, 1.0f);
+ {
+ ProxyAutoLock lock;
+ PluginResourceTracker* resource_tracker =
+ static_cast<PluginResourceTracker*>(
+ PluginGlobals::Get()->GetResourceTracker());
+ Resource* resource_object = resource_tracker->GetResource(resource);
+ ImageData* image_data_object = static_cast<ImageData*>(resource_object);
+ PP_ImageDataDesc actual_desc = image_data_object->desc();
+ ASSERT_EQ(expected_desc.format, actual_desc.format);
+ ASSERT_EQ(expected_desc.size.width, actual_desc.size.width);
+ ASSERT_EQ(expected_desc.size.height, actual_desc.size.height);
+ ASSERT_EQ(expected_desc.stride, actual_desc.stride);
+
+ ASSERT_EQ(resource_tracker->PluginResourceForHostResource(
+ expected_resource), resource);
+
+ resource_tracker->ReleaseResource(resource);
+ }
+
+ // Remove the filter or it will be destroyed before the sink() is destroyed.
+ sink().RemoveFilter(&handler);
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index 812b2e9..d479ec7 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -7,11 +7,12 @@
#include <map>
#include "base/compiler_specific.h"
+#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_sync_channel.h"
-#include "base/debug/trace_event.h"
+#include "ipc/ipc_sync_message_filter.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/proxy/flash_resource.h"
@@ -20,6 +21,7 @@
#include "ppapi/proxy/gamepad_resource.h"
#include "ppapi/proxy/interface_list.h"
#include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/plugin_var_serialization_rules.h"
@@ -77,6 +79,8 @@
}
PluginDispatcher::~PluginDispatcher() {
+ PluginGlobals::Get()->plugin_var_tracker()->DidDeleteDispatcher(this);
+
if (plugin_delegate_)
plugin_delegate_->Unregister(plugin_dispatcher_id_);
@@ -164,6 +168,9 @@
plugin_delegate_ = delegate;
plugin_dispatcher_id_ = plugin_delegate_->Register(this);
+ sync_filter_ = new IPC::SyncMessageFilter(delegate->GetShutdownEvent());
+ channel()->AddFilter(sync_filter_.get());
+
// The message filter will intercept and process certain messages directly
// on the I/O thread.
channel()->AddFilter(
@@ -175,6 +182,15 @@
return true;
}
+bool PluginDispatcher::SendMessage(IPC::Message* msg) {
+ // Currently we need to choose between two different mechanisms for sending.
+ // On the main thread we use the regular dispatch Send() method, on another
+ // thread we use SyncMessageFilter.
+ if (PpapiGlobals::Get()->GetMainThreadMessageLoop()->BelongsToCurrentThread())
+ return Dispatcher::Send(msg);
+ return sync_filter_->Send(msg);
+}
+
bool PluginDispatcher::Send(IPC::Message* msg) {
TRACE_EVENT2("ppapi proxy", "PluginDispatcher::Send",
"Class", IPC_MESSAGE_ID_CLASS(msg->type()),
@@ -194,13 +210,9 @@
if (msg->is_sync()) {
// Synchronous messages might be re-entrant, so we need to drop the lock.
ProxyAutoUnlock unlock;
-
- // TODO(yzshen): Make sending message thread-safe. It may be accessed from
- // non-main threads. Moreover, since the proxy lock has been released, it
- // may be accessed by multiple threads at the same time.
- return Dispatcher::Send(msg);
+ return SendMessage(msg);
}
- return Dispatcher::Send(msg);
+ return SendMessage(msg);
}
bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) {
diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h
index 1c213b6..7d6c719 100644
--- a/ppapi/proxy/plugin_dispatcher.h
+++ b/ppapi/proxy/plugin_dispatcher.h
@@ -14,6 +14,7 @@
#include "base/memory/weak_ptr.h"
#include "base/process.h"
#include "build/build_config.h"
+#include "ipc/ipc_sync_channel.h"
#include "ppapi/c/pp_rect.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/ppb_console.h"
@@ -23,6 +24,10 @@
#include "ppapi/shared_impl/singleton_resource_id.h"
#include "ppapi/shared_impl/tracked_callback.h"
+namespace IPC {
+class SyncMessageFilter;
+}
+
namespace ppapi {
struct Preferences;
@@ -184,6 +189,8 @@
const ppapi::proxy::ResourceMessageReplyParams& reply_params,
const IPC::Message& nested_msg);
+ virtual bool SendMessage(IPC::Message* msg);
+
PluginDelegate* plugin_delegate_;
// Contains all the plugin interfaces we've queried. The mapped value will
@@ -207,6 +214,9 @@
// incognito mode.
bool incognito_;
+ // A filter for sending messages from threads other than the main thread.
+ scoped_refptr<IPC::SyncMessageFilter> sync_filter_;
+
DISALLOW_COPY_AND_ASSIGN(PluginDispatcher);
};
diff --git a/ppapi/proxy/plugin_globals.cc b/ppapi/proxy/plugin_globals.cc
index 2e18ac5..3083832 100644
--- a/ppapi/proxy/plugin_globals.cc
+++ b/ppapi/proxy/plugin_globals.cc
@@ -49,40 +49,36 @@
PluginGlobals::PluginGlobals()
: ppapi::PpapiGlobals(),
plugin_proxy_delegate_(NULL),
- callback_tracker_(new CallbackTracker),
- loop_for_main_thread_(
- new MessageLoopResource(MessageLoopResource::ForMainThread())) {
-#if defined(ENABLE_PEPPER_THREADING)
- enable_threading_ = true;
-#else
- enable_threading_ = false;
-#endif
-
+ callback_tracker_(new CallbackTracker) {
DCHECK(!plugin_globals_);
plugin_globals_ = this;
+
+ // ResourceTracker asserts that we have the lock when we add new resources,
+ // so we lock when creating the MessageLoopResource even though there is no
+ // chance of race conditions.
+ ProxyAutoLock lock;
+ loop_for_main_thread_ =
+ new MessageLoopResource(MessageLoopResource::ForMainThread());
}
PluginGlobals::PluginGlobals(PerThreadForTest per_thread_for_test)
: ppapi::PpapiGlobals(per_thread_for_test),
plugin_proxy_delegate_(NULL),
callback_tracker_(new CallbackTracker) {
-#if defined(ENABLE_PEPPER_THREADING)
- enable_threading_ = true;
-#else
- enable_threading_ = false;
-#endif
DCHECK(!plugin_globals_);
}
PluginGlobals::~PluginGlobals() {
DCHECK(plugin_globals_ == this || !plugin_globals_);
- // Release the main-thread message loop. We should have the last reference
- // count, so this will delete the MessageLoop resource. We do this before
- // we clear plugin_globals_, because the Resource destructor tries to access
- // this PluginGlobals.
- DCHECK(!loop_for_main_thread_ || loop_for_main_thread_->HasOneRef());
- loop_for_main_thread_ = NULL;
-
+ {
+ ProxyAutoLock lock;
+ // Release the main-thread message loop. We should have the last reference
+ // count, so this will delete the MessageLoop resource. We do this before
+ // we clear plugin_globals_, because the Resource destructor tries to access
+ // this PluginGlobals.
+ DCHECK(!loop_for_main_thread_ || loop_for_main_thread_->HasOneRef());
+ loop_for_main_thread_ = NULL;
+ }
plugin_globals_ = NULL;
}
@@ -131,9 +127,7 @@
}
base::Lock* PluginGlobals::GetProxyLock() {
- if (enable_threading_)
- return &proxy_lock_;
- return NULL;
+ return &proxy_lock_;
}
void PluginGlobals::LogWithSource(PP_Instance instance,
diff --git a/ppapi/proxy/plugin_globals.h b/ppapi/proxy/plugin_globals.h
index 4da6d5f..37fdc1a 100644
--- a/ppapi/proxy/plugin_globals.h
+++ b/ppapi/proxy/plugin_globals.h
@@ -114,10 +114,6 @@
// The embedder should call this function when the command line is known.
void set_command_line(const std::string& c) { command_line_ = c; }
- // Sets whether threadsafety is supported. Defaults to whether the
- // ENABLE_PEPPER_THREADING build flag is set.
- void set_enable_threading(bool enable) { enable_threading_ = enable; }
-
private:
class BrowserSender;
@@ -131,7 +127,6 @@
PluginVarTracker plugin_var_tracker_;
scoped_refptr<CallbackTracker> callback_tracker_;
- bool enable_threading_; // Indicates whether we'll use the lock.
base::Lock proxy_lock_;
scoped_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_;
diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc
index 8733b9c..90d034c 100644
--- a/ppapi/proxy/plugin_main_nacl.cc
+++ b/ppapi/proxy/plugin_main_nacl.cc
@@ -11,6 +11,7 @@
// IPC_MESSAGE_MACROS_LOG_ENABLED so ppapi_messages.h will generate the
// ViewMsgLog et al. functions.
+#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
@@ -83,8 +84,7 @@
private:
void OnMsgCreateNaClChannel(int renderer_id,
- const ppapi::PpapiPermissions& permissions,
- bool incognito,
+ const ppapi::PpapiNaClChannelArgs& args,
SerializedHandle handle);
void OnMsgResourceReply(
const ppapi::proxy::ResourceMessageReplyParams& reply_params,
@@ -181,16 +181,32 @@
void PpapiDispatcher::OnMsgCreateNaClChannel(
int renderer_id,
- const ppapi::PpapiPermissions& permissions,
- bool incognito,
+ const ppapi::PpapiNaClChannelArgs& args,
SerializedHandle handle) {
+ static bool command_line_and_logging_initialized = false;
+ if (!command_line_and_logging_initialized) {
+ CommandLine::Init(0, NULL);
+ for (size_t i = 0; i < args.switch_names.size(); ++i) {
+ DCHECK(i < args.switch_values.size());
+ 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);
+ command_line_and_logging_initialized = true;
+ }
// Tell the process-global GetInterface which interfaces it can return to the
// plugin.
ppapi::proxy::InterfaceList::SetProcessGlobalPermissions(
- permissions);
+ args.permissions);
PluginDispatcher* dispatcher =
- new PluginDispatcher(::PPP_GetInterface, permissions, incognito);
+ new PluginDispatcher(::PPP_GetInterface, args.permissions,
+ args.off_the_record);
// The channel handle's true name is not revealed here.
IPC::ChannelHandle channel_handle("nacl", handle.descriptor());
if (!dispatcher->InitPluginWithChannel(this, base::kNullProcessId,
@@ -250,12 +266,12 @@
// Though it isn't referenced here, we must instantiate an AtExitManager.
base::AtExitManager exit_manager;
- MessageLoop loop;
+ base::MessageLoop loop;
IPC::Logging::set_log_function_map(&g_log_function_mapping);
ppapi::proxy::PluginGlobals plugin_globals;
base::Thread io_thread("Chrome_NaClIOThread");
base::Thread::Options options;
- options.message_loop_type = MessageLoop::TYPE_IO;
+ options.message_loop_type = base::MessageLoop::TYPE_IO;
io_thread.StartWithOptions(options);
// Start up the SRPC server on another thread. Otherwise, when it blocks
diff --git a/ppapi/proxy/plugin_resource.cc b/ppapi/proxy/plugin_resource.cc
index 3dd47ba..823e056 100644
--- a/ppapi/proxy/plugin_resource.cc
+++ b/ppapi/proxy/plugin_resource.cc
@@ -33,6 +33,9 @@
void PluginResource::OnReplyReceived(
const proxy::ResourceMessageReplyParams& params,
const IPC::Message& msg) {
+ TRACE_EVENT2("ppapi proxy", "PluginResource::OnReplyReceived",
+ "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(msg.type()));
// Grab the callback for the reply sequence number and run it with |msg|.
CallbackMap::iterator it = callbacks_.find(params.sequence());
if (it == callbacks_.end()) {
@@ -69,6 +72,9 @@
}
void PluginResource::SendCreate(Destination dest, const IPC::Message& msg) {
+ TRACE_EVENT2("ppapi proxy", "PluginResource::SendCreate",
+ "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(msg.type()));
if (dest == RENDERER) {
DCHECK(!sent_create_to_renderer_);
sent_create_to_renderer_ = true;
@@ -96,6 +102,9 @@
}
void PluginResource::Post(Destination dest, const IPC::Message& msg) {
+ TRACE_EVENT2("ppapi proxy", "PluginResource::Post",
+ "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(msg.type()));
ResourceMessageCallParams params(pp_resource(), GetNextSequence());
SendResourceCall(dest, params, msg);
}
@@ -113,6 +122,9 @@
const IPC::Message& msg,
IPC::Message* reply,
ResourceMessageReplyParams* reply_params) {
+ TRACE_EVENT2("ppapi proxy", "PluginResource::GenericSyncCall",
+ "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(msg.type()));
ResourceMessageCallParams params(pp_resource(), GetNextSequence());
params.set_has_callback();
bool success = GetSender(dest)->Send(new PpapiHostMsg_ResourceSyncCall(
diff --git a/ppapi/proxy/plugin_resource.h b/ppapi/proxy/plugin_resource.h
index 2e2e10f..1535278 100644
--- a/ppapi/proxy/plugin_resource.h
+++ b/ppapi/proxy/plugin_resource.h
@@ -164,6 +164,9 @@
int32_t PluginResource::Call(Destination dest,
const IPC::Message& msg,
const CallbackType& callback) {
+ TRACE_EVENT2("ppapi proxy", "PluginResource::Call",
+ "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
+ "Line", IPC_MESSAGE_ID_LINE(msg.type()));
ResourceMessageCallParams params(pp_resource(), next_sequence_number_++);
// Stash the |callback| in |callbacks_| identified by the sequence number of
// the call.
diff --git a/ppapi/proxy/plugin_resource_tracker.cc b/ppapi/proxy/plugin_resource_tracker.cc
index fb81857..12e9d3f 100644
--- a/ppapi/proxy/plugin_resource_tracker.cc
+++ b/ppapi/proxy/plugin_resource_tracker.cc
@@ -17,7 +17,7 @@
namespace ppapi {
namespace proxy {
-PluginResourceTracker::PluginResourceTracker() {
+PluginResourceTracker::PluginResourceTracker() : ResourceTracker(THREAD_SAFE) {
}
PluginResourceTracker::~PluginResourceTracker() {
diff --git a/ppapi/proxy/plugin_resource_tracker_unittest.cc b/ppapi/proxy/plugin_resource_tracker_unittest.cc
index 59b64db..9a60864 100644
--- a/ppapi/proxy/plugin_resource_tracker_unittest.cc
+++ b/ppapi/proxy/plugin_resource_tracker_unittest.cc
@@ -9,6 +9,7 @@
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
+#include "ppapi/shared_impl/proxy_lock.h"
namespace ppapi {
namespace proxy {
@@ -40,6 +41,8 @@
};
TEST_F(PluginResourceTrackerTest, PluginResourceForHostResource) {
+ ProxyAutoLock lock;
+
PP_Resource host_resource = 0x5678;
HostResource serialized;
diff --git a/ppapi/proxy/plugin_var_tracker.cc b/ppapi/proxy/plugin_var_tracker.cc
index cff8fa1..4561ac5 100644
--- a/ppapi/proxy/plugin_var_tracker.cc
+++ b/ppapi/proxy/plugin_var_tracker.cc
@@ -31,7 +31,7 @@
return host_object_id < other.host_object_id;
}
-PluginVarTracker::PluginVarTracker() {
+PluginVarTracker::PluginVarTracker() : VarTracker(THREAD_SAFE) {
}
PluginVarTracker::~PluginVarTracker() {
@@ -39,7 +39,7 @@
PP_Var PluginVarTracker::ReceiveObjectPassRef(const PP_Var& host_var,
PluginDispatcher* dispatcher) {
- DCHECK(CalledOnValidThread());
+ CheckThreadingPreconditions();
DCHECK(host_var.type == PP_VARTYPE_OBJECT);
// Get the object.
@@ -65,7 +65,7 @@
PP_Var PluginVarTracker::TrackObjectWithNoReference(
const PP_Var& host_var,
PluginDispatcher* dispatcher) {
- DCHECK(CalledOnValidThread());
+ CheckThreadingPreconditions();
DCHECK(host_var.type == PP_VARTYPE_OBJECT);
// Get the object.
@@ -83,7 +83,7 @@
void PluginVarTracker::StopTrackingObjectWithNoReference(
const PP_Var& plugin_var) {
- DCHECK(CalledOnValidThread());
+ CheckThreadingPreconditions();
DCHECK(plugin_var.type == PP_VARTYPE_OBJECT);
VarMap::iterator found = GetLiveVar(plugin_var);
@@ -98,8 +98,7 @@
}
PP_Var PluginVarTracker::GetHostObject(const PP_Var& plugin_object) const {
- DCHECK(CalledOnValidThread());
-
+ CheckThreadingPreconditions();
if (plugin_object.type != PP_VARTYPE_OBJECT) {
NOTREACHED();
return PP_MakeUndefined();
@@ -120,8 +119,7 @@
PluginDispatcher* PluginVarTracker::DispatcherForPluginObject(
const PP_Var& plugin_object) const {
- DCHECK(CalledOnValidThread());
-
+ CheckThreadingPreconditions();
if (plugin_object.type != PP_VARTYPE_OBJECT)
return NULL;
@@ -137,7 +135,7 @@
void PluginVarTracker::ReleaseHostObject(PluginDispatcher* dispatcher,
const PP_Var& host_object) {
- DCHECK(CalledOnValidThread());
+ CheckThreadingPreconditions();
DCHECK(host_object.type == PP_VARTYPE_OBJECT);
// Convert the host object to a normal var valid in the plugin.
@@ -190,6 +188,16 @@
}
}
+void PluginVarTracker::DidDeleteDispatcher(PluginDispatcher* dispatcher) {
+ for (size_t i = 0; i < live_vars_.size(); ++i) {
+ if (live_vars_[i].var.get() == NULL)
+ continue;
+ ProxyObjectVar* object = live_vars_[i].var->AsProxyObjectVar();
+ if (object && object->dispatcher() == dispatcher)
+ object->clear_dispatcher();
+ }
+}
+
ArrayBufferVar* PluginVarTracker::CreateArrayBuffer(uint32 size_in_bytes) {
return new PluginArrayBufferVar(size_in_bytes);
}
@@ -342,14 +350,18 @@
void PluginVarTracker::SendAddRefObjectMsg(
const ProxyObjectVar& proxy_object) {
int unused;
- proxy_object.dispatcher()->Send(new PpapiHostMsg_PPBVar_AddRefObject(
- API_ID_PPB_VAR_DEPRECATED, proxy_object.host_var_id(), &unused));
+ if (proxy_object.dispatcher()) {
+ proxy_object.dispatcher()->Send(new PpapiHostMsg_PPBVar_AddRefObject(
+ API_ID_PPB_VAR_DEPRECATED, proxy_object.host_var_id(), &unused));
+ }
}
void PluginVarTracker::SendReleaseObjectMsg(
const ProxyObjectVar& proxy_object) {
- proxy_object.dispatcher()->Send(new PpapiHostMsg_PPBVar_ReleaseObject(
- API_ID_PPB_VAR_DEPRECATED, proxy_object.host_var_id()));
+ if (proxy_object.dispatcher()) {
+ proxy_object.dispatcher()->Send(new PpapiHostMsg_PPBVar_ReleaseObject(
+ API_ID_PPB_VAR_DEPRECATED, proxy_object.host_var_id()));
+ }
}
scoped_refptr<ProxyObjectVar> PluginVarTracker::FindOrMakePluginVarFromHostVar(
diff --git a/ppapi/proxy/plugin_var_tracker.h b/ppapi/proxy/plugin_var_tracker.h
index a8b2293..ca8b978 100644
--- a/ppapi/proxy/plugin_var_tracker.h
+++ b/ppapi/proxy/plugin_var_tracker.h
@@ -59,7 +59,7 @@
const PP_Var& host_object);
// VarTracker public overrides.
- void DidDeleteInstance(PP_Instance instance) OVERRIDE;
+ virtual void DidDeleteInstance(PP_Instance instance) OVERRIDE;
virtual int TrackSharedMemoryHandle(PP_Instance instance,
base::SharedMemoryHandle file,
uint32 size_in_bytes) OVERRIDE;
@@ -87,6 +87,8 @@
bool ValidatePluginObjectCall(const PPP_Class_Deprecated* ppp_class,
void* user_data);
+ void DidDeleteDispatcher(PluginDispatcher* dispatcher);
+
private:
// VarTracker protected overrides.
virtual int32 AddVarInternal(Var* var, AddVarRefMode mode) OVERRIDE;
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 6ae94ab..76fe6ec 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -12,6 +12,7 @@
#include "base/shared_memory.h"
#include "base/string16.h"
#include "base/sync_socket.h"
+#include "base/values.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/ipc/gpu_command_buffer_traits.h"
#include "ipc/ipc_channel_handle.h"
@@ -20,7 +21,6 @@
#include "ipc/ipc_platform_file.h"
#include "ppapi/c/dev/pp_video_capture_dev.h"
#include "ppapi/c/dev/pp_video_dev.h"
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
#include "ppapi/c/dev/ppb_text_input_dev.h"
#include "ppapi/c/dev/ppb_truetype_font_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
@@ -40,6 +40,7 @@
#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"
@@ -53,6 +54,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/ppapi_nacl_channel_args.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "ppapi/shared_impl/ppb_device_ref_shared.h"
#include "ppapi/shared_impl/ppb_input_event_shared.h"
@@ -71,6 +73,7 @@
IPC_ENUM_TRAITS(PP_AudioSampleRate)
IPC_ENUM_TRAITS(PP_DeviceType_Dev)
IPC_ENUM_TRAITS(PP_DecryptorStreamType)
+IPC_ENUM_TRAITS(PP_FileSystemType)
IPC_ENUM_TRAITS(PP_FileType)
IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_Permission)
IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_SettingType)
@@ -84,6 +87,8 @@
IPC_ENUM_TRAITS(PP_PrintOutputFormat_Dev)
IPC_ENUM_TRAITS(PP_PrintScalingOption_Dev)
IPC_ENUM_TRAITS(PP_PrivateFontCharset)
+IPC_ENUM_TRAITS(PP_ResourceImage)
+IPC_ENUM_TRAITS(PP_ResourceString)
IPC_ENUM_TRAITS(PP_TextInput_Type)
IPC_ENUM_TRAITS(PP_TrueTypeFontFamily_Dev)
IPC_ENUM_TRAITS(PP_TrueTypeFontStyle_Dev)
@@ -291,6 +296,16 @@
IPC_STRUCT_TRAITS_MEMBER(mtu)
IPC_STRUCT_TRAITS_END()
+// Only whitelisted switches passed through NaClChannelArgs.
+// The list of switches can be found in:
+// chrome/browser/nacl_host/nacl_process_host.cc
+IPC_STRUCT_TRAITS_BEGIN(ppapi::PpapiNaClChannelArgs)
+ IPC_STRUCT_TRAITS_MEMBER(off_the_record)
+ IPC_STRUCT_TRAITS_MEMBER(permissions)
+ IPC_STRUCT_TRAITS_MEMBER(switch_names)
+ IPC_STRUCT_TRAITS_MEMBER(switch_values)
+IPC_STRUCT_TRAITS_END()
+
#if !defined(OS_NACL) && !defined(NACL_WIN64)
IPC_STRUCT_TRAITS_BEGIN(ppapi::proxy::PPPDecryptor_Buffer)
@@ -317,10 +332,9 @@
// Creates a channel to talk to a renderer. This message is only used by the
// NaCl IPC proxy. It is intercepted by NaClIPCAdapter, which creates the
// actual channel and rewrites the message for the untrusted side.
-IPC_MESSAGE_CONTROL4(PpapiMsg_CreateNaClChannel,
+IPC_MESSAGE_CONTROL3(PpapiMsg_CreateNaClChannel,
int /* renderer_id */,
- ppapi::PpapiPermissions /* permissions */,
- bool /* incognito */,
+ ppapi::PpapiNaClChannelArgs /* args */,
ppapi::proxy::SerializedHandle /* channel_handle */)
// Instructs the plugin process to crash.
@@ -449,7 +463,22 @@
IPC_MESSAGE_ROUTED3(
PpapiMsg_PPBFileRef_CallbackComplete,
ppapi::HostResource /* resource */,
- int /* callback_id */,
+ uint32_t /* callback_id */,
+ int32_t /* result */)
+
+IPC_MESSAGE_ROUTED4(
+ PpapiMsg_PPBFileRef_QueryCallbackComplete,
+ ppapi::HostResource /* resource */,
+ PP_FileInfo /* file_info */,
+ uint32_t /* callback_id */,
+ int32_t /* result */)
+
+IPC_MESSAGE_ROUTED5(
+ PpapiMsg_PPBFileRef_ReadDirectoryEntriesCallbackComplete,
+ ppapi::HostResource /* resource */,
+ std::vector<ppapi::PPB_FileRef_CreateInfo> /* files */,
+ std::vector<PP_FileType> /* file_types */,
+ uint32_t /* callback_id */,
int32_t /* result */)
// PPB_FileSystem.
@@ -782,8 +811,9 @@
ppapi::HostResource)
// PPB_FileRef.
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFileRef_Create,
- ppapi::HostResource /* file_system */,
+IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBFileRef_Create,
+ PP_Instance /* instance */,
+ PP_Resource /* file_system */,
std::string /* path */,
ppapi::PPB_FileRef_CreateInfo /* result */)
IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFileRef_GetParent,
@@ -792,31 +822,28 @@
IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileRef_MakeDirectory,
ppapi::HostResource /* file_ref */,
PP_Bool /* make_ancestors */,
- int /* callback_id */)
+ uint32_t /* callback_id */)
IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBFileRef_Touch,
ppapi::HostResource /* file_ref */,
PP_Time /* last_access */,
PP_Time /* last_modified */,
- int /* callback_id */)
+ uint32_t /* callback_id */)
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFileRef_Delete,
ppapi::HostResource /* file_ref */,
- int /* callback_id */)
+ uint32_t /* callback_id */)
IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileRef_Rename,
ppapi::HostResource /* file_ref */,
ppapi::HostResource /* new_file_ref */,
- int /* callback_id */)
+ uint32_t /* callback_id */)
+IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFileRef_Query,
+ ppapi::HostResource /* file_ref */,
+ uint32_t /* callback_id */)
IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFileRef_GetAbsolutePath,
ppapi::HostResource /* file_ref */,
ppapi::proxy::SerializedVar /* result */)
-
-// PPB_FileSystem.
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFileSystem_Create,
- PP_Instance /* instance */,
- int /* type */,
- ppapi::HostResource /* result */)
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFileSystem_Open,
- ppapi::HostResource /* result */,
- int64_t /* expected_size */)
+IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFileRef_ReadDirectoryEntries,
+ ppapi::HostResource /* file_ref */,
+ uint32_t /* callback_id */)
// PPB_Graphics3D.
IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics3D_Create,
@@ -1119,21 +1146,6 @@
IPC_MESSAGE_CONTROL1(PpapiHostMsg_PPBNetworkMonitor_Stop,
uint32 /* plugin_dispatcher_id */)
-#if !defined(OS_NACL) && !defined(NACL_WIN64)
-// PPB_PDF
-IPC_SYNC_MESSAGE_ROUTED3_1(
- PpapiHostMsg_PPBPDF_GetFontFileWithFallback,
- PP_Instance /* instance */,
- ppapi::proxy::SerializedFontDescription /* description */,
- int32_t /* charset */,
- ppapi::HostResource /* result */)
-IPC_SYNC_MESSAGE_ROUTED2_1(
- PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile,
- ppapi::HostResource /* font_file */,
- uint32_t /* table */,
- std::string /* result */)
-#endif // !defined(OS_NACL) && !defined(NACL_WIN64)
-
// PPB_Testing.
IPC_SYNC_MESSAGE_ROUTED3_1(
PpapiHostMsg_PPBTesting_ReadImageData,
@@ -1147,6 +1159,9 @@
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBTesting_SimulateInputEvent,
PP_Instance /* instance */,
ppapi::InputEventData /* input_event */)
+IPC_SYNC_MESSAGE_ROUTED1_0(
+ PpapiHostMsg_PPBTesting_SetMinimumArrayBufferSizeForShmem,
+ uint32_t /* threshold */)
#if !defined(OS_NACL) && !defined(NACL_WIN64)
@@ -1325,13 +1340,24 @@
// ResourceMessageReplyParams in the reply message.
IPC_MESSAGE_CONTROL0(PpapiHostMsg_Broker_IsAllowed)
-// Directory reader.
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_DirectoryReader_Create)
-IPC_MESSAGE_CONTROL1(PpapiHostMsg_DirectoryReader_GetEntries,
- ppapi::HostResource /* file_ref_resource */)
-IPC_MESSAGE_CONTROL2(PpapiPluginMsg_DirectoryReader_GetEntriesReply,
- std::vector<ppapi::PPB_FileRef_CreateInfo> /* files */,
- std::vector<PP_FileType> /* file_types */)
+// Extensions common -----------------------------------------------------------
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_ExtensionsCommon_Create)
+
+// Starts an extension API request which doesn't expect a response.
+// |request_name| is an API function name. |args| is a list of input arguments.
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_ExtensionsCommon_Post,
+ std::string /* request_name */,
+ base::ListValue /* args */)
+
+// Starts an extension API request which expects a response sent back using a
+// PpapiPluginMsg_ExtensionsCommon_CallReply message.
+// |request_name| is an API function name. |args| is a list of input arguments.
+// |output| is a list of output results.
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_ExtensionsCommon_Call,
+ std::string /* request_name */,
+ base::ListValue /* args */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_ExtensionsCommon_CallReply,
+ base::ListValue /* output */)
// File chooser.
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileChooser_Create)
@@ -1373,8 +1399,17 @@
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_GetOSFileDescriptor)
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FileIO_GetOSFileDescriptorReply,
int32_t /* file descriptor */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_RequestOSFileHandle)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileIO_RequestOSFileHandleReply)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileIO_GeneralReply)
+// FileSystem
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_Create,
+ PP_FileSystemType /* type */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_Open,
+ int64_t /* expected_size */)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileSystem_OpenReply)
+
// Flash device ID.
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDeviceID_Create)
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDeviceID_GetDeviceID)
@@ -1425,6 +1460,11 @@
IPC_MESSAGE_CONTROL0(PpapiHostMsg_TrueTypeFontSingleton_GetFontFamilies)
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_TrueTypeFontSingleton_GetFontFamiliesReply,
std::vector<std::string> /* font_families */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_TrueTypeFontSingleton_GetFontsInFamily,
+ std::string /* family */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_TrueTypeFontSingleton_GetFontsInFamilyReply,
+ std::vector<ppapi::proxy::SerializedTrueTypeFontDesc>
+ /* fonts */)
IPC_MESSAGE_CONTROL1(PpapiHostMsg_TrueTypeFont_Create,
ppapi::proxy::SerializedTrueTypeFontDesc /* desc */)
IPC_MESSAGE_CONTROL0(PpapiHostMsg_TrueTypeFont_Describe)
@@ -1714,6 +1754,57 @@
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashMenu_ShowReply,
int32_t /* selected_id */)
+// PDF ------------------------------------------------------------------------
+
+// Creates the PDF resource.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_PDF_Create)
+
+// Requests the localized string for the given ID.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_PDF_GetLocalizedString,
+ PP_ResourceString /* string_id */)
+// Reply for PpapiHostMsg_PDF_GetLocalizedString containing the localized
+// string.
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_PDF_GetLocalizedStringReply,
+ std::string /* localized_string*/)
+
+// Notifies the renderer that the PDF started loading.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_PDF_DidStartLoading)
+
+// Notifies the renderer that the PDF stopped loading.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_PDF_DidStopLoading)
+
+// Sets any restrictions on the PDF content.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_PDF_SetContentRestriction,
+ int /* restrictions */)
+
+// Requests that the specified action be recorded with UMA.
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_PDF_UserMetricsRecordAction,
+ std::string /* action */)
+
+// Notifies the renderer that the current PDF uses an unsupported feature.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_PDF_HasUnsupportedFeature)
+
+// Notifies the renderer to print the current PDF.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_PDF_Print)
+
+// Notifies the renderer to save the current PDF.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_PDF_SaveAs)
+
+// Requests a resource image for the plugin at a particular scale.
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_PDF_GetResourceImage,
+ PP_ResourceImage /* image_id */,
+ float /* scale */)
+// Reply for PpapiHostMsg_PDF_GetResourceImage containing the host resource id
+// of the image and a string (representing a PP_ImageDataDesc) containing the
+// properties of the image. Also carries a shared memory handle pointing to the
+// memory containg the image. On linux, the handle is transmitted in this
+// message as |fd|. This is due to the unfortunate way that ImageHandles are
+// defined for use with PPB_ImageData.
+IPC_MESSAGE_CONTROL3(PpapiPluginMsg_PDF_GetResourceImageReply,
+ ppapi::HostResource /* resource_id */,
+ std::string /* image_data_desc */,
+ int /* fd */)
+
// VideoCapture_Dev, plugin -> host
IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoCapture_Create)
IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoCapture_StartCapture)
@@ -1753,4 +1844,27 @@
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_VideoCapture_OnBufferReady,
uint32_t /* buffer */)
+// 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_CONTROL2(PpapiPluginMsg_VideoSource_GetFrameReply,
+ ppapi::HostResource /* image_data */,
+ 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 b654b22..40a421d 100644
--- a/ppapi/proxy/ppapi_param_traits.cc
+++ b/ppapi/proxy/ppapi_param_traits.cc
@@ -174,25 +174,6 @@
l->append(" bytes)>");
}
-// PP_ObjectProperty -----------------------------------------------------------
-
-// static
-void ParamTraits<PP_ObjectProperty>::Write(Message* m, const param_type& p) {
- // FIXME(brettw);
-}
-
-// static
-bool ParamTraits<PP_ObjectProperty>::Read(const Message* m,
- PickleIterator* iter,
- param_type* r) {
- // FIXME(brettw);
- return true;
-}
-
-// static
-void ParamTraits<PP_ObjectProperty>::Log(const param_type& p, std::string* l) {
-}
-
// PPB_FileRef_CreateInfo ------------------------------------------------------
// static
@@ -202,6 +183,7 @@
ParamTraits<int>::Write(m, p.file_system_type);
ParamTraits<std::string>::Write(m, p.path);
ParamTraits<std::string>::Write(m, p.name);
+ ParamTraits<PP_Resource>::Write(m, p.file_system_plugin_resource);
}
// static
@@ -212,7 +194,8 @@
ParamTraits<ppapi::HostResource>::Read(m, iter, &r->resource) &&
ParamTraits<int>::Read(m, iter, &r->file_system_type) &&
ParamTraits<std::string>::Read(m, iter, &r->path) &&
- ParamTraits<std::string>::Read(m, iter, &r->name);
+ ParamTraits<std::string>::Read(m, iter, &r->name) &&
+ ParamTraits<PP_Resource>::Read(m, iter, &r->file_system_plugin_resource);
}
// static
diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h
index 38ec6f3..196ef9e 100644
--- a/ppapi/proxy/ppapi_param_traits.h
+++ b/ppapi/proxy/ppapi_param_traits.h
@@ -19,7 +19,6 @@
#include "ppapi/shared_impl/ppb_file_ref_shared.h"
struct PP_FileInfo;
-struct PP_ObjectProperty;
struct PP_NetAddress_Private;
namespace ppapi {
@@ -68,14 +67,6 @@
};
template<>
-struct PPAPI_PROXY_EXPORT ParamTraits<PP_ObjectProperty> {
- typedef PP_ObjectProperty 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);
-};
-
-template<>
struct PPAPI_PROXY_EXPORT ParamTraits<
ppapi::proxy::PPBFlash_DrawGlyphs_Params> {
typedef ppapi::proxy::PPBFlash_DrawGlyphs_Params param_type;
diff --git a/ppapi/proxy/ppapi_proxy_test.cc b/ppapi/proxy/ppapi_proxy_test.cc
index 00947e3..19f41bb 100644
--- a/ppapi/proxy/ppapi_proxy_test.cc
+++ b/ppapi/proxy/ppapi_proxy_test.cc
@@ -171,6 +171,8 @@
void PluginProxyTestHarness::SetUpHarness() {
// These must be first since the dispatcher set-up uses them.
CreatePluginGlobals();
+ // Some of the methods called during set-up check that the lock is held.
+ ProxyAutoLock lock;
resource_tracker().DidCreateInstance(pp_instance());
@@ -196,6 +198,8 @@
bool is_client) {
// These must be first since the dispatcher set-up uses them.
CreatePluginGlobals();
+ // Some of the methods called during set-up check that the lock is held.
+ ProxyAutoLock lock;
resource_tracker().DidCreateInstance(pp_instance());
plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event);
@@ -214,10 +218,15 @@
}
void PluginProxyTestHarness::TearDownHarness() {
- plugin_dispatcher_->DidDestroyInstance(pp_instance());
- plugin_dispatcher_.reset();
+ {
+ // Some of the methods called during tear-down check that the lock is held.
+ ProxyAutoLock lock;
- resource_tracker().DidDeleteInstance(pp_instance());
+ plugin_dispatcher_->DidDestroyInstance(pp_instance());
+ plugin_dispatcher_.reset();
+
+ resource_tracker().DidDeleteInstance(pp_instance());
+ }
plugin_globals_.reset();
}
@@ -528,7 +537,7 @@
void TwoWayTest::SetUp() {
base::Thread::Options options;
- options.message_loop_type = MessageLoop::TYPE_IO;
+ options.message_loop_type = base::MessageLoop::TYPE_IO;
io_thread_.StartWithOptions(options);
plugin_thread_.Start();
diff --git a/ppapi/proxy/ppapi_proxy_test.h b/ppapi/proxy/ppapi_proxy_test.h
index 0882790..d4e54bf 100644
--- a/ppapi/proxy/ppapi_proxy_test.h
+++ b/ppapi/proxy/ppapi_proxy_test.h
@@ -177,7 +177,7 @@
virtual void SetUp();
virtual void TearDown();
private:
- MessageLoop message_loop_;
+ base::MessageLoop message_loop_;
};
// This class provides support for multi-thread testing. A secondary thread is
@@ -301,7 +301,7 @@
virtual void SetUp();
virtual void TearDown();
private:
- MessageLoop message_loop_;
+ base::MessageLoop message_loop_;
};
// Use this base class to test both sides of a proxy.
@@ -339,7 +339,7 @@
// The plugin side of the proxy runs on its own thread.
base::Thread plugin_thread_;
// The message loop for the main (host) thread.
- MessageLoop message_loop_;
+ base::MessageLoop message_loop_;
// Aliases for the host and plugin harnesses; if we're testing a PPP
// interface, remote_harness will point to plugin_, and local_harness
diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc
index 30d323f..22488cf 100644
--- a/ppapi/proxy/ppb_audio_proxy.cc
+++ b/ppapi/proxy/ppb_audio_proxy.cc
@@ -49,7 +49,7 @@
virtual PP_Resource GetCurrentConfig() OVERRIDE;
virtual PP_Bool StartPlayback() OVERRIDE;
virtual PP_Bool StopPlayback() OVERRIDE;
- virtual int32_t OpenTrusted(
+ virtual int32_t Open(
PP_Resource config_id,
scoped_refptr<TrackedCallback> create_callback) OVERRIDE;
virtual int32_t GetSyncSocket(int* sync_socket) OVERRIDE;
@@ -114,8 +114,8 @@
return PP_TRUE;
}
-int32_t Audio::OpenTrusted(PP_Resource config_id,
- scoped_refptr<TrackedCallback> create_callback) {
+int32_t Audio::Open(PP_Resource config_id,
+ scoped_refptr<TrackedCallback> create_callback) {
return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface.
}
@@ -129,7 +129,7 @@
PPB_Audio_Proxy::PPB_Audio_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ callback_factory_(this) {
}
PPB_Audio_Proxy::~PPB_Audio_Proxy() {
@@ -222,8 +222,8 @@
}
// Initiate opening the audio object.
- enter.SetResult(enter.object()->OpenTrusted(audio_config_res,
- enter.callback()));
+ enter.SetResult(enter.object()->Open(audio_config_res,
+ enter.callback()));
// Clean up the temporary audio config resource we made.
const PPB_Core* core = static_cast<const PPB_Core*>(
diff --git a/ppapi/proxy/ppb_broker_proxy.cc b/ppapi/proxy/ppb_broker_proxy.cc
index 4e19b66..19cd978 100644
--- a/ppapi/proxy/ppb_broker_proxy.cc
+++ b/ppapi/proxy/ppb_broker_proxy.cc
@@ -113,7 +113,7 @@
PPB_Broker_Proxy::PPB_Broker_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)){
+ callback_factory_(this){
}
PPB_Broker_Proxy::~PPB_Broker_Proxy() {
diff --git a/ppapi/proxy/ppb_file_ref_proxy.cc b/ppapi/proxy/ppb_file_ref_proxy.cc
index 49dac58..62c55da 100644
--- a/ppapi/proxy/ppb_file_ref_proxy.cc
+++ b/ppapi/proxy/ppb_file_ref_proxy.cc
@@ -7,6 +7,7 @@
#include <map>
#include "base/bind.h"
+#include "ppapi/c/pp_directory_entry.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/c/private/ppb_file_ref_private.h"
@@ -16,7 +17,9 @@
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/serialized_var.h"
+#include "ppapi/shared_impl/array_writer.h"
#include "ppapi/shared_impl/ppb_file_ref_shared.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
@@ -28,6 +31,17 @@
namespace ppapi {
namespace proxy {
+namespace {
+
+void ReleaseEntries(const std::vector<PP_DirectoryEntry>& entries) {
+ ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker();
+ for (std::vector<PP_DirectoryEntry>::const_iterator it = entries.begin();
+ it != entries.end(); ++it)
+ tracker->ReleaseResource(it->file_ref);
+}
+
+} // namespace
+
class FileRef : public PPB_FileRef_Shared {
public:
explicit FileRef(const PPB_FileRef_CreateInfo& info);
@@ -47,10 +61,27 @@
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 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;
virtual PP_Var GetAbsolutePath() OVERRIDE;
// Executes the pending callback with the given ID. See pending_callbacks_.
- void ExecuteCallback(int callback_id, int32_t result);
+ void ExecuteCallback(uint32_t callback_id, int32_t result);
+ int32_t SetFileInfo(uint32_t callback_id, const PP_FileInfo& info);
+ int32_t SetReadDirectoryEntriesOutput(
+ uint32_t callback_id,
+ const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos,
+ const std::vector<PP_FileType>& file_types);
private:
PluginDispatcher* GetDispatcher() const {
@@ -58,7 +89,7 @@
}
// Adds a callback to the list and returns its ID.
- int SendCallback(scoped_refptr<TrackedCallback> callback);
+ uint32_t SendCallback(scoped_refptr<TrackedCallback> callback);
// This class can have any number of out-standing requests with completion
// callbacks, in contrast to most resources which have one possible pending
@@ -67,27 +98,51 @@
// To keep track of them, assign integer IDs to the callbacks, which is how
// the callback will be identified when it's passed to the host and then
// back here. Use unsigned so that overflow is well-defined.
- unsigned int next_callback_id_;
- typedef std::map<unsigned int,
+ uint32_t next_callback_id_;
+ typedef std::map<uint32_t,
scoped_refptr<TrackedCallback> > PendingCallbackMap;
PendingCallbackMap pending_callbacks_;
+ // Used to keep pointers to PP_FileInfo instances that are written before
+ // callbacks are invoked. The id of a pending file info will match that of
+ // the corresponding callback.
+ typedef std::map<uint32_t, PP_FileInfo*> PendingFileInfoMap;
+ PendingFileInfoMap pending_file_infos_;
+
+ // Used to keep PP_ArrayOutput instances that are written before callbacks
+ // are invoked. The id of a pending array output will match that of the
+ // corresponding callback.
+ typedef std::map<uint32_t, PP_ArrayOutput>
+ PendingReadDirectoryEntriesOutputMap;
+ PendingReadDirectoryEntriesOutputMap pending_read_entries_outputs_;
+
+ // Holds a reference on plugin side when running out of process, so that
+ // FileSystem won't die before FileRef. See PPB_FileRef_Impl for
+ // corresponding code for in-process mode. Note that this workaround will
+ // be no longer needed after FileRef refactoring.
+ ScopedPPResource file_system_;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(FileRef);
};
FileRef::FileRef(const PPB_FileRef_CreateInfo& info)
: PPB_FileRef_Shared(OBJECT_IS_PROXY, info),
- next_callback_id_(0u) {
+ next_callback_id_(0u),
+ file_system_(info.file_system_plugin_resource) {
}
FileRef::~FileRef() {
// The callbacks map should have been cleared by LastPluginRefWasDeleted.
DCHECK(pending_callbacks_.empty());
+ DCHECK(pending_file_infos_.empty());
+ DCHECK(pending_read_entries_outputs_.empty());
}
void FileRef::LastPluginRefWasDeleted() {
// The callback tracker will abort our callbacks for us.
pending_callbacks_.clear();
+ pending_file_infos_.clear();
+ pending_read_entries_outputs_.clear();
}
PP_Resource FileRef::GetParent() {
@@ -134,6 +189,42 @@
return PP_OK_COMPLETIONPENDING;
}
+int32_t FileRef::Query(PP_FileInfo* info,
+ scoped_refptr<TrackedCallback> callback) {
+ // Store the pending file info id.
+ uint32_t id = SendCallback(callback);
+ pending_file_infos_[id] = info;
+ GetDispatcher()->Send(new PpapiHostMsg_PPBFileRef_Query(
+ API_ID_PPB_FILE_REF, host_resource(), id));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t FileRef::ReadDirectoryEntries(
+ const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) {
+ // Store the pending read entries output id.
+ uint32_t id = SendCallback(callback);
+ pending_read_entries_outputs_[id] = output;
+ GetDispatcher()->Send(new PpapiHostMsg_PPBFileRef_ReadDirectoryEntries(
+ API_ID_PPB_FILE_REF, host_resource(), id));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t FileRef::QueryInHost(
+ linked_ptr<PP_FileInfo> info,
+ scoped_refptr<TrackedCallback> callback) {
+ NOTREACHED();
+ return PP_ERROR_FAILED;
+}
+
+int32_t FileRef::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 FileRef::GetAbsolutePath() {
ReceiveSerializedVarReturnValue result;
GetDispatcher()->Send(new PpapiHostMsg_PPBFileRef_GetAbsolutePath(
@@ -141,7 +232,7 @@
return result.Return(GetDispatcher());
}
-void FileRef::ExecuteCallback(int callback_id, int32_t result) {
+void FileRef::ExecuteCallback(uint32_t callback_id, int32_t result) {
PendingCallbackMap::iterator found = pending_callbacks_.find(callback_id);
if (found == pending_callbacks_.end()) {
// This will happen when the plugin deletes its resource with a pending
@@ -156,7 +247,47 @@
callback->Run(result);
}
-int FileRef::SendCallback(scoped_refptr<TrackedCallback> callback) {
+int32_t FileRef::SetFileInfo(uint32_t callback_id, const PP_FileInfo& info) {
+ PendingFileInfoMap::iterator found = pending_file_infos_.find(callback_id);
+ if (found == pending_file_infos_.end())
+ return PP_ERROR_FAILED;
+ PP_FileInfo* target_info = found->second;
+ *target_info = info;
+ pending_file_infos_.erase(found);
+ return PP_OK;
+}
+
+int32_t FileRef::SetReadDirectoryEntriesOutput(
+ uint32_t callback_id,
+ const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos,
+ const std::vector<PP_FileType>& file_types) {
+ PendingReadDirectoryEntriesOutputMap::iterator found =
+ pending_read_entries_outputs_.find(callback_id);
+ if (found == pending_read_entries_outputs_.end())
+ return PP_ERROR_FAILED;
+
+ PP_ArrayOutput output = found->second;
+ pending_read_entries_outputs_.erase(found);
+
+ std::vector<PP_DirectoryEntry> entries;
+ for (size_t i = 0; i < infos.size(); ++i) {
+ PP_DirectoryEntry entry;
+ entry.file_ref = PPB_FileRef_Proxy::DeserializeFileRef(infos[i]);
+ entry.file_type = file_types[i];
+ entries.push_back(entry);
+ }
+
+ ArrayWriter writer(output);
+ if (!writer.is_valid()) {
+ ReleaseEntries(entries);
+ return PP_ERROR_BADARGUMENT;
+ }
+
+ writer.StoreVector(entries);
+ return PP_OK;
+}
+
+uint32_t FileRef::SendCallback(scoped_refptr<TrackedCallback> callback) {
// In extreme cases the IDs may wrap around, so avoid duplicates.
while (pending_callbacks_.count(next_callback_id_))
++next_callback_id_;
@@ -167,25 +298,20 @@
PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ callback_factory_(this) {
}
PPB_FileRef_Proxy::~PPB_FileRef_Proxy() {
}
// static
-PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system,
+PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Instance instance,
+ PP_Resource file_system,
const char* path) {
- Resource* file_system_object =
- PpapiGlobals::Get()->GetResourceTracker()->GetResource(file_system);
- if (!file_system_object)
- return 0;
-
PPB_FileRef_CreateInfo create_info;
- PluginDispatcher::GetForResource(file_system_object)->Send(
+ PluginDispatcher::GetForInstance(instance)->Send(
new PpapiHostMsg_PPBFileRef_Create(
- API_ID_PPB_FILE_REF, file_system_object->host_resource(),
- path, &create_info));
+ API_ID_PPB_FILE_REF, instance, file_system, path, &create_info));
return PPB_FileRef_Proxy::DeserializeFileRef(create_info);
}
@@ -200,12 +326,20 @@
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Touch, OnMsgTouch)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Delete, OnMsgDelete)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Rename, OnMsgRename)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Query, OnMsgQuery)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_ReadDirectoryEntries,
+ OnMsgReadDirectoryEntries)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_GetAbsolutePath,
OnMsgGetAbsolutePath)
#endif // !defined(OS_NACL)
IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileRef_CallbackComplete,
OnMsgCallbackComplete)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileRef_QueryCallbackComplete,
+ OnMsgQueryCallbackComplete)
+ IPC_MESSAGE_HANDLER(
+ PpapiMsg_PPBFileRef_ReadDirectoryEntriesCallbackComplete,
+ OnMsgReadDirectoryEntriesCallbackComplete)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -228,14 +362,16 @@
}
#if !defined(OS_NACL)
-void PPB_FileRef_Proxy::OnMsgCreate(const HostResource& file_system,
+void PPB_FileRef_Proxy::OnMsgCreate(PP_Instance pp_instance,
+ PP_Resource file_system,
const std::string& path,
PPB_FileRef_CreateInfo* result) {
- thunk::EnterResourceCreation enter(file_system.instance());
+ thunk::EnterResourceCreation enter(pp_instance);
if (enter.failed())
return;
+
PP_Resource resource = enter.functions()->CreateFileRef(
- file_system.host_resource(), path.c_str());
+ pp_instance, file_system, path.c_str());
if (!resource)
return; // CreateInfo default constructor initializes to 0.
SerializeFileRef(resource, result);
@@ -250,7 +386,7 @@
void PPB_FileRef_Proxy::OnMsgMakeDirectory(const HostResource& host_resource,
PP_Bool make_ancestors,
- int callback_id) {
+ uint32_t callback_id) {
EnterHostFromHostResourceForceCallback<PPB_FileRef_API> enter(
host_resource, callback_factory_,
&PPB_FileRef_Proxy::OnCallbackCompleteInHost, host_resource, callback_id);
@@ -263,7 +399,7 @@
void PPB_FileRef_Proxy::OnMsgTouch(const HostResource& host_resource,
PP_Time last_access,
PP_Time last_modified,
- int callback_id) {
+ uint32_t callback_id) {
EnterHostFromHostResourceForceCallback<PPB_FileRef_API> enter(
host_resource, callback_factory_,
&PPB_FileRef_Proxy::OnCallbackCompleteInHost, host_resource, callback_id);
@@ -274,7 +410,7 @@
}
void PPB_FileRef_Proxy::OnMsgDelete(const HostResource& host_resource,
- int callback_id) {
+ uint32_t callback_id) {
EnterHostFromHostResourceForceCallback<PPB_FileRef_API> enter(
host_resource, callback_factory_,
&PPB_FileRef_Proxy::OnCallbackCompleteInHost, host_resource, callback_id);
@@ -284,7 +420,7 @@
void PPB_FileRef_Proxy::OnMsgRename(const HostResource& file_ref,
const HostResource& new_file_ref,
- int callback_id) {
+ uint32_t callback_id) {
EnterHostFromHostResourceForceCallback<PPB_FileRef_API> enter(
file_ref, callback_factory_,
&PPB_FileRef_Proxy::OnCallbackCompleteInHost, file_ref, callback_id);
@@ -294,17 +430,46 @@
}
}
+void PPB_FileRef_Proxy::OnMsgQuery(const HostResource& file_ref,
+ uint32_t callback_id) {
+ linked_ptr<PP_FileInfo> info(new PP_FileInfo());
+ EnterHostFromHostResourceForceCallback<PPB_FileRef_API> enter(
+ file_ref, callback_factory_,
+ &PPB_FileRef_Proxy::OnQueryCallbackCompleteInHost, file_ref,
+ info, callback_id);
+ if (enter.succeeded())
+ enter.SetResult(enter.object()->QueryInHost(info, enter.callback()));
+}
+
void PPB_FileRef_Proxy::OnMsgGetAbsolutePath(const HostResource& host_resource,
SerializedVarReturnValue result) {
EnterHostFromHostResource<PPB_FileRef_API> enter(host_resource);
if (enter.succeeded())
result.Return(dispatcher(), enter.object()->GetAbsolutePath());
}
+
+void PPB_FileRef_Proxy::OnMsgReadDirectoryEntries(const HostResource& file_ref,
+ uint32_t callback_id) {
+ linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files(
+ new std::vector<ppapi::PPB_FileRef_CreateInfo>());
+ linked_ptr<std::vector<PP_FileType> > file_types(
+ new std::vector<PP_FileType>());
+ HostCallbackParams params(file_ref, callback_id);
+ EnterHostFromHostResourceForceCallback<PPB_FileRef_API> enter(
+ file_ref, callback_factory_,
+ &PPB_FileRef_Proxy::OnReadDirectoryEntriesCallbackCompleteInHost,
+ params, files, file_types);
+ if (enter.succeeded()) {
+ enter.SetResult(enter.object()->ReadDirectoryEntriesInHost(
+ files, file_types, enter.callback()));
+ }
+}
+
#endif // !defined(OS_NACL)
void PPB_FileRef_Proxy::OnMsgCallbackComplete(
const HostResource& host_resource,
- int callback_id,
+ uint32_t callback_id,
int32_t result) {
// Forward the callback info to the plugin resource.
EnterPluginFromHostResource<PPB_FileRef_API> enter(host_resource);
@@ -312,15 +477,72 @@
static_cast<FileRef*>(enter.object())->ExecuteCallback(callback_id, result);
}
+void PPB_FileRef_Proxy::OnMsgQueryCallbackComplete(
+ const HostResource& host_resource,
+ const PP_FileInfo& info,
+ uint32_t callback_id,
+ int32_t result) {
+ EnterPluginFromHostResource<PPB_FileRef_API> enter(host_resource);
+ if (!enter.succeeded())
+ return;
+
+ if (result == PP_OK) {
+ result = static_cast<FileRef*>(enter.object())->SetFileInfo(
+ callback_id, info);
+ }
+ static_cast<FileRef*>(enter.object())->ExecuteCallback(callback_id, result);
+}
+
+void PPB_FileRef_Proxy::OnMsgReadDirectoryEntriesCallbackComplete(
+ const HostResource& host_resource,
+ const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos,
+ const std::vector<PP_FileType>& file_types,
+ uint32_t callback_id,
+ int32_t result) {
+ CHECK_EQ(infos.size(), file_types.size());
+
+ EnterPluginFromHostResource<PPB_FileRef_API> enter(host_resource);
+ if (!enter.succeeded())
+ return;
+
+ if (result == PP_OK) {
+ result =
+ static_cast<FileRef*>(enter.object())->SetReadDirectoryEntriesOutput(
+ callback_id, infos, file_types);
+ }
+ static_cast<FileRef*>(enter.object())->ExecuteCallback(
+ callback_id, result);
+}
+
#if !defined(OS_NACL)
void PPB_FileRef_Proxy::OnCallbackCompleteInHost(
int32_t result,
const HostResource& host_resource,
- int callback_id) {
+ uint32_t callback_id) {
// Execute OnMsgCallbackComplete in the plugin process.
Send(new PpapiMsg_PPBFileRef_CallbackComplete(
API_ID_PPB_FILE_REF, host_resource, callback_id, result));
}
+
+void PPB_FileRef_Proxy::OnQueryCallbackCompleteInHost(
+ int32_t result,
+ const HostResource& host_resource,
+ linked_ptr<PP_FileInfo> info,
+ uint32_t callback_id) {
+ Send(new PpapiMsg_PPBFileRef_QueryCallbackComplete(
+ API_ID_PPB_FILE_REF, host_resource, *info, callback_id, result));
+}
+
+void PPB_FileRef_Proxy::OnReadDirectoryEntriesCallbackCompleteInHost(
+ int32_t result,
+ HostCallbackParams params,
+ linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files,
+ linked_ptr<std::vector<PP_FileType> > file_types) {
+ Send(new PpapiMsg_PPBFileRef_ReadDirectoryEntriesCallbackComplete(
+ API_ID_PPB_FILE_REF, params.host_resource,
+ *files, *file_types, params.callback_id, result));
+}
+
#endif // !defined(OS_NACL)
} // namespace proxy
diff --git a/ppapi/proxy/ppb_file_ref_proxy.h b/ppapi/proxy/ppb_file_ref_proxy.h
index e4a412e..cbfadb5 100644
--- a/ppapi/proxy/ppb_file_ref_proxy.h
+++ b/ppapi/proxy/ppb_file_ref_proxy.h
@@ -8,17 +8,19 @@
#include <string>
#include "base/basictypes.h"
+#include "base/memory/linked_ptr.h"
+#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_time.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/proxy/proxy_completion_callback_factory.h"
+#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/utility/completion_callback_factory.h"
namespace ppapi {
-class HostResource;
struct PPB_FileRef_CreateInfo;
namespace proxy {
@@ -31,7 +33,8 @@
explicit PPB_FileRef_Proxy(Dispatcher* dispatcher);
virtual ~PPB_FileRef_Proxy();
- static PP_Resource CreateProxyResource(PP_Resource file_system,
+ static PP_Resource CreateProxyResource(PP_Instance instance,
+ PP_Resource file_system,
const char* path);
static PP_Resource CreateProxyResource(
const PPB_FileRef_CreateInfo& serialized);
@@ -62,34 +65,67 @@
private:
// Plugin -> host message handlers.
- void OnMsgCreate(const HostResource& file_system,
+ void OnMsgCreate(PP_Instance instance,
+ PP_Resource file_system,
const std::string& path,
PPB_FileRef_CreateInfo* result);
void OnMsgGetParent(const HostResource& host_resource,
PPB_FileRef_CreateInfo* result);
void OnMsgMakeDirectory(const HostResource& host_resource,
PP_Bool make_ancestors,
- int callback_id);
+ uint32_t callback_id);
void OnMsgTouch(const HostResource& host_resource,
PP_Time last_access,
PP_Time last_modified,
- int callback_id);
+ uint32_t callback_id);
void OnMsgDelete(const HostResource& host_resource,
- int callback_id);
+ uint32_t callback_id);
void OnMsgRename(const HostResource& file_ref,
const HostResource& new_file_ref,
- int callback_id);
+ uint32_t callback_id);
+ void OnMsgQuery(const HostResource& file_ref,
+ uint32_t callback_id);
void OnMsgGetAbsolutePath(const HostResource& host_resource,
SerializedVarReturnValue result);
+ void OnMsgReadDirectoryEntries(const HostResource& file_ref,
+ uint32_t callback_id);
// Host -> Plugin message handlers.
void OnMsgCallbackComplete(const HostResource& host_resource,
- int callback_id,
+ uint32_t callback_id,
int32_t result);
+ void OnMsgQueryCallbackComplete(const HostResource& host_resource,
+ const PP_FileInfo& info,
+ uint32_t callback_id,
+ int32_t result);
+ void OnMsgReadDirectoryEntriesCallbackComplete(
+ const HostResource& host_resource,
+ const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos,
+ const std::vector<PP_FileType>& file_types,
+ uint32_t callback_id,
+ int32_t result);
+
+ struct HostCallbackParams {
+ HostCallbackParams(const HostResource& host_res, uint32_t cb_id)
+ : host_resource(host_res), callback_id(cb_id) {
+ }
+ HostResource host_resource;
+ uint32_t callback_id;
+ };
void OnCallbackCompleteInHost(int32_t result,
const HostResource& host_resource,
- int callback_id);
+ uint32_t callback_id);
+ void OnQueryCallbackCompleteInHost(
+ int32_t result,
+ const HostResource& host_resource,
+ linked_ptr<PP_FileInfo> info,
+ uint32_t callback_id);
+ void OnReadDirectoryEntriesCallbackCompleteInHost(
+ int32_t result,
+ HostCallbackParams params,
+ linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files,
+ linked_ptr<std::vector<PP_FileType> > file_types);
ProxyCompletionCallbackFactory<PPB_FileRef_Proxy> callback_factory_;
diff --git a/ppapi/proxy/ppb_file_system_proxy.cc b/ppapi/proxy/ppb_file_system_proxy.cc
deleted file mode 100644
index f0e67a4..0000000
--- a/ppapi/proxy/ppb_file_system_proxy.cc
+++ /dev/null
@@ -1,190 +0,0 @@
-// 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.
-
-#include "ppapi/proxy/ppb_file_system_proxy.h"
-
-#include "base/bind.h"
-#include "base/message_loop.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_file_system.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/host_dispatcher.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/serialized_var.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_file_system_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-#include "ppapi/thunk/thunk.h"
-
-using ppapi::thunk::PPB_FileSystem_API;
-using ppapi::thunk::ResourceCreationAPI;
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-InterfaceProxy* CreateFileSystemProxy(Dispatcher* dispatcher) {
- return new PPB_FileSystem_Proxy(dispatcher);
-}
-
-} // namespace
-
-// This object maintains most of the state of the ref in the plugin for fast
-// querying. It's all set in the constructor from the "create info" sent from
-// the host.
-class FileSystem : public Resource, public PPB_FileSystem_API {
- public:
- FileSystem(const HostResource& host_resource, PP_FileSystemType type);
- virtual ~FileSystem();
-
- // Resource override.
- virtual PPB_FileSystem_API* AsPPB_FileSystem_API() OVERRIDE;
-
- // PPB_FileSystem_APi implementation.
- virtual int32_t Open(int64_t expected_size,
- scoped_refptr<TrackedCallback> callback) OVERRIDE;
- virtual PP_FileSystemType GetType() OVERRIDE;
-
- // Called when the host has responded to our open request.
- void OpenComplete(int32_t result);
-
- private:
- PP_FileSystemType type_;
- bool called_open_;
- scoped_refptr<TrackedCallback> current_open_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(FileSystem);
-};
-
-FileSystem::FileSystem(const HostResource& host_resource,
- PP_FileSystemType type)
- : Resource(OBJECT_IS_PROXY, host_resource),
- type_(type),
- called_open_(false) {
-}
-
-FileSystem::~FileSystem() {
-}
-
-PPB_FileSystem_API* FileSystem::AsPPB_FileSystem_API() {
- return this;
-}
-
-int32_t FileSystem::Open(int64_t expected_size,
- scoped_refptr<TrackedCallback> callback) {
- if (TrackedCallback::IsPending(current_open_callback_))
- return PP_ERROR_INPROGRESS;
- if (called_open_)
- return PP_ERROR_FAILED;
-
- current_open_callback_ = callback;
- called_open_ = true;
- PluginDispatcher::GetForResource(this)->Send(
- new PpapiHostMsg_PPBFileSystem_Open(
- API_ID_PPB_FILE_SYSTEM, host_resource(), expected_size));
- return PP_OK_COMPLETIONPENDING;
-}
-
-PP_FileSystemType FileSystem::GetType() {
- return type_;
-}
-
-void FileSystem::OpenComplete(int32_t result) {
- current_open_callback_->Run(result);
-}
-
-PPB_FileSystem_Proxy::PPB_FileSystem_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
-}
-
-PPB_FileSystem_Proxy::~PPB_FileSystem_Proxy() {
-}
-
-const InterfaceProxy::Info* PPB_FileSystem_Proxy::GetInfo() {
- static const Info info = {
- thunk::GetPPB_FileSystem_1_0_Thunk(),
- PPB_FILESYSTEM_INTERFACE_1_0,
- API_ID_PPB_FILE_SYSTEM,
- false,
- &CreateFileSystemProxy,
- };
- return &info;
-}
-
-// static
-PP_Resource PPB_FileSystem_Proxy::CreateProxyResource(
- PP_Instance instance,
- PP_FileSystemType type) {
- PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
- if (!dispatcher)
- return PP_ERROR_BADARGUMENT;
-
- HostResource result;
- dispatcher->Send(new PpapiHostMsg_PPBFileSystem_Create(
- API_ID_PPB_FILE_SYSTEM, instance, type, &result));
- if (result.is_null())
- return 0;
- return (new FileSystem(result, type))->GetReference();
-}
-
-bool PPB_FileSystem_Proxy::OnMessageReceived(const IPC::Message& msg) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PPB_FileSystem_Proxy, msg)
-#if !defined(OS_NACL)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Create, OnMsgCreate)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen)
-#endif
- IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-#if !defined(OS_NACL)
-void PPB_FileSystem_Proxy::OnMsgCreate(PP_Instance instance,
- int type,
- HostResource* result) {
- thunk::EnterResourceCreation enter(instance);
- if (enter.failed())
- return;
- PP_Resource resource = enter.functions()->CreateFileSystem(
- instance, static_cast<PP_FileSystemType>(type));
- if (!resource)
- return; // CreateInfo default constructor initializes to 0.
- result->SetHostResource(instance, resource);
-}
-
-void PPB_FileSystem_Proxy::OnMsgOpen(const HostResource& host_resource,
- int64_t expected_size) {
- EnterHostFromHostResourceForceCallback<PPB_FileSystem_API> enter(
- host_resource, callback_factory_,
- &PPB_FileSystem_Proxy::OpenCompleteInHost, host_resource);
- if (enter.succeeded())
- enter.SetResult(enter.object()->Open(expected_size, enter.callback()));
-}
-#endif // !defined(OS_NACL)
-
-// Called in the plugin to handle the open callback.
-void PPB_FileSystem_Proxy::OnMsgOpenComplete(const HostResource& host_resource,
- int32_t result) {
- EnterPluginFromHostResource<PPB_FileSystem_API> enter(host_resource);
- if (enter.succeeded())
- static_cast<FileSystem*>(enter.object())->OpenComplete(result);
-}
-
-#if !defined(OS_NACL)
-void PPB_FileSystem_Proxy::OpenCompleteInHost(
- int32_t result,
- const HostResource& host_resource) {
- dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete(
- API_ID_PPB_FILE_SYSTEM, host_resource, result));
-}
-#endif // !defined(OS_NACL)
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/ppapi/proxy/ppb_file_system_proxy.h b/ppapi/proxy/ppb_file_system_proxy.h
deleted file mode 100644
index 68197e7..0000000
--- a/ppapi/proxy/ppb_file_system_proxy.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2011 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_SYSTEM_PROXY_H_
-#define PPAPI_PROXY_PPB_FILE_SYSTEM_PROXY_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_time.h"
-#include "ppapi/c/ppb_file_system.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/proxy_completion_callback_factory.h"
-#include "ppapi/utility/completion_callback_factory.h"
-
-namespace ppapi {
-
-class HostResource;
-
-namespace proxy {
-
-class PPB_FileSystem_Proxy : public InterfaceProxy {
- public:
- explicit PPB_FileSystem_Proxy(Dispatcher* dispatcher);
- virtual ~PPB_FileSystem_Proxy();
-
- static const Info* GetInfo();
-
- static PP_Resource CreateProxyResource(PP_Instance instance,
- PP_FileSystemType type);
-
- // InterfaceProxy implementation.
- virtual bool OnMessageReceived(const IPC::Message& msg);
-
- static const ApiID kApiID = API_ID_PPB_FILE_SYSTEM;
-
- private:
- // Message handlers.
- void OnMsgCreate(PP_Instance instance,
- int type,
- ppapi::HostResource* result);
- void OnMsgOpen(const ppapi::HostResource& filesystem,
- int64_t expected_size);
-
- void OnMsgOpenComplete(const ppapi::HostResource& filesystem,
- int32_t result);
-
- void OpenCompleteInHost(int32_t result,
- const ppapi::HostResource& host_resource);
-
- ProxyCompletionCallbackFactory<PPB_FileSystem_Proxy> callback_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_FileSystem_Proxy);
-};
-
-} // namespace proxy
-} // namespace ppapi
-
-#endif // PPAPI_PROXY_PPB_FILE_SYSTEM_PROXY_H_
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc
index 11db5a1..ddacde6 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc
@@ -294,7 +294,7 @@
PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ callback_factory_(this) {
}
PPB_Graphics3D_Proxy::~PPB_Graphics3D_Proxy() {
diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc
index b2ede29..40fddf4 100644
--- a/ppapi/proxy/ppb_image_data_proxy.cc
+++ b/ppapi/proxy/ppb_image_data_proxy.cc
@@ -25,6 +25,7 @@
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
@@ -43,39 +44,37 @@
// How ImageData re-use works
// --------------------------
//
-// When a plugin does ReplaceContents, it transfers the ImageData to the system
-// for use as the backing store for the instance. When animating plugins (like
-// video) re-creating image datas for each frame and mapping the memory has a
-// high overhead. So we try to re-use these when possible.
+// When animating plugins (like video), re-creating image datas for each frame
+// and mapping the memory has a high overhead. So we try to re-use these when
+// possible.
//
-// 1. Plugin does ReplaceContents and Flush and the proxy queues up an
-// asynchronous request to the renderer.
+// 1. Plugin makes an asynchronous call that transfers an ImageData to the
+// implementation of some API.
// 2. Plugin frees its ImageData reference. If it doesn't do this we can't
// re-use it.
// 3. When the last plugin ref of an ImageData is released, we don't actually
// delete it. Instead we put it on a queue where we hold onto it in the
// plugin process for a short period of time.
-// 4. When the Flush for the Graphics2D.ReplaceContents is executed, the proxy
-// will request the old ImageData. This is the one that's being replaced by
-// the new contents so is being abandoned, and without our caching system it
-// would get deleted at this point.
+// 4. The API implementation that received the ImageData finishes using it.
+// Without our caching system it would get deleted at this point.
// 5. The proxy in the renderer will send NotifyUnusedImageData back to the
// plugin process. We check if the given resource is in the queue and mark
// it as usable.
// 6. When the plugin requests a new image data, we check our queue and if there
// is a usable ImageData of the right size and format, we'll return it
-// instead of making a new one. Since when you're doing full frame
-// animations, generally the size doesn't change so cache hits should be
-// high.
+// instead of making a new one. It's important that caching is only requested
+// when the size is unlikely to change, so cache hits are high.
//
// Some notes:
//
-// - We only re-use image datas when the plugin does ReplaceContents on them.
-// Theoretically we could re-use them in other cases but the lifetime
+// - We only re-use image data when the plugin and host are rapidly exchanging
+// them and the size is likely to remain constant. It should be clear that
+// the plugin is promising that it's done with the image.
+//
+// - Theoretically we could re-use them in other cases but the lifetime
// becomes more difficult to manage. The plugin could have used an ImageData
// in an arbitrary number of queued up PaintImageData calls which we would
-// have to check. By doing ReplaceContents, the plugin is promising that it's
-// done with the image, so this is a good signal.
+// have to check.
//
// - If a flush takes a long time or there are many released image datas
// accumulating in our queue such that some are deleted, we will have
@@ -219,7 +218,7 @@
class ImageDataCache {
public:
- ImageDataCache() : weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {}
+ ImageDataCache() : weak_factory_(this) {}
~ImageDataCache() {}
static ImageDataCache* GetInstance();
@@ -276,11 +275,11 @@
cache_[image_data->pp_instance()].Add(image_data);
// Schedule a timer to invalidate this entry.
- MessageLoop::current()->PostDelayedTask(
+ base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
RunWhileLocked(base::Bind(&ImageDataCache::OnTimer,
- weak_factory_.GetWeakPtr(),
- image_data->pp_instance())),
+ weak_factory_.GetWeakPtr(),
+ image_data->pp_instance())),
base::TimeDelta::FromSeconds(kMaxAgeSeconds));
}
@@ -314,7 +313,7 @@
ImageHandle handle)
: Resource(OBJECT_IS_PROXY, resource),
desc_(desc),
- used_in_replace_contents_(false) {
+ is_candidate_for_reuse_(false) {
#if defined(OS_WIN)
transport_dib_.reset(TransportDIB::CreateWithHandle(handle));
#else
@@ -331,7 +330,7 @@
shm_(handle, false /* read_only */),
size_(desc.size.width * desc.size.height * 4),
map_count_(0),
- used_in_replace_contents_(false) {
+ is_candidate_for_reuse_(false) {
}
#endif // else, !defined(OS_NACL)
@@ -346,7 +345,7 @@
// The plugin no longer needs this ImageData, add it to our cache if it's
// been used in a ReplaceContents. These are the ImageDatas that the renderer
// will send back ImageDataUsable messages for.
- if (used_in_replace_contents_)
+ if (is_candidate_for_reuse_)
ImageDataCache::GetInstance()->Add(this);
}
@@ -413,12 +412,12 @@
#endif
}
-void ImageData::SetUsedInReplaceContents() {
- used_in_replace_contents_ = true;
+void ImageData::SetIsCandidateForReuse() {
+ is_candidate_for_reuse_ = true;
}
void ImageData::RecycleToPlugin(bool zero_contents) {
- used_in_replace_contents_ = false;
+ is_candidate_for_reuse_ = false;
if (zero_contents) {
void* data = Map();
memset(data, 0, desc_.stride * desc_.size.height);
@@ -521,6 +520,67 @@
}
#if !defined(OS_NACL)
+// static
+PP_Resource PPB_ImageData_Proxy::CreateImageData(
+ PP_Instance instance,
+ PP_ImageDataFormat format,
+ const PP_Size& size,
+ bool init_to_zero,
+ bool is_nacl_plugin,
+ PP_ImageDataDesc* desc,
+ IPC::PlatformFileForTransit* image_handle,
+ uint32_t* byte_count) {
+ HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return 0;
+
+ thunk::EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+
+ PP_Bool pp_init_to_zero = init_to_zero ? PP_TRUE : PP_FALSE;
+ ppapi::ScopedPPResource resource(
+ ppapi::ScopedPPResource::PassRef(),
+ is_nacl_plugin ?
+ enter.functions()->CreateImageDataNaCl(instance, format, &size,
+ pp_init_to_zero) :
+ enter.functions()->CreateImageData(instance, format, &size,
+ pp_init_to_zero));
+ if (!resource.get())
+ return 0;
+
+ thunk::EnterResourceNoLock<PPB_ImageData_API> enter_resource(resource.get(),
+ false);
+ if (enter_resource.object()->Describe(desc) != PP_TRUE) {
+ DVLOG(1) << "CreateImageData failed: could not Describe";
+ return 0;
+ }
+
+ int local_fd = 0;
+ if (enter_resource.object()->GetSharedMemory(&local_fd,
+ byte_count) != PP_OK) {
+ DVLOG(1) << "CreateImageData failed: could not GetSharedMemory";
+ return 0;
+ }
+
+#if defined(OS_WIN)
+ *image_handle = dispatcher->ShareHandleWithRemote(
+ reinterpret_cast<HANDLE>(static_cast<intptr_t>(local_fd)), false);
+#elif defined(OS_MACOSX) || defined(OS_ANDROID)
+ *image_handle = dispatcher->ShareHandleWithRemote(local_fd, false);
+#elif defined(OS_POSIX)
+ // On X Windows, a non-nacl handle is a SysV shared memory key.
+ if (is_nacl_plugin)
+ *image_handle = dispatcher->ShareHandleWithRemote(local_fd, false);
+ else
+ *image_handle = IPC::PlatformFileForTransit(local_fd, false);
+#else
+ #error Not implemented.
+#endif
+
+ return resource.Release();
+}
+
void PPB_ImageData_Proxy::OnHostMsgCreate(PP_Instance instance,
int32_t format,
const PP_Size& size,
@@ -528,36 +588,29 @@
HostResource* result,
std::string* image_data_desc,
ImageHandle* result_image_handle) {
- *result_image_handle = ImageData::NullHandle();
-
- thunk::EnterResourceCreation enter(instance);
- if (enter.failed())
- return;
-
- PP_Resource resource = enter.functions()->CreateImageData(
- instance, static_cast<PP_ImageDataFormat>(format), size, init_to_zero);
- if (!resource)
- return;
- result->SetHostResource(instance, resource);
-
- // Get the description, it's just serialized as a string.
- thunk::EnterResourceNoLock<PPB_ImageData_API> enter_resource(resource, false);
PP_ImageDataDesc desc;
- if (enter_resource.object()->Describe(&desc) == PP_TRUE) {
+ IPC::PlatformFileForTransit image_handle;
+ uint32_t byte_count;
+ PP_Resource resource =
+ CreateImageData(instance,
+ static_cast<PP_ImageDataFormat>(format),
+ size,
+ true /* init_to_zero */,
+ false /* is_nacl_plugin */,
+ &desc, &image_handle, &byte_count);
+ result->SetHostResource(instance, resource);
+ if (resource) {
image_data_desc->resize(sizeof(PP_ImageDataDesc));
memcpy(&(*image_data_desc)[0], &desc, sizeof(PP_ImageDataDesc));
- }
-
- // Get the shared memory handle.
- uint32_t byte_count = 0;
- int32_t handle = 0;
- if (enter_resource.object()->GetSharedMemory(&handle, &byte_count) == PP_OK) {
-#if defined(OS_WIN)
- ImageHandle ih = ImageData::HandleFromInt(handle);
- *result_image_handle = dispatcher()->ShareHandleWithRemote(ih, false);
+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID)
+ *result_image_handle = image_handle;
#else
- *result_image_handle = ImageData::HandleFromInt(handle);
-#endif // defined(OS_WIN)
+ // On X Windows ImageHandle is a SysV shared memory key.
+ *result_image_handle = image_handle.fd;
+#endif
+ } else {
+ image_data_desc->clear();
+ *result_image_handle = ImageData::NullHandle();
}
}
@@ -569,47 +622,26 @@
HostResource* result,
std::string* image_data_desc,
ppapi::proxy::SerializedHandle* result_image_handle) {
- result_image_handle->set_null_shmem();
- HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
- if (!dispatcher)
- return;
-
- thunk::EnterResourceCreation enter(instance);
- if (enter.failed())
- return;
-
- PP_Resource resource = enter.functions()->CreateImageDataNaCl(
- instance, static_cast<PP_ImageDataFormat>(format), size, init_to_zero);
- if (!resource)
- return;
- result->SetHostResource(instance, resource);
-
- // Get the description, it's just serialized as a string.
- thunk::EnterResourceNoLock<PPB_ImageData_API> enter_resource(resource, false);
- if (enter_resource.failed())
- return;
PP_ImageDataDesc desc;
- if (enter_resource.object()->Describe(&desc) == PP_TRUE) {
+ IPC::PlatformFileForTransit image_handle;
+ uint32_t byte_count;
+ PP_Resource resource =
+ CreateImageData(instance,
+ static_cast<PP_ImageDataFormat>(format),
+ size,
+ true /* init_to_zero */,
+ true /* is_nacl_plugin */,
+ &desc, &image_handle, &byte_count);
+
+ result->SetHostResource(instance, resource);
+ if (resource) {
image_data_desc->resize(sizeof(PP_ImageDataDesc));
memcpy(&(*image_data_desc)[0], &desc, sizeof(PP_ImageDataDesc));
+ result_image_handle->set_shmem(image_handle, byte_count);
+ } else {
+ image_data_desc->clear();
+ result_image_handle->set_null_shmem();
}
- int local_fd;
- uint32_t byte_count;
- if (enter_resource.object()->GetSharedMemory(&local_fd, &byte_count) != PP_OK)
- return;
- // TODO(dmichael): Change trusted interface to return a PP_FileHandle, those
- // casts are ugly.
- base::PlatformFile platform_file =
-#if defined(OS_WIN)
- reinterpret_cast<HANDLE>(static_cast<intptr_t>(local_fd));
-#elif defined(OS_POSIX)
- local_fd;
-#else
- #error Not implemented.
-#endif // defined(OS_WIN)
- result_image_handle->set_shmem(
- dispatcher->ShareHandleWithRemote(platform_file, false),
- byte_count);
}
#endif // !defined(OS_NACL)
diff --git a/ppapi/proxy/ppb_image_data_proxy.h b/ppapi/proxy/ppb_image_data_proxy.h
index 6001b37..2f2cd60 100644
--- a/ppapi/proxy/ppb_image_data_proxy.h
+++ b/ppapi/proxy/ppb_image_data_proxy.h
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/shared_memory.h"
#include "build/build_config.h"
+#include "ipc/ipc_platform_file.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_instance.h"
@@ -17,6 +18,7 @@
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/proxy/serialized_structs.h"
#include "ppapi/shared_impl/ppb_image_data_shared.h"
#include "ppapi/shared_impl/resource.h"
@@ -31,9 +33,10 @@
// The proxied image data resource. Unlike most resources, this needs to be
// public in the header since a number of other resources need to access it.
-class ImageData : public ppapi::Resource,
- public ppapi::thunk::PPB_ImageData_API,
- public ppapi::PPB_ImageData_Shared {
+class PPAPI_PROXY_EXPORT ImageData
+ : public ppapi::Resource,
+ public NON_EXPORTED_BASE(ppapi::thunk::PPB_ImageData_API),
+ public ppapi::PPB_ImageData_Shared {
public:
#if !defined(OS_NACL)
ImageData(const ppapi::HostResource& resource,
@@ -62,7 +65,7 @@
virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE;
virtual SkCanvas* GetPlatformCanvas() OVERRIDE;
virtual SkCanvas* GetCanvas() OVERRIDE;
- virtual void SetUsedInReplaceContents() OVERRIDE;
+ virtual void SetIsCandidateForReuse() OVERRIDE;
const PP_ImageDataDesc& desc() const { return desc_; }
@@ -89,9 +92,8 @@
scoped_ptr<SkCanvas> mapped_canvas_;
#endif
- // Set to true when this ImageData has been used in a call to
- // Graphics2D.ReplaceContents. This is used to signal that it can be cached.
- bool used_in_replace_contents_;
+ // Set to true when this ImageData is a good candidate for reuse.
+ bool is_candidate_for_reuse_;
DISALLOW_COPY_AND_ASSIGN(ImageData);
};
@@ -109,6 +111,24 @@
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
+ // Utility for creating ImageData resources.
+ // This can only be called on the host side of the proxy.
+ // On failure, will return invalid resource (0). On success it will return a
+ // valid resource and the out params will be written.
+ // |desc| contains the result of Describe.
+ // |image_handle| and |byte_count| contain the result of GetSharedMemory.
+ // NOTE: if |init_to_zero| is false, you should write over the entire image
+ // to avoid leaking sensitive data to a less privileged process.
+ PPAPI_PROXY_EXPORT static PP_Resource CreateImageData(
+ PP_Instance instance,
+ PP_ImageDataFormat format,
+ const PP_Size& size,
+ bool init_to_zero,
+ bool is_nacl_plugin,
+ PP_ImageDataDesc* desc,
+ IPC::PlatformFileForTransit* image_handle,
+ uint32_t* byte_count);
+
static const ApiID kApiID = API_ID_PPB_IMAGE_DATA;
private:
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 36d8b30..ff044b6 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -18,12 +18,14 @@
#include "ppapi/proxy/browser_font_singleton_resource.h"
#include "ppapi/proxy/content_decryptor_private_serializer.h"
#include "ppapi/proxy/enter_proxy.h"
+#include "ppapi/proxy/extensions_common_resource.h"
#include "ppapi/proxy/flash_clipboard_resource.h"
#include "ppapi/proxy/flash_file_resource.h"
#include "ppapi/proxy/flash_fullscreen_resource.h"
#include "ppapi/proxy/flash_resource.h"
#include "ppapi/proxy/gamepad_resource.h"
#include "ppapi/proxy/host_dispatcher.h"
+#include "ppapi/proxy/pdf_resource.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/serialized_var.h"
@@ -82,7 +84,7 @@
PPB_Instance_Proxy::PPB_Instance_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ callback_factory_(this) {
}
PPB_Instance_Proxy::~PPB_Instance_Proxy() {
@@ -322,6 +324,14 @@
NOTIMPLEMENTED(); // Not proxied yet.
}
+PP_Bool PPB_Instance_Proxy::IsFullscreen(PP_Instance instance) {
+ InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
+ GetInstanceData(instance);
+ if (!data)
+ return PP_FALSE;
+ return PP_FromBool(data->view.is_fullscreen);
+}
+
PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance,
PP_Bool fullscreen) {
PP_Bool result = PP_FALSE;
@@ -355,6 +365,9 @@
case BROKER_SINGLETON_ID:
new_singleton = new BrokerResource(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;
@@ -380,7 +393,7 @@
static_cast<PluginDispatcher*>(dispatcher()));
break;
case PDF_SINGLETON_ID:
- // TODO(raymes): fill this in.
+ new_singleton = new PDFResource(connection, instance);
break;
#else
case BROWSER_FONT_SINGLETON_ID:
@@ -774,7 +787,7 @@
data->should_do_request_surrounding_text = true;
if (!data->is_request_surrounding_text_pending) {
- MessageLoop::current()->PostTask(
+ base::MessageLoop::current()->PostTask(
FROM_HERE,
RunWhileLocked(base::Bind(&RequestSurroundingText, instance)));
data->is_request_surrounding_text_pending = true;
diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h
index b62706e..6df4f8d 100644
--- a/ppapi/proxy/ppb_instance_proxy.h
+++ b/ppapi/proxy/ppb_instance_proxy.h
@@ -65,6 +65,7 @@
PP_Bool final_result) OVERRIDE;
virtual void SelectedFindResultChanged(PP_Instance instance,
int32_t index) OVERRIDE;
+ virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE;
virtual PP_Bool SetFullscreen(PP_Instance instance,
PP_Bool fullscreen) OVERRIDE;
virtual PP_Bool GetScreenSize(PP_Instance instance,
diff --git a/ppapi/proxy/ppb_message_loop_proxy.cc b/ppapi/proxy/ppb_message_loop_proxy.cc
index 0062fb7..fb01485 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.cc
+++ b/ppapi/proxy/ppb_message_loop_proxy.cc
@@ -86,7 +86,7 @@
AddRef();
slot->Set(this);
- loop_.reset(new MessageLoop(MessageLoop::TYPE_DEFAULT));
+ loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT));
loop_proxy_ = base::MessageLoopProxy::current();
// Post all pending work to the message loop.
@@ -106,8 +106,8 @@
return PP_ERROR_INPROGRESS;
nested_invocations_++;
- CallWhileUnlocked(base::Bind(&MessageLoop::Run,
- base::Unretained(loop_.get())));
+ CallWhileUnlocked(
+ base::Bind(&base::MessageLoop::Run, base::Unretained(loop_.get())));
nested_invocations_--;
if (should_destroy_ && nested_invocations_ == 0) {
@@ -141,7 +141,7 @@
if (IsCurrent() && nested_invocations_ > 0)
loop_->Quit();
else
- PostClosure(FROM_HERE, MessageLoop::QuitClosure(), 0);
+ PostClosure(FROM_HERE, base::MessageLoop::QuitClosure(), 0);
return PP_OK;
}
diff --git a/ppapi/proxy/ppb_message_loop_proxy.h b/ppapi/proxy/ppb_message_loop_proxy.h
index 3fa7674..8bec5a7 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.h
+++ b/ppapi/proxy/ppb_message_loop_proxy.h
@@ -70,7 +70,7 @@
// that it's created on the thread it will run on. NULL for the main thread
// loop, since that's owned by somebody else. This is needed for Run and Quit.
// Any time we post tasks, we should post them using loop_proxy_.
- scoped_ptr<MessageLoop> loop_;
+ scoped_ptr<base::MessageLoop> loop_;
scoped_refptr<base::MessageLoopProxy> loop_proxy_;
// Number of invocations of Run currently on the stack.
diff --git a/ppapi/proxy/ppb_network_monitor_private_proxy.cc b/ppapi/proxy/ppb_network_monitor_private_proxy.cc
index ad9d06d..055ed2e 100644
--- a/ppapi/proxy/ppb_network_monitor_private_proxy.cc
+++ b/ppapi/proxy/ppb_network_monitor_private_proxy.cc
@@ -106,9 +106,11 @@
// here.
proxy->current_list_ = NULL;
} else if (proxy->current_list_.get()) {
- MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
- &NetworkMonitor::OnNetworkListReceivedLocks,
- result->AsWeakPtr(), proxy->current_list_));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&NetworkMonitor::OnNetworkListReceivedLocks,
+ result->AsWeakPtr(),
+ proxy->current_list_));
}
return result->GetReference();
diff --git a/ppapi/proxy/ppb_testing_proxy.cc b/ppapi/proxy/ppb_testing_proxy.cc
index 167a91e..f28c500 100644
--- a/ppapi/proxy/ppb_testing_proxy.cc
+++ b/ppapi/proxy/ppb_testing_proxy.cc
@@ -51,16 +51,17 @@
}
void RunMessageLoop(PP_Instance instance) {
- MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
+ base::MessageLoop::ScopedNestableTaskAllower allow(
+ base::MessageLoop::current());
CHECK(PpapiGlobals::Get()->GetMainThreadMessageLoop()->
- BelongsToCurrentThread());
- MessageLoop::current()->Run();
+ BelongsToCurrentThread());
+ base::MessageLoop::current()->Run();
}
void QuitMessageLoop(PP_Instance instance) {
CHECK(PpapiGlobals::Get()->GetMainThreadMessageLoop()->
BelongsToCurrentThread());
- MessageLoop::current()->QuitNow();
+ base::MessageLoop::current()->QuitNow();
}
uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
@@ -114,6 +115,18 @@
return vars.size();
}
+void SetMinimumArrayBufferSizeForShmem(PP_Instance instance,
+ uint32_t threshold) {
+ ProxyAutoLock lock;
+ RawVarDataGraph::SetMinimumArrayBufferSizeForShmemForTest(threshold);
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return;
+ dispatcher->Send(
+ new PpapiHostMsg_PPBTesting_SetMinimumArrayBufferSizeForShmem(
+ API_ID_PPB_TESTING, threshold));
+}
+
const PPB_Testing_Dev testing_interface = {
&ReadImageData,
&RunMessageLoop,
@@ -122,7 +135,8 @@
&IsOutOfProcess,
&SimulateInputEvent,
&GetDocumentURL,
- &GetLiveVars
+ &GetLiveVars,
+ &SetMinimumArrayBufferSizeForShmem
};
InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) {
@@ -167,6 +181,9 @@
OnMsgGetLiveObjectsForInstance)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_SimulateInputEvent,
OnMsgSimulateInputEvent)
+ IPC_MESSAGE_HANDLER(
+ PpapiHostMsg_PPBTesting_SetMinimumArrayBufferSizeForShmem,
+ OnMsgSetMinimumArrayBufferSizeForShmem)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -203,5 +220,10 @@
input_event_impl->pp_resource());
}
+void PPB_Testing_Proxy::OnMsgSetMinimumArrayBufferSizeForShmem(
+ uint32_t threshold) {
+ RawVarDataGraph::SetMinimumArrayBufferSizeForShmemForTest(threshold);
+}
+
} // namespace proxy
} // namespace ppapi
diff --git a/ppapi/proxy/ppb_testing_proxy.h b/ppapi/proxy/ppb_testing_proxy.h
index c6dd373..61af47f 100644
--- a/ppapi/proxy/ppb_testing_proxy.h
+++ b/ppapi/proxy/ppb_testing_proxy.h
@@ -41,6 +41,7 @@
void OnMsgGetLiveObjectsForInstance(PP_Instance instance, uint32_t* result);
void OnMsgSimulateInputEvent(PP_Instance instance,
const ppapi::InputEventData& input_event);
+ void OnMsgSetMinimumArrayBufferSizeForShmem(uint32_t threshold);
// When this proxy is in the host side, this value caches the interface
// pointer so we don't have to retrieve it from the dispatcher each time.
diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc
index 3293516..425b61f 100644
--- a/ppapi/proxy/ppb_url_loader_proxy.cc
+++ b/ppapi/proxy/ppb_url_loader_proxy.cc
@@ -112,7 +112,7 @@
scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual void Close() OVERRIDE;
virtual void GrantUniversalAccess() OVERRIDE;
- virtual void SetStatusCallback(
+ virtual void RegisterStatusCallback(
PP_URLLoaderTrusted_StatusCallback cb) OVERRIDE;
virtual bool GetResponseInfoData(URLResponseInfoData* data) OVERRIDE;
@@ -324,7 +324,7 @@
API_ID_PPB_URL_LOADER, host_resource()));
}
-void URLLoader::SetStatusCallback(
+void URLLoader::RegisterStatusCallback(
PP_URLLoaderTrusted_StatusCallback cb) {
// Not implemented in the proxied version, this is for implementing the
// proxy itself in the host.
@@ -388,7 +388,7 @@
PPB_URLLoader_Proxy::PPB_URLLoader_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ callback_factory_(this) {
}
PPB_URLLoader_Proxy::~PPB_URLLoader_Proxy() {
@@ -467,7 +467,7 @@
// callback before sending any URLLoader to the plugin.
EnterResourceNoLock<PPB_URLLoader_API> enter(resource, false);
if (enter.succeeded())
- enter.object()->SetStatusCallback(&UpdateResourceLoadStatus);
+ enter.object()->RegisterStatusCallback(&UpdateResourceLoadStatus);
else
NOTREACHED(); // Only called internally, resource should be valid.
}
diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc
index 2513a85..29aa2c0 100644
--- a/ppapi/proxy/ppb_var_deprecated_proxy.cc
+++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc
@@ -285,7 +285,7 @@
PPB_Var_Deprecated_Proxy::PPB_Var_Deprecated_Proxy(
Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
- task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
+ task_factory_(this),
ppb_var_impl_(NULL) {
if (!dispatcher->IsPlugin()) {
ppb_var_impl_ = static_cast<const PPB_Var_Deprecated*>(
@@ -392,10 +392,11 @@
// spurious warning).
// TODO(piman): See if we can fix the IPC code to enforce strict ordering, and
// then remove this.
- MessageLoop::current()->PostNonNestableTask(FROM_HERE,
+ base::MessageLoop::current()->PostNonNestableTask(
+ FROM_HERE,
RunWhileLocked(base::Bind(&PPB_Var_Deprecated_Proxy::DoReleaseObject,
- task_factory_.GetWeakPtr(),
- object_id)));
+ task_factory_.GetWeakPtr(),
+ object_id)));
}
void PPB_Var_Deprecated_Proxy::OnMsgHasProperty(
diff --git a/ppapi/proxy/ppb_var_unittest.cc b/ppapi/proxy/ppb_var_unittest.cc
index bf6147d..0ed0f47 100644
--- a/ppapi/proxy/ppb_var_unittest.cc
+++ b/ppapi/proxy/ppb_var_unittest.cc
@@ -164,11 +164,7 @@
} // namespace
-#ifdef ENABLE_PEPPER_THREADING
TEST_F(PPB_VarTest, Threads) {
-#else
-TEST_F(PPB_VarTest, DISABLED_Threads) {
-#endif
std::vector<base::PlatformThreadHandle> create_var_threads(kNumThreads);
std::vector<CreateVarThreadDelegate> create_var_delegates;
// The strings that the threads will re-extract from Vars (so we can check
diff --git a/ppapi/proxy/ppb_video_decoder_proxy.cc b/ppapi/proxy/ppb_video_decoder_proxy.cc
index 496646e..2a00674 100644
--- a/ppapi/proxy/ppb_video_decoder_proxy.cc
+++ b/ppapi/proxy/ppb_video_decoder_proxy.cc
@@ -61,6 +61,8 @@
}
VideoDecoder::~VideoDecoder() {
+ FlushCommandBuffer();
+ PPB_VideoDecoder_Shared::Destroy();
}
int32_t VideoDecoder::Decode(
@@ -148,7 +150,7 @@
PPB_VideoDecoder_Proxy::PPB_VideoDecoder_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ callback_factory_(this) {
}
PPB_VideoDecoder_Proxy::~PPB_VideoDecoder_Proxy() {
diff --git a/ppapi/proxy/ppp_instance_private_proxy_unittest.cc b/ppapi/proxy/ppp_instance_private_proxy_unittest.cc
index df1af0c..317f4d4 100644
--- a/ppapi/proxy/ppp_instance_private_proxy_unittest.cc
+++ b/ppapi/proxy/ppp_instance_private_proxy_unittest.cc
@@ -147,15 +147,7 @@
} // namespace
-// TODO(raymes): This #ifdef is only here because we check the state of the
-// plugin globals on the main thread, rather than the plugin thread which causes
-// the thread checker to fail. Once ENABLE_PEPPER_THREADING is the default,
-// this will be safe to do anyway, so we can remove this.
-#ifdef ENABLE_PEPPER_THREADING
TEST_F(PPP_Instance_Private_ProxyTest, PPPInstancePrivate) {
-#else
-TEST_F(PPP_Instance_Private_ProxyTest, DISABLED_PPPInstancePrivate) {
-#endif
// This test controls its own instance; we can't use the one that
// PluginProxyTestHarness provides.
ASSERT_NE(kInstance, pp_instance());
diff --git a/ppapi/proxy/ppp_instance_proxy_unittest.cc b/ppapi/proxy/ppp_instance_proxy_unittest.cc
index 91775b0..e2df26e 100644
--- a/ppapi/proxy/ppp_instance_proxy_unittest.cc
+++ b/ppapi/proxy/ppp_instance_proxy_unittest.cc
@@ -10,10 +10,10 @@
#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/private/ppb_flash_fullscreen.h"
+#include "ppapi/proxy/locking_resource_releaser.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "ppapi/shared_impl/ppb_view_shared.h"
-#include "ppapi/shared_impl/scoped_pp_resource.h"
namespace ppapi {
namespace proxy {
@@ -163,11 +163,10 @@
data.clip_rect = expected_clip;
data.device_scale = 1.0f;
ResetReceived();
- ScopedPPResource view_resource(
- ScopedPPResource::PassRef(),
+ LockingResourceReleaser view_resource(
(new PPB_View_Shared(OBJECT_IS_IMPL,
expected_instance, data))->GetReference());
- ppp_instance->DidChangeView(expected_instance, view_resource);
+ ppp_instance->DidChangeView(expected_instance, view_resource.get());
did_change_view_called.Wait();
EXPECT_EQ(received_instance, expected_instance);
EXPECT_EQ(received_position.point.x, expected_position.point.x);
diff --git a/ppapi/proxy/printing_resource_unittest.cc b/ppapi/proxy/printing_resource_unittest.cc
index 980147f..ed96364 100644
--- a/ppapi/proxy/printing_resource_unittest.cc
+++ b/ppapi/proxy/printing_resource_unittest.cc
@@ -7,11 +7,11 @@
#include "base/message_loop.h"
#include "ppapi/c/dev/ppb_printing_dev.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/locking_resource_releaser.h"
#include "ppapi/proxy/printing_resource.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "ppapi/thunk/thunk.h"
-#include "ppapi/shared_impl/scoped_pp_resource.h"
namespace ppapi {
namespace proxy {
@@ -47,13 +47,12 @@
const PPB_Printing_Dev_0_7* printing_iface =
thunk::GetPPB_Printing_Dev_0_7_Thunk();
- ScopedPPResource res(ScopedPPResource::PassRef(),
- printing_iface->Create(pp_instance()));
+ LockingResourceReleaser res(printing_iface->Create(pp_instance()));
PP_PrintSettings_Dev output_settings;
int32_t result = printing_iface->GetDefaultPrintSettings(
- res, &output_settings, PP_MakeCompletionCallback(&Callback, NULL));
+ res.get(), &output_settings, PP_MakeCompletionCallback(&Callback, NULL));
ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
// Should have sent a "GetDefaultPrintSettings" message.
diff --git a/ppapi/proxy/proxy_completion_callback_factory.h b/ppapi/proxy/proxy_completion_callback_factory.h
index 1221f43..9e3ab88 100644
--- a/ppapi/proxy/proxy_completion_callback_factory.h
+++ b/ppapi/proxy/proxy_completion_callback_factory.h
@@ -21,26 +21,26 @@
public:
RefCount() : ref_(0) {
#ifndef NDEBUG
- message_loop_ = MessageLoop::current();
+ message_loop_ = base::MessageLoop::current();
#endif
}
~RefCount() {
#ifndef NDEBUG
- DCHECK(message_loop_ == MessageLoop::current());
+ DCHECK(message_loop_ == base::MessageLoop::current());
#endif
}
int32_t AddRef() {
#ifndef NDEBUG
- DCHECK(message_loop_ == MessageLoop::current());
+ DCHECK(message_loop_ == base::MessageLoop::current());
#endif
return ++ref_;
}
int32_t Release() {
#ifndef NDEBUG
- DCHECK(message_loop_ == MessageLoop::current());
+ DCHECK(message_loop_ == base::MessageLoop::current());
#endif
DCHECK(ref_ > 0);
return --ref_;
@@ -49,7 +49,7 @@
private:
int32_t ref_;
#ifndef NDEBUG
- MessageLoop* message_loop_;
+ base::MessageLoop* message_loop_;
#endif
};
diff --git a/ppapi/proxy/proxy_object_var.h b/ppapi/proxy/proxy_object_var.h
index 5b9caa3..5991053 100644
--- a/ppapi/proxy/proxy_object_var.h
+++ b/ppapi/proxy/proxy_object_var.h
@@ -39,6 +39,8 @@
// it's creating IDs.
void AssignVarID(int32 id);
+ void clear_dispatcher() { dispatcher_ = NULL; }
+
private:
proxy::PluginDispatcher* dispatcher_;
int32 host_var_id_;
diff --git a/ppapi/proxy/raw_var_data.cc b/ppapi/proxy/raw_var_data.cc
new file mode 100644
index 0000000..d4ad279
--- /dev/null
+++ b/ppapi/proxy/raw_var_data.cc
@@ -0,0 +1,640 @@
+// 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/raw_var_data.h"
+
+#include <stack>
+
+#include "base/hash_tables.h"
+#include "base/stl_util.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/proxy/ppapi_param_traits.h"
+#include "ppapi/shared_impl/array_var.h"
+#include "ppapi/shared_impl/dictionary_var.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/shared_impl/var_tracker.h"
+
+using std::make_pair;
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+// When sending array buffers, if the size is over 256K, we use shared
+// memory instead of sending the data over IPC. Light testing suggests
+// shared memory is much faster for 256K and larger messages.
+static const uint32 kMinimumArrayBufferSizeForShmem = 256 * 1024;
+static uint32 g_minimum_array_buffer_size_for_shmem =
+ kMinimumArrayBufferSizeForShmem;
+
+void DefaultHandleWriter(IPC::Message* m, const SerializedHandle& handle) {
+ IPC::ParamTraits<SerializedHandle>::Write(m, handle);
+}
+
+// For a given PP_Var, returns the RawVarData associated with it, or creates a
+// new one if there is no existing one. The data is appended to |data| if it
+// is newly created. The index into |data| pointing to the result is returned.
+// |id_map| keeps track of RawVarDatas that have already been created.
+size_t GetOrCreateRawVarData(const PP_Var& var,
+ base::hash_map<int64_t, size_t>* id_map,
+ ScopedVector<RawVarData>* data) {
+ if (VarTracker::IsVarTypeRefcounted(var.type)) {
+ base::hash_map<int64_t, size_t>::iterator it = id_map->find(
+ var.value.as_id);
+ if (it != id_map->end()) {
+ return it->second;
+ } else {
+ data->push_back(RawVarData::Create(var.type));
+ (*id_map)[var.value.as_id] = data->size() - 1;
+ }
+ } else {
+ data->push_back(RawVarData::Create(var.type));
+ }
+ return data->size() - 1;
+}
+
+} // namespace
+
+// RawVarDataGraph ------------------------------------------------------------
+RawVarDataGraph::RawVarDataGraph() {
+}
+
+RawVarDataGraph::~RawVarDataGraph() {
+}
+
+// static
+scoped_ptr<RawVarDataGraph> RawVarDataGraph::Create(const PP_Var& var,
+ PP_Instance instance) {
+ scoped_ptr<RawVarDataGraph> graph(new RawVarDataGraph);
+ // Map of |var.value.as_id| to a RawVarData index in RawVarDataGraph.
+ base::hash_map<int64_t, size_t> id_map;
+
+ std::stack<std::pair<PP_Var, size_t> > stack;
+ stack.push(make_pair(var, GetOrCreateRawVarData(var, &id_map,
+ &graph->data_)));
+
+ // Traverse the PP_Var graph with DFS.
+ while (!stack.empty()) {
+ PP_Var current_var = stack.top().first;
+ RawVarData* current_var_data = graph->data_[stack.top().second];
+ stack.pop();
+
+ // If the node is initialized, it means we have visited it.
+ if (current_var_data->initialized())
+ continue;
+
+ if (!current_var_data->Init(current_var, instance)) {
+ NOTREACHED();
+ return scoped_ptr<RawVarDataGraph>();
+ }
+
+ // Add child nodes to the stack.
+ if (current_var.type == PP_VARTYPE_ARRAY) {
+ ArrayVar* array_var = ArrayVar::FromPPVar(current_var);
+ if (!array_var) {
+ NOTREACHED();
+ return scoped_ptr<RawVarDataGraph>();
+ }
+ for (ArrayVar::ElementVector::const_iterator iter =
+ array_var->elements().begin();
+ iter != array_var->elements().end();
+ ++iter) {
+ size_t child_id = GetOrCreateRawVarData(iter->get(), &id_map,
+ &graph->data_);
+ static_cast<ArrayRawVarData*>(current_var_data)->AddChild(child_id);
+ stack.push(make_pair(iter->get(), child_id));
+ }
+ } else if (current_var.type == PP_VARTYPE_DICTIONARY) {
+ DictionaryVar* dict_var = DictionaryVar::FromPPVar(current_var);
+ if (!dict_var) {
+ NOTREACHED();
+ return scoped_ptr<RawVarDataGraph>();
+ }
+ for (DictionaryVar::KeyValueMap::const_iterator iter =
+ dict_var->key_value_map().begin();
+ iter != dict_var->key_value_map().end();
+ ++iter) {
+ size_t child_id = GetOrCreateRawVarData(iter->second.get(), &id_map,
+ &graph->data_);
+ static_cast<DictionaryRawVarData*>(
+ current_var_data)->AddChild(iter->first, child_id);
+ stack.push(make_pair(iter->second.get(), child_id));
+ }
+ }
+ }
+ return graph.Pass();
+}
+
+PP_Var RawVarDataGraph::CreatePPVar(PP_Instance instance) {
+ // Create and initialize each node in the graph.
+ std::vector<PP_Var> graph;
+ for (size_t i = 0; i < data_.size(); ++i)
+ graph.push_back(data_[i]->CreatePPVar(instance));
+ for (size_t i = 0; i < data_.size(); ++i)
+ data_[i]->PopulatePPVar(graph[i], graph);
+ // Everything except the root will have one extra ref. Remove that ref.
+ for (size_t i = 1; i < data_.size(); ++i)
+ ScopedPPVar(ScopedPPVar::PassRef(), graph[i]);
+ // The first element is the root.
+ return graph[0];
+}
+
+void RawVarDataGraph::Write(IPC::Message* m,
+ const HandleWriter& handle_writer) {
+ // Write the size, followed by each node in the graph.
+ m->WriteUInt32(static_cast<uint32_t>(data_.size()));
+ for (size_t i = 0; i < data_.size(); ++i) {
+ m->WriteInt(data_[i]->Type());
+ data_[i]->Write(m, handle_writer);
+ }
+}
+
+void RawVarDataGraph::Write(IPC::Message* m) {
+ Write(m, base::Bind(&DefaultHandleWriter));
+}
+
+// static
+scoped_ptr<RawVarDataGraph> RawVarDataGraph::Read(const IPC::Message* m,
+ PickleIterator* iter) {
+ scoped_ptr<RawVarDataGraph> result(new RawVarDataGraph);
+ uint32_t size = 0;
+ if (!m->ReadUInt32(iter, &size))
+ return scoped_ptr<RawVarDataGraph>();
+ for (uint32_t i = 0; i < size; ++i) {
+ int32_t type;
+ if (!m->ReadInt(iter, &type))
+ return scoped_ptr<RawVarDataGraph>();
+ PP_VarType var_type = static_cast<PP_VarType>(type);
+ result->data_.push_back(RawVarData::Create(var_type));
+ if (!result->data_.back()->Read(var_type, m, iter))
+ return scoped_ptr<RawVarDataGraph>();
+ }
+ return result.Pass();
+}
+
+std::vector<SerializedHandle*> RawVarDataGraph::GetHandles() {
+ std::vector<SerializedHandle*> result;
+ for (size_t i = 0; i < data_.size(); ++i) {
+ SerializedHandle* handle = data_[i]->GetHandle();
+ if (handle)
+ result.push_back(handle);
+ }
+ return result;
+}
+
+// static
+void RawVarDataGraph::SetMinimumArrayBufferSizeForShmemForTest(
+ uint32 threshold) {
+ if (threshold == 0)
+ g_minimum_array_buffer_size_for_shmem = kMinimumArrayBufferSizeForShmem;
+ else
+ g_minimum_array_buffer_size_for_shmem = threshold;
+}
+
+// RawVarData ------------------------------------------------------------------
+
+// static
+RawVarData* RawVarData::Create(PP_VarType type) {
+ switch (type) {
+ case PP_VARTYPE_UNDEFINED:
+ case PP_VARTYPE_NULL:
+ case PP_VARTYPE_BOOL:
+ case PP_VARTYPE_INT32:
+ case PP_VARTYPE_DOUBLE:
+ case PP_VARTYPE_OBJECT:
+ return new BasicRawVarData();
+ case PP_VARTYPE_STRING:
+ return new StringRawVarData();
+ case PP_VARTYPE_ARRAY_BUFFER:
+ return new ArrayBufferRawVarData();
+ case PP_VARTYPE_ARRAY:
+ return new ArrayRawVarData();
+ case PP_VARTYPE_DICTIONARY:
+ return new DictionaryRawVarData();
+ }
+ NOTREACHED();
+ return NULL;
+}
+
+RawVarData::RawVarData() : initialized_(false) {
+}
+
+RawVarData::~RawVarData() {
+}
+
+SerializedHandle* RawVarData::GetHandle() {
+ return NULL;
+}
+
+// BasicRawVarData -------------------------------------------------------------
+BasicRawVarData::BasicRawVarData() {
+}
+
+BasicRawVarData::~BasicRawVarData() {
+}
+
+PP_VarType BasicRawVarData::Type() {
+ return var_.type;
+}
+
+bool BasicRawVarData::Init(const PP_Var& var, PP_Instance /*instance*/) {
+ var_ = var;
+ initialized_ = true;
+ return true;
+}
+
+PP_Var BasicRawVarData::CreatePPVar(PP_Instance instance) {
+ return var_;
+}
+
+void BasicRawVarData::PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) {
+}
+
+void BasicRawVarData::Write(
+ IPC::Message* m,
+ const HandleWriter& handle_writer) {
+ switch (var_.type) {
+ case PP_VARTYPE_UNDEFINED:
+ case PP_VARTYPE_NULL:
+ // These don't need any data associated with them other than the type we
+ // just serialized.
+ break;
+ case PP_VARTYPE_BOOL:
+ m->WriteBool(PP_ToBool(var_.value.as_bool));
+ break;
+ case PP_VARTYPE_INT32:
+ m->WriteInt(var_.value.as_int);
+ break;
+ case PP_VARTYPE_DOUBLE:
+ IPC::ParamTraits<double>::Write(m, var_.value.as_double);
+ break;
+ case PP_VARTYPE_OBJECT:
+ m->WriteInt64(var_.value.as_id);
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+}
+
+bool BasicRawVarData::Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) {
+ PP_Var result;
+ result.type = type;
+ switch (type) {
+ case PP_VARTYPE_UNDEFINED:
+ case PP_VARTYPE_NULL:
+ // These don't have any data associated with them other than the type we
+ // just serialized.
+ break;
+ case PP_VARTYPE_BOOL: {
+ bool bool_value;
+ if (!m->ReadBool(iter, &bool_value))
+ return false;
+ result.value.as_bool = PP_FromBool(bool_value);
+ break;
+ }
+ case PP_VARTYPE_INT32:
+ if (!m->ReadInt(iter, &result.value.as_int))
+ return false;
+ break;
+ case PP_VARTYPE_DOUBLE:
+ if (!IPC::ParamTraits<double>::Read(m, iter, &result.value.as_double))
+ return false;
+ break;
+ case PP_VARTYPE_OBJECT:
+ if (!m->ReadInt64(iter, &result.value.as_id))
+ return false;
+ break;
+ default:
+ NOTREACHED();
+ return false;
+ }
+ var_ = result;
+ return true;
+}
+
+// StringRawVarData ------------------------------------------------------------
+StringRawVarData::StringRawVarData() {
+}
+
+StringRawVarData::~StringRawVarData() {
+}
+
+PP_VarType StringRawVarData::Type() {
+ return PP_VARTYPE_STRING;
+}
+
+bool StringRawVarData::Init(const PP_Var& var, PP_Instance /*instance*/) {
+ DCHECK(var.type == PP_VARTYPE_STRING);
+ StringVar* string_var = StringVar::FromPPVar(var);
+ if (!string_var)
+ return false;
+ data_ = string_var->value();
+ initialized_ = true;
+ return true;
+}
+
+PP_Var StringRawVarData::CreatePPVar(PP_Instance instance) {
+ return StringVar::SwapValidatedUTF8StringIntoPPVar(&data_);
+}
+
+void StringRawVarData::PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) {
+}
+
+void StringRawVarData::Write(IPC::Message* m,
+ const HandleWriter& handle_writer) {
+ m->WriteString(data_);
+}
+
+bool StringRawVarData::Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) {
+ if (!m->ReadString(iter, &data_))
+ return false;
+ return true;
+}
+
+// ArrayBufferRawVarData -------------------------------------------------------
+ArrayBufferRawVarData::ArrayBufferRawVarData() {
+}
+
+ArrayBufferRawVarData::~ArrayBufferRawVarData() {
+}
+
+PP_VarType ArrayBufferRawVarData::Type() {
+ return PP_VARTYPE_ARRAY_BUFFER;
+}
+
+bool ArrayBufferRawVarData::Init(const PP_Var& var,
+ PP_Instance instance) {
+ DCHECK(var.type == PP_VARTYPE_ARRAY_BUFFER);
+ ArrayBufferVar* buffer_var = ArrayBufferVar::FromPPVar(var);
+ if (!buffer_var)
+ return false;
+ bool using_shmem = false;
+ if (buffer_var->ByteLength() >= g_minimum_array_buffer_size_for_shmem &&
+ instance != 0) {
+ int host_handle_id;
+ base::SharedMemoryHandle plugin_handle;
+ using_shmem = buffer_var->CopyToNewShmem(instance,
+ &host_handle_id,
+ &plugin_handle);
+ if (using_shmem) {
+ if (host_handle_id != -1) {
+ DCHECK(!base::SharedMemory::IsHandleValid(plugin_handle));
+ DCHECK(PpapiGlobals::Get()->IsPluginGlobals());
+ type_ = ARRAY_BUFFER_SHMEM_HOST;
+ host_shm_handle_id_ = host_handle_id;
+ } else {
+ DCHECK(base::SharedMemory::IsHandleValid(plugin_handle));
+ DCHECK(PpapiGlobals::Get()->IsHostGlobals());
+ type_ = ARRAY_BUFFER_SHMEM_PLUGIN;
+ plugin_shm_handle_ = SerializedHandle(plugin_handle,
+ buffer_var->ByteLength());
+ }
+ }
+ }
+ if (!using_shmem) {
+ type_ = ARRAY_BUFFER_NO_SHMEM;
+ data_ = std::string(static_cast<const char*>(buffer_var->Map()),
+ buffer_var->ByteLength());
+ }
+ initialized_ = true;
+ return true;
+}
+
+PP_Var ArrayBufferRawVarData::CreatePPVar(PP_Instance instance) {
+ PP_Var result = PP_MakeUndefined();
+ switch (type_) {
+ case ARRAY_BUFFER_SHMEM_HOST: {
+ base::SharedMemoryHandle host_handle;
+ uint32 size_in_bytes;
+ bool ok = PpapiGlobals::Get()->GetVarTracker()->
+ StopTrackingSharedMemoryHandle(host_shm_handle_id_,
+ instance,
+ &host_handle,
+ &size_in_bytes);
+ if (ok) {
+ result = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+ size_in_bytes, host_handle);
+ } else {
+ LOG(ERROR) << "Couldn't find array buffer id: " << host_shm_handle_id_;
+ return PP_MakeUndefined();
+ }
+ break;
+ }
+ case ARRAY_BUFFER_SHMEM_PLUGIN: {
+ result = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+ plugin_shm_handle_.size(),
+ plugin_shm_handle_.shmem());
+ break;
+ }
+ case ARRAY_BUFFER_NO_SHMEM: {
+ result = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+ static_cast<uint32>(data_.size()), data_.data());
+ break;
+ }
+ default:
+ NOTREACHED();
+ return PP_MakeUndefined();
+ }
+ DCHECK(result.type == PP_VARTYPE_ARRAY_BUFFER);
+ return result;
+}
+
+void ArrayBufferRawVarData::PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) {
+}
+
+void ArrayBufferRawVarData::Write(
+ IPC::Message* m,
+ const HandleWriter& handle_writer) {
+ m->WriteInt(type_);
+ switch (type_) {
+ case ARRAY_BUFFER_SHMEM_HOST:
+ m->WriteInt(host_shm_handle_id_);
+ break;
+ case ARRAY_BUFFER_SHMEM_PLUGIN:
+ handle_writer.Run(m, plugin_shm_handle_);
+ break;
+ case ARRAY_BUFFER_NO_SHMEM:
+ m->WriteString(data_);
+ break;
+ }
+}
+
+bool ArrayBufferRawVarData::Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) {
+ int shmem_type;
+ if (!m->ReadInt(iter, &shmem_type))
+ return false;
+ type_ = static_cast<ShmemType>(shmem_type);
+ switch (type_) {
+ case ARRAY_BUFFER_SHMEM_HOST:
+ if (!m->ReadInt(iter, &host_shm_handle_id_))
+ return false;
+ break;
+ case ARRAY_BUFFER_SHMEM_PLUGIN:
+ if (!IPC::ParamTraits<SerializedHandle>::Read(
+ m, iter, &plugin_shm_handle_)) {
+ return false;
+ }
+ break;
+ case ARRAY_BUFFER_NO_SHMEM:
+ if (!m->ReadString(iter, &data_))
+ return false;
+ break;
+ default:
+ // We read an invalid ID.
+ NOTREACHED();
+ return false;
+ }
+ return true;
+}
+
+SerializedHandle* ArrayBufferRawVarData::GetHandle() {
+ if (type_ == ARRAY_BUFFER_SHMEM_PLUGIN && plugin_shm_handle_.size() != 0)
+ return &plugin_shm_handle_;
+ return NULL;
+}
+
+// ArrayRawVarData -------------------------------------------------------------
+ArrayRawVarData::ArrayRawVarData() {
+}
+
+ArrayRawVarData::~ArrayRawVarData() {
+}
+
+void ArrayRawVarData::AddChild(size_t element) {
+ children_.push_back(element);
+}
+
+PP_VarType ArrayRawVarData::Type() {
+ return PP_VARTYPE_ARRAY;
+}
+
+bool ArrayRawVarData::Init(const PP_Var& var, PP_Instance /*instance*/) {
+ initialized_ = true;
+ DCHECK(var.type == PP_VARTYPE_ARRAY);
+ initialized_ = true;
+ return true;
+}
+
+PP_Var ArrayRawVarData::CreatePPVar(PP_Instance instance) {
+ return (new ArrayVar())->GetPPVar();
+}
+
+void ArrayRawVarData::PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) {
+ if (var.type != PP_VARTYPE_ARRAY) {
+ NOTREACHED();
+ return;
+ }
+ ArrayVar* array_var = ArrayVar::FromPPVar(var);
+ DCHECK(array_var->elements().empty());
+ for (size_t i = 0; i < children_.size(); ++i)
+ array_var->elements().push_back(ScopedPPVar(graph[children_[i]]));
+}
+
+void ArrayRawVarData::Write(IPC::Message* m,
+ const HandleWriter& handle_writer) {
+ m->WriteUInt32(static_cast<uint32_t>(children_.size()));
+ for (size_t i = 0; i < children_.size(); ++i)
+ m->WriteUInt32(static_cast<uint32_t>(children_[i]));
+}
+
+bool ArrayRawVarData::Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) {
+ uint32_t size;
+ if (!m->ReadUInt32(iter, &size))
+ return false;
+ for (uint32_t i = 0; i < size; ++i) {
+ uint32_t index;
+ if (!m->ReadUInt32(iter, &index))
+ return false;
+ children_.push_back(index);
+ }
+ return true;
+}
+
+// DictionaryRawVarData --------------------------------------------------------
+DictionaryRawVarData::DictionaryRawVarData() {
+}
+
+DictionaryRawVarData::~DictionaryRawVarData() {
+}
+
+void DictionaryRawVarData::AddChild(const std::string& key,
+ size_t value) {
+ children_.push_back(make_pair(key, value));
+}
+
+PP_VarType DictionaryRawVarData::Type() {
+ return PP_VARTYPE_DICTIONARY;
+}
+
+bool DictionaryRawVarData::Init(const PP_Var& var, PP_Instance /*instance*/) {
+ DCHECK(var.type == PP_VARTYPE_DICTIONARY);
+ initialized_ = true;
+ return true;
+}
+
+PP_Var DictionaryRawVarData::CreatePPVar(PP_Instance instance) {
+ return (new DictionaryVar())->GetPPVar();
+}
+
+void DictionaryRawVarData::PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) {
+ if (var.type != PP_VARTYPE_DICTIONARY) {
+ NOTREACHED();
+ return;
+ }
+ DictionaryVar* dictionary_var = DictionaryVar::FromPPVar(var);
+ DCHECK(dictionary_var->key_value_map().empty());
+ for (size_t i = 0; i < children_.size(); ++i) {
+ bool success = dictionary_var->SetWithStringKey(children_[i].first,
+ graph[children_[i].second]);
+ DCHECK(success);
+ }
+}
+
+void DictionaryRawVarData::Write(
+ IPC::Message* m,
+ const HandleWriter& handle_writer) {
+ m->WriteUInt32(static_cast<uint32_t>(children_.size()));
+ for (size_t i = 0; i < children_.size(); ++i) {
+ m->WriteString(children_[i].first);
+ m->WriteUInt32(static_cast<uint32_t>(children_[i].second));
+ }
+}
+
+bool DictionaryRawVarData::Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) {
+ uint32_t size;
+ if (!m->ReadUInt32(iter, &size))
+ return false;
+ for (uint32_t i = 0; i < size; ++i) {
+ std::string key;
+ uint32_t value;
+ if (!m->ReadString(iter, &key))
+ return false;
+ if (!m->ReadUInt32(iter, &value))
+ return false;
+ children_.push_back(make_pair(key, value));
+ }
+ return true;
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/raw_var_data.h b/ppapi/proxy/raw_var_data.h
new file mode 100644
index 0000000..1e8746f
--- /dev/null
+++ b/ppapi/proxy/raw_var_data.h
@@ -0,0 +1,263 @@
+// 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_RAW_VAR_DATA_H_
+#define PPAPI_PROXY_RAW_VAR_DATA_H_
+
+#include <vector>
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/proxy/ppapi_param_traits.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/proxy/serialized_handle.h"
+
+class PickleIterator;
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace proxy {
+
+class RawVarData;
+
+typedef base::Callback<void(IPC::Message*, const SerializedHandle&)>
+ HandleWriter;
+
+// Contains the data associated with a graph of connected PP_Vars. Useful for
+// serializing/deserializing a graph of PP_Vars. First we compute the transitive
+// closure of the given PP_Var to find all PP_Vars which are referenced by that
+// var. A RawVarData object is created for each of these vars. We then write
+// data contained in each RawVarData to the message. The format looks like this:
+// idx | size | (number of vars in the graph)
+// 0 | var type |
+// | var data |
+// 1 | var type |
+// | var data |
+// 2 | var type |
+// | var data |
+// | .... |
+//
+// Vars that reference other vars (such as Arrays or Dictionaries) use indices
+// into the message to denote which PP_Var is pointed to.
+class PPAPI_PROXY_EXPORT RawVarDataGraph {
+ public:
+ // Construct a RawVarDataGraph from a given root PP_Var. A null pointer
+ // is returned upon failure.
+ static scoped_ptr<RawVarDataGraph> Create(const PP_Var& var,
+ PP_Instance instance);
+
+ // Constructs an empty RawVarDataGraph.
+ RawVarDataGraph();
+ ~RawVarDataGraph();
+
+ // Construct a new PP_Var from the graph. All of the PP_Vars referenced by
+ // the returned PP_Var are also constructed. Each PP_Var created has a
+ // ref-count equal to the number of references it has in the graph of vars.
+ // The returned var (the "root") has one additional reference.
+ PP_Var CreatePPVar(PP_Instance instance);
+
+ // Write the graph to a message using the given HandleWriter.
+ void Write(IPC::Message* m, const HandleWriter& handle_writer);
+ // Write the graph to a message using the default handle writer.
+ void Write(IPC::Message* m);
+
+ // Create a RawVarDataGraph from the given message.
+ static scoped_ptr<RawVarDataGraph> Read(const IPC::Message* m,
+ PickleIterator* iter);
+
+ // Returns a vector of SerializedHandles associated with this RawVarDataGraph.
+ // Ownership of the pointers remains with the elements of the RawVarDataGraph.
+ std::vector<SerializedHandle*> GetHandles();
+
+ // Sets the threshold size at which point we switch from transmitting
+ // array buffers in IPC messages to using shared memory. This is only used
+ // for testing purposes where we need to transmit small buffers using shmem
+ // (in order to have fast tests).
+ static void SetMinimumArrayBufferSizeForShmemForTest(uint32 threshold);
+
+ // A list of the nodes in the graph.
+ ScopedVector<RawVarData> data_;
+};
+
+// Abstract base class for the data contained in a PP_Var.
+class RawVarData {
+ public:
+ // Create a new, empty RawVarData for the given type.
+ static RawVarData* Create(PP_VarType type);
+ RawVarData();
+ virtual ~RawVarData();
+
+ // Returns the type of the PP_Var represented by the RawVarData.
+ virtual PP_VarType Type() = 0;
+
+ // Initializes a RawVarData from a PP_Var. Returns true on success.
+ virtual bool Init(const PP_Var& var, PP_Instance instance) = 0;
+
+ // Create a PP_Var from the raw data contained in this object.
+ virtual PP_Var CreatePPVar(PP_Instance instance) = 0;
+ // Some PP_Vars may require 2-step initialization. For example, they may
+ // reference other PP_Vars which had not yet been created when |CreatePPVar|
+ // was called. The original var created with |CreatePPVar| is passed back in,
+ // along with the graph it is a part of to be initialized.
+ virtual void PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) = 0;
+
+ // Writes the RawVarData to a message.
+ virtual void Write(IPC::Message* m,
+ const HandleWriter& handle_writer) = 0;
+ // Reads the RawVarData from a message. Returns true on success.
+ virtual bool Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) = 0;
+
+ // Returns a SerializedHandle associated with this RawVarData or NULL if none
+ // exists. Ownership of the pointer remains with the RawVarData.
+ virtual SerializedHandle* GetHandle();
+
+ bool initialized() { return initialized_; }
+
+ protected:
+ bool initialized_;
+};
+
+// A RawVarData class for PP_Vars which are value types.
+class BasicRawVarData : public RawVarData {
+ public:
+ BasicRawVarData();
+ virtual ~BasicRawVarData();
+
+ // RawVarData implementation.
+ virtual PP_VarType Type() OVERRIDE;
+ virtual bool Init(const PP_Var& var, PP_Instance instance) OVERRIDE;
+ virtual PP_Var CreatePPVar(PP_Instance instance) OVERRIDE;
+ virtual void PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) OVERRIDE;
+ virtual void Write(IPC::Message* m,
+ const HandleWriter& handle_writer) OVERRIDE;
+ virtual bool Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) OVERRIDE;
+
+ private:
+ PP_Var var_;
+};
+
+// A RawVarData class for string PP_Vars.
+class StringRawVarData : public RawVarData {
+ public:
+ StringRawVarData();
+ virtual ~StringRawVarData();
+
+ // RawVarData implementation.
+ virtual PP_VarType Type() OVERRIDE;
+ virtual bool Init(const PP_Var& var, PP_Instance instance) OVERRIDE;
+ virtual PP_Var CreatePPVar(PP_Instance instance) OVERRIDE;
+ virtual void PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) OVERRIDE;
+ virtual void Write(IPC::Message* m,
+ const HandleWriter& handle_writer) OVERRIDE;
+ virtual bool Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) OVERRIDE;
+
+ private:
+ // The data in the string.
+ std::string data_;
+};
+
+// A RawVarData class for array buffer PP_Vars.
+class ArrayBufferRawVarData : public RawVarData {
+ public:
+ // Enum for array buffer message types.
+ enum ShmemType {
+ ARRAY_BUFFER_NO_SHMEM,
+ ARRAY_BUFFER_SHMEM_HOST,
+ ARRAY_BUFFER_SHMEM_PLUGIN,
+ };
+
+ ArrayBufferRawVarData();
+ virtual ~ArrayBufferRawVarData();
+
+ // RawVarData implementation.
+ virtual PP_VarType Type() OVERRIDE;
+ virtual bool Init(const PP_Var& var, PP_Instance instance) OVERRIDE;
+ virtual PP_Var CreatePPVar(PP_Instance instance) OVERRIDE;
+ virtual void PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) OVERRIDE;
+ virtual void Write(IPC::Message* m,
+ const HandleWriter& handle_writer) OVERRIDE;
+ virtual bool Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) OVERRIDE;
+ virtual SerializedHandle* GetHandle() OVERRIDE;
+
+ private:
+ // The type of the storage underlying the array buffer.
+ ShmemType type_;
+ // The data in the buffer. Valid for |type_| == ARRAY_BUFFER_NO_SHMEM.
+ std::string data_;
+ // Host shmem handle. Valid for |type_| == ARRAY_BUFFER_SHMEM_HOST.
+ int host_shm_handle_id_;
+ // Plugin shmem handle. Valid for |type_| == ARRAY_BUFFER_SHMEM_PLUGIN.
+ SerializedHandle plugin_shm_handle_;
+};
+
+// A RawVarData class for array PP_Vars.
+class ArrayRawVarData : public RawVarData {
+ public:
+ ArrayRawVarData();
+ virtual ~ArrayRawVarData();
+
+ void AddChild(size_t element);
+
+ // RawVarData implementation.
+ virtual PP_VarType Type() OVERRIDE;
+ virtual bool Init(const PP_Var& var, PP_Instance instance) OVERRIDE;
+ virtual PP_Var CreatePPVar(PP_Instance instance) OVERRIDE;
+ virtual void PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) OVERRIDE;
+ virtual void Write(IPC::Message* m,
+ const HandleWriter& handle_writer) OVERRIDE;
+ virtual bool Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) OVERRIDE;
+
+ private:
+ std::vector<size_t> children_;
+};
+
+// A RawVarData class for dictionary PP_Vars.
+class DictionaryRawVarData : public RawVarData {
+ public:
+ DictionaryRawVarData();
+ virtual ~DictionaryRawVarData();
+
+ void AddChild(const std::string& key, size_t value);
+
+ // RawVarData implementation.
+ virtual PP_VarType Type() OVERRIDE;
+ virtual bool Init(const PP_Var& var, PP_Instance instance) OVERRIDE;
+ virtual PP_Var CreatePPVar(PP_Instance instance) OVERRIDE;
+ virtual void PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) OVERRIDE;
+ virtual void Write(IPC::Message* m,
+ const HandleWriter& handle_writer) OVERRIDE;
+ virtual bool Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) OVERRIDE;
+
+ private:
+ std::vector<std::pair<std::string, size_t> > children_;
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_RAW_VAR_DATA_H_
diff --git a/ppapi/proxy/raw_var_data_unittest.cc b/ppapi/proxy/raw_var_data_unittest.cc
new file mode 100644
index 0000000..8a00d21
--- /dev/null
+++ b/ppapi/proxy/raw_var_data_unittest.cc
@@ -0,0 +1,333 @@
+// 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.
+
+#include "ppapi/proxy/raw_var_data.h"
+
+#include <cmath>
+
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/array_var.h"
+#include "ppapi/shared_impl/dictionary_var.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/test_globals.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/shared_impl/var_tracker.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+class RawVarDataTest : public testing::Test {
+ public:
+ RawVarDataTest() {}
+ ~RawVarDataTest() {}
+
+ // testing::Test implementation.
+ virtual void SetUp() {
+ ProxyLock::Acquire();
+ }
+ virtual void TearDown() {
+ ASSERT_TRUE(PpapiGlobals::Get()->GetVarTracker()->GetLiveVars().empty());
+ ProxyLock::Release();
+ }
+
+ private:
+ TestGlobals globals_;
+};
+
+// Compares two vars for equality. When two vars are found to be equal, an entry
+// is inserted into |visited_map| with (expected id, actual id). When comparing
+// two PP_Vars that have a graph of references, this avoids following reference
+// cycles. It also ensures that a var with ID x in the graph is always equal
+// to a var with ID y. This guarantees that the topology of the two graphs
+// being compared is identical.
+bool Equals(const PP_Var& expected,
+ const PP_Var& actual,
+ base::hash_map<int64_t, int64_t>* visited_map) {
+ if (expected.type != actual.type) {
+ LOG(ERROR) << "expected type: " << expected.type <<
+ " actual type: " << actual.type;
+ return false;
+ }
+ if (VarTracker::IsVarTypeRefcounted(expected.type)) {
+ base::hash_map<int64_t, int64_t>::iterator it =
+ visited_map->find(expected.value.as_id);
+ if (it != visited_map->end()) {
+ if (it->second != actual.value.as_id) {
+ LOG(ERROR) << "expected id: " << it->second << " actual id: " <<
+ actual.value.as_id;
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ (*visited_map)[expected.value.as_id] = actual.value.as_id;
+ }
+ }
+ switch (expected.type) {
+ case PP_VARTYPE_UNDEFINED:
+ return true;
+ case PP_VARTYPE_NULL:
+ return true;
+ case PP_VARTYPE_BOOL:
+ if (expected.value.as_bool != actual.value.as_bool) {
+ LOG(ERROR) << "expected: " << expected.value.as_bool << " actual: " <<
+ actual.value.as_bool;
+ return false;
+ }
+ return true;
+ case PP_VARTYPE_INT32:
+ if (expected.value.as_int != actual.value.as_int) {
+ LOG(ERROR) << "expected: " << expected.value.as_int << " actual: " <<
+ actual.value.as_int;
+ return false;
+ }
+ return true;
+ case PP_VARTYPE_DOUBLE:
+ if (fabs(expected.value.as_double - actual.value.as_double) > 1.0e-4) {
+ LOG(ERROR) << "expected: " << expected.value.as_double <<
+ " actual: " << actual.value.as_double;
+ return false;
+ }
+ return true;
+ case PP_VARTYPE_OBJECT:
+ if (expected.value.as_id != actual.value.as_id) {
+ LOG(ERROR) << "expected: " << expected.value.as_id << " actual: " <<
+ actual.value.as_id;
+ return false;
+ }
+ return true;
+ case PP_VARTYPE_STRING: {
+ StringVar* expected_var = StringVar::FromPPVar(expected);
+ StringVar* actual_var = StringVar::FromPPVar(actual);
+ DCHECK(expected_var && actual_var);
+ if (expected_var->value() != actual_var->value()) {
+ LOG(ERROR) << "expected: " << expected_var->value() << " actual: " <<
+ actual_var->value();
+ return false;
+ }
+ return true;
+ }
+ case PP_VARTYPE_ARRAY_BUFFER: {
+ ArrayBufferVar* expected_var = ArrayBufferVar::FromPPVar(expected);
+ ArrayBufferVar* actual_var = ArrayBufferVar::FromPPVar(actual);
+ DCHECK(expected_var && actual_var);
+ if (expected_var->ByteLength() != actual_var->ByteLength()) {
+ LOG(ERROR) << "expected: " << expected_var->ByteLength() <<
+ " actual: " << actual_var->ByteLength();
+ return false;
+ }
+ if (memcmp(expected_var->Map(), actual_var->Map(),
+ expected_var->ByteLength()) != 0) {
+ LOG(ERROR) << "expected array buffer does not match actual.";
+ return false;
+ }
+ return true;
+ }
+ case PP_VARTYPE_ARRAY: {
+ ArrayVar* expected_var = ArrayVar::FromPPVar(expected);
+ ArrayVar* actual_var = ArrayVar::FromPPVar(actual);
+ DCHECK(expected_var && actual_var);
+ if (expected_var->elements().size() != actual_var->elements().size()) {
+ LOG(ERROR) << "expected: " << expected_var->elements().size() <<
+ " actual: " << actual_var->elements().size();
+ return false;
+ }
+ for (size_t i = 0; i < expected_var->elements().size(); ++i) {
+ if (!Equals(expected_var->elements()[i].get(),
+ actual_var->elements()[i].get(),
+ visited_map)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ case PP_VARTYPE_DICTIONARY: {
+ DictionaryVar* expected_var = DictionaryVar::FromPPVar(expected);
+ DictionaryVar* actual_var = DictionaryVar::FromPPVar(actual);
+ DCHECK(expected_var && actual_var);
+ if (expected_var->key_value_map().size() !=
+ actual_var->key_value_map().size()) {
+ LOG(ERROR) << "expected: " << expected_var->key_value_map().size() <<
+ " actual: " << actual_var->key_value_map().size();
+ return false;
+ }
+ DictionaryVar::KeyValueMap::const_iterator expected_iter =
+ expected_var->key_value_map().begin();
+ DictionaryVar::KeyValueMap::const_iterator actual_iter =
+ actual_var->key_value_map().begin();
+ for ( ; expected_iter != expected_var->key_value_map().end();
+ ++expected_iter, ++actual_iter) {
+ if (expected_iter->first != actual_iter->first) {
+ LOG(ERROR) << "expected: " << expected_iter->first <<
+ " actual: " << actual_iter->first;
+ return false;
+ }
+ if (!Equals(expected_iter->second.get(),
+ actual_iter->second.get(),
+ visited_map)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ NOTREACHED();
+ return false;
+}
+
+bool Equals(const PP_Var& expected,
+ const PP_Var& actual) {
+ base::hash_map<int64_t, int64_t> visited_map;
+ return Equals(expected, actual, &visited_map);
+}
+
+PP_Var WriteAndRead(const PP_Var& var) {
+ PP_Instance dummy_instance = 1234;
+ scoped_ptr<RawVarDataGraph> expected_data(RawVarDataGraph::Create(
+ var, dummy_instance));
+ IPC::Message m;
+ expected_data->Write(&m);
+ PickleIterator iter(m);
+ scoped_ptr<RawVarDataGraph> actual_data(RawVarDataGraph::Read(&m, &iter));
+ return actual_data->CreatePPVar(dummy_instance);
+}
+
+// Assumes a ref for var.
+bool WriteReadAndCompare(const PP_Var& var) {
+ ScopedPPVar expected(ScopedPPVar::PassRef(), var);
+ ScopedPPVar actual(ScopedPPVar::PassRef(), WriteAndRead(expected.get()));
+ return Equals(expected.get(), actual.get());
+}
+
+} // namespace
+
+TEST_F(RawVarDataTest, SimpleTest) {
+ EXPECT_TRUE(WriteReadAndCompare(PP_MakeUndefined()));
+ EXPECT_TRUE(WriteReadAndCompare(PP_MakeNull()));
+ EXPECT_TRUE(WriteReadAndCompare(PP_MakeInt32(100)));
+ EXPECT_TRUE(WriteReadAndCompare(PP_MakeBool(PP_TRUE)));
+ EXPECT_TRUE(WriteReadAndCompare(PP_MakeDouble(53.75)));
+ PP_Var object;
+ object.type = PP_VARTYPE_OBJECT;
+ object.value.as_id = 10;
+ EXPECT_TRUE(WriteReadAndCompare(object));
+}
+
+TEST_F(RawVarDataTest, StringTest) {
+ EXPECT_TRUE(WriteReadAndCompare(StringVar::StringToPPVar("")));
+ EXPECT_TRUE(WriteReadAndCompare(StringVar::StringToPPVar("hello world!")));
+}
+
+TEST_F(RawVarDataTest, ArrayBufferTest) {
+ std::string data = "hello world!";
+ PP_Var var = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+ data.size(), data.data());
+ EXPECT_TRUE(WriteReadAndCompare(var));
+ var = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
+ 0, static_cast<void*>(NULL));
+ EXPECT_TRUE(WriteReadAndCompare(var));
+ // TODO(raymes): add tests for shmem type array buffers.
+}
+
+TEST_F(RawVarDataTest, DictionaryArrayTest) {
+ // Empty array.
+ scoped_refptr<ArrayVar> array(new ArrayVar);
+ ScopedPPVar release_array(ScopedPPVar::PassRef(), array->GetPPVar());
+ EXPECT_TRUE(WriteReadAndCompare(array->GetPPVar()));
+
+ size_t index = 0;
+
+ // Array with primitives.
+ array->Set(index++, PP_MakeUndefined());
+ array->Set(index++, PP_MakeNull());
+ array->Set(index++, PP_MakeInt32(100));
+ array->Set(index++, PP_MakeBool(PP_FALSE));
+ array->Set(index++, PP_MakeDouble(0.123));
+ EXPECT_TRUE(WriteReadAndCompare(array->GetPPVar()));
+
+ // Array with 2 references to the same string.
+ ScopedPPVar release_string(
+ ScopedPPVar::PassRef(), StringVar::StringToPPVar("abc"));
+ array->Set(index++, release_string.get());
+ array->Set(index++, release_string.get());
+ EXPECT_TRUE(WriteReadAndCompare(array->GetPPVar()));
+
+ // Array with nested array that references the same string.
+ scoped_refptr<ArrayVar> array2(new ArrayVar);
+ ScopedPPVar release_array2(ScopedPPVar::PassRef(), array2->GetPPVar());
+ array2->Set(0, release_string.get());
+ array->Set(index++, release_array2.get());
+ EXPECT_TRUE(WriteReadAndCompare(array->GetPPVar()));
+
+ // Empty dictionary.
+ scoped_refptr<DictionaryVar> dictionary(new DictionaryVar);
+ ScopedPPVar release_dictionary(ScopedPPVar::PassRef(),
+ dictionary->GetPPVar());
+ EXPECT_TRUE(WriteReadAndCompare(dictionary->GetPPVar()));
+
+ // Dictionary with primitives.
+ dictionary->SetWithStringKey("1", PP_MakeUndefined());
+ dictionary->SetWithStringKey("2", PP_MakeNull());
+ dictionary->SetWithStringKey("3", PP_MakeInt32(-100));
+ dictionary->SetWithStringKey("4", PP_MakeBool(PP_TRUE));
+ dictionary->SetWithStringKey("5", PP_MakeDouble(-103.52));
+ EXPECT_TRUE(WriteReadAndCompare(dictionary->GetPPVar()));
+
+ // Dictionary with 2 references to the same string.
+ dictionary->SetWithStringKey("6", release_string.get());
+ dictionary->SetWithStringKey("7", release_string.get());
+ EXPECT_TRUE(WriteReadAndCompare(dictionary->GetPPVar()));
+
+ // Dictionary with nested dictionary that references the same string.
+ scoped_refptr<DictionaryVar> dictionary2(new DictionaryVar);
+ ScopedPPVar release_dictionary2(ScopedPPVar::PassRef(),
+ dictionary2->GetPPVar());
+ dictionary2->SetWithStringKey("abc", release_string.get());
+ dictionary->SetWithStringKey("8", release_dictionary2.get());
+ EXPECT_TRUE(WriteReadAndCompare(dictionary->GetPPVar()));
+
+ // Array with dictionary.
+ array->Set(index++, release_dictionary.get());
+ EXPECT_TRUE(WriteReadAndCompare(array->GetPPVar()));
+
+ // Array with dictionary with array.
+ array2->Set(0, PP_MakeInt32(100));
+ dictionary->SetWithStringKey("9", release_array2.get());
+ EXPECT_TRUE(WriteReadAndCompare(array->GetPPVar()));
+
+ // Array <-> dictionary cycle.
+ dictionary->SetWithStringKey("10", release_array.get());
+ ScopedPPVar result = ScopedPPVar(ScopedPPVar::PassRef(),
+ WriteAndRead(release_dictionary.get()));
+ EXPECT_TRUE(Equals(release_dictionary.get(), result.get()));
+ // Break the cycle.
+ // TODO(raymes): We need some better machinery for releasing vars with
+ // cycles. Remove the code below once we have that.
+ dictionary->DeleteWithStringKey("10");
+ DictionaryVar* result_dictionary = DictionaryVar::FromPPVar(result.get());
+ result_dictionary->DeleteWithStringKey("10");
+
+ // Array with self references.
+ array->Set(index, release_array.get());
+ result = ScopedPPVar(ScopedPPVar::PassRef(),
+ WriteAndRead(release_array.get()));
+ EXPECT_TRUE(Equals(release_array.get(), result.get()));
+ // Break the self reference.
+ array->Set(index, PP_MakeUndefined());
+ ArrayVar* result_array = ArrayVar::FromPPVar(result.get());
+ result_array->Set(index, PP_MakeUndefined());
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index 4aec036..a234ca6 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -10,9 +10,9 @@
#include "ppapi/proxy/audio_input_resource.h"
#include "ppapi/proxy/browser_font_resource_trusted.h"
#include "ppapi/proxy/connection.h"
-#include "ppapi/proxy/directory_reader_resource.h"
#include "ppapi/proxy/file_chooser_resource.h"
#include "ppapi/proxy/file_io_resource.h"
+#include "ppapi/proxy/file_system_resource.h"
#include "ppapi/proxy/flash_device_id_resource.h"
#include "ppapi/proxy/flash_font_file_resource.h"
#include "ppapi/proxy/flash_menu_resource.h"
@@ -26,7 +26,6 @@
#include "ppapi/proxy/ppb_broker_proxy.h"
#include "ppapi/proxy/ppb_buffer_proxy.h"
#include "ppapi/proxy/ppb_file_ref_proxy.h"
-#include "ppapi/proxy/ppb_file_system_proxy.h"
#include "ppapi/proxy/ppb_flash_message_loop_proxy.h"
#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
#include "ppapi/proxy/ppb_image_data_proxy.h"
@@ -43,6 +42,8 @@
#include "ppapi/proxy/url_request_info_resource.h"
#include "ppapi/proxy/url_response_info_resource.h"
#include "ppapi/proxy/video_capture_resource.h"
+#include "ppapi/proxy/video_destination_resource.h"
+#include "ppapi/proxy/video_source_resource.h"
#include "ppapi/proxy/websocket_resource.h"
#include "ppapi/shared_impl/api_id.h"
#include "ppapi/shared_impl/host_resource.h"
@@ -74,15 +75,17 @@
return (new FileIOResource(GetConnection(), instance))->GetReference();
}
-PP_Resource ResourceCreationProxy::CreateFileRef(PP_Resource file_system,
+PP_Resource ResourceCreationProxy::CreateFileRef(PP_Instance instance,
+ PP_Resource file_system,
const char* path) {
- return PPB_FileRef_Proxy::CreateProxyResource(file_system, path);
+ return PPB_FileRef_Proxy::CreateProxyResource(instance, file_system, path);
}
PP_Resource ResourceCreationProxy::CreateFileSystem(
PP_Instance instance,
PP_FileSystemType type) {
- return PPB_FileSystem_Proxy::CreateProxyResource(instance, type);
+ return (new FileSystemResource(GetConnection(), instance,
+ type))->GetReference();
}
PP_Resource ResourceCreationProxy::CreateIMEInputEvent(
@@ -146,9 +149,9 @@
PP_Resource ResourceCreationProxy::CreateTrueTypeFont(
PP_Instance instance,
- const PP_TrueTypeFontDesc_Dev& desc) {
+ const PP_TrueTypeFontDesc_Dev* desc) {
return (new TrueTypeFontResource(GetConnection(),
- instance, desc))->GetReference();
+ instance, *desc))->GetReference();
}
@@ -157,10 +160,9 @@
}
PP_Resource ResourceCreationProxy::CreateURLRequestInfo(
- PP_Instance instance,
- const URLRequestInfoData& data) {
- return (new URLRequestInfoResource(GetConnection(),
- instance, data))->GetReference();
+ PP_Instance instance) {
+ return (new URLRequestInfoResource(
+ GetConnection(), instance, URLRequestInfoData()))->GetReference();
}
PP_Resource ResourceCreationProxy::CreateURLResponseInfo(
@@ -209,15 +211,17 @@
PP_Resource ResourceCreationProxy::CreateFileChooser(
PP_Instance instance,
PP_FileChooserMode_Dev mode,
- const char* accept_types) {
+ const PP_Var& accept_types) {
+ scoped_refptr<StringVar> string_var = StringVar::FromPPVar(accept_types);
+ std::string str = string_var ? string_var->value() : std::string();
return (new FileChooserResource(GetConnection(), instance, mode,
- accept_types))->GetReference();
+ str.c_str()))->GetReference();
}
PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance,
- const PP_Size& size,
+ const PP_Size* size,
PP_Bool is_always_opaque) {
- return (new Graphics2DResource(GetConnection(), instance, size,
+ return (new Graphics2DResource(GetConnection(), instance, *size,
is_always_opaque))->GetReference();
}
@@ -246,16 +250,16 @@
PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance,
PP_ImageDataFormat format,
- const PP_Size& size,
+ const PP_Size* size,
PP_Bool init_to_zero) {
- return PPB_ImageData_Proxy::CreateProxyResource(instance, format, size,
+ return PPB_ImageData_Proxy::CreateProxyResource(instance, format, *size,
init_to_zero);
}
PP_Resource ResourceCreationProxy::CreateImageDataNaCl(
PP_Instance instance,
PP_ImageDataFormat format,
- const PP_Size& size,
+ const PP_Size* size,
PP_Bool init_to_zero) {
// These really only are different on the host side. On the plugin side, we
// always request a "platform" ImageData if we're trusted, or a "NaCl" one
@@ -327,13 +331,6 @@
return PPB_Buffer_Proxy::CreateProxyResource(instance, size);
}
-PP_Resource ResourceCreationProxy::CreateDirectoryReader(
- PP_Instance instance,
- PP_Resource directory_ref) {
- return (new DirectoryReaderResource(
- GetConnection(), instance, directory_ref))->GetReference();
-}
-
PP_Resource ResourceCreationProxy::CreateFlashDeviceID(PP_Instance instance) {
return (new FlashDeviceIDResource(GetConnection(), instance))->GetReference();
}
@@ -387,6 +384,17 @@
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 2a95c12..404c219 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -38,7 +38,8 @@
// ResourceCreationAPI (called in plugin).
virtual PP_Resource CreateFileIO(PP_Instance instance) OVERRIDE;
- virtual PP_Resource CreateFileRef(PP_Resource file_system,
+ virtual PP_Resource CreateFileRef(PP_Instance instance,
+ PP_Resource file_system,
const char* path) OVERRIDE;
virtual PP_Resource CreateFileSystem(PP_Instance instance,
PP_FileSystemType type) OVERRIDE;
@@ -77,11 +78,10 @@
uint32_t size) OVERRIDE;
virtual PP_Resource CreateTrueTypeFont(
PP_Instance instance,
- const PP_TrueTypeFontDesc_Dev& desc) OVERRIDE;
+ const PP_TrueTypeFontDesc_Dev* desc) OVERRIDE;
virtual PP_Resource CreateURLLoader(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateURLRequestInfo(
- PP_Instance instance,
- const URLRequestInfoData& data) OVERRIDE;
+ PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateURLResponseInfo(
PP_Instance instance,
const URLResponseInfoData& data,
@@ -104,9 +104,9 @@
uint32_t sample_frame_count) OVERRIDE;
virtual PP_Resource CreateFileChooser(PP_Instance instance,
PP_FileChooserMode_Dev mode,
- const char* accept_types) OVERRIDE;
+ const PP_Var& accept_types) OVERRIDE;
virtual PP_Resource CreateGraphics2D(PP_Instance pp_instance,
- const PP_Size& size,
+ const PP_Size* size,
PP_Bool is_always_opaque) OVERRIDE;
virtual PP_Resource CreateGraphics3D(PP_Instance instance,
PP_Resource share_context,
@@ -118,11 +118,11 @@
virtual PP_Resource CreateHostResolverPrivate(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateImageData(PP_Instance instance,
PP_ImageDataFormat format,
- const PP_Size& size,
+ const PP_Size* size,
PP_Bool init_to_zero) OVERRIDE;
virtual PP_Resource CreateImageDataNaCl(PP_Instance instance,
PP_ImageDataFormat format,
- const PP_Size& size,
+ const PP_Size* size,
PP_Bool init_to_zero) OVERRIDE;
virtual PP_Resource CreateNetworkMonitor(
PP_Instance instance,
@@ -144,9 +144,6 @@
const PP_BrowserFont_Trusted_Description* description) OVERRIDE;
virtual PP_Resource CreateBuffer(PP_Instance instance,
uint32_t size) OVERRIDE;
- virtual PP_Resource CreateDirectoryReader(
- PP_Instance instance,
- PP_Resource directory_ref) OVERRIDE;
virtual PP_Resource CreateFlashDeviceID(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateFlashFontFile(
PP_Instance instance,
@@ -163,6 +160,8 @@
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/resource_message_test_sink.cc b/ppapi/proxy/resource_message_test_sink.cc
index a2920e3..e76e32a 100644
--- a/ppapi/proxy/resource_message_test_sink.cc
+++ b/ppapi/proxy/resource_message_test_sink.cc
@@ -6,6 +6,7 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/proxy/serialized_handle.h"
namespace ppapi {
namespace proxy {
@@ -92,6 +93,7 @@
: test_sink_(test_sink),
incoming_type_(incoming_type),
result_(result),
+ serialized_handle_(NULL),
reply_msg_(reply_msg) {
}
@@ -113,6 +115,8 @@
ResourceMessageReplyParams reply_params(call_params.pp_resource(),
call_params.sequence());
reply_params.set_result(result_);
+ if (serialized_handle_)
+ reply_params.AppendHandle(*serialized_handle_);
PpapiHostMsg_ResourceSyncCall::WriteReplyParams(
wrapper_reply_msg, reply_params, reply_msg_);
test_sink_->SetSyncReplyMessage(wrapper_reply_msg);
diff --git a/ppapi/proxy/resource_message_test_sink.h b/ppapi/proxy/resource_message_test_sink.h
index f5f97cf..cbbece3 100644
--- a/ppapi/proxy/resource_message_test_sink.h
+++ b/ppapi/proxy/resource_message_test_sink.h
@@ -14,6 +14,7 @@
class ResourceMessageCallParams;
class ResourceMessageReplyParams;
+class SerializedHandle;
// Extends IPC::TestSink to add extra capabilities for searching for and
// decoding resource messages.
@@ -77,10 +78,17 @@
IPC::Message last_handled_msg() { return last_handled_msg_; }
+ // Sets a handle to be appended to the ReplyParams. The pointer is owned by
+ // the caller.
+ void set_serialized_handle(const SerializedHandle* serialized_handle) {
+ serialized_handle_ = serialized_handle;
+ }
+
private:
ResourceMessageTestSink* test_sink_;
uint32 incoming_type_;
int32_t result_;
+ const SerializedHandle* serialized_handle_; // Non-owning pointer.
IPC::Message reply_msg_;
IPC::Message last_handled_msg_;
};
diff --git a/ppapi/proxy/serialized_structs.h b/ppapi/proxy/serialized_structs.h
index 4844d6b..2b403b4 100644
--- a/ppapi/proxy/serialized_structs.h
+++ b/ppapi/proxy/serialized_structs.h
@@ -117,6 +117,7 @@
base::SharedMemoryHandle handle;
};
+// TODO(raymes): Make ImageHandle compatible with SerializedHandle.
#if defined(OS_WIN)
typedef HANDLE ImageHandle;
#elif defined(OS_MACOSX) || defined(OS_ANDROID)
diff --git a/ppapi/proxy/serialized_var.cc b/ppapi/proxy/serialized_var.cc
index 698d920..2f4a396 100644
--- a/ppapi/proxy/serialized_var.cc
+++ b/ppapi/proxy/serialized_var.cc
@@ -18,11 +18,6 @@
namespace ppapi {
namespace proxy {
-// When sending array buffers, if the size is over 256K, we use shared
-// memory instead of sending the data over IPC. Light testing suggests
-// shared memory is much faster for 256K and larger messages.
-static const uint32 kMinimumArrayBufferSizeForShmem = 256 * 1024;
-
// SerializedVar::Inner --------------------------------------------------------
SerializedVar::Inner::Inner()
@@ -63,7 +58,16 @@
PP_Var SerializedVar::Inner::GetVar() {
DCHECK(serialization_rules_);
- ConvertRawVarData();
+#if defined(NACL_WIN64)
+ NOTREACHED();
+ return PP_MakeUndefined();
+#endif
+
+ if (raw_var_data_.get()) {
+ var_ = raw_var_data_->CreatePPVar(instance_);
+ raw_var_data_.reset(NULL);
+ }
+
return var_;
}
@@ -84,21 +88,6 @@
raw_var_data_.reset(NULL);
}
-void SerializedVar::Inner::WriteRawVarHeader(IPC::Message* m) const {
- // Write raw_var_data_ when we're called from
- // chrome/nacl/nacl_ipc_adapter.cc.
- DCHECK(raw_var_data_.get());
- DCHECK_EQ(PP_VARTYPE_ARRAY_BUFFER, raw_var_data_->type);
- DCHECK(raw_var_data_->shmem_size != 0);
-
- // The serialization for this message MUST MATCH the implementation at
- // SerializedVar::Inner::WriteToMessage for ARRAY_BUFFER_SHMEM_PLUGIN.
- m->WriteInt(static_cast<int>(raw_var_data_->type));
- m->WriteInt(ARRAY_BUFFER_SHMEM_PLUGIN);
- m->WriteInt(raw_var_data_->shmem_size);
- // NaClIPCAdapter will write the handles for us.
-}
-
void SerializedVar::Inner::WriteToMessage(IPC::Message* m) const {
// When writing to the IPC messages, a serialization rules handler should
// always have been set.
@@ -118,92 +107,7 @@
DCHECK(!has_been_serialized_);
has_been_serialized_ = true;
#endif
-
- DCHECK(!raw_var_data_.get());
- m->WriteInt(static_cast<int>(var_.type));
- switch (var_.type) {
- case PP_VARTYPE_UNDEFINED:
- case PP_VARTYPE_NULL:
- // These don't need any data associated with them other than the type we
- // just serialized.
- break;
- case PP_VARTYPE_BOOL:
- m->WriteBool(PP_ToBool(var_.value.as_bool));
- break;
- case PP_VARTYPE_INT32:
- m->WriteInt(var_.value.as_int);
- break;
- case PP_VARTYPE_DOUBLE:
- IPC::ParamTraits<double>::Write(m, var_.value.as_double);
- break;
- case PP_VARTYPE_STRING: {
- // TODO(brettw) in the case of an invalid string ID, it would be nice
- // to send something to the other side such that a 0 ID would be
- // generated there. Then the function implementing the interface can
- // handle the invalid string as if it was in process rather than seeing
- // what looks like a valid empty string.
- StringVar* string_var = StringVar::FromPPVar(var_);
- m->WriteString(string_var ? *string_var->ptr() : std::string());
- break;
- }
- case PP_VARTYPE_ARRAY_BUFFER: {
- // TODO(dmichael) in the case of an invalid var ID, it would be nice
- // to send something to the other side such that a 0 ID would be
- // generated there. Then the function implementing the interface can
- // handle the invalid string as if it was in process rather than seeing
- // what looks like a valid empty ArraryBuffer.
- ArrayBufferVar* buffer_var = ArrayBufferVar::FromPPVar(var_);
- bool using_shmem = false;
- if (buffer_var &&
- buffer_var->ByteLength() >= kMinimumArrayBufferSizeForShmem &&
- instance_ != 0) {
- int host_shm_handle_id;
- base::SharedMemoryHandle plugin_shm_handle;
- using_shmem = buffer_var->CopyToNewShmem(instance_,
- &host_shm_handle_id,
- &plugin_shm_handle);
- if (using_shmem) {
- // The serialization for this message MUST MATCH the implementation
- // at SerializedVar::Inner::WriteRawVarHeader for
- // ARRAY_BUFFER_SHMEM_PLUGIN.
- if (host_shm_handle_id != -1) {
- DCHECK(!base::SharedMemory::IsHandleValid(plugin_shm_handle));
- DCHECK(PpapiGlobals::Get()->IsPluginGlobals());
- m->WriteInt(ARRAY_BUFFER_SHMEM_HOST);
- m->WriteInt(host_shm_handle_id);
- } else {
- DCHECK(base::SharedMemory::IsHandleValid(plugin_shm_handle));
- DCHECK(PpapiGlobals::Get()->IsHostGlobals());
- m->WriteInt(ARRAY_BUFFER_SHMEM_PLUGIN);
- m->WriteInt(buffer_var->ByteLength());
- SerializedHandle handle(plugin_shm_handle,
- buffer_var->ByteLength());
- IPC::ParamTraits<SerializedHandle>::Write(m, handle);
- }
- }
- }
- if (!using_shmem) {
- if (buffer_var) {
- m->WriteInt(ARRAY_BUFFER_NO_SHMEM);
- m->WriteData(static_cast<const char*>(buffer_var->Map()),
- buffer_var->ByteLength());
- } else {
- // TODO(teravest): Introduce an ARRAY_BUFFER_EMPTY message type.
- m->WriteBool(ARRAY_BUFFER_NO_SHMEM);
- m->WriteData(NULL, 0);
- }
- }
- break;
- }
- case PP_VARTYPE_OBJECT:
- m->WriteInt64(var_.value.as_id);
- break;
- case PP_VARTYPE_ARRAY:
- case PP_VARTYPE_DICTIONARY:
- // TODO(yzshen) when these are supported, implement this.
- NOTIMPLEMENTED();
- break;
- }
+ RawVarDataGraph::Create(var_, instance_)->Write(m);
}
bool SerializedVar::Inner::ReadFromMessage(const IPC::Message* m,
@@ -221,99 +125,8 @@
#endif
// When reading, the dispatcher should be set when we get a Deserialize
// call (which will supply a dispatcher).
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
-
- bool success = false;
- switch (type) {
- case PP_VARTYPE_UNDEFINED:
- case PP_VARTYPE_NULL:
- // These don't have any data associated with them other than the type we
- // just serialized.
- success = true;
- break;
- case PP_VARTYPE_BOOL: {
- bool bool_value;
- success = m->ReadBool(iter, &bool_value);
- var_.value.as_bool = PP_FromBool(bool_value);
- break;
- }
- case PP_VARTYPE_INT32:
- success = m->ReadInt(iter, &var_.value.as_int);
- break;
- case PP_VARTYPE_DOUBLE:
- success = IPC::ParamTraits<double>::Read(m, iter, &var_.value.as_double);
- break;
- case PP_VARTYPE_STRING: {
- raw_var_data_.reset(new RawVarData);
- raw_var_data_->type = PP_VARTYPE_STRING;
- success = m->ReadString(iter, &raw_var_data_->data);
- if (!success)
- raw_var_data_.reset(NULL);
- break;
- }
- case PP_VARTYPE_ARRAY_BUFFER: {
- int length = 0;
- const char* message_bytes = NULL;
- int shmem_type;
- success = m->ReadInt(iter, &shmem_type);
- if (success) {
- if (shmem_type == ARRAY_BUFFER_NO_SHMEM) {
- success = m->ReadData(iter, &message_bytes, &length);
- if (success) {
- raw_var_data_.reset(new RawVarData);
- raw_var_data_->type = PP_VARTYPE_ARRAY_BUFFER;
- raw_var_data_->shmem_type = static_cast<ShmemType>(shmem_type);
- raw_var_data_->shmem_size = 0;
- raw_var_data_->data.assign(message_bytes, length);
- }
- } else if (shmem_type == ARRAY_BUFFER_SHMEM_HOST) {
- int host_handle_id;
- success = m->ReadInt(iter, &host_handle_id);
- if (success) {
- raw_var_data_.reset(new RawVarData);
- raw_var_data_->type = PP_VARTYPE_ARRAY_BUFFER;
- raw_var_data_->shmem_type = static_cast<ShmemType>(shmem_type);
- raw_var_data_->host_handle_id = host_handle_id;
- }
- } else if (shmem_type == ARRAY_BUFFER_SHMEM_PLUGIN) {
- SerializedHandle plugin_handle;
- success = m->ReadInt(iter, &length);
- success &= IPC::ParamTraits<SerializedHandle>::Read(
- m, iter, &plugin_handle);
- if (success) {
- raw_var_data_.reset(new RawVarData);
- raw_var_data_->type = PP_VARTYPE_ARRAY_BUFFER;
- raw_var_data_->shmem_type = static_cast<ShmemType>(shmem_type);
- raw_var_data_->shmem_size = length;
- raw_var_data_->plugin_handle = plugin_handle;
- }
- }
- }
- break;
- }
- case PP_VARTYPE_OBJECT:
- success = m->ReadInt64(iter, &var_.value.as_id);
- break;
- case PP_VARTYPE_ARRAY:
- case PP_VARTYPE_DICTIONARY:
- // TODO(yzshen) when these types are supported, implement this.
- NOTIMPLEMENTED();
- break;
- default:
- // Leave success as false.
- break;
- }
-
- // All success cases get here. We avoid writing the type above so that the
- // output param is untouched (defaults to VARTYPE_UNDEFINED) even in the
- // failure case.
- // We also don't write the type if |raw_var_data_| is set. |var_| will be
- // updated lazily when GetVar() is called.
- if (success && !raw_var_data_.get())
- var_.type = static_cast<PP_VarType>(type);
- return success;
+ raw_var_data_ = RawVarDataGraph::Read(m, iter);
+ return raw_var_data_.get() != NULL;
}
void SerializedVar::Inner::SetCleanupModeToEndSendPassRef() {
@@ -324,66 +137,6 @@
cleanup_mode_ = END_RECEIVE_CALLER_OWNED;
}
-void SerializedVar::Inner::ConvertRawVarData() {
-#if defined(NACL_WIN64)
- NOTREACHED();
-#else
- if (!raw_var_data_.get())
- return;
-
- DCHECK_EQ(PP_VARTYPE_UNDEFINED, var_.type);
- switch (raw_var_data_->type) {
- case PP_VARTYPE_STRING: {
- var_ = StringVar::SwapValidatedUTF8StringIntoPPVar(
- &raw_var_data_->data);
- break;
- }
- case PP_VARTYPE_ARRAY_BUFFER: {
- if (raw_var_data_->shmem_type == ARRAY_BUFFER_SHMEM_HOST) {
- base::SharedMemoryHandle host_handle;
- uint32 size_in_bytes;
- bool ok =
- PpapiGlobals::Get()->GetVarTracker()->
- StopTrackingSharedMemoryHandle(raw_var_data_->host_handle_id,
- instance_,
- &host_handle,
- &size_in_bytes);
- if (ok) {
- var_ = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
- size_in_bytes, host_handle);
- } else {
- LOG(ERROR) << "Couldn't find array buffer id: "
- << raw_var_data_->host_handle_id;
- var_ = PP_MakeUndefined();
- }
- } else if (raw_var_data_->shmem_type == ARRAY_BUFFER_SHMEM_PLUGIN) {
- var_ = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
- raw_var_data_->shmem_size,
- raw_var_data_->plugin_handle.shmem());
- } else {
- var_ = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
- static_cast<uint32>(raw_var_data_->data.size()),
- raw_var_data_->data.data());
- }
- break;
- }
- default:
- NOTREACHED();
- }
- raw_var_data_.reset(NULL);
-#endif
-}
-
-SerializedHandle* SerializedVar::Inner::GetPluginShmemHandle() const {
- if (raw_var_data_.get()) {
- if (raw_var_data_->type == PP_VARTYPE_ARRAY_BUFFER) {
- if (raw_var_data_->shmem_size != 0)
- return &raw_var_data_->plugin_handle;
- }
- }
- return NULL;
-}
-
// SerializedVar ---------------------------------------------------------------
SerializedVar::SerializedVar() : inner_(new Inner) {
diff --git a/ppapi/proxy/serialized_var.h b/ppapi/proxy/serialized_var.h
index f283590..7c3349f 100644
--- a/ppapi/proxy/serialized_var.h
+++ b/ppapi/proxy/serialized_var.h
@@ -15,6 +15,7 @@
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/proxy/raw_var_data.h"
#include "ppapi/proxy/serialized_handle.h"
#include "ppapi/proxy/serialized_structs.h"
#include "ppapi/proxy/var_serialization_rules.h"
@@ -83,12 +84,8 @@
return inner_->ReadFromMessage(m, iter);
}
- // Used by chrome/nacl/nacl_ipc_adapter.cc
- SerializedHandle* GetPluginShmemHandle() const {
- return inner_->GetPluginShmemHandle();
- }
- void WriteRawVarHeader(IPC::Message* m) const {
- inner_->WriteRawVarHeader(m);
+ RawVarDataGraph* raw_var_data() const {
+ return inner_->raw_var_data();
}
protected:
@@ -113,6 +110,10 @@
serialization_rules_ = serialization_rules;
}
+ RawVarDataGraph* raw_var_data() {
+ return raw_var_data_.get();
+ }
+
// See outer class's declarations above.
PP_Var GetVar();
void SetVar(PP_Var var);
@@ -129,12 +130,6 @@
void SetCleanupModeToEndSendPassRef();
void SetCleanupModeToEndReceiveCallerOwned();
- // Returns a handle in the underlying data, if it exists.
- SerializedHandle* GetPluginShmemHandle() const;
-
- // Writes raw var data, excluding handles.
- void WriteRawVarHeader(IPC::Message* m) const;
-
private:
enum CleanupMode {
// The serialized var won't do anything special in the destructor
@@ -148,32 +143,6 @@
END_RECEIVE_CALLER_OWNED
};
- // Enum for array buffer message types.
- enum ShmemType {
- ARRAY_BUFFER_NO_SHMEM,
- ARRAY_BUFFER_SHMEM_HOST,
- ARRAY_BUFFER_SHMEM_PLUGIN,
- };
-
- // ReadFromMessage() may be called on the I/O thread, e.g., when reading the
- // reply to a sync message. We cannot use the var tracker on the I/O thread,
- // which means we cannot create PP_Var for PP_VARTYPE_STRING and
- // PP_VARTYPE_ARRAY_BUFFER in ReadFromMessage(). So we save the raw var data
- // and create PP_Var later when GetVar() is called, which should happen on
- // the main thread.
- struct RawVarData {
- PP_VarType type;
- ShmemType shmem_type;
- std::string data;
- uint32 shmem_size;
- int host_handle_id;
- SerializedHandle plugin_handle;
- };
-
- // Converts |raw_var_data_| to |var_|. It is a no-op if |raw_var_data_| is
- // NULL.
- void ConvertRawVarData();
-
// Rules for serializing and deserializing vars for this process type.
// This may be NULL, but must be set before trying to serialize to IPC when
// sending, or before converting back to a PP_Var when receiving.
@@ -200,10 +169,12 @@
mutable bool has_been_deserialized_;
#endif
- // It will be non-NULL if there is PP_VARTYPE_STRING or
- // PP_VARTYPE_ARRAY_BUFFER data from ReadFromMessage() that hasn't been
- // converted to PP_Var.
- scoped_ptr<RawVarData> raw_var_data_;
+ // ReadFromMessage() may be called on the I/O thread, e.g., when reading the
+ // reply to a sync message. We cannot use the var tracker on the I/O thread,
+ // which means we cannot create some types of PP_Var
+ // (e.g. PP_VARTYPE_STRING). The data is stored in |raw_var_data_| and the
+ // PP_Var is constructed when |GetVar()| is called.
+ scoped_ptr<RawVarDataGraph> raw_var_data_;
DISALLOW_COPY_AND_ASSIGN(Inner);
};
@@ -499,9 +470,6 @@
public:
explicit SerializedVarTestReader(const SerializedVar& var);
- // The "incomplete" var is the one sent over the wire. Strings and object
- // IDs have not yet been converted, so this is the thing that tests will
- // actually want to check.
PP_Var GetVar() const { return inner_->GetVar(); }
};
diff --git a/ppapi/proxy/truetype_font_resource.cc b/ppapi/proxy/truetype_font_resource.cc
index 0b07195..1de32ab 100644
--- a/ppapi/proxy/truetype_font_resource.cc
+++ b/ppapi/proxy/truetype_font_resource.cc
@@ -44,7 +44,6 @@
int32_t TrueTypeFontResource::Describe(
PP_TrueTypeFontDesc_Dev* desc,
scoped_refptr<TrackedCallback> callback) {
-
Call<PpapiPluginMsg_TrueTypeFont_DescribeReply>(RENDERER,
PpapiHostMsg_TrueTypeFont_Describe(),
base::Bind(&TrueTypeFontResource::OnPluginMsgDescribeComplete, this,
@@ -83,6 +82,7 @@
int32_t result = params.result();
if (result == PP_OK)
desc.CopyToPPTrueTypeFontDesc(pp_desc);
+
callback->Run(result);
}
diff --git a/ppapi/proxy/truetype_font_singleton_resource.cc b/ppapi/proxy/truetype_font_singleton_resource.cc
index b812bf1..1fee97b 100644
--- a/ppapi/proxy/truetype_font_singleton_resource.cc
+++ b/ppapi/proxy/truetype_font_singleton_resource.cc
@@ -5,9 +5,12 @@
#include "ppapi/proxy/truetype_font_singleton_resource.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/serialized_structs.h"
#include "ppapi/shared_impl/array_writer.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/shared_impl/var.h"
+#include "ppapi/shared_impl/var_tracker.h"
namespace ppapi {
namespace proxy {
@@ -39,11 +42,30 @@
return PP_OK_COMPLETIONPENDING;
}
+int32_t TrueTypeFontSingletonResource::GetFontsInFamily(
+ PP_Instance instance,
+ PP_Var family,
+ const PP_ArrayOutput& output,
+ const scoped_refptr<TrackedCallback>& callback) {
+ scoped_refptr<StringVar> family_var = StringVar::FromPPVar(family);
+ const uint32_t kMaxFamilySizeInBytes = 1024;
+ if (!family_var || family_var->value().size() > kMaxFamilySizeInBytes)
+ return PP_ERROR_BADARGUMENT;
+ Call<PpapiPluginMsg_TrueTypeFontSingleton_GetFontsInFamilyReply>(BROWSER,
+ PpapiHostMsg_TrueTypeFontSingleton_GetFontsInFamily(family_var->value()),
+ base::Bind(
+ &TrueTypeFontSingletonResource::OnPluginMsgGetFontsInFamilyComplete,
+ this, callback, output));
+ return PP_OK_COMPLETIONPENDING;
+}
+
void TrueTypeFontSingletonResource::OnPluginMsgGetFontFamiliesComplete(
scoped_refptr<TrackedCallback> callback,
PP_ArrayOutput array_output,
const ResourceMessageReplyParams& params,
const std::vector<std::string>& font_families) {
+ if (!TrackedCallback::IsPending(callback))
+ return;
// The result code should contain the data size if it's positive.
int32_t result = params.result();
DCHECK((result < 0 && font_families.size() == 0) ||
@@ -64,5 +86,36 @@
callback->Run(result);
}
+void TrueTypeFontSingletonResource::OnPluginMsgGetFontsInFamilyComplete(
+ scoped_refptr<TrackedCallback> callback,
+ PP_ArrayOutput array_output,
+ const ResourceMessageReplyParams& params,
+ const std::vector<SerializedTrueTypeFontDesc>& fonts) {
+ if (!TrackedCallback::IsPending(callback))
+ return;
+ // The result code should contain the data size if it's positive.
+ int32_t result = params.result();
+ DCHECK((result < 0 && fonts.size() == 0) ||
+ result == static_cast<int32_t>(fonts.size()));
+ ArrayWriter output;
+ output.set_pp_array_output(array_output);
+ if (output.is_valid()) {
+ // Convert the message data to an array of PP_TrueTypeFontDesc_Dev structs.
+ // Each desc has an embedded PP_Var containing the family name.
+ std::vector<PP_TrueTypeFontDesc_Dev> pp_fonts(fonts.size());
+ for (size_t i = 0; i < fonts.size(); i++)
+ fonts[i].CopyToPPTrueTypeFontDesc(&pp_fonts[i]);
+
+ if (!output.StoreVector(pp_fonts)) {
+ for (size_t i = 0; i < pp_fonts.size(); i++)
+ PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(pp_fonts[i].family);
+ }
+ } else {
+ result = PP_ERROR_FAILED;
+ }
+
+ callback->Run(result);
+}
+
} // namespace proxy
} // namespace ppapi
diff --git a/ppapi/proxy/truetype_font_singleton_resource.h b/ppapi/proxy/truetype_font_singleton_resource.h
index 03c9c7d..dee5863 100644
--- a/ppapi/proxy/truetype_font_singleton_resource.h
+++ b/ppapi/proxy/truetype_font_singleton_resource.h
@@ -18,7 +18,7 @@
namespace proxy {
-struct SerializedTrueTypeFontDescription;
+struct SerializedTrueTypeFontDesc;
// This handles the singleton calls (that don't take a PP_Resource parameter)
// on the TrueType font interface.
@@ -38,6 +38,11 @@
PP_Instance instance,
const PP_ArrayOutput& output,
const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
+ virtual int32_t GetFontsInFamily(
+ PP_Instance instance,
+ PP_Var family,
+ const PP_ArrayOutput& output,
+ const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
private:
void OnPluginMsgGetFontFamiliesComplete(
@@ -45,6 +50,11 @@
PP_ArrayOutput array_output,
const ResourceMessageReplyParams& params,
const std::vector<std::string>& data);
+ void OnPluginMsgGetFontsInFamilyComplete(
+ scoped_refptr<TrackedCallback> callback,
+ PP_ArrayOutput array_output,
+ const ResourceMessageReplyParams& params,
+ const std::vector<SerializedTrueTypeFontDesc>& fonts);
DISALLOW_COPY_AND_ASSIGN(TrueTypeFontSingletonResource);
};
diff --git a/ppapi/proxy/video_capture_resource.cc b/ppapi/proxy/video_capture_resource.cc
index ca88adf..6ea8bd5 100644
--- a/ppapi/proxy/video_capture_resource.cc
+++ b/ppapi/proxy/video_capture_resource.cc
@@ -24,7 +24,7 @@
PluginDispatcher* dispatcher)
: PluginResource(connection, instance),
open_state_(BEFORE_OPEN),
- ALLOW_THIS_IN_INITIALIZER_LIST(enumeration_helper_(this)) {
+ enumeration_helper_(this) {
SendCreate(RENDERER, PpapiHostMsg_VideoCapture_Create());
ppp_video_capture_impl_ = static_cast<const PPP_VideoCapture_Dev*>(
@@ -158,7 +158,7 @@
PluginResourceTracker* tracker =
PluginGlobals::Get()->plugin_resource_tracker();
- scoped_array<PP_Resource> resources(new PP_Resource[buffers.size()]);
+ scoped_ptr<PP_Resource[]> resources(new PP_Resource[buffers.size()]);
for (size_t i = 0; i < buffers.size(); ++i) {
// We assume that the browser created a new set of resources.
DCHECK(!tracker->PluginResourceForHostResource(buffers[i]));
diff --git a/ppapi/proxy/video_destination_resource.cc b/ppapi/proxy/video_destination_resource.cc
new file mode 100644
index 0000000..b08d063
--- /dev/null
+++ b/ppapi/proxy/video_destination_resource.cc
@@ -0,0 +1,102 @@
+// 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/video_destination_resource.h"
+
+#include "base/bind.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_image_data_api.h"
+
+using ppapi::thunk::EnterResourceNoLock;
+using ppapi::thunk::PPB_VideoDestination_Private_API;
+
+namespace ppapi {
+namespace proxy {
+
+VideoDestinationResource::VideoDestinationResource(
+ Connection connection,
+ PP_Instance instance)
+ : PluginResource(connection, instance),
+ is_open_(false) {
+ SendCreate(RENDERER, PpapiHostMsg_VideoDestination_Create());
+}
+
+VideoDestinationResource::~VideoDestinationResource() {
+}
+
+PPB_VideoDestination_Private_API*
+ VideoDestinationResource::AsPPB_VideoDestination_Private_API() {
+ return this;
+}
+
+int32_t VideoDestinationResource::Open(
+ const PP_Var& stream_url,
+ scoped_refptr<TrackedCallback> callback) {
+ if (TrackedCallback::IsPending(open_callback_))
+ return PP_ERROR_INPROGRESS;
+
+ open_callback_ = callback;
+
+ scoped_refptr<StringVar> stream_url_var = StringVar::FromPPVar(stream_url);
+ const uint32_t kMaxStreamIdSizeInBytes = 16384;
+ if (!stream_url_var ||
+ stream_url_var->value().size() > kMaxStreamIdSizeInBytes)
+ return PP_ERROR_BADARGUMENT;
+ Call<PpapiPluginMsg_VideoDestination_OpenReply>(RENDERER,
+ PpapiHostMsg_VideoDestination_Open(stream_url_var->value()),
+ base::Bind(&VideoDestinationResource::OnPluginMsgOpenComplete, this));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t VideoDestinationResource::PutFrame(
+ const PP_VideoFrame_Private& frame) {
+ if (!is_open_)
+ return PP_ERROR_FAILED;
+
+ thunk::EnterResourceNoLock<thunk::PPB_ImageData_API> enter_image(
+ frame.image_data, true);
+ if (enter_image.failed())
+ return PP_ERROR_BADRESOURCE;
+
+ // Check that the PP_Instance matches.
+ Resource* image_object =
+ PpapiGlobals::Get()->GetResourceTracker()->GetResource(frame.image_data);
+ if (!image_object || pp_instance() != image_object->pp_instance()) {
+ Log(PP_LOGLEVEL_ERROR,
+ "VideoDestinationPrivateResource.PutFrame: Bad image resource.");
+ return PP_ERROR_BADRESOURCE;
+ }
+
+ Post(RENDERER,
+ PpapiHostMsg_VideoDestination_PutFrame(image_object->host_resource(),
+ frame.timestamp));
+ return PP_OK;
+}
+
+void VideoDestinationResource::Close() {
+ Post(RENDERER, PpapiHostMsg_VideoDestination_Close());
+
+ if (TrackedCallback::IsPending(open_callback_))
+ open_callback_->PostAbort();
+}
+
+void VideoDestinationResource::OnPluginMsgOpenComplete(
+ const ResourceMessageReplyParams& params) {
+ if (TrackedCallback::IsPending(open_callback_)) {
+ int32_t result = params.result();
+ if (result == PP_OK)
+ is_open_ = true;
+ open_callback_->Run(result);
+ }
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/video_destination_resource.h b/ppapi/proxy/video_destination_resource.h
new file mode 100644
index 0000000..91c0d1d
--- /dev/null
+++ b/ppapi/proxy/video_destination_resource.h
@@ -0,0 +1,56 @@
+// 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_VIDEO_DESTINATION_RESOURCE_H_
+#define PPAPI_PROXY_VIDEO_DESTINATION_RESOURCE_H_
+
+#include <string>
+
+#include "ppapi/c/pp_var.h"
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/thunk/ppb_video_destination_private_api.h"
+
+struct PP_VideoFrame_Private;
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT VideoDestinationResource
+ : public PluginResource,
+ public thunk::PPB_VideoDestination_Private_API {
+ public:
+ VideoDestinationResource(Connection connection,
+ PP_Instance instance);
+ virtual ~VideoDestinationResource();
+
+ // Resource overrides.
+ virtual thunk::PPB_VideoDestination_Private_API*
+ AsPPB_VideoDestination_Private_API() OVERRIDE;
+
+ // PPB_VideoDestination_Private_API implementation.
+ virtual int32_t Open(
+ const PP_Var& stream_url,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
+ virtual int32_t PutFrame(const PP_VideoFrame_Private& frame) OVERRIDE;
+ virtual void Close() OVERRIDE;
+
+ private:
+ void OnPluginMsgOpenComplete(
+ const ResourceMessageReplyParams& params);
+
+ scoped_refptr<TrackedCallback> open_callback_;
+ bool is_open_;
+
+ DISALLOW_COPY_AND_ASSIGN(VideoDestinationResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_VIDEO_DESTINATION_RESOURCE_H_
diff --git a/ppapi/proxy/video_source_resource.cc b/ppapi/proxy/video_source_resource.cc
new file mode 100644
index 0000000..4585eb3
--- /dev/null
+++ b/ppapi/proxy/video_source_resource.cc
@@ -0,0 +1,112 @@
+// 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/video_source_resource.h"
+
+#include "base/bind.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+
+using ppapi::thunk::EnterResourceNoLock;
+using ppapi::thunk::PPB_VideoSource_Private_API;
+
+namespace ppapi {
+namespace proxy {
+
+VideoSourceResource::VideoSourceResource(
+ Connection connection,
+ PP_Instance instance)
+ : PluginResource(connection, instance),
+ is_open_(false) {
+ SendCreate(RENDERER, PpapiHostMsg_VideoSource_Create());
+}
+
+VideoSourceResource::~VideoSourceResource() {
+}
+
+PPB_VideoSource_Private_API*
+ VideoSourceResource::AsPPB_VideoSource_Private_API() {
+ return this;
+}
+
+int32_t VideoSourceResource::Open(
+ const PP_Var& stream_url,
+ scoped_refptr<TrackedCallback> callback) {
+ if (TrackedCallback::IsPending(open_callback_))
+ return PP_ERROR_INPROGRESS;
+
+ open_callback_ = callback;
+
+ scoped_refptr<StringVar> stream_url_var = StringVar::FromPPVar(stream_url);
+ const uint32_t kMaxStreamIdSizeInBytes = 16384;
+ if (!stream_url_var ||
+ stream_url_var->value().size() > kMaxStreamIdSizeInBytes)
+ return PP_ERROR_BADARGUMENT;
+ Call<PpapiPluginMsg_VideoSource_OpenReply>(RENDERER,
+ PpapiHostMsg_VideoSource_Open(stream_url_var->value()),
+ base::Bind(&VideoSourceResource::OnPluginMsgOpenComplete, this));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t VideoSourceResource::GetFrame(
+ PP_VideoFrame_Private* frame,
+ scoped_refptr<TrackedCallback> callback) {
+ if (!is_open_)
+ return PP_ERROR_FAILED;
+
+ if (TrackedCallback::IsPending(get_frame_callback_))
+ return PP_ERROR_INPROGRESS;
+
+ get_frame_callback_ = callback;
+
+ Call<PpapiPluginMsg_VideoSource_GetFrameReply>(RENDERER,
+ PpapiHostMsg_VideoSource_GetFrame(),
+ base::Bind(&VideoSourceResource::OnPluginMsgGetFrameComplete, this,
+ frame));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+void VideoSourceResource::Close() {
+ Post(RENDERER, PpapiHostMsg_VideoSource_Close());
+
+ if (TrackedCallback::IsPending(open_callback_))
+ open_callback_->PostAbort();
+ if (TrackedCallback::IsPending(get_frame_callback_))
+ get_frame_callback_->PostAbort();
+}
+
+void VideoSourceResource::OnPluginMsgOpenComplete(
+ const ResourceMessageReplyParams& params) {
+ if (TrackedCallback::IsPending(open_callback_)) {
+ int32_t result = params.result();
+ if (result == PP_OK)
+ is_open_ = true;
+ open_callback_->Run(result);
+ }
+}
+
+void VideoSourceResource::OnPluginMsgGetFrameComplete(
+ PP_VideoFrame_Private* frame,
+ const ResourceMessageReplyParams& params,
+ const HostResource& image_data,
+ PP_TimeTicks timestamp) {
+ // The callback may have been aborted by Close().
+ if (TrackedCallback::IsPending(get_frame_callback_)) {
+ int32_t result = params.result();
+ if (result == PP_OK) {
+ frame->timestamp = timestamp;
+ frame->image_data = image_data.host_resource();
+ }
+ get_frame_callback_->Run(result);
+ }
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/video_source_resource.h b/ppapi/proxy/video_source_resource.h
new file mode 100644
index 0000000..641a723
--- /dev/null
+++ b/ppapi/proxy/video_source_resource.h
@@ -0,0 +1,65 @@
+// 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_VIDEO_SOURCE_RESOURCE_H_
+#define PPAPI_PROXY_VIDEO_SOURCE_RESOURCE_H_
+
+#include <string>
+
+#include "ppapi/c/pp_time.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/thunk/ppb_video_source_private_api.h"
+
+struct PP_VideoFrame_Private;
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT VideoSourceResource
+ : public PluginResource,
+ public thunk::PPB_VideoSource_Private_API {
+ public:
+ VideoSourceResource(Connection connection,
+ PP_Instance instance);
+ virtual ~VideoSourceResource();
+
+ // Resource overrides.
+ virtual thunk::PPB_VideoSource_Private_API*
+ AsPPB_VideoSource_Private_API() OVERRIDE;
+
+ // PPB_VideoSource_Private_API implementation.
+ virtual int32_t Open(
+ const PP_Var& stream_url,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
+ virtual int32_t GetFrame(
+ PP_VideoFrame_Private* frame,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
+ virtual void Close() OVERRIDE;
+
+ private:
+ void OnPluginMsgOpenComplete(
+ const ResourceMessageReplyParams& params);
+ void OnPluginMsgGetFrameComplete(
+ PP_VideoFrame_Private* frame,
+ const ResourceMessageReplyParams& params,
+ const HostResource& image_data,
+ PP_TimeTicks timestamp);
+
+ scoped_refptr<TrackedCallback> open_callback_;
+ scoped_refptr<TrackedCallback> get_frame_callback_;
+ bool is_open_;
+
+ DISALLOW_COPY_AND_ASSIGN(VideoSourceResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_VIDEO_SOURCE_RESOURCE_H_
diff --git a/ppapi/proxy/websocket_resource_unittest.cc b/ppapi/proxy/websocket_resource_unittest.cc
index 56012b3..89ea831 100644
--- a/ppapi/proxy/websocket_resource_unittest.cc
+++ b/ppapi/proxy/websocket_resource_unittest.cc
@@ -7,10 +7,14 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_websocket.h"
#include "ppapi/c/ppb_var.h"
+#include "ppapi/proxy/locking_resource_releaser.h"
#include "ppapi/proxy/websocket_resource.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/ppb_var_shared.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/resource_tracker.h"
#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/shared_impl/scoped_pp_var.h"
#include "ppapi/shared_impl/tracked_callback.h"
@@ -59,11 +63,10 @@
PP_Var url_var = MakeStringVar(url);
PP_Var protocols[] = { MakeStringVar(protocol0), MakeStringVar(protocol1) };
- ScopedPPResource res(ScopedPPResource::PassRef(),
- websocket_iface->Create(pp_instance()));
+ LockingResourceReleaser res(websocket_iface->Create(pp_instance()));
- int32_t result =
- websocket_iface->Connect(res, url_var, protocols, 2, MakeCallback());
+ int32_t result = websocket_iface->Connect(res.get(), url_var, protocols, 2,
+ MakeCallback());
ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
// Should be sent a "Connect" message.
@@ -94,18 +97,17 @@
const PPB_WebSocket_1_0* websocket_iface =
thunk::GetPPB_WebSocket_1_0_Thunk();
- ScopedPPResource res(ScopedPPResource::PassRef(),
- websocket_iface->Create(pp_instance()));
+ LockingResourceReleaser res(websocket_iface->Create(pp_instance()));
// Check if BufferedAmountReply is handled.
- ResourceMessageReplyParams reply_params(res, 0);
+ ResourceMessageReplyParams reply_params(res.get(), 0);
reply_params.set_result(PP_OK);
ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
PpapiPluginMsg_ResourceReply(
reply_params,
PpapiPluginMsg_WebSocket_BufferedAmountReply(19760227u))));
- uint64_t amount = websocket_iface->GetBufferedAmount(res);
+ uint64_t amount = websocket_iface->GetBufferedAmount(res.get());
EXPECT_EQ(19760227u, amount);
// Check if StateReply is handled.
@@ -115,7 +117,7 @@
PpapiPluginMsg_WebSocket_StateReply(
static_cast<int32_t>(PP_WEBSOCKETREADYSTATE_CLOSING)))));
- PP_WebSocketReadyState state = websocket_iface->GetReadyState(res);
+ PP_WebSocketReadyState state = websocket_iface->GetReadyState(res.get());
EXPECT_EQ(PP_WEBSOCKETREADYSTATE_CLOSING, state);
}
@@ -126,12 +128,11 @@
std::string url("ws://ws.google.com");
PP_Var url_var = MakeStringVar(url);
- ScopedPPResource res(ScopedPPResource::PassRef(),
- websocket_iface->Create(pp_instance()));
+ LockingResourceReleaser res(websocket_iface->Create(pp_instance()));
// Establish the connection virtually.
int32_t result =
- websocket_iface->Connect(res, url_var, NULL, 0, MakeCallback());
+ websocket_iface->Connect(res.get(), url_var, NULL, 0, MakeCallback());
ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
ResourceMessageCallParams params;
@@ -150,11 +151,11 @@
EXPECT_TRUE(g_callback_called);
PP_Var message;
- result = websocket_iface->ReceiveMessage(res, &message, MakeCallback());
+ result = websocket_iface->ReceiveMessage(res.get(), &message, MakeCallback());
EXPECT_FALSE(g_callback_called);
// Synthesize a WebSocket_ErrorReply message.
- ResourceMessageReplyParams error_reply_params(res, 0);
+ ResourceMessageReplyParams error_reply_params(res.get(), 0);
error_reply_params.set_result(PP_OK);
ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
PpapiPluginMsg_ResourceReply(error_reply_params,
diff --git a/ppapi/shared_impl/ppapi_globals.cc b/ppapi/shared_impl/ppapi_globals.cc
index be10d4c..9f4aaa3 100644
--- a/ppapi/shared_impl/ppapi_globals.cc
+++ b/ppapi/shared_impl/ppapi_globals.cc
@@ -48,6 +48,10 @@
return main_loop_proxy_.get();
}
+void PpapiGlobals::ResetMainThreadMessageLoopForTesting() {
+ main_loop_proxy_ = base::MessageLoopProxy::current();
+}
+
bool PpapiGlobals::IsHostGlobals() const {
return false;
}
diff --git a/ppapi/shared_impl/ppapi_globals.h b/ppapi/shared_impl/ppapi_globals.h
index 84b90e7..d226c7f 100644
--- a/ppapi/shared_impl/ppapi_globals.h
+++ b/ppapi/shared_impl/ppapi_globals.h
@@ -110,6 +110,11 @@
// constructor, so PpapiGlobals must be created on the main thread.
base::MessageLoopProxy* GetMainThreadMessageLoop();
+ // In tests, the PpapiGlobals object persists across tests but the MLP pointer
+ // it hangs on will go stale and the next PPAPI test will crash because of
+ // thread checks. This resets the pointer to be the current MLP object.
+ void ResetMainThreadMessageLoopForTesting();
+
// Return the MessageLoopShared of the current thread, if any. This will
// always return NULL on the host side, where PPB_MessageLoop is not
// supported.
diff --git a/ppapi/shared_impl/ppapi_nacl_channel_args.cc b/ppapi/shared_impl/ppapi_nacl_channel_args.cc
new file mode 100644
index 0000000..7e20a53
--- /dev/null
+++ b/ppapi/shared_impl/ppapi_nacl_channel_args.cc
@@ -0,0 +1,17 @@
+// 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.
+
+#include "ppapi/shared_impl/ppapi_nacl_channel_args.h"
+
+namespace ppapi {
+
+// We must provide explicit definitions of these functions for builds on
+// Windows.
+PpapiNaClChannelArgs::PpapiNaClChannelArgs() {
+}
+
+PpapiNaClChannelArgs::~PpapiNaClChannelArgs() {
+}
+
+} // namespace ppapi
diff --git a/ppapi/shared_impl/ppapi_nacl_channel_args.h b/ppapi/shared_impl/ppapi_nacl_channel_args.h
new file mode 100644
index 0000000..462a3a0
--- /dev/null
+++ b/ppapi/shared_impl/ppapi_nacl_channel_args.h
@@ -0,0 +1,30 @@
+// 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_SHARED_IMPL_PPAPI_CREATE_NACL_CHANNEL_ARGS_H
+#define PPAPI_SHARED_IMPL_PPAPI_CREATE_NACL_CHANNEL_ARGS_H
+
+#include <string>
+#include <vector>
+
+#include "ppapi/shared_impl/ppapi_permissions.h"
+
+namespace ppapi {
+
+struct PPAPI_SHARED_EXPORT PpapiNaClChannelArgs {
+ public:
+ PpapiNaClChannelArgs();
+ ~PpapiNaClChannelArgs();
+
+ bool off_the_record;
+ PpapiPermissions permissions;
+
+ // Switches from the command-line.
+ std::vector<std::string> switch_names;
+ std::vector<std::string> switch_values;
+};
+
+} // namespace ppapi
+
+#endif // PPAPI_SHARED_IMPL_PPAPI_CREATE_NACL_CHANNEL_ARGS_H
diff --git a/ppapi/shared_impl/ppapi_preferences.cc b/ppapi/shared_impl/ppapi_preferences.cc
index a3ac413..fd2ee97 100644
--- a/ppapi/shared_impl/ppapi_preferences.cc
+++ b/ppapi/shared_impl/ppapi_preferences.cc
@@ -15,7 +15,7 @@
is_stage3d_baseline_supported(false) {
}
-Preferences::Preferences(const webkit_glue::WebPreferences& prefs)
+Preferences::Preferences(const WebPreferences& prefs)
: standard_font_family_map(prefs.standard_font_family_map),
fixed_font_family_map(prefs.fixed_font_family_map),
serif_font_family_map(prefs.serif_font_family_map),
diff --git a/ppapi/shared_impl/ppapi_preferences.h b/ppapi/shared_impl/ppapi_preferences.h
index dad7c0c..852f7b9 100644
--- a/ppapi/shared_impl/ppapi_preferences.h
+++ b/ppapi/shared_impl/ppapi_preferences.h
@@ -8,22 +8,20 @@
#include "ppapi/shared_impl/ppapi_shared_export.h"
#include "webkit/glue/webpreferences.h"
-namespace webkit_glue {
struct WebPreferences;
-}
namespace ppapi {
struct PPAPI_SHARED_EXPORT Preferences {
public:
Preferences();
- explicit Preferences(const webkit_glue::WebPreferences& prefs);
+ explicit Preferences(const WebPreferences& prefs);
~Preferences();
- webkit_glue::WebPreferences::ScriptFontFamilyMap standard_font_family_map;
- webkit_glue::WebPreferences::ScriptFontFamilyMap fixed_font_family_map;
- webkit_glue::WebPreferences::ScriptFontFamilyMap serif_font_family_map;
- webkit_glue::WebPreferences::ScriptFontFamilyMap sans_serif_font_family_map;
+ webkit_glue::ScriptFontFamilyMap standard_font_family_map;
+ webkit_glue::ScriptFontFamilyMap fixed_font_family_map;
+ webkit_glue::ScriptFontFamilyMap serif_font_family_map;
+ webkit_glue::ScriptFontFamilyMap sans_serif_font_family_map;
int default_font_size;
int default_fixed_font_size;
int number_of_cpu_cores;
diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc
index f275559..f6d0cac 100644
--- a/ppapi/shared_impl/ppb_audio_shared.cc
+++ b/ppapi/shared_impl/ppb_audio_shared.cc
@@ -80,8 +80,11 @@
if (!shared_memory_->Map(
media::TotalSharedMemorySizeInBytes(shared_memory_size_))) {
- PpapiGlobals::Get()->LogWithSource(instance, PP_LOGLEVEL_WARNING, "",
- "Failed to map shared memory for PPB_Audio_Shared.");
+ PpapiGlobals::Get()->LogWithSource(
+ instance,
+ PP_LOGLEVEL_WARNING,
+ std::string(),
+ "Failed to map shared memory for PPB_Audio_Shared.");
} else {
audio_bus_ = media::AudioBus::WrapMemory(
kChannels, sample_frame_count, shared_memory_->memory());
diff --git a/ppapi/shared_impl/ppb_audio_shared.h b/ppapi/shared_impl/ppb_audio_shared.h
index 0b6afd4..c164470 100644
--- a/ppapi/shared_impl/ppb_audio_shared.h
+++ b/ppapi/shared_impl/ppb_audio_shared.h
@@ -109,7 +109,7 @@
// Internal buffer for client's integer audio data.
int client_buffer_size_bytes_;
- scoped_array<uint8_t> client_buffer_;
+ scoped_ptr<uint8_t[]> client_buffer_;
DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Shared);
};
diff --git a/ppapi/shared_impl/ppb_device_ref_shared.cc b/ppapi/shared_impl/ppb_device_ref_shared.cc
index 73a9a7c..4f9c14c 100644
--- a/ppapi/shared_impl/ppb_device_ref_shared.cc
+++ b/ppapi/shared_impl/ppb_device_ref_shared.cc
@@ -47,7 +47,7 @@
ResourceObjectType type,
PP_Instance instance,
const std::vector<DeviceRefData>& devices) {
- scoped_array<PP_Resource> elements;
+ scoped_ptr<PP_Resource[]> elements;
size_t size = devices.size();
if (size > 0) {
elements.reset(new PP_Resource[size]);
diff --git a/ppapi/shared_impl/ppb_file_ref_shared.h b/ppapi/shared_impl/ppb_file_ref_shared.h
index 5decd7f..5025eb3 100644
--- a/ppapi/shared_impl/ppb_file_ref_shared.h
+++ b/ppapi/shared_impl/ppb_file_ref_shared.h
@@ -18,12 +18,19 @@
// FileRefs are created in a number of places and they include a number of
// return values. This struct encapsulates everything in one place.
struct PPB_FileRef_CreateInfo {
- PPB_FileRef_CreateInfo() : file_system_type(PP_FILESYSTEMTYPE_EXTERNAL) {}
+ PPB_FileRef_CreateInfo()
+ : file_system_type(PP_FILESYSTEMTYPE_EXTERNAL),
+ file_system_plugin_resource(0) {}
ppapi::HostResource resource;
int file_system_type; // One of PP_FileSystemType values.
std::string path;
std::string name;
+
+ // Since FileRef needs to hold a FileSystem reference, we need to pass the
+ // resource in this CreateInfo. Note that this is a plugin resource as
+ // FileSystem is already in new design.
+ PP_Resource file_system_plugin_resource;
};
// This class provides the shared implementation of a FileRef. The functions
diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc
index e2d0154..e480e0c 100644
--- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc
+++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc
@@ -70,6 +70,12 @@
return DoSwapBuffers();
}
+int32_t PPB_Graphics3D_Shared::GetAttribMaxValue(int32_t attribute,
+ int32_t* value) {
+ // TODO(alokp): Implement me.
+ return PP_ERROR_FAILED;
+}
+
void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target,
GLint level,
GLint xoffset,
diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.h b/ppapi/shared_impl/ppb_graphics_3d_shared.h
index 96bc6bb..482cb4c 100644
--- a/ppapi/shared_impl/ppb_graphics_3d_shared.h
+++ b/ppapi/shared_impl/ppb_graphics_3d_shared.h
@@ -37,6 +37,8 @@
virtual int32_t GetError() OVERRIDE;
virtual int32_t ResizeBuffers(int32_t width, int32_t height) OVERRIDE;
virtual int32_t SwapBuffers(scoped_refptr<TrackedCallback> callback) OVERRIDE;
+ virtual int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) OVERRIDE;
+
virtual void* MapTexSubImage2DCHROMIUM(GLenum target,
GLint level,
GLint xoffset,
diff --git a/ppapi/shared_impl/ppb_image_data_shared.cc b/ppapi/shared_impl/ppb_image_data_shared.cc
index abdea60..4201a1e 100644
--- a/ppapi/shared_impl/ppb_image_data_shared.cc
+++ b/ppapi/shared_impl/ppb_image_data_shared.cc
@@ -36,10 +36,10 @@
}
// static
-bool PPB_ImageData_Shared::IsImageDataFormatSupported(
+PP_Bool PPB_ImageData_Shared::IsImageDataFormatSupported(
PP_ImageDataFormat format) {
- return format == PP_IMAGEDATAFORMAT_BGRA_PREMUL ||
- format == PP_IMAGEDATAFORMAT_RGBA_PREMUL;
+ return PP_FromBool(format == PP_IMAGEDATAFORMAT_BGRA_PREMUL ||
+ format == PP_IMAGEDATAFORMAT_RGBA_PREMUL);
}
} // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_image_data_shared.h b/ppapi/shared_impl/ppb_image_data_shared.h
index 4f9a4d5..0f1f4bb 100644
--- a/ppapi/shared_impl/ppb_image_data_shared.h
+++ b/ppapi/shared_impl/ppb_image_data_shared.h
@@ -23,7 +23,7 @@
class PPAPI_SHARED_EXPORT PPB_ImageData_Shared {
public:
static PP_ImageDataFormat GetNativeImageDataFormat();
- static bool IsImageDataFormatSupported(PP_ImageDataFormat format);
+ static PP_Bool IsImageDataFormatSupported(PP_ImageDataFormat format);
};
} // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_network_list_private_shared.cc b/ppapi/shared_impl/ppb_network_list_private_shared.cc
index 0430289..29874b3 100644
--- a/ppapi/shared_impl/ppb_network_list_private_shared.cc
+++ b/ppapi/shared_impl/ppb_network_list_private_shared.cc
@@ -48,8 +48,8 @@
return object->GetReference();
}
-::ppapi::thunk::PPB_NetworkList_Private_API*
-PPB_NetworkList_Private_Shared::AsPPB_NetworkList_Private_API() {
+::ppapi::thunk::PPB_NetworkList_API*
+PPB_NetworkList_Private_Shared::AsPPB_NetworkList_API() {
return this;
}
diff --git a/ppapi/shared_impl/ppb_network_list_private_shared.h b/ppapi/shared_impl/ppb_network_list_private_shared.h
index 196f386..916cc12 100644
--- a/ppapi/shared_impl/ppb_network_list_private_shared.h
+++ b/ppapi/shared_impl/ppb_network_list_private_shared.h
@@ -11,7 +11,7 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "ppapi/shared_impl/resource.h"
-#include "ppapi/thunk/ppb_network_list_private_api.h"
+#include "ppapi/thunk/ppb_network_list_api.h"
namespace ppapi {
@@ -49,7 +49,7 @@
class PPAPI_SHARED_EXPORT PPB_NetworkList_Private_Shared
: public ::ppapi::Resource,
- public ::ppapi::thunk::PPB_NetworkList_Private_API {
+ public ::ppapi::thunk::PPB_NetworkList_API {
public:
static PP_Resource Create(ResourceObjectType type,
PP_Instance instance,
@@ -58,10 +58,10 @@
virtual ~PPB_NetworkList_Private_Shared();
// Resource override.
- virtual ::ppapi::thunk::PPB_NetworkList_Private_API*
- AsPPB_NetworkList_Private_API() OVERRIDE;
+ virtual ::ppapi::thunk::PPB_NetworkList_API*
+ AsPPB_NetworkList_API() OVERRIDE;
- // PPB_NetworkList_Private_API implementation.
+ // PPB_NetworkList_API implementation.
virtual const NetworkList& GetNetworkListData() const OVERRIDE;
virtual uint32_t GetCount() OVERRIDE;
virtual PP_Var GetName(uint32_t index) OVERRIDE;
diff --git a/ppapi/shared_impl/ppb_trace_event_impl.cc b/ppapi/shared_impl/ppb_trace_event_impl.cc
index 439bbd4..6803fc6 100644
--- a/ppapi/shared_impl/ppb_trace_event_impl.cc
+++ b/ppapi/shared_impl/ppb_trace_event_impl.cc
@@ -23,7 +23,8 @@
// return a pointer type to the caller without some const_cast. The pointer
// type the tracing system works with is normally unsigned char*.
return const_cast<void*>(static_cast<const void*>(
- base::debug::TraceLog::GetInstance()->GetCategoryEnabled(category_name)));
+ base::debug::TraceLog::GetInstance()->GetCategoryGroupEnabled(
+ category_name)));
}
// static
@@ -43,7 +44,7 @@
// 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), flags);
+ reinterpret_cast<const unsigned long long*>(arg_values), NULL, flags);
}
// static
diff --git a/ppapi/shared_impl/ppb_video_decoder_shared.cc b/ppapi/shared_impl/ppb_video_decoder_shared.cc
index ffd422d..7d8d021 100644
--- a/ppapi/shared_impl/ppb_video_decoder_shared.cc
+++ b/ppapi/shared_impl/ppb_video_decoder_shared.cc
@@ -27,6 +27,8 @@
}
PPB_VideoDecoder_Shared::~PPB_VideoDecoder_Shared() {
+ // Destroy() must be called before the object is destroyed.
+ DCHECK(graphics_context_ == 0);
}
thunk::PPB_VideoDecoder_API* PPB_VideoDecoder_Shared::AsPPB_VideoDecoder_API() {
@@ -44,9 +46,12 @@
}
void PPB_VideoDecoder_Shared::Destroy() {
- graphics_context_ = 0;
+ if (graphics_context_) {
+ PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(
+ graphics_context_);
+ graphics_context_ = 0;
+ }
gles2_impl_ = NULL;
- PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(graphics_context_);
}
bool PPB_VideoDecoder_Shared::SetFlushCallback(
diff --git a/ppapi/shared_impl/resource.cc b/ppapi/shared_impl/resource.cc
index f1db8de..2c40961 100644
--- a/ppapi/shared_impl/resource.cc
+++ b/ppapi/shared_impl/resource.cc
@@ -45,7 +45,7 @@
}
Resource::~Resource() {
- PpapiGlobals::Get()->GetResourceTracker()->RemoveResource(this);
+ RemoveFromResourceTracker();
}
PP_Resource Resource::GetReference() {
@@ -79,6 +79,10 @@
message);
}
+void Resource::RemoveFromResourceTracker() {
+ PpapiGlobals::Get()->GetResourceTracker()->RemoveResource(this);
+}
+
#define DEFINE_TYPE_GETTER(RESOURCE) \
thunk::RESOURCE* Resource::As##RESOURCE() { return NULL; }
FOR_ALL_PPAPI_RESOURCE_APIS(DEFINE_TYPE_GETTER)
diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h
index 23522d5..9333a0b 100644
--- a/ppapi/shared_impl/resource.h
+++ b/ppapi/shared_impl/resource.h
@@ -19,6 +19,7 @@
// All resource types should be added here. This implements our hand-rolled
// RTTI system since we don't compile with "real" RTTI.
#define FOR_ALL_PPAPI_RESOURCE_APIS(F) \
+ F(ExtensionsCommon_API) \
F(PPB_Audio_API) \
F(PPB_AudioConfig_API) \
F(PPB_AudioInput_API) \
@@ -29,7 +30,6 @@
F(PPB_BrowserFont_Trusted_API) \
F(PPB_Buffer_API) \
F(PPB_DeviceRef_API) \
- F(PPB_DirectoryReader_API) \
F(PPB_FileChooser_API) \
F(PPB_FileIO_API) \
F(PPB_FileRef_API) \
@@ -51,8 +51,9 @@
F(PPB_InputEvent_API) \
F(PPB_LayerCompositor_API) \
F(PPB_MessageLoop_API) \
- F(PPB_NetworkList_Private_API) \
+ F(PPB_NetworkList_API) \
F(PPB_NetworkMonitor_Private_API) \
+ F(PPB_PDF_API) \
F(PPB_Printing_API) \
F(PPB_ResourceArray_API) \
F(PPB_Scrollbar_API) \
@@ -67,7 +68,9 @@
F(PPB_URLResponseInfo_API) \
F(PPB_VideoCapture_API) \
F(PPB_VideoDecoder_API) \
+ F(PPB_VideoDestination_Private_API) \
F(PPB_VideoLayer_API) \
+ F(PPB_VideoSource_Private_API) \
F(PPB_View_API) \
F(PPB_WebSocket_API) \
F(PPB_Widget_API) \
@@ -206,6 +209,14 @@
// Logs a message to the console from this resource.
void Log(PP_LogLevel level, const std::string& message);
+ // Removes the resource from the ResourceTracker's tables. This normally
+ // happens as part of Resource destruction, but if a subclass destructor
+ // has a risk of re-entering destruction via the ResourceTracker, it can
+ // call this explicitly to get rid of the table entry before continuing
+ // with the destruction. If the resource is not in the ResourceTracker's
+ // tables, silently does nothing. See http://crbug.com/159429.
+ void RemoveFromResourceTracker();
+
// Notifications for subclasses.
virtual void LastPluginRefWasDeleted() {}
virtual void InstanceWasDeleted() {}
diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc
index f7e22eb..da904da 100644
--- a/ppapi/shared_impl/resource_tracker.cc
+++ b/ppapi/shared_impl/resource_tracker.cc
@@ -15,17 +15,25 @@
namespace ppapi {
-ResourceTracker::ResourceTracker()
+ResourceTracker::ResourceTracker(ThreadMode thread_mode)
: last_resource_value_(0),
- ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
+ weak_ptr_factory_(this) {
+ if (thread_mode == SINGLE_THREADED)
+ thread_checker_.reset(new base::ThreadChecker);
}
ResourceTracker::~ResourceTracker() {
}
-Resource* ResourceTracker::GetResource(PP_Resource res) const {
- CHECK(thread_checker_.CalledOnValidThread());
+void ResourceTracker::CheckThreadingPreconditions() const {
+ DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread());
+#ifndef NDEBUG
ProxyLock::AssertAcquired();
+#endif
+}
+
+Resource* ResourceTracker::GetResource(PP_Resource res) const {
+ CheckThreadingPreconditions();
ResourceMap::const_iterator i = live_resources_.find(res);
if (i == live_resources_.end())
return NULL;
@@ -33,7 +41,7 @@
}
void ResourceTracker::AddRefResource(PP_Resource res) {
- CHECK(thread_checker_.CalledOnValidThread());
+ CheckThreadingPreconditions();
DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE))
<< res << " is not a PP_Resource.";
ResourceMap::iterator i = live_resources_.find(res);
@@ -55,7 +63,7 @@
}
void ResourceTracker::ReleaseResource(PP_Resource res) {
- CHECK(thread_checker_.CalledOnValidThread());
+ CheckThreadingPreconditions();
DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE))
<< res << " is not a PP_Resource.";
ResourceMap::iterator i = live_resources_.find(res);
@@ -78,7 +86,7 @@
}
void ResourceTracker::ReleaseResourceSoon(PP_Resource res) {
- MessageLoop::current()->PostNonNestableTask(
+ base::MessageLoop::current()->PostNonNestableTask(
FROM_HERE,
RunWhileLocked(base::Bind(&ResourceTracker::ReleaseResource,
weak_ptr_factory_.GetWeakPtr(),
@@ -86,7 +94,7 @@
}
void ResourceTracker::DidCreateInstance(PP_Instance instance) {
- CHECK(thread_checker_.CalledOnValidThread());
+ CheckThreadingPreconditions();
// Due to the infrastructure of some tests, the instance is registered
// twice in a few cases. It would be nice not to do that and assert here
// instead.
@@ -96,7 +104,7 @@
}
void ResourceTracker::DidDeleteInstance(PP_Instance instance) {
- CHECK(thread_checker_.CalledOnValidThread());
+ CheckThreadingPreconditions();
InstanceMap::iterator found_instance = instance_map_.find(instance);
// Due to the infrastructure of some tests, the instance is unregistered
@@ -151,7 +159,7 @@
}
int ResourceTracker::GetLiveObjectsForInstance(PP_Instance instance) const {
- CHECK(thread_checker_.CalledOnValidThread());
+ CheckThreadingPreconditions();
InstanceMap::const_iterator found = instance_map_.find(instance);
if (found == instance_map_.end())
return 0;
@@ -159,7 +167,7 @@
}
PP_Resource ResourceTracker::AddResource(Resource* object) {
- CHECK(thread_checker_.CalledOnValidThread());
+ CheckThreadingPreconditions();
// If the plugin manages to create too many resources, don't do crazy stuff.
if (last_resource_value_ == kMaxPPId)
return 0;
@@ -191,7 +199,7 @@
}
void ResourceTracker::RemoveResource(Resource* object) {
- CHECK(thread_checker_.CalledOnValidThread());
+ CheckThreadingPreconditions();
PP_Resource pp_resource = object->pp_resource();
InstanceMap::iterator found = instance_map_.find(object->pp_instance());
if (found != instance_map_.end())
diff --git a/ppapi/shared_impl/resource_tracker.h b/ppapi/shared_impl/resource_tracker.h
index f5f790c..54e6daf 100644
--- a/ppapi/shared_impl/resource_tracker.h
+++ b/ppapi/shared_impl/resource_tracker.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/hash_tables.h"
#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/threading/thread_checker_impl.h"
@@ -23,7 +24,12 @@
class PPAPI_SHARED_EXPORT ResourceTracker {
public:
- ResourceTracker();
+ // A SINGLE_THREADED ResourceTracker will use a thread-checker to make sure
+ // it's always invoked on the same thread on which it was constructed. A
+ // THREAD_SAFE ResourceTracker will check that the ProxyLock is held. See
+ // CheckThreadingPreconditions() for more details.
+ enum ThreadMode { SINGLE_THREADED, THREAD_SAFE };
+ explicit ResourceTracker(ThreadMode thread_mode);
virtual ~ResourceTracker();
// The returned pointer will be NULL if there is no resource. The reference
@@ -53,6 +59,10 @@
// This calls AddResource and RemoveResource.
friend class Resource;
+ // On the host-side, make sure we are called on the right thread. On the
+ // plugin side, make sure we have the proxy lock.
+ void CheckThreadingPreconditions() const;
+
// Adds the given resource to the tracker, associating it with the instance
// stored in the resource object. The new resource ID is returned, and the
// resource will have 0 plugin refcount. This is called by the resource
@@ -98,19 +108,11 @@
base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_;
- // TODO(raymes): We won't need to do thread checks once pepper calls are
- // allowed off of the main thread.
- // See http://code.google.com/p/chromium/issues/detail?id=92909.
-#ifdef ENABLE_PEPPER_THREADING
- base::ThreadCheckerDoNothing thread_checker_;
-#else
- // TODO(raymes): We've seen plugins (Flash) creating resources from random
- // threads. Let's always crash for now in this case. Once we have a handle
- // over how common this is, we can change ThreadCheckerImpl->ThreadChecker
- // so that we only crash in debug mode. See
- // https://code.google.com/p/chromium/issues/detail?id=146415.
- base::ThreadCheckerImpl thread_checker_;
-#endif
+ // On the host side, we want to check that we are only called on the main
+ // thread. This is to protect us from accidentally using the tracker from
+ // other threads (especially the IO thread). On the plugin side, the tracker
+ // is protected by the proxy lock and is thread-safe, so this will be NULL.
+ scoped_ptr<base::ThreadChecker> thread_checker_;
DISALLOW_COPY_AND_ASSIGN(ResourceTracker);
};
diff --git a/ppapi/shared_impl/singleton_resource_id.h b/ppapi/shared_impl/singleton_resource_id.h
index ef3096d..de9178c 100644
--- a/ppapi/shared_impl/singleton_resource_id.h
+++ b/ppapi/shared_impl/singleton_resource_id.h
@@ -15,6 +15,7 @@
// resource model.
BROKER_SINGLETON_ID,
BROWSER_FONT_SINGLETON_ID,
+ EXTENSIONS_COMMON_SINGLETON_ID,
FLASH_CLIPBOARD_SINGLETON_ID,
FLASH_FILE_SINGLETON_ID,
FLASH_FULLSCREEN_SINGLETON_ID,
diff --git a/ppapi/shared_impl/test_globals.cc b/ppapi/shared_impl/test_globals.cc
index 913d53c..6c6af5b 100644
--- a/ppapi/shared_impl/test_globals.cc
+++ b/ppapi/shared_impl/test_globals.cc
@@ -8,11 +8,13 @@
TestGlobals::TestGlobals()
: ppapi::PpapiGlobals(),
+ resource_tracker_(ResourceTracker::THREAD_SAFE),
callback_tracker_(new CallbackTracker) {
}
TestGlobals::TestGlobals(PpapiGlobals::PerThreadForTest per_thread_for_test)
: ppapi::PpapiGlobals(per_thread_for_test),
+ resource_tracker_(ResourceTracker::THREAD_SAFE),
callback_tracker_(new CallbackTracker) {
}
diff --git a/ppapi/shared_impl/test_globals.h b/ppapi/shared_impl/test_globals.h
index 5579b09..c4d4aa1 100644
--- a/ppapi/shared_impl/test_globals.h
+++ b/ppapi/shared_impl/test_globals.h
@@ -16,7 +16,7 @@
class TestVarTracker : public VarTracker {
public:
- TestVarTracker() {}
+ TestVarTracker() : VarTracker(THREAD_SAFE) {}
virtual ~TestVarTracker() {}
virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) OVERRIDE {
return NULL;
diff --git a/ppapi/shared_impl/tracked_callback.cc b/ppapi/shared_impl/tracked_callback.cc
index ae4656e..b4cf9e5 100644
--- a/ppapi/shared_impl/tracked_callback.cc
+++ b/ppapi/shared_impl/tracked_callback.cc
@@ -157,7 +157,7 @@
// classes protect against having a null target_loop_ otherwise).
DCHECK(IsMainThread());
DCHECK(PpapiGlobals::Get()->IsHostGlobals());
- MessageLoop::current()->PostTask(FROM_HERE, callback_closure);
+ base::MessageLoop::current()->PostTask(FROM_HERE, callback_closure);
} else {
target_loop_->PostClosure(FROM_HERE, callback_closure, 0);
}
diff --git a/ppapi/shared_impl/tracked_callback_unittest.cc b/ppapi/shared_impl/tracked_callback_unittest.cc
index bc1c7f3..89db6d0 100644
--- a/ppapi/shared_impl/tracked_callback_unittest.cc
+++ b/ppapi/shared_impl/tracked_callback_unittest.cc
@@ -20,8 +20,7 @@
class TrackedCallbackTest : public testing::Test {
public:
TrackedCallbackTest()
- : message_loop_(MessageLoop::TYPE_DEFAULT),
- pp_instance_(1234) {}
+ : message_loop_(base::MessageLoop::TYPE_DEFAULT), pp_instance_(1234) {}
PP_Instance pp_instance() const { return pp_instance_; }
@@ -33,7 +32,7 @@
}
private:
- MessageLoop message_loop_;
+ base::MessageLoop message_loop_;
TestGlobals globals_;
PP_Instance pp_instance_;
};
@@ -220,18 +219,18 @@
// Kill resource #1, spin the message loop to run posted calls, and check that
// things are in the expected states.
resource_tracker->ReleaseResource(resource_1_id);
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource_1->CheckFinalState();
resource_2->CheckIntermediateState();
// Kill resource #2.
resource_tracker->ReleaseResource(resource_2_id);
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource_1->CheckFinalState();
resource_2->CheckFinalState();
// This shouldn't be needed, but make sure there are no stranded tasks.
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
// Test that "resurrecting" a resource (getting a new ID for a |Resource|)
@@ -247,21 +246,21 @@
// Unref it, spin the message loop to run posted calls, and check that things
// are in the expected states.
resource_tracker->ReleaseResource(resource_id);
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource->CheckFinalState();
// "Resurrect" it and check that the callbacks are still dead.
PP_Resource new_resource_id = resource->GetReference();
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource->CheckFinalState();
// Unref it again and do the same.
resource_tracker->ReleaseResource(new_resource_id);
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource->CheckFinalState();
// This shouldn't be needed, but make sure there are no stranded tasks.
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
} // namespace ppapi
diff --git a/ppapi/shared_impl/var_tracker.cc b/ppapi/shared_impl/var_tracker.cc
index 434121e..924b1ec 100644
--- a/ppapi/shared_impl/var_tracker.cc
+++ b/ppapi/shared_impl/var_tracker.cc
@@ -29,22 +29,29 @@
track_with_no_reference_count(0) {
}
-VarTracker::VarTracker() : last_var_id_(0) {
+VarTracker::VarTracker(ThreadMode thread_mode) : last_var_id_(0) {
+ if (thread_mode == SINGLE_THREADED)
+ thread_checker_.reset(new base::ThreadChecker);
}
VarTracker::~VarTracker() {
}
-int32 VarTracker::AddVar(Var* var) {
- DCHECK(CalledOnValidThread());
+void VarTracker::CheckThreadingPreconditions() const {
+ DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread());
+#ifndef NDEBUG
ProxyLock::AssertAcquired();
+#endif
+}
+
+int32 VarTracker::AddVar(Var* var) {
+ CheckThreadingPreconditions();
return AddVarInternal(var, ADD_VAR_TAKE_ONE_REFERENCE);
}
Var* VarTracker::GetVar(int32 var_id) const {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
VarMap::const_iterator result = live_vars_.find(var_id);
if (result == live_vars_.end())
@@ -53,8 +60,7 @@
}
Var* VarTracker::GetVar(const PP_Var& var) const {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
if (!IsVarTypeRefcounted(var.type))
return NULL;
@@ -62,8 +68,7 @@
}
bool VarTracker::AddRefVar(int32 var_id) {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR))
<< var_id << " is not a PP_Var ID.";
@@ -88,8 +93,7 @@
}
bool VarTracker::AddRefVar(const PP_Var& var) {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
if (!IsVarTypeRefcounted(var.type))
return true;
@@ -97,8 +101,7 @@
}
bool VarTracker::ReleaseVar(int32 var_id) {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR))
<< var_id << " is not a PP_Var ID.";
@@ -129,8 +132,7 @@
}
bool VarTracker::ReleaseVar(const PP_Var& var) {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
if (!IsVarTypeRefcounted(var.type))
return false;
@@ -154,8 +156,7 @@
}
int VarTracker::GetRefCountForObject(const PP_Var& plugin_object) {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
VarMap::iterator found = GetLiveVar(plugin_object);
if (found == live_vars_.end())
@@ -165,8 +166,7 @@
int VarTracker::GetTrackedWithNoReferenceCountForObject(
const PP_Var& plugin_object) {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
VarMap::iterator found = GetLiveVar(plugin_object);
if (found == live_vars_.end())
@@ -174,6 +174,11 @@
return found->second.track_with_no_reference_count;
}
+// static
+bool VarTracker::IsVarTypeRefcounted(PP_VarType type) {
+ return type >= PP_VARTYPE_STRING;
+}
+
VarTracker::VarMap::iterator VarTracker::GetLiveVar(const PP_Var& var) {
return live_vars_.find(static_cast<int32>(var.value.as_id));
}
@@ -183,13 +188,8 @@
return live_vars_.find(static_cast<int32>(var.value.as_id));
}
-bool VarTracker::IsVarTypeRefcounted(PP_VarType type) const {
- return type >= PP_VARTYPE_STRING;
-}
-
PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes) {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
scoped_refptr<ArrayBufferVar> array_buffer(CreateArrayBuffer(size_in_bytes));
if (!array_buffer)
@@ -199,8 +199,7 @@
PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes,
const void* data) {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
ArrayBufferVar* array_buffer = MakeArrayBufferVar(size_in_bytes, data);
return array_buffer ? array_buffer->GetPPVar() : PP_MakeNull();
@@ -208,8 +207,7 @@
ArrayBufferVar* VarTracker::MakeArrayBufferVar(uint32 size_in_bytes,
const void* data) {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
ArrayBufferVar* array_buffer(CreateArrayBuffer(size_in_bytes));
if (!array_buffer)
@@ -220,7 +218,7 @@
PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes,
base::SharedMemoryHandle handle) {
- DCHECK(CalledOnValidThread());
+ CheckThreadingPreconditions();
scoped_refptr<ArrayBufferVar> array_buffer(
CreateShmArrayBuffer(size_in_bytes, handle));
@@ -230,8 +228,7 @@
}
std::vector<PP_Var> VarTracker::GetLiveVars() {
- DCHECK(CalledOnValidThread());
- ProxyLock::AssertAcquired();
+ CheckThreadingPreconditions();
std::vector<PP_Var> var_vector;
var_vector.reserve(live_vars_.size());
diff --git a/ppapi/shared_impl/var_tracker.h b/ppapi/shared_impl/var_tracker.h
index 32acdeb..e7278a3 100644
--- a/ppapi/shared_impl/var_tracker.h
+++ b/ppapi/shared_impl/var_tracker.h
@@ -10,19 +10,20 @@
#include "base/basictypes.h"
#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/shared_memory.h"
-#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread_checker.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
+#include "ppapi/shared_impl/var.h"
namespace ppapi {
class ArrayBufferVar;
-class Var;
// Tracks non-POD (refcounted) var objects held by a plugin.
//
@@ -36,16 +37,14 @@
// This class maintains the "track_with_no_reference_count" but doesn't do
// anything with it other than call virtual functions. The interesting parts
// are added by the PluginObjectVar derived from this class.
-class PPAPI_SHARED_EXPORT VarTracker
-#ifdef ENABLE_PEPPER_THREADING
- : NON_EXPORTED_BASE(public base::NonThreadSafeDoNothing) {
-#else
- // TODO(dmichael): Remove the thread checking when calls are allowed off the
- // main thread (crbug.com/92909).
- : NON_EXPORTED_BASE(public base::NonThreadSafe) {
-#endif
+class PPAPI_SHARED_EXPORT VarTracker {
public:
- VarTracker();
+ // A SINGLE_THREADED VarTracker will use a thread-checker to make sure it's
+ // always invoked on the same thread on which it was constructed. A
+ // THREAD_SAFE VarTracker will check that the ProxyLock is held. See
+ // CheckThreadingPreconditions() for more details.
+ enum ThreadMode { SINGLE_THREADED, THREAD_SAFE };
+ explicit VarTracker(ThreadMode thread_mode);
virtual ~VarTracker();
// Called by the Var object to add a new var to the tracker.
@@ -98,6 +97,10 @@
int GetRefCountForObject(const PP_Var& object);
int GetTrackedWithNoReferenceCountForObject(const PP_Var& object);
+ // Returns true if the given vartype is refcounted and has associated objects
+ // (it's not POD).
+ static bool IsVarTypeRefcounted(PP_VarType type);
+
// Called after an instance is deleted to do var cleanup.
virtual void DidDeleteInstance(PP_Instance instance) = 0;
@@ -118,7 +121,7 @@
uint32* size_in_bytes) = 0;
protected:
- struct VarInfo {
+ struct PPAPI_SHARED_EXPORT VarInfo {
VarInfo();
VarInfo(Var* v, int input_ref_count);
@@ -148,6 +151,10 @@
ADD_VAR_CREATE_WITH_NO_REFERENCE
};
+ // On the host-side, make sure we are called on the right thread. On the
+ // plugin side, make sure we have the proxy lock.
+ void CheckThreadingPreconditions() const;
+
// Implementation of AddVar that allows the caller to specify whether the
// initial refcount of the added object will be 0 or 1.
//
@@ -159,10 +166,6 @@
VarMap::iterator GetLiveVar(const PP_Var& var);
VarMap::const_iterator GetLiveVar(const PP_Var& var) const;
- // Returns true if the given vartype is refcounted and has associated objects
- // (it's not POD).
- bool IsVarTypeRefcounted(PP_VarType type) const;
-
// Called when AddRefVar increases a "tracked" ProxyObject's refcount from
// zero to one. In the plugin side of the proxy, we need to send some
// messages to the host. In the host side, this should never be called since
@@ -198,6 +201,12 @@
uint32 size_in_bytes,
base::SharedMemoryHandle handle) = 0;
+ // On the host side, we want to check that we are only called on the main
+ // thread. This is to protect us from accidentally using the tracker from
+ // other threads (especially the IO thread). On the plugin side, the tracker
+ // is protected by the proxy lock and is thread-safe, so this will be NULL.
+ scoped_ptr<base::ThreadChecker> thread_checker_;
+
DISALLOW_COPY_AND_ASSIGN(VarTracker);
};
diff --git a/ppapi/shared_impl/var_value_conversions.cc b/ppapi/shared_impl/var_value_conversions.cc
index 614002a..46f3161 100644
--- a/ppapi/shared_impl/var_value_conversions.cc
+++ b/ppapi/shared_impl/var_value_conversions.cc
@@ -249,9 +249,11 @@
dict_var->key_value_map().begin();
iter != dict_var->key_value_map().end();
++iter) {
- // Skip the key-value pair if the value is undefined.
- if (iter->second.get().type == PP_VARTYPE_UNDEFINED)
+ // Skip the key-value pair if the value is undefined or null.
+ if (iter->second.get().type == PP_VARTYPE_UNDEFINED ||
+ iter->second.get().type == PP_VARTYPE_NULL) {
continue;
+ }
scoped_ptr<base::Value> child_value;
if (!CreateValueFromVarHelper(parent_ids, iter->second.get(),
@@ -340,5 +342,50 @@
return root_var.Release();
}
+
+base::ListValue* CreateListValueFromVarVector(
+ const std::vector<PP_Var>& vars) {
+ scoped_ptr<base::ListValue> list_value(new base::ListValue());
+
+ for (std::vector<PP_Var>::const_iterator iter = vars.begin();
+ iter != vars.end();
+ ++iter) {
+ base::Value* value = CreateValueFromVar(*iter);
+ if (!value)
+ return NULL;
+ list_value->Append(value);
+ }
+ return list_value.release();
+}
+
+bool CreateVarVectorFromListValue(const base::ListValue& list_value,
+ std::vector<PP_Var>* vars) {
+ if (!vars)
+ return false;
+
+ std::vector<ScopedPPVar> result;
+ result.reserve(list_value.GetSize());
+ for (base::ListValue::const_iterator iter = list_value.begin();
+ iter != list_value.end();
+ ++iter) {
+ ScopedPPVar child_var(ScopedPPVar::PassRef(),
+ CreateVarFromValue(**iter));
+ if (child_var.get().type == PP_VARTYPE_UNDEFINED)
+ return false;
+
+ result.push_back(child_var);
+ }
+
+ vars->clear();
+ vars->reserve(result.size());
+ for (std::vector<ScopedPPVar>::iterator iter = result.begin();
+ iter != result.end();
+ ++iter) {
+ vars->push_back(iter->Release());
+ }
+
+ return true;
+}
+
} // namespace ppapi
diff --git a/ppapi/shared_impl/var_value_conversions.h b/ppapi/shared_impl/var_value_conversions.h
index 09145ce..b72e7cc 100644
--- a/ppapi/shared_impl/var_value_conversions.h
+++ b/ppapi/shared_impl/var_value_conversions.h
@@ -5,10 +5,13 @@
#ifndef PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
#define PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
+#include <vector>
+
#include "ppapi/c/pp_var.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
namespace base {
+class ListValue;
class Value;
}
@@ -19,10 +22,10 @@
//
// Both PP_VARTYPE_UNDEFINED and PP_VARTYPE_NULL are converted to
// base::Value::TYPE_NULL. In dictionary vars, key-value pairs whose value is
-// undefined (PP_VARTYPE_UNDEFINED) are ignored. If a node in |var| appears more
-// than once, it is duplicated in the result. For example, if |var| is an array
-// and it has two elements pointing to the same dictionary, the resulting list
-// value will have two copies of the dictionary.
+// undefined (PP_VARTYPE_UNDEFINED) or null (PP_VARTYPE_NULL) are ignored. If a
+// node in |var| appears more than once, it is duplicated in the result. For
+// example, if |var| is an array and it has two elements pointing to the same
+// dictionary, the resulting list value will have two copies of the dictionary.
//
// The conversion fails and returns NULL if
// - |var| is object (PP_VARTYPE_OBJECT); or
@@ -32,10 +35,26 @@
// ancestor/descendant.
PPAPI_SHARED_EXPORT base::Value* CreateValueFromVar(const PP_Var& var);
-// The returned var has been added ref on behalf of the caller.
+// The returned var has had 1 ref added on behalf of the caller.
// Returns an undefined var if the conversion fails.
PPAPI_SHARED_EXPORT PP_Var CreateVarFromValue(const base::Value& value);
+// Calls CreateValueFromVar() on each element of |vars| and puts them in a
+// base::ListValue. The caller takes ownership of the returned object.
+//
+// The conversion fails and returns NULL if any of the calls to
+// CreateValueFromVar() fails.
+PPAPI_SHARED_EXPORT base::ListValue* CreateListValueFromVarVector(
+ const std::vector<PP_Var>& vars);
+
+// Calls CreateVarFromValue() on each element of |list_value| and puts them in
+// |vars|. The returned vars have had 1 ref added on behalf of the caller.
+//
+// The conversion fails and returns false if any of the calls to
+// CreateVarFromValue() fails. In that case, |vars| is untouched.
+PPAPI_SHARED_EXPORT bool CreateVarVectorFromListValue(
+ const base::ListValue& list_value, std::vector<PP_Var>* vars);
+
} // namespace ppapi
#endif // PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
diff --git a/ppapi/shared_impl/var_value_conversions_unittest.cc b/ppapi/shared_impl/var_value_conversions_unittest.cc
index 8dd2c42..88d645a 100644
--- a/ppapi/shared_impl/var_value_conversions_unittest.cc
+++ b/ppapi/shared_impl/var_value_conversions_unittest.cc
@@ -77,22 +77,24 @@
if (!dict_var)
return false;
- size_t non_undefined_count = 0;
+ size_t count = 0;
for (DictionaryVar::KeyValueMap::const_iterator iter =
dict_var->key_value_map().begin();
iter != dict_var->key_value_map().end();
++iter) {
- if (iter->second.get().type == PP_VARTYPE_UNDEFINED)
+ if (iter->second.get().type == PP_VARTYPE_UNDEFINED ||
+ iter->second.get().type == PP_VARTYPE_NULL) {
continue;
+ }
- ++non_undefined_count;
+ ++count;
const base::Value* sub_value = NULL;
if (!dict_value.GetWithoutPathExpansion(iter->first, &sub_value) ||
!Equals(*sub_value, iter->second.get())) {
return false;
}
}
- return non_undefined_count == dict_value.size();
+ return count == dict_value.size();
}
case base::Value::TYPE_LIST: {
const base::ListValue& list_value =
@@ -117,6 +119,20 @@
return false;
}
+bool ConvertVarAndVerify(const PP_Var& var) {
+ scoped_ptr<base::Value> value(CreateValueFromVar(var));
+ if (value.get())
+ return Equals(*value, var);
+ return false;
+}
+
+bool ConvertValueAndVerify(const base::Value& value) {
+ ScopedPPVar var(ScopedPPVar::PassRef(), CreateVarFromValue(value));
+ if (var.get().type != PP_VARTYPE_UNDEFINED)
+ return Equals(value, var.get());
+ return false;
+}
+
class VarValueConversionsTest : public testing::Test {
public:
VarValueConversionsTest() {
@@ -148,11 +164,10 @@
ScopedPPVar var_2(ScopedPPVar::PassRef(), array_var->GetPPVar());
ASSERT_TRUE(dict_var->SetWithStringKey("key_1", var_2.get()));
- scoped_ptr<base::Value> value(CreateValueFromVar(var_1.get()));
- ASSERT_TRUE(value.get());
+ ASSERT_TRUE(ConvertVarAndVerify(var_1.get()));
ASSERT_TRUE(array_var->Set(0, var_1.get()));
- value.reset(CreateValueFromVar(var_1.get()));
+ scoped_ptr<base::Value> value(CreateValueFromVar(var_1.get()));
ASSERT_EQ(NULL, value.get());
// Make sure |var_1| doesn't indirectly hold a ref to itself, otherwise it
@@ -162,13 +177,8 @@
// Vars of null or undefined type are converted to null values.
{
- scoped_ptr<base::Value> value(CreateValueFromVar(PP_MakeNull()));
- ASSERT_TRUE(value.get());
- ASSERT_TRUE(Equals(*value, PP_MakeNull()));
-
- value.reset(CreateValueFromVar(PP_MakeUndefined()));
- ASSERT_TRUE(value.get());
- ASSERT_TRUE(Equals(*value, PP_MakeUndefined()));
+ ASSERT_TRUE(ConvertVarAndVerify(PP_MakeNull()));
+ ASSERT_TRUE(ConvertVarAndVerify(PP_MakeUndefined()));
}
{
@@ -176,21 +186,18 @@
scoped_refptr<DictionaryVar> dict_var(new DictionaryVar());
ScopedPPVar var(ScopedPPVar::PassRef(), dict_var->GetPPVar());
- scoped_ptr<base::Value> value(CreateValueFromVar(var.get()));
- ASSERT_TRUE(value.get());
- ASSERT_TRUE(Equals(*value, var.get()));
+ ASSERT_TRUE(ConvertVarAndVerify(var.get()));
}
{
- // Key-value pairs whose value is undefined are ignored.
+ // Key-value pairs whose value is undefined or null are ignored.
scoped_refptr<DictionaryVar> dict_var(new DictionaryVar());
ASSERT_TRUE(dict_var->SetWithStringKey("key_1", PP_MakeUndefined()));
ASSERT_TRUE(dict_var->SetWithStringKey("key_2", PP_MakeInt32(1)));
+ ASSERT_TRUE(dict_var->SetWithStringKey("key_3", PP_MakeNull()));
ScopedPPVar var(ScopedPPVar::PassRef(), dict_var->GetPPVar());
- scoped_ptr<base::Value> value(CreateValueFromVar(var.get()));
- ASSERT_TRUE(value.get());
- ASSERT_TRUE(Equals(*value, var.get()));
+ ASSERT_TRUE(ConvertVarAndVerify(var.get()));
}
{
@@ -207,9 +214,7 @@
ASSERT_TRUE(dict_var_1->SetWithStringKey("key_3", string_pp_var.get()));
ASSERT_TRUE(dict_var_2->SetWithStringKey("key_4", string_pp_var.get()));
- scoped_ptr<base::Value> value(CreateValueFromVar(dict_pp_var_1.get()));
- ASSERT_TRUE(value.get());
- ASSERT_TRUE(Equals(*value, dict_pp_var_1.get()));
+ ASSERT_TRUE(ConvertVarAndVerify(dict_pp_var_1.get()));
}
{
@@ -217,14 +222,11 @@
scoped_refptr<ArrayVar> array_var(new ArrayVar());
ScopedPPVar var(ScopedPPVar::PassRef(), array_var->GetPPVar());
- scoped_ptr<base::Value> value(CreateValueFromVar(var.get()));
- ASSERT_TRUE(value.get());
- ASSERT_TRUE(Equals(*value, var.get()));
+ ASSERT_TRUE(ConvertVarAndVerify(var.get()));
ASSERT_TRUE(array_var->Set(0, PP_MakeDouble(1)));
- value.reset(CreateValueFromVar(var.get()));
- ASSERT_TRUE(value.get());
- ASSERT_TRUE(Equals(*value, var.get()));
+
+ ASSERT_TRUE(ConvertVarAndVerify(var.get()));
}
{
@@ -252,9 +254,7 @@
ASSERT_TRUE(array_var->Set(1, PP_MakeBool(PP_TRUE)));
ASSERT_TRUE(array_var->SetLength(4));
- scoped_ptr<base::Value> value(CreateValueFromVar(dict_pp_var_1.get()));
- ASSERT_TRUE(value.get());
- ASSERT_TRUE(Equals(*value, dict_pp_var_1.get()));
+ ASSERT_TRUE(ConvertVarAndVerify(dict_pp_var_1.get()));
}
{
@@ -265,9 +265,7 @@
ASSERT_TRUE(dict_var->SetWithStringKey("double.key", PP_MakeDouble(1)));
ASSERT_TRUE(dict_var->SetWithStringKey("int.key..name", PP_MakeInt32(2)));
- scoped_ptr<base::Value> value(CreateValueFromVar(dict_pp_var.get()));
- ASSERT_TRUE(value.get());
- ASSERT_TRUE(Equals(*value, dict_pp_var.get()));
+ ASSERT_TRUE(ConvertVarAndVerify(dict_pp_var.get()));
}
}
@@ -275,29 +273,24 @@
{
// Test basic cases for dictionary.
base::DictionaryValue dict_value;
- ScopedPPVar var(ScopedPPVar::PassRef(), CreateVarFromValue(dict_value));
- ASSERT_TRUE(Equals(dict_value, var.get()));
+ ASSERT_TRUE(ConvertValueAndVerify(dict_value));
dict_value.SetInteger("int_key", 1);
- var = ScopedPPVar(ScopedPPVar::PassRef(), CreateVarFromValue(dict_value));
- ASSERT_TRUE(Equals(dict_value, var.get()));
+ ASSERT_TRUE(ConvertValueAndVerify(dict_value));
}
{
// Test basic cases for array.
base::ListValue list_value;
- ScopedPPVar var(ScopedPPVar::PassRef(), CreateVarFromValue(list_value));
- ASSERT_TRUE(Equals(list_value, var.get()));
+ ASSERT_TRUE(ConvertValueAndVerify(list_value));
list_value.AppendInteger(1);
- var = ScopedPPVar(ScopedPPVar::PassRef(), CreateVarFromValue(list_value));
- ASSERT_TRUE(Equals(list_value, var.get()));
+ ASSERT_TRUE(ConvertValueAndVerify(list_value));
}
{
// Test more complex inputs.
base::DictionaryValue dict_value;
- dict_value.Set("null_key", base::Value::CreateNullValue());
dict_value.SetString("string_key", "string_value");
dict_value.SetDouble("dict_key.double_key", 1);
@@ -308,8 +301,94 @@
dict_value.Set("dict_key.array_key", list_value.release());
- ScopedPPVar var(ScopedPPVar::PassRef(), CreateVarFromValue(dict_value));
- ASSERT_TRUE(Equals(dict_value, var.get()));
+ ASSERT_TRUE(ConvertValueAndVerify(dict_value));
+ }
+}
+
+TEST_F(VarValueConversionsTest, CreateListValueFromVarVector) {
+ {
+ // Test empty var vector.
+ scoped_ptr<base::ListValue> list_value(
+ CreateListValueFromVarVector(std::vector<PP_Var>()));
+ ASSERT_TRUE(list_value.get());
+ ASSERT_EQ(0u, list_value->GetSize());
+ }
+
+ {
+ // Test more complex inputs.
+ scoped_refptr<StringVar> string_var(new StringVar("string_value"));
+ ScopedPPVar string_pp_var(ScopedPPVar::PassRef(), string_var->GetPPVar());
+
+ scoped_refptr<DictionaryVar> dict_var(new DictionaryVar());
+ ScopedPPVar dict_pp_var(ScopedPPVar::PassRef(), dict_var->GetPPVar());
+ ASSERT_TRUE(dict_var->SetWithStringKey("null_key", PP_MakeNull()));
+ ASSERT_TRUE(dict_var->SetWithStringKey("string_key", string_pp_var.get()));
+
+ scoped_refptr<ArrayVar> array_var(new ArrayVar());
+ ScopedPPVar array_pp_var(ScopedPPVar::PassRef(), array_var->GetPPVar());
+ ASSERT_TRUE(array_var->Set(0, PP_MakeInt32(2)));
+ ASSERT_TRUE(array_var->Set(1, PP_MakeBool(PP_TRUE)));
+ ASSERT_TRUE(array_var->SetLength(4));
+
+ std::vector<PP_Var> vars;
+ vars.push_back(dict_pp_var.get());
+ vars.push_back(string_pp_var.get());
+ vars.push_back(array_pp_var.get());
+ vars.push_back(PP_MakeDouble(1));
+ vars.push_back(PP_MakeUndefined());
+ vars.push_back(PP_MakeNull());
+
+ scoped_ptr<base::ListValue> list_value(CreateListValueFromVarVector(vars));
+
+ ASSERT_TRUE(list_value.get());
+ ASSERT_EQ(vars.size(), list_value->GetSize());
+
+ for (size_t i = 0; i < list_value->GetSize(); ++i) {
+ const base::Value* value = NULL;
+ ASSERT_TRUE(list_value->Get(i, &value));
+ ASSERT_TRUE(Equals(*value, vars[i]));
+ }
+ }
+}
+
+TEST_F(VarValueConversionsTest, CreateVarVectorFromListValue) {
+ {
+ // Test empty list.
+ base::ListValue list_value;
+ std::vector<PP_Var> vars;
+ ASSERT_TRUE(CreateVarVectorFromListValue(list_value, &vars));
+ ASSERT_EQ(0u, vars.size());
+ }
+
+ {
+ // Test more complex inputs.
+ base::ListValue list_value;
+
+ scoped_ptr<base::DictionaryValue> dict_value(new base::DictionaryValue());
+ dict_value->SetString("string_key", "string_value");
+
+ scoped_ptr<base::ListValue> sub_list_value(new base::ListValue());
+ sub_list_value->AppendInteger(2);
+ sub_list_value->AppendBoolean(true);
+
+ list_value.Append(dict_value.release());
+ list_value.AppendString("string_value");
+ list_value.Append(sub_list_value.release());
+ list_value.AppendDouble(1);
+ list_value.Append(base::Value::CreateNullValue());
+
+ std::vector<PP_Var> vars;
+ ASSERT_TRUE(CreateVarVectorFromListValue(list_value, &vars));
+
+ ASSERT_EQ(list_value.GetSize(), vars.size());
+
+ for (size_t i = 0; i < list_value.GetSize(); ++i) {
+ const base::Value* value = NULL;
+ ASSERT_TRUE(list_value.Get(i, &value));
+ ASSERT_TRUE(Equals(*value, vars[i]));
+
+ PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(vars[i]);
+ }
}
}
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index 7dc99ae..ff5ee00 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -16,7 +16,6 @@
#include "ppapi/c/dev/ppb_crypto_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/c/dev/ppb_device_ref_dev.h"
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
#include "ppapi/c/dev/ppb_file_chooser_dev.h"
#include "ppapi/c/dev/ppb_find_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
@@ -47,8 +46,9 @@
#include "ppapi/c/dev/ppp_video_decoder_dev.h"
#include "ppapi/c/dev/ppp_widget_dev.h"
#include "ppapi/c/dev/ppp_zoom_dev.h"
-#include "ppapi/c/extensions/dev/ppb_alarms_dev.h"
-#include "ppapi/c/extensions/dev/ppb_events_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h"
+#include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
@@ -96,7 +96,9 @@
#include "ppapi/c/ppp_messaging.h"
#include "ppapi/c/ppp_mouse_lock.h"
#include "ppapi/c/private/pp_private_font_charset.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
+#include "ppapi/c/private/ppb_file_io_private.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/c/private/ppb_flash_clipboard.h"
#include "ppapi/c/private/ppb_flash_font_file.h"
@@ -114,6 +116,8 @@
#include "ppapi/c/private/ppb_tcp_socket_private.h"
#include "ppapi/c/private/ppb_udp_socket_private.h"
#include "ppapi/c/private/ppb_uma_private.h"
+#include "ppapi/c/private/ppb_video_destination_private.h"
+#include "ppapi/c/private/ppb_video_source_private.h"
#include "ppapi/c/private/ppb_x509_certificate_private.h"
#include "ppapi/c/private/ppp_content_decryptor_private.h"
#include "ppapi/c/private/ppp_instance_private.h"
diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h
index deabeaa..72aedc8 100644
--- a/ppapi/tests/all_cpp_includes.h
+++ b/ppapi/tests/all_cpp_includes.h
@@ -14,8 +14,6 @@
#include "ppapi/cpp/core.h"
#include "ppapi/cpp/dev/buffer_dev.h"
#include "ppapi/cpp/dev/device_ref_dev.h"
-#include "ppapi/cpp/dev/directory_entry_dev.h"
-#include "ppapi/cpp/dev/directory_reader_dev.h"
#include "ppapi/cpp/dev/file_chooser_dev.h"
#include "ppapi/cpp/dev/find_dev.h"
#include "ppapi/cpp/dev/font_dev.h"
@@ -36,7 +34,9 @@
#include "ppapi/cpp/dev/widget_client_dev.h"
#include "ppapi/cpp/dev/widget_dev.h"
#include "ppapi/cpp/dev/zoom_dev.h"
+#include "ppapi/cpp/directory_entry.h"
#include "ppapi/cpp/extensions/dev/alarms_dev.h"
+#include "ppapi/cpp/extensions/dev/socket_dev.h"
#include "ppapi/cpp/file_io.h"
#include "ppapi/cpp/file_ref.h"
#include "ppapi/cpp/file_system.h"
@@ -60,6 +60,9 @@
#include "ppapi/cpp/private/tcp_socket_private.h"
#include "ppapi/cpp/private/udp_socket_private.h"
#include "ppapi/cpp/private/var_private.h"
+#include "ppapi/cpp/private/video_destination_private.h"
+#include "ppapi/cpp/private/video_frame_private.h"
+#include "ppapi/cpp/private/video_source_private.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/resource.h"
#include "ppapi/cpp/size.h"
diff --git a/ppapi/tests/test_audio.cc b/ppapi/tests/test_audio.cc
index a85e955..b3853ea 100644
--- a/ppapi/tests/test_audio.cc
+++ b/ppapi/tests/test_audio.cc
@@ -23,7 +23,7 @@
TestAudio::TestAudio(TestingInstance* instance)
: TestCase(instance),
audio_callback_method_(NULL),
- test_callback_(),
+ audio_callback_event_(instance->pp_instance()),
test_done_(false) {
}
@@ -212,29 +212,19 @@
core_interface_->ReleaseResource(ac);
ac = 0;
- // |AudioCallbackTest()| calls |test_callback_|, sleeps a bit, then sets
- // |test_done_|.
- TestCompletionCallback test_callback(instance_->pp_instance());
- test_callback_ = test_callback.GetCallback().pp_completion_callback();
+ audio_callback_event_.Reset();
test_done_ = false;
- callback_fired_ = false;
audio_callback_method_ = &TestAudio::AudioCallbackTest;
ASSERT_TRUE(audio_interface_->StartPlayback(audio));
// Wait for the audio callback to be called.
- test_callback.WaitForResult();
- ASSERT_EQ(kMagicValue, test_callback.result());
-
+ audio_callback_event_.Wait();
ASSERT_TRUE(audio_interface_->StopPlayback(audio));
-
- // |StopPlayback()| should wait for the audio callback to finish.
- ASSERT_TRUE(callback_fired_);
test_done_ = true;
// If any more audio callbacks are generated, we should crash (which is good).
audio_callback_method_ = NULL;
- test_callback_ = PP_CompletionCallback();
core_interface_->ReleaseResource(audio);
@@ -258,10 +248,7 @@
core_interface_->ReleaseResource(ac);
ac = 0;
- // |AudioCallbackTest()| calls |test_callback_|, sleeps a bit, then sets
- // |test_done_|.
- TestCompletionCallback test_callback(instance_->pp_instance());
- test_callback_ = test_callback.GetCallback().pp_completion_callback();
+ audio_callback_event_.Reset();
test_done_ = false;
callback_fired_ = false;
@@ -269,18 +256,14 @@
ASSERT_TRUE(audio_interface_->StartPlayback(audio));
// Wait for the audio callback to be called.
- test_callback.WaitForResult();
- ASSERT_EQ(kMagicValue, test_callback.result());
+ audio_callback_event_.Wait();
core_interface_->ReleaseResource(audio);
- // The final release should wait for the audio callback to finish.
- ASSERT_TRUE(callback_fired_);
test_done_ = true;
// If any more audio callbacks are generated, we should crash (which is good).
audio_callback_method_ = NULL;
- test_callback_ = PP_CompletionCallback();
PASS();
}
@@ -303,10 +286,7 @@
core_interface_->ReleaseResource(ac);
ac = 0;
- // |AudioCallbackTest()| calls |test_callback_|, sleeps a bit, then sets
- // |test_done_|.
- TestCompletionCallback test_callback_1(instance_->pp_instance());
- test_callback_ = test_callback_1.GetCallback().pp_completion_callback();
+ audio_callback_event_.Reset();
test_done_ = false;
callback_fired_ = false;
@@ -314,36 +294,22 @@
ASSERT_TRUE(audio_interface_->StartPlayback(audio));
// Wait for the audio callback to be called.
- test_callback_1.WaitForResult();
- ASSERT_EQ(kMagicValue, test_callback_1.result());
+ audio_callback_event_.Wait();
ASSERT_TRUE(audio_interface_->StopPlayback(audio));
- // |StopPlayback()| should wait for the audio callback to finish.
- ASSERT_TRUE(callback_fired_);
-
- TestCompletionCallback test_callback_2(instance_->pp_instance());
- test_callback_ = test_callback_2.GetCallback().pp_completion_callback();
-
// Repeat one more |StartPlayback| & |StopPlayback| cycle, and verify again
// that the callback function was invoked.
- callback_fired_ = false;
+ audio_callback_event_.Reset();
ASSERT_TRUE(audio_interface_->StartPlayback(audio));
// Wait for the audio callback to be called.
- test_callback_2.WaitForResult();
- ASSERT_EQ(kMagicValue, test_callback_2.result());
-
+ audio_callback_event_.Wait();
ASSERT_TRUE(audio_interface_->StopPlayback(audio));
-
- // |StopPlayback()| should wait for the audio callback to finish.
- ASSERT_TRUE(callback_fired_);
-
test_done_ = true;
// If any more audio callbacks are generated, we should crash (which is good).
audio_callback_method_ = NULL;
- test_callback_ = PP_CompletionCallback();
core_interface_->ReleaseResource(audio);
@@ -363,7 +329,7 @@
void* user_data) {
TestAudio* thiz = static_cast<TestAudio*>(user_data);
- // Crash if not on the main thread.
+ // Crash if on the main thread.
if (thiz->core_interface_->IsMainThread())
Crash();
@@ -381,9 +347,6 @@
if (test_done_)
Crash();
- if (!callback_fired_) {
- memset(sample_buffer, 0, buffer_size_in_bytes);
- core_interface_->CallOnMainThread(0, test_callback_, kMagicValue);
- callback_fired_ = true;
- }
+ memset(sample_buffer, 0, buffer_size_in_bytes);
+ audio_callback_event_.Signal();
}
diff --git a/ppapi/tests/test_audio.h b/ppapi/tests/test_audio.h
index 9554661..db86d1f 100644
--- a/ppapi/tests/test_audio.h
+++ b/ppapi/tests/test_audio.h
@@ -49,7 +49,7 @@
void AudioCallbackTest(void* sample_buffer, uint32_t buffer_size_in_bytes);
// Used by |TestAudioCallbackN()|.
- PP_CompletionCallback test_callback_;
+ NestedEvent audio_callback_event_;
bool test_done_;
bool callback_fired_;
diff --git a/ppapi/tests/test_case.h b/ppapi/tests/test_case.h
index c2379d1..2c81774 100644
--- a/ppapi/tests/test_case.h
+++ b/ppapi/tests/test_case.h
@@ -137,7 +137,6 @@
// Run the given test method on a background thread and return the result.
template <class T>
std::string RunOnThread(std::string(T::*test_to_run)()) {
-#ifdef ENABLE_PEPPER_THREADING
if (!testing_interface_) {
return "Testing blocking callbacks requires the testing interface. In "
"Chrome, use the --enable-pepper-testing flag.";
@@ -152,10 +151,6 @@
RunOnThreadInternal(&ThreadedTestRunner<T>::ThreadFunction, &runner,
testing_interface_);
return runner.result();
-#else
- // If threading's not enabled, just treat it as success.
- return std::string();
-#endif
}
// Pointer to the instance that owns us.
@@ -164,14 +159,8 @@
// NULL unless InitTestingInterface is called.
const PPB_Testing_Dev* testing_interface_;
- // TODO(dmichael): Remove this, it's for temporary backwards compatibility so
- // I don't have to change all the tests at once.
- bool force_async_;
-
void set_callback_type(CallbackType callback_type) {
callback_type_ = callback_type;
- // TODO(dmichael): Remove this; see comment on force_async_.
- force_async_ = (callback_type_ == PP_REQUIRED);
}
CallbackType callback_type() const {
return callback_type_;
@@ -374,12 +363,17 @@
// Helper macros for checking values in tests, and returning a location
// description of the test fails.
#define ASSERT_TRUE(cmd) \
- if (!(cmd)) { \
- return MakeFailureMessage(__FILE__, __LINE__, #cmd); \
- }
+ do { \
+ if (!(cmd)) \
+ return MakeFailureMessage(__FILE__, __LINE__, #cmd); \
+ } while (false)
#define ASSERT_FALSE(cmd) ASSERT_TRUE(!(cmd))
#define ASSERT_EQ(a, b) ASSERT_TRUE((a) == (b))
#define ASSERT_NE(a, b) ASSERT_TRUE((a) != (b))
+#define ASSERT_LT(a, b) ASSERT_TRUE((a) < (b))
+#define ASSERT_LE(a, b) ASSERT_TRUE((a) <= (b))
+#define ASSERT_GT(a, b) ASSERT_TRUE((a) > (b))
+#define ASSERT_GE(a, b) ASSERT_TRUE((a) >= (b))
#define ASSERT_DOUBLE_EQ(a, b) ASSERT_TRUE( \
std::fabs((a)-(b)) <= std::numeric_limits<double>::epsilon())
diff --git a/ppapi/tests/test_directory_reader.cc b/ppapi/tests/test_directory_reader.cc
deleted file mode 100644
index f577b12..0000000
--- a/ppapi/tests/test_directory_reader.cc
+++ /dev/null
@@ -1,216 +0,0 @@
-// Copyright (c) 2011 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_directory_reader.h"
-
-#include <stdio.h>
-#include <set>
-#include <vector>
-
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_file_io.h"
-#include "ppapi/cpp/dev/directory_entry_dev.h"
-#include "ppapi/cpp/dev/directory_reader_dev.h"
-#include "ppapi/cpp/file_io.h"
-#include "ppapi/cpp/file_ref.h"
-#include "ppapi/cpp/file_system.h"
-#include "ppapi/cpp/instance.h"
-#include "ppapi/tests/test_utils.h"
-#include "ppapi/tests/testing_instance.h"
-
-REGISTER_TEST_CASE(DirectoryReader);
-
-namespace {
-
-typedef std::vector<pp::DirectoryEntry_Dev> Entries;
-
-std::string IntegerToString(int value) {
- char result[12];
- sprintf(result, "%d", value);
- return result;
-}
-
-} // namespace
-
-bool TestDirectoryReader::Init() {
- return CheckTestingInterface() && EnsureRunningOverHTTP();
-}
-
-void TestDirectoryReader::RunTests(const std::string& filter) {
- RUN_TEST(ReadEntries, filter);
-}
-
-int32_t TestDirectoryReader::DeleteDirectoryRecursively(pp::FileRef* dir) {
- if (!dir)
- return PP_ERROR_BADARGUMENT;
-
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- TestCompletionCallbackWithOutput<Entries> output_callback(
- instance_->pp_instance(), force_async_);
-
- int32_t rv = PP_OK;
- pp::DirectoryReader_Dev directory_reader(*dir);
- rv = directory_reader.ReadEntries(output_callback);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = output_callback.WaitForResult();
- if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
- return rv;
-
- Entries entries = output_callback.output();
- for (Entries::const_iterator it = entries.begin();
- it != entries.end(); ++it) {
- pp::FileRef file_ref = it->file_ref();
- if (it->file_type() == PP_FILETYPE_DIRECTORY) {
- rv = DeleteDirectoryRecursively(&file_ref);
- if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
- return rv;
- } else {
- rv = file_ref.Delete(callback.GetCallback());
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
- return rv;
- }
- }
- rv = dir->Delete(callback.GetCallback());
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- return rv;
-}
-
-std::string TestDirectoryReader::TestReadEntries() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- pp::FileSystem file_system(
- instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
-
- // Setup testing directories and files.
- const char* test_dir_name = "/test_get_next_file";
- const char* file_prefix = "file_";
- const char* dir_prefix = "dir_";
-
- pp::FileRef test_dir(file_system, test_dir_name);
- rv = DeleteDirectoryRecursively(&test_dir);
- if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
- return ReportError("DeleteDirectoryRecursively", rv);
-
- rv = test_dir.MakeDirectory(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::MakeDirectory", rv);
-
- std::set<std::string> expected_file_names;
- for (int i = 1; i < 4; ++i) {
- char buffer[40];
- sprintf(buffer, "%s/%s%d", test_dir_name, file_prefix, i);
- pp::FileRef file_ref(file_system, buffer);
-
- pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
-
- expected_file_names.insert(buffer);
- }
-
- std::set<std::string> expected_dir_names;
- for (int i = 1; i < 4; ++i) {
- char buffer[40];
- sprintf(buffer, "%s/%s%d", test_dir_name, dir_prefix, i);
- pp::FileRef file_ref(file_system, buffer);
-
- rv = file_ref.MakeDirectory(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::MakeDirectory", rv);
-
- expected_dir_names.insert(buffer);
- }
-
- // Test that |ReadEntries()| is able to fetch all directories and files that
- // we created.
- {
- TestCompletionCallbackWithOutput<Entries> output_callback(
- instance_->pp_instance(), force_async_);
-
- pp::DirectoryReader_Dev directory_reader(test_dir);
- rv = directory_reader.ReadEntries(output_callback);
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("DirectoryReader::ReadEntries force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = output_callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("DirectoryReader::ReadEntries", rv);
-
- Entries entries = output_callback.output();
- size_t sum = expected_file_names.size() + expected_dir_names.size();
- if (entries.size() != sum)
- return "Expected " + IntegerToString(sum) + " entries, got " +
- IntegerToString(entries.size());
-
- for (Entries::const_iterator it = entries.begin();
- it != entries.end(); ++it) {
- pp::FileRef file_ref = it->file_ref();
- std::string file_path = file_ref.GetPath().AsString();
- std::set<std::string>::iterator found =
- expected_file_names.find(file_path);
- if (found != expected_file_names.end()) {
- if (it->file_type() != PP_FILETYPE_REGULAR)
- return file_path + " should have been a regular file.";
- expected_file_names.erase(found);
- } else {
- found = expected_dir_names.find(file_path);
- if (found == expected_dir_names.end())
- return "Unexpected file path: " + file_path;
- if (it->file_type() != PP_FILETYPE_DIRECTORY)
- return file_path + " should have been a directory.";
- expected_dir_names.erase(found);
- }
- }
- if (!expected_file_names.empty() || !expected_dir_names.empty())
- return "Expected more file paths.";
- }
-
- // Test cancellation of asynchronous |ReadEntries()|.
- {
- TestCompletionCallbackWithOutput<Entries> output_callback(
- instance_->pp_instance(), force_async_);
-
- // Note that the directory reader will be deleted immediately.
- rv = pp::DirectoryReader_Dev(test_dir).ReadEntries(output_callback);
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("DirectoryReader::ReadEntries force_async", rv);
- if (output_callback.run_count() > 0)
- return "DirectoryReader::ReadEntries ran callback synchronously.";
-
- // If |ReadEntries()| is completing asynchronously, the callback should be
- // aborted (i.e., called with |PP_ERROR_ABORTED| from the message loop)
- // since the resource was destroyed.
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = output_callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "DirectoryReader::ReadEntries not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("DirectoryReader::ReadEntries", rv);
- }
- }
-
- PASS();
-}
diff --git a/ppapi/tests/test_directory_reader.h b/ppapi/tests/test_directory_reader.h
deleted file mode 100644
index ee446c5..0000000
--- a/ppapi/tests/test_directory_reader.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2011 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_DIRECTORY_READER_H_
-#define PAPPI_TESTS_TEST_DIRECTORY_READER_H_
-
-#include <string>
-
-#include "ppapi/tests/test_case.h"
-
-namespace pp {
-class FileRef;
-}
-
-class TestDirectoryReader : public TestCase {
- public:
- explicit TestDirectoryReader(TestingInstance* instance)
- : TestCase(instance) {}
-
- // TestCase implementation.
- virtual bool Init();
- virtual void RunTests(const std::string& filter);
-
- private:
- int32_t DeleteDirectoryRecursively(pp::FileRef*);
-
- std::string TestReadEntries();
-};
-
-#endif // PAPPI_TESTS_TEST_DIRECTORY_READER_H_
diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc
index ea9224f..c76f69f 100644
--- a/ppapi/tests/test_file_io.cc
+++ b/ppapi/tests/test_file_io.cc
@@ -4,22 +4,42 @@
#include "ppapi/tests/test_file_io.h"
+#include <errno.h>
+#include <fcntl.h>
#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <vector>
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_file_io.h"
+#include "ppapi/c/private/pp_file_handle.h"
#include "ppapi/c/trusted/ppb_file_io_trusted.h"
#include "ppapi/cpp/file_io.h"
#include "ppapi/cpp/file_ref.h"
#include "ppapi/cpp/file_system.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/private/file_io_private.h"
+#include "ppapi/cpp/private/pass_file_handle.h"
#include "ppapi/tests/test_utils.h"
#include "ppapi/tests/testing_instance.h"
+#if defined(PPAPI_OS_WIN)
+# include <io.h>
+# include <windows.h>
+// TODO(hamaji): Use standard windows APIs instead of compatibility layer?
+# define lseek _lseek
+# define read _read
+# define write _write
+# define ssize_t int
+#else
+# include <sys/mman.h>
+# include <unistd.h>
+#endif
+
REGISTER_TEST_CASE(FileIO);
namespace {
@@ -62,22 +82,21 @@
int32_t ReadEntireFile(PP_Instance instance,
pp::FileIO* file_io,
int32_t offset,
- std::string* data) {
- TestCompletionCallback callback(instance);
+ std::string* data,
+ CallbackType callback_type) {
+ TestCompletionCallback callback(instance, callback_type);
char buf[256];
int32_t read_offset = offset;
for (;;) {
- int32_t rv = file_io->Read(read_offset, buf, sizeof(buf),
- callback.GetCallback());
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv < 0)
- return rv;
- if (rv == 0)
+ callback.WaitForResult(
+ file_io->Read(read_offset, buf, sizeof(buf), callback.GetCallback()));
+ if (callback.result() < 0)
+ return callback.result();
+ if (callback.result() == 0)
break;
- read_offset += rv;
- data->append(buf, rv);
+ read_offset += callback.result();
+ data->append(buf, callback.result());
}
return PP_OK;
@@ -87,20 +106,21 @@
pp::FileIO* file_io,
int32_t offset,
std::string* data,
- bool force_async) {
+ CallbackType callback_type) {
TestCompletionCallbackWithOutput< std::vector<char> > callback(
- instance, force_async);
+ instance, callback_type);
for (;;) {
- callback.WaitForResult(file_io->Read(offset, 256, callback));
+ callback.WaitForResult(file_io->Read(offset, 256, callback.GetCallback()));
int32_t rv = callback.result();
if (rv < 0)
return rv;
if (rv == 0)
break;
- assert(rv == static_cast<int32_t>(callback.output().size()));
+ const std::vector<char>& output = callback.output();
+ assert(rv == static_cast<int32_t>(output.size()));
offset += rv;
- data->append(callback.output().begin(), callback.output().end());
+ data->append(output.begin(), output.end());
}
return PP_OK;
@@ -109,23 +129,23 @@
int32_t WriteEntireBuffer(PP_Instance instance,
pp::FileIO* file_io,
int32_t offset,
- const std::string& data) {
- TestCompletionCallback callback(instance);
+ const std::string& data,
+ CallbackType callback_type) {
+ TestCompletionCallback callback(instance, callback_type);
int32_t write_offset = offset;
const char* buf = data.c_str();
int32_t size = data.size();
while (write_offset < offset + size) {
- int32_t rv = file_io->Write(write_offset, &buf[write_offset - offset],
- size - write_offset + offset,
- callback.GetCallback());
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv < 0)
- return rv;
- if (rv == 0)
+ callback.WaitForResult(file_io->Write(write_offset,
+ &buf[write_offset - offset],
+ size - write_offset + offset,
+ callback.GetCallback()));
+ if (callback.result() < 0)
+ return callback.result();
+ if (callback.result() == 0)
return PP_ERROR_FAILED;
- write_offset += rv;
+ write_offset += callback.result();
}
return PP_OK;
@@ -138,16 +158,17 @@
}
void TestFileIO::RunTests(const std::string& filter) {
- RUN_TEST_FORCEASYNC_AND_NOT(Open, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(OpenDirectory, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ReadWriteSetLength, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ReadToArrayWriteSetLength, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(TouchQuery, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ParallelReads, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ParallelWrites, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(NotAllowMixedReadWrite, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(WillWriteWillSetLength, filter);
+ RUN_CALLBACK_TEST(TestFileIO, Open, filter);
+ RUN_CALLBACK_TEST(TestFileIO, OpenDirectory, filter);
+ RUN_CALLBACK_TEST(TestFileIO, ReadWriteSetLength, filter);
+ RUN_CALLBACK_TEST(TestFileIO, ReadToArrayWriteSetLength, filter);
+ RUN_CALLBACK_TEST(TestFileIO, TouchQuery, filter);
+ RUN_CALLBACK_TEST(TestFileIO, AbortCalls, filter);
+ RUN_CALLBACK_TEST(TestFileIO, ParallelReads, filter);
+ RUN_CALLBACK_TEST(TestFileIO, ParallelWrites, filter);
+ RUN_CALLBACK_TEST(TestFileIO, NotAllowMixedReadWrite, filter);
+ RUN_CALLBACK_TEST(TestFileIO, WillWriteWillSetLength, filter);
+ RUN_CALLBACK_TEST(TestFileIO, RequestOSFileHandle, filter);
// TODO(viettrungluu): add tests:
// - that PP_ERROR_PENDING is correctly returned
@@ -155,17 +176,14 @@
}
std::string TestFileIO::TestOpen() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref(file_system, "/file_open");
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
std::string result;
result = MatchOpenExpectations(
@@ -253,170 +271,131 @@
}
std::string TestFileIO::TestOpenDirectory() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Make a directory.
pp::FileRef dir_ref(file_system, "/test_dir_open_directory");
- rv = dir_ref.MakeDirectory(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::MakeDirectory", rv);
+ callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Open the directory. This is expected to fail since directories cannot be
// opened.
pp::FileIO file_io(instance_);
- rv = file_io.Open(dir_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- // Check for failing open operation for the directory.
- if (rv != PP_ERROR_NOTAFILE)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(dir_ref, PP_FILEOPENFLAG_READ,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_ERROR_NOTAFILE, callback.result());
PASS();
}
std::string TestFileIO::TestReadWriteSetLength() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref(file_system, "/file_read_write_setlength");
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref,
- PP_FILEOPENFLAG_CREATE |
- PP_FILEOPENFLAG_TRUNCATE |
- PP_FILEOPENFLAG_READ |
- PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_TRUNCATE |
+ PP_FILEOPENFLAG_READ |
+ PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Write something to the file.
- rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0, "test_test");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ int32_t rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0,
+ "test_test", callback_type());
+ ASSERT_EQ(PP_OK, rv);
- // Check for failing read operation.
+ // Attempt to read a negative number of bytes; it should fail.
char buf[256];
- rv = file_io.Read(0, buf, -1, // negative number of bytes to read
- callback.GetCallback());
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_FAILED)
- return ReportError("FileIO::Read", rv);
+ callback.WaitForResult(file_io.Read(0,
+ buf,
+ -1,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_ERROR_FAILED, callback.result());
// Read the entire file.
std::string read_buffer;
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != "test_test")
- return ReportMismatch("FileIO::Read", read_buffer, "test_test");
+ rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer,
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test_test"), read_buffer);
// Truncate the file.
- rv = file_io.SetLength(4, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::SetLength force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::SetLength", rv);
+ callback.WaitForResult(file_io.SetLength(4, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Check the file contents.
read_buffer.clear();
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != "test")
- return ReportMismatch("FileIO::Read", read_buffer, "test");
+ rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer,
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test"), read_buffer);
// Try to read past the end of the file.
read_buffer.clear();
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 100, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (!read_buffer.empty())
- return ReportMismatch("FileIO::Read", read_buffer, "<empty string>");
+ rv = ReadEntireFile(instance_->pp_instance(), &file_io, 100, &read_buffer,
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_TRUE(read_buffer.empty());
// Write past the end of the file. The file should be zero-padded.
- rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 8, "test");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 8, "test",
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
// Check the contents of the file.
read_buffer.clear();
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != std::string("test\0\0\0\0test", 12))
- return ReportMismatch("FileIO::Read", read_buffer,
- std::string("test\0\0\0\0test", 12));
+ rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer,
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test\0\0\0\0test", 12), read_buffer);
// Extend the file.
- rv = file_io.SetLength(16, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::SetLength force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::SetLength", rv);
+ callback.WaitForResult(file_io.SetLength(16, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Check the contents of the file.
read_buffer.clear();
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != std::string("test\0\0\0\0test\0\0\0\0", 16))
- return ReportMismatch("FileIO::Read", read_buffer,
- std::string("test\0\0\0\0test\0\0\0\0", 16));
+ rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer,
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test\0\0\0\0test\0\0\0\0", 16), read_buffer);
// Write in the middle of the file.
- rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 4, "test");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 4, "test",
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
// Check the contents of the file.
read_buffer.clear();
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != std::string("testtesttest\0\0\0\0", 16))
- return ReportMismatch("FileIO::Read", read_buffer,
- std::string("testtesttest\0\0\0\0", 16));
+ rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer,
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("testtesttest\0\0\0\0", 16), read_buffer);
// Read from the middle of the file.
read_buffer.clear();
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 4, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != std::string("testtest\0\0\0\0", 12))
- return ReportMismatch("FileIO::Read", read_buffer,
- std::string("testtest\0\0\0\0", 12));
+ rv = ReadEntireFile(instance_->pp_instance(), &file_io, 4, &read_buffer,
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("testtest\0\0\0\0", 12), read_buffer);
PASS();
}
@@ -425,202 +404,149 @@
// API. With this test case, we can make sure the two Read's have the same
// behavior.
std::string TestFileIO::TestReadToArrayWriteSetLength() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ if (callback_type() == PP_BLOCKING) {
+ // This test does not make sense for blocking callbacks.
+ PASS();
+ }
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref(file_system, "/file_read_write_setlength");
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref,
- PP_FILEOPENFLAG_CREATE |
- PP_FILEOPENFLAG_TRUNCATE |
- PP_FILEOPENFLAG_READ |
- PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_TRUNCATE |
+ PP_FILEOPENFLAG_READ |
+ PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Write something to the file.
- rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0, "test_test");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ int32_t rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0,
+ "test_test", callback_type());
+ ASSERT_EQ(PP_OK, rv);
TestCompletionCallbackWithOutput< std::vector<char> > callback2(
- instance_->pp_instance(), force_async_);
- // Check for failing read operation.
- callback2.WaitForResult(
- file_io.Read(0, -1, // negative number of bytes to read
- callback2));
+ instance_->pp_instance(), callback_type());
+ // Attempt to read a negative number of bytes; it should fail.
+ callback2.WaitForResult(file_io.Read(0, -1, callback2.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback2);
- if (callback2.result() != PP_ERROR_FAILED)
- return ReportError("FileIO::Read", callback2.result());
+ ASSERT_EQ(PP_ERROR_FAILED, callback2.result());
// Read the entire file.
std::string read_buffer;
read_buffer.reserve(10);
rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
- &read_buffer, force_async_);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != "test_test")
- return ReportMismatch("FileIO::Read", read_buffer, "test_test");
+ &read_buffer, callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test_test"), read_buffer);
// Truncate the file.
- rv = file_io.SetLength(4, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::SetLength force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::SetLength", rv);
+ callback.WaitForResult(file_io.SetLength(4, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, rv);
// Check the file contents.
read_buffer.clear();
rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
- &read_buffer, force_async_);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != "test")
- return ReportMismatch("FileIO::Read", read_buffer, "test");
+ &read_buffer, callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test"), read_buffer);
// Try to read past the end of the file.
read_buffer.clear();
rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 100,
- &read_buffer, force_async_);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (!read_buffer.empty())
- return ReportMismatch("FileIO::Read", read_buffer, "<empty string>");
+ &read_buffer, callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_TRUE(read_buffer.empty());
// Write past the end of the file. The file should be zero-padded.
- rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 8, "test");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 8, "test",
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
// Check the contents of the file.
read_buffer.clear();
rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
- &read_buffer, force_async_);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != std::string("test\0\0\0\0test", 12))
- return ReportMismatch("FileIO::Read", read_buffer,
- std::string("test\0\0\0\0test", 12));
+ &read_buffer, callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test\0\0\0\0test", 12), read_buffer);
// Extend the file.
- rv = file_io.SetLength(16, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::SetLength force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::SetLength", rv);
+ callback.WaitForResult(file_io.SetLength(16, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Check the contents of the file.
read_buffer.clear();
rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
- &read_buffer, force_async_);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != std::string("test\0\0\0\0test\0\0\0\0", 16))
- return ReportMismatch("FileIO::Read", read_buffer,
- std::string("test\0\0\0\0test\0\0\0\0", 16));
+ &read_buffer, callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test\0\0\0\0test\0\0\0\0", 16), read_buffer);
// Write in the middle of the file.
- rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 4, "test");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 4, "test",
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
// Check the contents of the file.
read_buffer.clear();
rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 0,
- &read_buffer, force_async_);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != std::string("testtesttest\0\0\0\0", 16))
- return ReportMismatch("FileIO::Read", read_buffer,
- std::string("testtesttest\0\0\0\0", 16));
+ &read_buffer, callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("testtesttest\0\0\0\0", 16), read_buffer);
// Read from the middle of the file.
read_buffer.clear();
rv = ReadToArrayEntireFile(instance_->pp_instance(), &file_io, 4,
- &read_buffer, force_async_);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != std::string("testtest\0\0\0\0", 12))
- return ReportMismatch("FileIO::Read", read_buffer,
- std::string("testtest\0\0\0\0", 12));
+ &read_buffer, callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("testtest\0\0\0\0", 12), read_buffer);
PASS();
}
std::string TestFileIO::TestTouchQuery() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef file_ref(file_system, "/file_touch");
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref,
- PP_FILEOPENFLAG_CREATE |
- PP_FILEOPENFLAG_TRUNCATE |
- PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_TRUNCATE |
+ PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Write some data to have a non-zero file size.
- rv = file_io.Write(0, "test", 4, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Write force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != 4)
- return ReportError("FileIO::Write", rv);
+ callback.WaitForResult(file_io.Write(0, "test", 4, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(4, callback.result());
// last_access_time's granularity is 1 day
// last_modified_time's granularity is 2 seconds
const PP_Time last_access_time = 123 * 24 * 3600.0;
const PP_Time last_modified_time = 246.0;
- rv = file_io.Touch(last_access_time, last_modified_time,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Touch force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Touch", rv);
+ callback.WaitForResult(file_io.Touch(last_access_time, last_modified_time,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
PP_FileInfo info;
- rv = file_io.Query(&info, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Query force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Query", rv);
+ callback.WaitForResult(file_io.Query(&info, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
if ((info.size != 4) ||
(info.type != PP_FILETYPE_REGULAR) ||
@@ -630,99 +556,71 @@
return "FileIO::Query() has returned bad data.";
// Call |Query()| again, to make sure it works a second time.
- rv = file_io.Query(&info, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Query force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Query", rv);
+ callback.WaitForResult(file_io.Query(&info, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
PASS();
}
std::string TestFileIO::TestAbortCalls() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref(file_system, "/file_abort_calls");
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- // First, create a file which to do ops on.
+ int32_t rv = PP_ERROR_FAILED;
+ // First, create a file on which to do ops.
{
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref,
- PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(
+ file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// N.B.: Should write at least 3 bytes.
- rv = WriteEntireBuffer(instance_->pp_instance(),
- &file_io,
- 0,
- "foobarbazquux");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0,
+ "foobarbazquux", callback_type());
+ ASSERT_EQ(PP_OK, rv);
}
// Abort |Open()|.
{
- callback.reset_run_count();
- rv = pp::FileIO(instance_).Open(file_ref, PP_FILEOPENFLAG_READ,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (callback.run_count() > 0)
- return "FileIO::Open ran callback synchronously.";
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileIO::Open not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileIO::Open", rv);
- }
+ rv = pp::FileIO(instance_)
+ .Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
}
+ callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
// Abort |Query()|.
{
PP_FileInfo info = { 0 };
+ // Save a copy and make sure |info| doesn't get written to if it is aborted.
+ PP_FileInfo info_copy;
+ memcpy(&info_copy, &info, sizeof(info));
{
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref, PP_FILEOPENFLAG_READ,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- callback.reset_run_count();
rv = file_io.Query(&info, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Query force_async", rv);
} // Destroy |file_io|.
- if (rv == PP_OK_COMPLETIONPENDING) {
- // Save a copy and make sure |info| doesn't get written to.
- PP_FileInfo info_copy;
- memcpy(&info_copy, &info, sizeof(info));
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileIO::Query not aborted.";
- if (memcmp(&info_copy, &info, sizeof(info)) != 0)
- return "FileIO::Query wrote data after resource destruction.";
- } else if (rv != PP_OK) {
- return ReportError("FileIO::Query", rv);
+ callback.WaitForResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ if (callback_type() == PP_BLOCKING) {
+ ASSERT_EQ(callback.result(), PP_OK);
+ // The operation completed synchronously, so |info| should have changed.
+ ASSERT_NE(0, memcmp(&info_copy, &info, sizeof(info)));
+ } else {
+ ASSERT_EQ(callback.result(), PP_ERROR_ABORTED);
+ ASSERT_EQ(0, memcmp(&info_copy, &info, sizeof(info)));
}
}
@@ -730,27 +628,15 @@
{
{
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- callback.reset_run_count();
rv = file_io.Touch(0, 0, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Touch force_async", rv);
} // Destroy |file_io|.
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileIO::Touch not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileIO::Touch", rv);
- }
+ callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
}
// Abort |Read()|.
@@ -758,30 +644,23 @@
char buf[3] = { 0 };
{
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref, PP_FILEOPENFLAG_READ,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- callback.reset_run_count();
rv = file_io.Read(0, buf, sizeof(buf), callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Read force_async", rv);
} // Destroy |file_io|.
- if (rv == PP_OK_COMPLETIONPENDING) {
- // Save a copy and make sure |buf| doesn't get written to.
- char buf_copy[3];
- memcpy(&buf_copy, &buf, sizeof(buf));
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileIO::Read not aborted.";
- if (memcmp(&buf_copy, &buf, sizeof(buf)) != 0)
- return "FileIO::Read wrote data after resource destruction.";
- } else if (rv != PP_OK) {
- return ReportError("FileIO::Read", rv);
+ // Save a copy to make sure buf isn't written to in the async case.
+ char buf_copy[3];
+ memcpy(&buf_copy, &buf, sizeof(buf));
+ callback.WaitForResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ if (callback_type() == PP_BLOCKING) {
+ ASSERT_EQ(callback.result(), sizeof(buf));
+ } else {
+ ASSERT_EQ(callback.result(), PP_ERROR_ABORTED);
+ ASSERT_EQ(0, memcmp(&buf_copy, &buf, sizeof(buf)));
}
}
@@ -790,122 +669,82 @@
char buf[3] = { 0 };
{
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- callback.reset_run_count();
rv = file_io.Write(0, buf, sizeof(buf), callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Write force_async", rv);
} // Destroy |file_io|.
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileIO::Write not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileIO::Write", rv);
- }
+ callback.WaitForResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ if (callback_type() == PP_BLOCKING)
+ ASSERT_EQ(callback.result(), sizeof(buf));
+ else
+ ASSERT_EQ(callback.result(), PP_ERROR_ABORTED);
}
// Abort |SetLength()|.
{
{
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref, PP_FILEOPENFLAG_READ,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- callback.reset_run_count();
rv = file_io.SetLength(3, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::SetLength force_async", rv);
} // Destroy |file_io|.
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileIO::SetLength not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileIO::SetLength", rv);
- }
+ callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
}
- // Abort |Flush()|.
+ // Abort |Flush|.
{
{
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- callback.reset_run_count();
rv = file_io.Flush(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Flush force_async", rv);
} // Destroy |file_io|.
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileIO::Flush not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileIO::Flush", rv);
- }
+ callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
}
- // TODO(viettrungluu): Also test that Close() aborts callbacks.
- // crbug.com/69457
-
PASS();
}
std::string TestFileIO::TestParallelReads() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref(file_system, "/file_parallel_reads");
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref,
- PP_FILEOPENFLAG_CREATE |
- PP_FILEOPENFLAG_TRUNCATE |
- PP_FILEOPENFLAG_READ |
- PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_TRUNCATE |
+ PP_FILEOPENFLAG_READ |
+ PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Set up testing contents.
- rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0, "abcdefghijkl");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ int32_t rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0,
+ "abcdefghijkl", callback_type());
+ ASSERT_EQ(PP_OK, rv);
// Parallel read operations.
const char* border = "__border__";
const int32_t border_size = strlen(border);
- TestCompletionCallback callback_1(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback_1(instance_->pp_instance(), callback_type());
int32_t read_offset_1 = 0;
int32_t size_1 = 3;
std::vector<char> extended_buf_1(border_size * 2 + size_1);
@@ -913,7 +752,7 @@
memcpy(&extended_buf_1[0], border, border_size);
memcpy(buf_1 + size_1, border, border_size);
- TestCompletionCallback callback_2(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback_2(instance_->pp_instance(), callback_type());
int32_t read_offset_2 = size_1;
int32_t size_2 = 9;
std::vector<char> extended_buf_2(border_size * 2 + size_2);
@@ -927,90 +766,69 @@
if (size_1 > 0) {
rv_1 = file_io.Read(read_offset_1, buf_1, size_1,
callback_1.GetCallback());
- if (rv_1 != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Read", rv_1);
}
-
if (size_2 > 0) {
rv_2 = file_io.Read(read_offset_2, buf_2, size_2,
callback_2.GetCallback());
- if (rv_2 != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Read", rv_2);
}
-
if (size_1 > 0) {
- rv_1 = callback_1.WaitForResult();
- if (rv_1 <= 0)
- return ReportError("FileIO::Read", rv_1);
- read_offset_1 += rv_1;
- buf_1 += rv_1;
- size_1 -= rv_1;
+ callback_1.WaitForResult(rv_1);
+ CHECK_CALLBACK_BEHAVIOR(callback_1);
+ ASSERT_TRUE(callback_1.result() > 0);
+ read_offset_1 += callback_1.result();
+ buf_1 += callback_1.result();
+ size_1 -= callback_1.result();
}
if (size_2 > 0) {
- rv_2 = callback_2.WaitForResult();
- if (rv_2 <= 0)
- return ReportError("FileIO::Read", rv_2);
- read_offset_2 += rv_2;
- buf_2 += rv_2;
- size_2 -= rv_2;
+ callback_2.WaitForResult(rv_2);
+ CHECK_CALLBACK_BEHAVIOR(callback_2);
+ ASSERT_TRUE(callback_2.result() > 0);
+ read_offset_2 += callback_2.result();
+ buf_2 += callback_2.result();
+ size_2 -= callback_2.result();
}
}
- // If |size_1| or |size_2| is less than 0, we have invoked wrong
- // callback(s).
- if (size_1 < 0 || size_2 < 0) {
- return std::string(
- "Parallel FileIO::Read operations have invoked wrong callbacks.");
- }
+ // If |size_1| or |size_2| is not 0, we have invoked wrong callback(s).
+ ASSERT_EQ(0, size_1);
+ ASSERT_EQ(0, size_2);
// Make sure every read operation writes into the correct buffer.
const char expected_result_1[] = "__border__abc__border__";
const char expected_result_2[] = "__border__defghijkl__border__";
- if (strncmp(&extended_buf_1[0], expected_result_1,
- strlen(expected_result_1)) != 0 ||
- strncmp(&extended_buf_2[0], expected_result_2,
- strlen(expected_result_2)) != 0) {
- return std::string(
- "Parallel FileIO::Read operations have written into wrong buffers.");
- }
-
+ ASSERT_TRUE(strncmp(&extended_buf_1[0], expected_result_1,
+ strlen(expected_result_1)) == 0);
+ ASSERT_TRUE(strncmp(&extended_buf_2[0], expected_result_2,
+ strlen(expected_result_2)) == 0);
PASS();
}
std::string TestFileIO::TestParallelWrites() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref(file_system, "/file_parallel_writes");
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref,
- PP_FILEOPENFLAG_CREATE |
- PP_FILEOPENFLAG_TRUNCATE |
- PP_FILEOPENFLAG_READ |
- PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_TRUNCATE |
+ PP_FILEOPENFLAG_READ |
+ PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Parallel write operations.
- TestCompletionCallback callback_1(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback_1(instance_->pp_instance(), callback_type());
int32_t write_offset_1 = 0;
const char* buf_1 = "abc";
int32_t size_1 = strlen(buf_1);
- TestCompletionCallback callback_2(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback_2(instance_->pp_instance(), callback_type());
int32_t write_offset_2 = size_1;
const char* buf_2 = "defghijkl";
int32_t size_2 = strlen(buf_2);
@@ -1021,229 +839,295 @@
if (size_1 > 0) {
rv_1 = file_io.Write(write_offset_1, buf_1, size_1,
callback_1.GetCallback());
- if (rv_1 != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Write", rv_1);
}
-
if (size_2 > 0) {
rv_2 = file_io.Write(write_offset_2, buf_2, size_2,
callback_2.GetCallback());
- if (rv_2 != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Write", rv_2);
}
if (size_1 > 0) {
- rv_1 = callback_1.WaitForResult();
- if (rv_1 <= 0)
- return ReportError("FileIO::Write", rv_1);
- write_offset_1 += rv_1;
- buf_1 += rv_1;
- size_1 -= rv_1;
+ callback_1.WaitForResult(rv_1);
+ CHECK_CALLBACK_BEHAVIOR(callback_1);
+ ASSERT_TRUE(callback_1.result() > 0);
+ write_offset_1 += callback_1.result();
+ buf_1 += callback_1.result();
+ size_1 -= callback_1.result();
}
if (size_2 > 0) {
- rv_2 = callback_2.WaitForResult();
- if (rv_2 <= 0)
- return ReportError("FileIO::Write", rv_2);
- write_offset_2 += rv_2;
- buf_2 += rv_2;
- size_2 -= rv_2;
+ callback_2.WaitForResult(rv_2);
+ CHECK_CALLBACK_BEHAVIOR(callback_2);
+ ASSERT_TRUE(callback_2.result() > 0);
+ write_offset_2 += callback_2.result();
+ buf_2 += callback_2.result();
+ size_2 -= callback_2.result();
}
}
- // If |size_1| or |size_2| is less than 0, we have invoked wrong
- // callback(s).
- if (size_1 < 0 || size_2 < 0) {
- return std::string(
- "Parallel FileIO::Write operations have invoked wrong callbacks.");
- }
+ // If |size_1| or |size_2| is not 0, we have invoked wrong callback(s).
+ ASSERT_EQ(0, size_1);
+ ASSERT_EQ(0, size_2);
// Check the file contents.
std::string read_buffer;
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != "abcdefghijkl")
- return ReportMismatch("FileIO::Read", read_buffer, "abcdefghijkl");
+ int32_t rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0,
+ &read_buffer, callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("abcdefghijkl"), read_buffer);
PASS();
}
std::string TestFileIO::TestNotAllowMixedReadWrite() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ if (callback_type() == PP_BLOCKING) {
+ // This test does not make sense for blocking callbacks.
+ PASS();
+ }
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref(file_system, "/file_not_allow_mixed_read_write");
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref,
- PP_FILEOPENFLAG_CREATE |
- PP_FILEOPENFLAG_TRUNCATE |
- PP_FILEOPENFLAG_READ |
- PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_TRUNCATE |
+ PP_FILEOPENFLAG_READ |
+ PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- // Cannot read and write in parallel.
- TestCompletionCallback callback_1(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback_1(instance_->pp_instance(), PP_REQUIRED);
int32_t write_offset_1 = 0;
const char* buf_1 = "mnopqrstuvw";
int32_t rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1),
callback_1.GetCallback());
- if (rv_1 != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Write", rv_1);
+ ASSERT_EQ(PP_OK_COMPLETIONPENDING, rv_1);
- TestCompletionCallback callback_2(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback_2(instance_->pp_instance(), callback_type());
int32_t read_offset_2 = 4;
char buf_2[3];
- int32_t rv_2 = file_io.Read(read_offset_2, buf_2, sizeof(buf_2),
- callback_2.GetCallback());
- if (force_async_ && rv_2 != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Read force_async", rv_2);
- if (rv_2 == PP_OK_COMPLETIONPENDING)
- rv_2 = callback_2.WaitForResult();
- if (rv_2 != PP_ERROR_INPROGRESS)
- return ReportError("FileIO::Read", rv_2);
- callback_1.WaitForResult();
+ callback_2.WaitForResult(file_io.Read(read_offset_2, buf_2, sizeof(buf_2),
+ callback_2.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback_2);
+ ASSERT_EQ(PP_ERROR_INPROGRESS, callback_2.result());
+ callback_1.WaitForResult(rv_1);
+ CHECK_CALLBACK_BEHAVIOR(callback_1);
// Cannot query while a write is pending.
rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1),
callback_1.GetCallback());
ASSERT_EQ(PP_OK_COMPLETIONPENDING, rv_1);
- TestCompletionCallback callback_3(instance_->pp_instance(), force_async_);
PP_FileInfo info;
- int32_t rv_3 = file_io.Query(&info, callback_3.GetCallback());
- if (rv_3 == PP_OK_COMPLETIONPENDING)
- rv_3 = callback_3.WaitForResult();
- if (rv_3 != PP_ERROR_INPROGRESS)
- return ReportError("FileIO::Query", rv_3);
- callback_1.WaitForResult();
+ callback_2.WaitForResult(file_io.Query(&info, callback_2.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback_2);
+ ASSERT_EQ(PP_ERROR_INPROGRESS, callback_2.result());
+ callback_1.WaitForResult(rv_1);
+ CHECK_CALLBACK_BEHAVIOR(callback_1);
// Cannot touch while a write is pending.
rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1),
callback_1.GetCallback());
ASSERT_EQ(PP_OK_COMPLETIONPENDING, rv_1);
- TestCompletionCallback callback_4(instance_->pp_instance(), force_async_);
- int32_t rv_4 = file_io.Touch(1234.0, 5678.0, callback_4.GetCallback());
- if (rv_4 == PP_OK_COMPLETIONPENDING)
- rv_4 = callback_4.WaitForResult();
- if (rv_4 != PP_ERROR_INPROGRESS)
- return ReportError("FileIO::Touch", rv_4);
- callback_1.WaitForResult();
+ callback_2.WaitForResult(file_io.Touch(1234.0, 5678.0,
+ callback_2.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback_2);
+ ASSERT_EQ(PP_ERROR_INPROGRESS, callback_2.result());
+ callback_1.WaitForResult(rv_1);
+ CHECK_CALLBACK_BEHAVIOR(callback_1);
// Cannot set length while a write is pending.
rv_1 = file_io.Write(write_offset_1, buf_1, strlen(buf_1),
callback_1.GetCallback());
ASSERT_EQ(PP_OK_COMPLETIONPENDING, rv_1);
- TestCompletionCallback callback_5(instance_->pp_instance(), force_async_);
- int32_t rv_5 = file_io.SetLength(123, callback_5.GetCallback());
- if (rv_5 == PP_OK_COMPLETIONPENDING)
- rv_5 = callback_5.WaitForResult();
- if (rv_5 != PP_ERROR_INPROGRESS)
- return ReportError("FileIO::SetLength", rv_5);
- callback_1.WaitForResult();
+ callback_2.WaitForResult(file_io.SetLength(123, callback_2.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback_2);
+ ASSERT_EQ(PP_ERROR_INPROGRESS, callback_2.result());
+ callback_1.WaitForResult(rv_1);
+ CHECK_CALLBACK_BEHAVIOR(callback_1);
PASS();
}
std::string TestFileIO::TestWillWriteWillSetLength() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref(file_system, "/file_will_write");
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref,
- PP_FILEOPENFLAG_CREATE |
- PP_FILEOPENFLAG_TRUNCATE |
- PP_FILEOPENFLAG_READ |
- PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_TRUNCATE |
+ PP_FILEOPENFLAG_READ |
+ PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
const PPB_FileIOTrusted* trusted = static_cast<const PPB_FileIOTrusted*>(
pp::Module::Get()->GetBrowserInterface(PPB_FILEIOTRUSTED_INTERFACE));
- if (!trusted)
- return ReportError("FileIOTrusted", PP_ERROR_FAILED);
+ ASSERT_TRUE(trusted);
// Get file descriptor. This is only supported in-process for now, so don't
// test out of process.
const PPB_Testing_Dev* testing_interface = GetTestingInterface();
if (testing_interface && !testing_interface->IsOutOfProcess()) {
int32_t fd = trusted->GetOSFileDescriptor(file_io.pp_resource());
- if (fd < 0)
- return "FileIO::GetOSFileDescriptor() returned a bad file descriptor.";
+ ASSERT_TRUE(fd >= 0);
}
// Calling WillWrite.
- rv = trusted->WillWrite(
+ callback.WaitForResult(trusted->WillWrite(
file_io.pp_resource(), 0, 9,
- callback.GetCallback().pp_completion_callback());
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != 9)
- return ReportError("WillWrite", rv);
+ callback.GetCallback().pp_completion_callback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(9, callback.result());
// Writing the actual data.
- rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0, "test_test");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ int32_t rv = WriteEntireBuffer(instance_->pp_instance(), &file_io, 0,
+ "test_test", callback_type());
+ ASSERT_EQ(PP_OK, rv);
std::string read_buffer;
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != "test_test")
- return ReportMismatch("FileIO::Read", read_buffer, "test_test");
+ rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer,
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test_test"), read_buffer);
// Calling WillSetLength.
- rv = trusted->WillSetLength(
+ callback.WaitForResult(trusted->WillSetLength(
file_io.pp_resource(), 4,
- callback.GetCallback().pp_completion_callback());
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("WillSetLength", rv);
+ callback.GetCallback().pp_completion_callback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, rv);
// Calling actual SetLength.
- rv = file_io.SetLength(4, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::SetLength force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::SetLength", rv);
+ callback.WaitForResult(file_io.SetLength(4, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, rv);
read_buffer.clear();
- rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer);
- if (rv != PP_OK)
- return ReportError("FileIO::Read", rv);
- if (read_buffer != "test")
- return ReportMismatch("FileIO::Read", read_buffer, "test");
+ rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer,
+ callback_type());
+ ASSERT_EQ(PP_OK, rv);
+ ASSERT_EQ(std::string("test"), read_buffer);
+
+ PASS();
+}
+
+std::string TestFileIO::TestRequestOSFileHandle() {
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+
+ pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
+ pp::FileRef file_ref(file_system, "/file_os_fd");
+
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ ASSERT_EQ(PP_OK, callback.result());
+
+ pp::FileIO_Private file_io(instance_);
+ callback.WaitForResult(file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_TRUNCATE |
+ PP_FILEOPENFLAG_READ |
+ PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ ASSERT_EQ(PP_OK, callback.result());
+
+ TestCompletionCallbackWithOutput<pp::PassFileHandle> output_callback(
+ instance_->pp_instance(), callback_type());
+ output_callback.WaitForResult(
+ file_io.RequestOSFileHandle(output_callback.GetCallback()));
+ PP_FileHandle handle = output_callback.output().Release();
+ ASSERT_EQ(PP_OK, output_callback.result());
+
+ if (handle == PP_kInvalidFileHandle)
+ return "FileIO::RequestOSFileHandle() returned a bad file handle.";
+#if defined(PPAPI_OS_WIN)
+ int fd = _open_osfhandle(reinterpret_cast<intptr_t>(handle),
+ _O_RDWR | _O_BINARY);
+#else
+ int fd = handle;
+#endif
+ if (fd < 0)
+ return "FileIO::RequestOSFileHandle() returned a bad file descriptor.";
+
+ // Check write(2) for the native FD.
+ const std::string msg = "foobar";
+ ssize_t cnt = write(fd, msg.data(), msg.size());
+ if (cnt < 0)
+ return ReportError("write for native FD returned error", errno);
+ if (cnt != static_cast<ssize_t>(msg.size()))
+ return ReportError("write for native FD count mismatch", cnt);
+
+ // Check lseek(2) for the native FD.
+ off_t off = lseek(fd, 0, SEEK_CUR);
+ if (off == static_cast<off_t>(-1))
+ return ReportError("lseek for native FD returned error", errno);
+ if (off != static_cast<off_t>(msg.size()))
+ return ReportError("lseek for native FD offset mismatch", off);
+
+ off = lseek(fd, 0, SEEK_SET);
+ if (off == static_cast<off_t>(-1))
+ return ReportError("lseek for native FD returned error", errno);
+ if (off != 0)
+ return ReportError("lseek for native FD offset mismatch", off);
+
+ // Check read(2) for the native FD.
+ std::string buf(msg.size(), '\0');
+ cnt = read(fd, &buf[0], msg.size());
+ if (cnt < 0)
+ return ReportError("read for native FD returned error", errno);
+ if (cnt != static_cast<ssize_t>(msg.size()))
+ return ReportError("read for native FD count mismatch", cnt);
+ if (msg != buf)
+ return ReportMismatch("read for native FD", buf, msg);
+
+ // TODO(hamaji): Test CreateFileMapping for windows.
+#if !defined(PPAPI_OS_WIN)
+ // Check mmap(2) for read.
+ char* mapped = reinterpret_cast<char*>(
+ mmap(NULL, msg.size(), PROT_READ, MAP_PRIVATE, fd, 0));
+ if (mapped == MAP_FAILED)
+ return ReportError("mmap(r) for native FD returned errno", errno);
+ // Make sure the buffer is cleared.
+ buf = std::string(msg.size(), '\0');
+ memcpy(&buf[0], mapped, msg.size());
+ if (msg != buf)
+ return ReportMismatch("mmap(r) for native FD", buf, msg);
+ int r = munmap(mapped, msg.size());
+ if (r < 0)
+ return ReportError("munmap for native FD returned error", errno);
+
+ // Check mmap(2) for write.
+ mapped = reinterpret_cast<char*>(
+ mmap(NULL, msg.size(), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
+ if (mapped == MAP_FAILED)
+ return ReportError("mmap(w) for native FD returned errno", errno);
+ // s/foo/baz/
+ strcpy(mapped, "baz");
+
+ r = munmap(mapped, msg.size());
+ if (r < 0)
+ return ReportError("munmap for native FD returned error", errno);
+#endif
+
+#if defined(PPAPI_OS_WIN)
+ int r = _close(fd);
+#else
+ r = close(handle);
+#endif
+ if (r < 0)
+ return ReportError("close for native FD returned error", errno);
+
+ // TODO(hamaji): Check if the file is actually updated?
PASS();
}
@@ -1270,7 +1154,7 @@
bool open_if_exists = !!(expectations & OPEN_IF_EXISTS);
bool truncate_if_exists = !!(expectations & TRUNCATE_IF_EXISTS);
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileRef existent_file_ref(
*file_system, "/match_open_expectation_existent_non_empty_file");
pp::FileRef nonexistent_file_ref(
@@ -1278,74 +1162,55 @@
// Setup files for test.
{
- int32_t rv = existent_file_ref.Delete(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Delete force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
- return ReportError("FileRef::Delete", rv);
-
- rv = nonexistent_file_ref.Delete(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Delete force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
- return ReportError("FileRef::Delete", rv);
+ callback.WaitForResult(existent_file_ref.Delete(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_TRUE(callback.result() == PP_OK ||
+ callback.result() == PP_ERROR_FILENOTFOUND);
+ callback.WaitForResult(nonexistent_file_ref.Delete(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_TRUE(callback.result() == PP_OK ||
+ callback.result() == PP_ERROR_FILENOTFOUND);
pp::FileIO existent_file_io(instance_);
- rv = existent_file_io.Open(existent_file_ref,
- PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
-
- rv = WriteEntireBuffer(instance_->pp_instance(), &existent_file_io, 0,
- "foobar");
- if (rv != PP_OK)
- return ReportError("FileIO::Write", rv);
+ callback.WaitForResult(existent_file_io.Open(
+ existent_file_ref,
+ PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+ int32_t rv = WriteEntireBuffer(instance_->pp_instance(), &existent_file_io,
+ 0, "foobar", callback_type());
+ ASSERT_EQ(PP_OK, rv);
}
pp::FileIO existent_file_io(instance_);
- int32_t rv = existent_file_io.Open(existent_file_ref, open_flags,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if ((invalid_combination && rv == PP_OK) ||
- (!invalid_combination && ((rv == PP_OK) != open_if_exists))) {
+ callback.WaitForResult(existent_file_io.Open(existent_file_ref, open_flags,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ if ((invalid_combination && callback.result() == PP_OK) ||
+ (!invalid_combination &&
+ ((callback.result() == PP_OK) != open_if_exists))) {
return ReportOpenError(open_flags);
}
if (!invalid_combination && open_if_exists) {
PP_FileInfo info;
- rv = existent_file_io.Query(&info, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Query force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Query", rv);
-
+ callback.WaitForResult(existent_file_io.Query(&info,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
if (truncate_if_exists != (info.size == 0))
return ReportOpenError(open_flags);
}
pp::FileIO nonexistent_file_io(instance_);
- rv = nonexistent_file_io.Open(nonexistent_file_ref, open_flags,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if ((invalid_combination && rv == PP_OK) ||
- (!invalid_combination && ((rv == PP_OK) != create_if_doesnt_exist))) {
+ callback.WaitForResult(nonexistent_file_io.Open(nonexistent_file_ref,
+ open_flags,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ if ((invalid_combination && callback.result() == PP_OK) ||
+ (!invalid_combination &&
+ ((callback.result() == PP_OK) != create_if_doesnt_exist))) {
return ReportOpenError(open_flags);
}
diff --git a/ppapi/tests/test_file_io.h b/ppapi/tests/test_file_io.h
index 8db0ba1..36917b5 100644
--- a/ppapi/tests/test_file_io.h
+++ b/ppapi/tests/test_file_io.h
@@ -47,6 +47,7 @@
std::string TestParallelWrites();
std::string TestNotAllowMixedReadWrite();
std::string TestWillWriteWillSetLength();
+ std::string TestRequestOSFileHandle();
// Helper method used by TestOpen().
// |expectations| is a combination of OpenExpectation values. The followings
diff --git a/ppapi/tests/test_file_ref.cc b/ppapi/tests/test_file_ref.cc
index 3c91f18..04e8ce1 100644
--- a/ppapi/tests/test_file_ref.cc
+++ b/ppapi/tests/test_file_ref.cc
@@ -5,13 +5,14 @@
#include "ppapi/tests/test_file_ref.h"
#include <stdio.h>
+
+#include <sstream>
#include <vector>
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_file_io.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
-#include "ppapi/cpp/dev/directory_entry_dev.h"
-#include "ppapi/cpp/dev/directory_reader_dev.h"
+#include "ppapi/cpp/directory_entry.h"
#include "ppapi/cpp/file_io.h"
#include "ppapi/cpp/file_ref.h"
#include "ppapi/cpp/file_system.h"
@@ -32,9 +33,9 @@
const char* kParentPath = "/foo/bar";
const char* kPersFilePath = "/foo/bar/persistent";
const char* kTempFilePath = "/foo/bar/temporary";
-#ifndef PPAPI_OS_NACL // Only used for a test that NaCl can't run yet.
const char* kTerribleName = "!@#$%^&*()-_=+{}[] ;:'\"|`~\t\n\r\b?";
-#endif
+
+typedef std::vector<pp::DirectoryEntry> DirEntries;
std::string ReportMismatch(const std::string& method_name,
const std::string& returned_result,
@@ -49,25 +50,84 @@
return CheckTestingInterface() && EnsureRunningOverHTTP();
}
+std::string TestFileRef::MakeExternalFileRef(pp::FileRef* file_ref_ext) {
+ pp::URLRequestInfo request(instance_);
+ request.SetURL("test_url_loader_data/hello.txt");
+ request.SetStreamToFile(true);
+
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+
+ pp::URLLoader loader(instance_);
+ callback.WaitForResult(loader.Open(request, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+
+ pp::URLResponseInfo response_info(loader.GetResponseInfo());
+ ASSERT_FALSE(response_info.is_null());
+ ASSERT_EQ(200, response_info.GetStatusCode());
+
+ *file_ref_ext = pp::FileRef(response_info.GetBodyAsFileRef());
+ ASSERT_EQ(PP_FILESYSTEMTYPE_EXTERNAL, file_ref_ext->GetFileSystemType());
+ PASS();
+}
+
+int32_t TestFileRef::DeleteDirectoryRecursively(pp::FileRef* dir) {
+ if (!dir)
+ return PP_ERROR_BADARGUMENT;
+
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ TestCompletionCallbackWithOutput<DirEntries> output_callback(
+ instance_->pp_instance(), callback_type());
+
+ output_callback.WaitForResult(
+ dir->ReadDirectoryEntries(output_callback.GetCallback()));
+ int32_t rv = output_callback.result();
+ if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
+ return rv;
+
+ DirEntries entries = output_callback.output();
+ for (DirEntries::const_iterator it = entries.begin();
+ it != entries.end();
+ ++it) {
+ pp::FileRef file_ref = it->file_ref();
+ if (it->file_type() == PP_FILETYPE_DIRECTORY) {
+ rv = DeleteDirectoryRecursively(&file_ref);
+ if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
+ return rv;
+ } else {
+ callback.WaitForResult(file_ref.Delete(callback.GetCallback()));
+ rv = callback.result();
+ if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
+ return rv;
+ }
+ }
+ callback.WaitForResult(dir->Delete(callback.GetCallback()));
+ return callback.result();
+}
+
void TestFileRef::RunTests(const std::string& filter) {
- RUN_TEST_FORCEASYNC_AND_NOT(Create, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(GetFileSystemType, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(GetName, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(GetPath, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(GetParent, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(MakeDirectory, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(QueryAndTouchFile, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(DeleteFileAndDirectory, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(RenameFileAndDirectory, filter);
-#ifndef PPAPI_OS_NACL // NaCl can't run this test yet.
- RUN_TEST_FORCEASYNC_AND_NOT(FileNameEscaping, filter);
-#endif
+ RUN_CALLBACK_TEST(TestFileRef, Create, filter);
+ RUN_CALLBACK_TEST(TestFileRef, GetFileSystemType, filter);
+ RUN_CALLBACK_TEST(TestFileRef, GetName, filter);
+ RUN_CALLBACK_TEST(TestFileRef, GetPath, filter);
+ RUN_CALLBACK_TEST(TestFileRef, GetParent, filter);
+ RUN_CALLBACK_TEST(TestFileRef, MakeDirectory, filter);
+ RUN_CALLBACK_TEST(TestFileRef, QueryAndTouchFile, filter);
+ RUN_CALLBACK_TEST(TestFileRef, DeleteFileAndDirectory, filter);
+ RUN_CALLBACK_TEST(TestFileRef, RenameFileAndDirectory, filter);
+ // FileRef::Query is out-of-process only.
+ if (testing_interface_->IsOutOfProcess())
+ RUN_CALLBACK_TEST(TestFileRef, Query, filter);
+ RUN_CALLBACK_TEST(TestFileRef, FileNameEscaping, filter);
+ // FileRef::ReadDirectoryEntries is out-of-process only.
+ if (testing_interface_->IsOutOfProcess())
+ RUN_CALLBACK_TEST(TestFileRef, ReadDirectoryEntries, filter);
}
std::string TestFileRef::TestCreate() {
std::vector<std::string> invalid_paths;
invalid_paths.push_back("invalid_path"); // no '/' at the first character
- invalid_paths.push_back(""); // empty path
+ invalid_paths.push_back(std::string()); // empty path
// The following are directory traversal checks
invalid_paths.push_back("..");
invalid_paths.push_back("/../invalid_path");
@@ -108,32 +168,10 @@
if (file_ref_temp.GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALTEMPORARY)
return "file_ref_temp expected to be temporary.";
- pp::URLRequestInfo request(instance_);
- request.SetURL("test_url_loader_data/hello.txt");
- request.SetStreamToFile(true);
-
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
-
- pp::URLLoader loader(instance_);
- int32_t rv = loader.Open(request, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("URLLoader::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return "URLLoader::Open() failed.";
-
- pp::URLResponseInfo response_info(loader.GetResponseInfo());
- if (response_info.is_null())
- return "URLLoader::GetResponseInfo returned null";
- int32_t status_code = response_info.GetStatusCode();
- if (status_code != 200)
- return "Unexpected HTTP status code";
-
- pp::FileRef file_ref_ext(response_info.GetBodyAsFileRef());
- if (file_ref_ext.GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL)
- return "file_ref_ext expected to be external.";
-
+ pp::FileRef file_ref_ext;
+ std::string result = MakeExternalFileRef(&file_ref_ext);
+ if (!result.empty())
+ return result;
PASS();
}
@@ -163,28 +201,20 @@
request.SetURL("test_url_loader_data/hello.txt");
request.SetStreamToFile(true);
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::URLLoader loader(instance_);
- int32_t rv = loader.Open(request, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("URLLoader::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return "URLLoader::Open() failed.";
+ callback.WaitForResult(loader.Open(request, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::URLResponseInfo response_info(loader.GetResponseInfo());
- if (response_info.is_null())
- return "URLLoader::GetResponseInfo returned null";
- int32_t status_code = response_info.GetStatusCode();
- if (status_code != 200)
- return "Unexpected HTTP status code";
+ ASSERT_FALSE(response_info.is_null());
+ ASSERT_EQ(200, response_info.GetStatusCode());
pp::FileRef file_ref_ext(response_info.GetBodyAsFileRef());
name = file_ref_ext.GetName().AsString();
- if (name == "")
- return ReportMismatch("FileRef::GetName", name, "<a temp file>");
+ ASSERT_FALSE(name.empty());
PASS();
}
@@ -196,40 +226,28 @@
instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref_pers(file_system_pers, kPersFilePath);
- std::string path = file_ref_pers.GetPath().AsString();
- if (path != kPersFilePath)
- return ReportMismatch("FileRef::GetPath", path, kPersFilePath);
+ ASSERT_EQ(kPersFilePath, file_ref_pers.GetPath().AsString());
pp::FileRef file_ref_temp(file_system_temp, kTempFilePath);
- path = file_ref_temp.GetPath().AsString();
- if (path != kTempFilePath)
- return ReportMismatch("FileRef::GetPath", path, kTempFilePath);
+ ASSERT_EQ(kTempFilePath, file_ref_temp.GetPath().AsString());
pp::URLRequestInfo request(instance_);
request.SetURL("test_url_loader_data/hello.txt");
request.SetStreamToFile(true);
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::URLLoader loader(instance_);
- int32_t rv = loader.Open(request, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("URLLoader::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return "URLLoader::Open() failed.";
+ callback.WaitForResult(loader.Open(request, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::URLResponseInfo response_info(loader.GetResponseInfo());
- if (response_info.is_null())
- return "URLLoader::GetResponseInfo returned null";
- int32_t status_code = response_info.GetStatusCode();
- if (status_code != 200)
- return "Unexpected HTTP status code";
+ ASSERT_FALSE(response_info.is_null());
+ ASSERT_EQ(200, response_info.GetStatusCode());
pp::FileRef file_ref_ext(response_info.GetBodyAsFileRef());
- if (!file_ref_ext.GetPath().is_undefined())
- return "The path of an external FileRef should be void.";
+ ASSERT_TRUE(file_ref_ext.GetPath().is_undefined());
PASS();
}
@@ -241,503 +259,494 @@
instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
pp::FileRef file_ref_pers(file_system_pers, kPersFilePath);
- std::string parent_path = file_ref_pers.GetParent().GetPath().AsString();
- if (parent_path != kParentPath)
- return ReportMismatch("FileRef::GetParent", parent_path, kParentPath);
+ ASSERT_EQ(kParentPath, file_ref_pers.GetParent().GetPath().AsString());
pp::FileRef file_ref_temp(file_system_temp, kTempFilePath);
- parent_path = file_ref_temp.GetParent().GetPath().AsString();
- if (parent_path != kParentPath)
- return ReportMismatch("FileRef::GetParent", parent_path, kParentPath);
+ ASSERT_EQ(kParentPath, file_ref_temp.GetParent().GetPath().AsString());
// Test the "/" case.
pp::FileRef file_ref_slash(file_system_temp, "/");
- parent_path = file_ref_slash.GetParent().GetPath().AsString();
- if (parent_path != "/")
- return ReportMismatch("FileRef::GetParent", parent_path, "/");
+ ASSERT_EQ("/", file_ref_slash.GetParent().GetPath().AsString());
// Test the "/foo" case (the parent is "/").
pp::FileRef file_ref_with_root_parent(file_system_temp, "/foo");
- parent_path = file_ref_with_root_parent.GetParent().GetPath().AsString();
- if (parent_path != "/")
- return ReportMismatch("FileRef::GetParent", parent_path, "/");
+ ASSERT_EQ("/", file_ref_with_root_parent.GetParent().GetPath().AsString());
pp::URLRequestInfo request(instance_);
request.SetURL("test_url_loader_data/hello.txt");
request.SetStreamToFile(true);
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::URLLoader loader(instance_);
- int32_t rv = loader.Open(request, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("URLLoader::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return "URLLoader::Open() failed.";
+ callback.WaitForResult(loader.Open(request, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::URLResponseInfo response_info(loader.GetResponseInfo());
- if (response_info.is_null())
- return "URLLoader::GetResponseInfo returned null";
- int32_t status_code = response_info.GetStatusCode();
- if (status_code != 200)
- return "Unexpected HTTP status code";
+ ASSERT_FALSE(response_info.is_null());
+ ASSERT_EQ(200, response_info.GetStatusCode());
pp::FileRef file_ref_ext(response_info.GetBodyAsFileRef());
- if (!file_ref_ext.GetParent().is_null())
- return "The parent of an external FileRef should be null.";
+ ASSERT_TRUE(file_ref_ext.GetParent().is_null());
PASS();
}
std::string TestFileRef::TestMakeDirectory() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
// Open.
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// MakeDirectory.
pp::FileRef dir_ref(file_system, "/test_dir_make_directory");
- rv = dir_ref.MakeDirectory(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::MakeDirectory", rv);
+ callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// MakeDirectory aborted.
- callback.reset_run_count();
- rv = pp::FileRef(file_system, "/test_dir_make_abort")
- .MakeDirectory(callback.GetCallback());
- if (callback.run_count() > 0)
- return "FileSystem::MakeDirectory ran callback synchronously.";
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileSystem::MakeDirectory not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileSystem::MakeDirectory", rv);
+ int32_t rv = PP_ERROR_FAILED;
+ {
+ rv = pp::FileRef(file_system, "/test_dir_make_abort")
+ .MakeDirectory(callback.GetCallback());
}
+ callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
// MakeDirectoryIncludingAncestors.
dir_ref = pp::FileRef(file_system, "/dir_make_dir_1/dir_make_dir_2");
- rv = dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::MakeDirectoryIncludingAncestors", rv);
+ callback.WaitForResult(
+ dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// MakeDirectoryIncludingAncestors aborted.
- callback.reset_run_count();
- rv = pp::FileRef(file_system, "/dir_make_abort_1/dir_make_abort_2")
- .MakeDirectoryIncludingAncestors(callback.GetCallback());
- if (callback.run_count() > 0) {
- return "FileSystem::MakeDirectoryIncludingAncestors "
- "ran callback synchronously.";
+ {
+ rv = pp::FileRef(file_system, "/dir_make_abort_1/dir_make_abort_2")
+ .MakeDirectoryIncludingAncestors(callback.GetCallback());
}
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError(
- "FileSystem::MakeDirectoryIncludingAncestors force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileSystem::MakeDirectoryIncludingAncestors not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileSystem::MakeDirectoryIncludingAncestors", rv);
- }
+ callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
- // MakeDirectory with nested path.
+ // MakeDirectory with nested path should fail.
dir_ref = pp::FileRef(file_system, "/dir_make_dir_3/dir_make_dir_4");
- rv = dir_ref.MakeDirectory(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv == PP_OK) {
- return "Calling FileSystem::MakeDirectory() with a nested directory path "
- "should have failed.";
- }
+ callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_NE(PP_OK, callback.result());
PASS();
}
std::string TestFileRef::TestQueryAndTouchFile() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef file_ref(file_system, "/file_touch");
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref,
- PP_FILEOPENFLAG_CREATE |
- PP_FILEOPENFLAG_TRUNCATE |
- PP_FILEOPENFLAG_WRITE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(
+ file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_TRUNCATE |
+ PP_FILEOPENFLAG_WRITE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Write some data to have a non-zero file size.
- rv = file_io.Write(0, "test", 4, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Write force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != 4)
- return ReportError("FileIO::Write", rv);
+ callback.WaitForResult(file_io.Write(0, "test", 4, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(4, callback.result());
// Touch.
// last_access_time's granularity is 1 day
// last_modified_time's granularity is 2 seconds
const PP_Time last_access_time = 123 * 24 * 3600.0;
const PP_Time last_modified_time = 246.0;
- rv = file_ref.Touch(last_access_time, last_modified_time,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Touch force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Touch", rv);
+ callback.WaitForResult(file_ref.Touch(last_access_time, last_modified_time,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Touch aborted.
- callback.reset_run_count();
- rv = pp::FileRef(file_system, "/file_touch_abort")
- .Touch(last_access_time, last_modified_time, callback.GetCallback());
- if (callback.run_count() > 0)
- return "FileSystem::Touch ran callback synchronously.";
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Touch force_async", rv);
+ int32_t rv = PP_ERROR_FAILED;
+ {
+ rv = pp::FileRef(file_system, "/file_touch_abort")
+ .Touch(last_access_time, last_modified_time, callback.GetCallback());
+ }
+ callback.WaitForResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileSystem::Touch not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileSystem::Touch", rv);
+ // Touch tried to run asynchronously and should have been aborted.
+ ASSERT_EQ(PP_ERROR_ABORTED, callback.result());
+ } else {
+ // Touch ran synchronously and should have failed because the file does not
+ // exist.
+ ASSERT_EQ(PP_ERROR_FILENOTFOUND, callback.result());
}
// Query.
PP_FileInfo info;
- rv = file_io.Query(&info, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Query force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Query", rv);
-
- if ((info.size != 4) ||
- (info.type != PP_FILETYPE_REGULAR) ||
- (info.system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) ||
- (info.last_access_time != last_access_time) ||
- (info.last_modified_time != last_modified_time))
- return "FileSystem::Query() has returned bad data.";
+ callback.WaitForResult(file_io.Query(&info, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+ ASSERT_EQ(4, info.size);
+ ASSERT_EQ(PP_FILETYPE_REGULAR, info.type);
+ ASSERT_EQ(PP_FILESYSTEMTYPE_LOCALTEMPORARY, info.system_type);
+ ASSERT_EQ(last_access_time, info.last_access_time);
+ ASSERT_EQ(last_modified_time, info.last_modified_time);
// Cancellation test.
// TODO(viettrungluu): this test causes a bunch of LOG(WARNING)s; investigate.
- callback.reset_run_count();
// TODO(viettrungluu): check |info| for late writes.
- rv = pp::FileRef(file_system, "/file_touch").Touch(
- last_access_time, last_modified_time, callback.GetCallback());
- if (callback.run_count() > 0)
- return "FileSystem::Touch ran callback synchronously.";
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Touch force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileSystem::Touch not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileSystem::Touch", rv);
+ {
+ rv = pp::FileRef(file_system, "/file_touch").Touch(
+ last_access_time, last_modified_time, callback.GetCallback());
}
+ callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
PASS();
}
std::string TestFileRef::TestDeleteFileAndDirectory() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef file_ref(file_system, "/file_delete");
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(
+ file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- rv = file_ref.Delete(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Delete force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::Delete", rv);
+ callback.WaitForResult(file_ref.Delete(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef dir_ref(file_system, "/dir_delete");
- rv = dir_ref.MakeDirectory(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::MakeDirectory", rv);
+ callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- rv = dir_ref.Delete(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::Delete", rv);
+ callback.WaitForResult(dir_ref.Delete(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef nested_dir_ref(file_system, "/dir_delete_1/dir_delete_2");
- rv = nested_dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::MakeDirectoryIncludingAncestors", rv);
+ callback.WaitForResult(
+ nested_dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- // Hang on to a ref to the parent; otherwise the callback will be aborted.
+ // Attempt to delete the parent directory (should fail; it's non-empty).
pp::FileRef parent_dir_ref = nested_dir_ref.GetParent();
- rv = parent_dir_ref.Delete(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_FAILED)
- return ReportError("FileRef::Delete", rv);
+ callback.WaitForResult(parent_dir_ref.Delete(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_ERROR_FAILED, callback.result());
pp::FileRef nonexistent_file_ref(file_system, "/nonexistent_file_delete");
- rv = nonexistent_file_ref.Delete(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_FILENOTFOUND)
- return ReportError("FileRef::Delete", rv);
+ callback.WaitForResult(nonexistent_file_ref.Delete(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_ERROR_FILENOTFOUND, callback.result());
// Delete aborted.
+ int32_t rv = PP_ERROR_FAILED;
{
pp::FileRef file_ref_abort(file_system, "/file_delete_abort");
pp::FileIO file_io_abort(instance_);
- rv = file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
-
- callback.reset_run_count();
+ callback.WaitForResult(
+ file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
rv = file_ref_abort.Delete(callback.GetCallback());
}
- if (callback.run_count() > 0)
- return "FileRef::Delete ran callback synchronously.";
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileRef::Delete not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileRef::Delete", rv);
- }
+ callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
PASS();
}
std::string TestFileRef::TestRenameFileAndDirectory() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef file_ref(file_system, "/file_rename");
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(
+ file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef target_file_ref(file_system, "/target_file_rename");
- rv = file_ref.Rename(target_file_ref, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Rename force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::Rename", rv);
+ callback.WaitForResult(
+ file_ref.Rename(target_file_ref, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef dir_ref(file_system, "/dir_rename");
- rv = dir_ref.MakeDirectory(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::MakeDirectory", rv);
+ callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef target_dir_ref(file_system, "/target_dir_rename");
- rv = dir_ref.Rename(target_dir_ref, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Rename force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::Rename", rv);
+ callback.WaitForResult(
+ dir_ref.Rename(target_dir_ref, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
pp::FileRef nested_dir_ref(file_system, "/dir_rename_1/dir_rename_2");
- rv = nested_dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::MakeDirectoryIncludingAncestors", rv);
+ callback.WaitForResult(
+ nested_dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+ // Try to rename nested directory to the parent name. Should fail.
pp::FileRef target_nested_dir_ref(file_system, "/dir_rename_1");
- rv = nested_dir_ref.Rename(target_nested_dir_ref, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_FAILED)
- return ReportError("FileRef::Rename", rv);
+ callback.WaitForResult(
+ nested_dir_ref.Rename(target_nested_dir_ref, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_ERROR_FAILED, callback.result());
// Rename aborted.
// TODO(viettrungluu): Figure out what we want to do if the target file
// resource is destroyed before completion.
+ int32_t rv = PP_ERROR_FAILED;
pp::FileRef target_file_ref_abort(file_system,
- "/target_file_rename_abort");
+ "/target_file_rename_abort");
{
pp::FileRef file_ref_abort(file_system, "/file_rename_abort");
pp::FileIO file_io_abort(instance_);
- rv = file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(
+ file_io_abort.Open(file_ref_abort, PP_FILEOPENFLAG_CREATE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- callback.reset_run_count();
rv = file_ref_abort.Rename(target_file_ref_abort, callback.GetCallback());
}
- if (callback.run_count() > 0)
- return "FileSystem::Rename ran callback synchronously.";
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Rename force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "FileSystem::Rename not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("FileSystem::Rename", rv);
- }
+ callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
PASS();
}
-#ifndef PPAPI_OS_NACL
-std::string TestFileRef::TestFileNameEscaping() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+std::string TestFileRef::TestQuery() {
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
- int32_t rv = file_system.Open(1024, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileSystem::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileSystem::Open", rv);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+
+ pp::FileRef file_ref(file_system, "/file");
+ pp::FileIO file_io(instance_);
+ callback.WaitForResult(file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE,
+ callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+
+ // We touch the file so we can easily check access and modified time.
+ callback.WaitForResult(file_io.Touch(0, 0, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+
+ TestCompletionCallbackWithOutput<PP_FileInfo> out_callback(
+ instance_->pp_instance(), callback_type());
+ out_callback.WaitForResult(file_ref.Query(out_callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(out_callback);
+ ASSERT_EQ(PP_OK, out_callback.result());
+
+ PP_FileInfo info = out_callback.output();
+ ASSERT_EQ(0, info.size);
+ ASSERT_EQ(PP_FILETYPE_REGULAR, info.type);
+ ASSERT_EQ(PP_FILESYSTEMTYPE_LOCALTEMPORARY, info.system_type);
+ ASSERT_DOUBLE_EQ(0.0, info.last_access_time);
+ ASSERT_DOUBLE_EQ(0.0, info.last_modified_time);
+
+ // Query a file ref on an external filesystem.
+ pp::FileRef file_ref_ext;
+ std::string result = MakeExternalFileRef(&file_ref_ext);
+ if (!result.empty())
+ return result;
+ out_callback.WaitForResult(file_ref_ext.Query(out_callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(out_callback);
+ if (out_callback.result() != PP_OK)
+ return ReportError("Query() result", out_callback.result());
+ ASSERT_EQ(PP_OK, out_callback.result());
+
+ info = out_callback.output();
+ ASSERT_EQ(PP_FILETYPE_REGULAR, info.type);
+ ASSERT_EQ(PP_FILESYSTEMTYPE_EXTERNAL, info.system_type);
+
+ // We can't touch the file, so just sanity check the times.
+ ASSERT_TRUE(info.creation_time >= 0.0);
+ ASSERT_TRUE(info.last_modified_time >= 0.0);
+ ASSERT_TRUE(info.last_access_time >= 0.0);
+
+ // Query a file ref for a file that doesn't exist.
+ pp::FileRef missing_file_ref(file_system, "/missing_file");
+ out_callback.WaitForResult(missing_file_ref.Query(
+ out_callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(out_callback);
+ ASSERT_EQ(PP_ERROR_FILENOTFOUND, out_callback.result());
+
+ PASS();
+}
+
+std::string TestFileRef::TestFileNameEscaping() {
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
std::string test_dir_path = "/dir_for_escaping_test";
// Create a directory in which to test.
pp::FileRef test_dir_ref(file_system, test_dir_path.c_str());
- rv = test_dir_ref.MakeDirectory(callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileRef::MakeDirectory force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileRef::MakeDirectory", rv);
+ callback.WaitForResult(test_dir_ref.MakeDirectory(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
// Create the file with the terrible name.
std::string full_file_path = test_dir_path + "/" + kTerribleName;
pp::FileRef file_ref(file_system, full_file_path.c_str());
pp::FileIO file_io(instance_);
- rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ callback.WaitForResult(
+ file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
- // DirectoryReader only works out-of-process.
+ // FileRef::ReadDirectoryEntries only works out-of-process.
if (testing_interface_->IsOutOfProcess()) {
- TestCompletionCallbackWithOutput< std::vector<pp::DirectoryEntry_Dev> >
- output_callback(instance_->pp_instance(), force_async_);
- pp::DirectoryReader_Dev directory_reader(test_dir_ref);
+ TestCompletionCallbackWithOutput<DirEntries>
+ output_callback(instance_->pp_instance(), callback_type());
- rv = directory_reader.ReadEntries(output_callback);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = output_callback.WaitForResult();
- if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
- return ReportError("DirectoryEntry_Dev::ReadEntries", rv);
+ output_callback.WaitForResult(
+ test_dir_ref.ReadDirectoryEntries(output_callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(output_callback);
+ ASSERT_EQ(PP_OK, output_callback.result());
- std::vector<pp::DirectoryEntry_Dev> entries = output_callback.output();
- if (entries.empty())
- return "Entry was not found.";
- if (entries.size() != 1)
- return "Directory had too many entries.";
- if (entries.front().file_ref().GetName().AsString() != kTerribleName)
- return "Entry name did not match.";
+ DirEntries entries = output_callback.output();
+ ASSERT_EQ(1, entries.size());
+ ASSERT_EQ(kTerribleName, entries.front().file_ref().GetName().AsString());
}
PASS();
}
-#endif
+
+std::string TestFileRef::TestReadDirectoryEntries() {
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ pp::FileSystem file_system(
+ instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+
+ // Setup testing directories and files.
+ const char* test_dir_name = "/test_get_next_file";
+ const char* file_prefix = "file_";
+ const char* dir_prefix = "dir_";
+
+ pp::FileRef test_dir(file_system, test_dir_name);
+ int32_t rv = DeleteDirectoryRecursively(&test_dir);
+ ASSERT_TRUE(rv == PP_OK || rv == PP_ERROR_FILENOTFOUND);
+
+ callback.WaitForResult(test_dir.MakeDirectory(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+
+ static const int kNumFiles = 3;
+ std::set<std::string> expected_file_names;
+ for (int i = 1; i <= kNumFiles; ++i) {
+ std::ostringstream buffer;
+ buffer << test_dir_name << '/' << file_prefix << i;
+ pp::FileRef file_ref(file_system, buffer.str().c_str());
+
+ pp::FileIO file_io(instance_);
+ callback.WaitForResult(
+ file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+
+ expected_file_names.insert(buffer.str());
+ }
+
+ static const int kNumDirectories = 3;
+ std::set<std::string> expected_dir_names;
+ for (int i = 1; i <= kNumDirectories; ++i) {
+ std::ostringstream buffer;
+ buffer << test_dir_name << '/' << dir_prefix << i;
+ pp::FileRef file_ref(file_system, buffer.str().c_str());
+
+ callback.WaitForResult(file_ref.MakeDirectory(callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+
+ expected_dir_names.insert(buffer.str());
+ }
+
+ // Test that |ReadDirectoryEntries()| is able to fetch all
+ // directories and files that we created.
+ {
+ TestCompletionCallbackWithOutput<DirEntries> output_callback(
+ instance_->pp_instance(), callback_type());
+
+ output_callback.WaitForResult(
+ test_dir.ReadDirectoryEntries(output_callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(output_callback);
+ ASSERT_EQ(PP_OK, output_callback.result());
+
+ DirEntries entries = output_callback.output();
+ size_t sum = expected_file_names.size() + expected_dir_names.size();
+ ASSERT_EQ(sum, entries.size());
+
+ for (DirEntries::const_iterator it = entries.begin();
+ it != entries.end(); ++it) {
+ pp::FileRef file_ref = it->file_ref();
+ std::string file_path = file_ref.GetPath().AsString();
+ std::set<std::string>::iterator found =
+ expected_file_names.find(file_path);
+ if (found != expected_file_names.end()) {
+ if (it->file_type() != PP_FILETYPE_REGULAR)
+ return file_path + " should have been a regular file.";
+ expected_file_names.erase(found);
+ } else {
+ found = expected_dir_names.find(file_path);
+ if (found == expected_dir_names.end())
+ return "Unexpected file path: " + file_path;
+ if (it->file_type() != PP_FILETYPE_DIRECTORY)
+ return file_path + " should have been a directory.";
+ expected_dir_names.erase(found);
+ }
+ }
+ ASSERT_TRUE(expected_file_names.empty());
+ ASSERT_TRUE(expected_dir_names.empty());
+ }
+
+ // Test cancellation of asynchronous |ReadDirectoryEntries()|.
+ TestCompletionCallbackWithOutput<DirEntries> output_callback(
+ instance_->pp_instance(), callback_type());
+ {
+ rv = pp::FileRef(file_system, test_dir_name)
+ .ReadDirectoryEntries(output_callback.GetCallback());
+ }
+ output_callback.WaitForAbortResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(output_callback);
+
+
+ PASS();
+}
diff --git a/ppapi/tests/test_file_ref.h b/ppapi/tests/test_file_ref.h
index 916ea35..ff91215 100644
--- a/ppapi/tests/test_file_ref.h
+++ b/ppapi/tests/test_file_ref.h
@@ -9,6 +9,10 @@
#include "ppapi/tests/test_case.h"
+namespace pp {
+class FileRef;
+}
+
class TestFileRef : public TestCase {
public:
explicit TestFileRef(TestingInstance* instance) : TestCase(instance) {}
@@ -18,6 +22,12 @@
virtual void RunTests(const std::string& filter);
private:
+ // Creates a FileRef on an external filesystem.
+ // Returns "" on success, a different string otherwise.
+ std::string MakeExternalFileRef(pp::FileRef* file_ref_ext);
+
+ int32_t DeleteDirectoryRecursively(pp::FileRef* dir);
+
std::string TestCreate();
std::string TestGetFileSystemType();
std::string TestGetName();
@@ -27,7 +37,9 @@
std::string TestQueryAndTouchFile();
std::string TestDeleteFileAndDirectory();
std::string TestRenameFileAndDirectory();
+ std::string TestQuery();
std::string TestFileNameEscaping();
+ std::string TestReadDirectoryEntries();
};
#endif // PAPPI_TESTS_TEST_FILE_REF_H_
diff --git a/ppapi/tests/test_file_system.cc b/ppapi/tests/test_file_system.cc
index 9601f54..7badabb 100644
--- a/ppapi/tests/test_file_system.cc
+++ b/ppapi/tests/test_file_system.cc
@@ -18,12 +18,12 @@
}
void TestFileSystem::RunTests(const std::string& filter) {
- RUN_TEST_FORCEASYNC_AND_NOT(Open, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(MultipleOpens, filter);
+ RUN_CALLBACK_TEST(TestFileSystem, Open, filter);
+ RUN_CALLBACK_TEST(TestFileSystem, MultipleOpens, filter);
}
std::string TestFileSystem::TestOpen() {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
// Open.
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
@@ -31,7 +31,7 @@
CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result());
- // Open aborted (see the DirectoryReader test for comments).
+ // Open aborted.
int32_t rv = 0;
{
pp::FileSystem fs(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
@@ -46,11 +46,11 @@
std::string TestFileSystem::TestMultipleOpens() {
// Should not allow multiple opens, regardless of whether or not the first
// open has completed.
- TestCompletionCallback callback_1(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback_1(instance_->pp_instance(), callback_type());
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
int32_t rv_1 = file_system.Open(1024, callback_1.GetCallback());
- TestCompletionCallback callback_2(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback_2(instance_->pp_instance(), callback_type());
callback_2.WaitForResult(file_system.Open(1024, callback_2.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback_2);
// FileSystem should not allow multiple opens.
@@ -60,7 +60,7 @@
CHECK_CALLBACK_BEHAVIOR(callback_1);
ASSERT_EQ(PP_OK, callback_1.result());
- TestCompletionCallback callback_3(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback_3(instance_->pp_instance(), callback_type());
callback_3.WaitForResult(file_system.Open(1024, callback_3.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback_3);
ASSERT_NE(PP_OK, callback_3.result());
diff --git a/ppapi/tests/test_flash_clipboard.cc b/ppapi/tests/test_flash_clipboard.cc
index e38c145..8eb756b 100644
--- a/ppapi/tests/test_flash_clipboard.cc
+++ b/ppapi/tests/test_flash_clipboard.cc
@@ -253,7 +253,7 @@
std::string TestFlashClipboard::TestRegisterCustomFormat() {
// Test an empty name is rejected.
uint32_t format_id =
- pp::flash::Clipboard::RegisterCustomFormat(instance_, "");
+ pp::flash::Clipboard::RegisterCustomFormat(instance_, std::string());
ASSERT_EQ(format_id, PP_FLASH_CLIPBOARD_FORMAT_INVALID);
// Test a valid format name.
diff --git a/ppapi/tests/test_flash_device_id.cc b/ppapi/tests/test_flash_device_id.cc
new file mode 100644
index 0000000..a4e20b2
--- /dev/null
+++ b/ppapi/tests/test_flash_device_id.cc
@@ -0,0 +1,42 @@
+// 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.
+
+#include "ppapi/tests/test_flash_device_id.h"
+
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/private/ppb_flash_device_id.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/private/flash_device_id.h"
+#include "ppapi/cpp/var.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(FlashDeviceID);
+
+using pp::flash::DeviceID;
+using pp::Var;
+
+TestFlashDeviceID::TestFlashDeviceID(TestingInstance* instance)
+ : TestCase(instance),
+ PP_ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {
+}
+
+void TestFlashDeviceID::RunTests(const std::string& filter) {
+ RUN_TEST(GetDeviceID, filter);
+}
+
+std::string TestFlashDeviceID::TestGetDeviceID() {
+ DeviceID device_id(instance_);
+ TestCompletionCallbackWithOutput<Var> output_callback(
+ instance_->pp_instance());
+ int32_t rv = device_id.GetDeviceID(output_callback.GetCallback());
+ output_callback.WaitForResult(rv);
+ ASSERT_TRUE(output_callback.result() == PP_OK);
+ Var result = output_callback.output();
+ ASSERT_TRUE(result.is_string());
+ std::string id = result.AsString();
+ ASSERT_FALSE(id.empty());
+
+ PASS();
+}
diff --git a/ppapi/tests/test_flash_device_id.h b/ppapi/tests/test_flash_device_id.h
new file mode 100644
index 0000000..10e50bf
--- /dev/null
+++ b/ppapi/tests/test_flash_device_id.h
@@ -0,0 +1,26 @@
+// 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.
+
+#ifndef PAPPI_TESTS_TEST_FLASH_DEVICE_ID_H_
+#define PAPPI_TESTS_TEST_FLASH_DEVICE_ID_H_
+
+#include <string>
+
+#include "ppapi/tests/test_case.h"
+#include "ppapi/utility/completion_callback_factory.h"
+
+class TestFlashDeviceID : public TestCase {
+ public:
+ explicit TestFlashDeviceID(TestingInstance* instance);
+
+ // TestCase implementation.
+ virtual void RunTests(const std::string& filter);
+
+ private:
+ std::string TestGetDeviceID();
+
+ pp::CompletionCallbackFactory<TestFlashDeviceID> callback_factory_;
+};
+
+#endif // PAPPI_TESTS_TEST_FLASH_DEVICE_ID_H_
diff --git a/ppapi/tests/test_flash_file.cc b/ppapi/tests/test_flash_file.cc
index 86100d9..e5a8ee9 100644
--- a/ppapi/tests/test_flash_file.cc
+++ b/ppapi/tests/test_flash_file.cc
@@ -285,12 +285,10 @@
CloseFileHandle(file_handle);
ASSERT_TRUE(FileModuleLocal::CreateDir(instance_, dirname));
- ASSERT_TRUE(FileModuleLocal::GetDirContents(instance_, "", &result));
- FileModuleLocal::DirEntry expected[] =
- { {"..", true},
- {filename, false},
- {dirname, true}
- };
+ ASSERT_TRUE(
+ FileModuleLocal::GetDirContents(instance_, std::string(), &result));
+ FileModuleLocal::DirEntry expected[] = { { "..", true }, { filename, false },
+ { dirname, true } };
size_t expected_size = sizeof(expected) / sizeof(expected[0]);
std::sort(expected, expected + expected_size, DirEntryLessThan);
@@ -329,7 +327,8 @@
std::string TestFlashFile::GetItemCountUnderModuleLocalRoot(
size_t* item_count) {
std::vector<FileModuleLocal::DirEntry> contents;
- ASSERT_TRUE(FileModuleLocal::GetDirContents(instance_, "", &contents));
+ ASSERT_TRUE(
+ FileModuleLocal::GetDirContents(instance_, std::string(), &contents));
*item_count = contents.size();
PASS();
}
diff --git a/ppapi/tests/test_graphics_2d.cc b/ppapi/tests/test_graphics_2d.cc
index aea741d..23a4fe7 100644
--- a/ppapi/tests/test_graphics_2d.cc
+++ b/ppapi/tests/test_graphics_2d.cc
@@ -36,6 +36,20 @@
static_cast<TestGraphics2D*>(data)->QuitMessageLoop();
}
+bool CanFlushContext(pp::Instance* instance, pp::Graphics2D* context) {
+ TestCompletionCallback callback(instance->pp_instance());
+ callback.WaitForResult(context->Flush(callback.GetCallback()));
+ return (callback.result() == PP_OK);
+}
+
+bool CanFlushContextC(pp::Instance* instance, PP_Resource graphics_2d,
+ const PPB_Graphics2D_1_1* graphics_2d_if) {
+ TestCompletionCallback callback(instance->pp_instance());
+ callback.WaitForResult(graphics_2d_if->Flush(
+ graphics_2d, callback.GetCallback().pp_completion_callback()));
+ return (callback.result() == PP_OK);
+}
+
} // namespace
TestGraphics2D::TestGraphics2D(TestingInstance* instance)
@@ -46,9 +60,9 @@
bool TestGraphics2D::Init() {
graphics_2d_interface_ = static_cast<const PPB_Graphics2D*>(
- pp::Module::Get()->GetBrowserInterface(PPB_GRAPHICS_2D_INTERFACE));
+ pp::Module::Get()->GetBrowserInterface(PPB_GRAPHICS_2D_INTERFACE_1_1));
image_data_interface_ = static_cast<const PPB_ImageData*>(
- pp::Module::Get()->GetBrowserInterface(PPB_IMAGEDATA_INTERFACE));
+ pp::Module::Get()->GetBrowserInterface(PPB_IMAGEDATA_INTERFACE_1_0));
return graphics_2d_interface_ && image_data_interface_ &&
CheckTestingInterface();
}
@@ -59,6 +73,7 @@
RUN_TEST(Humongous, filter);
RUN_TEST(InitToZero, filter);
RUN_TEST(Describe, filter);
+ RUN_TEST(Scale, filter);
RUN_TEST_FORCEASYNC_AND_NOT(Paint, filter);
RUN_TEST_FORCEASYNC_AND_NOT(Scroll, filter);
RUN_TEST_FORCEASYNC_AND_NOT(Replace, filter);
@@ -93,41 +108,12 @@
return IsSquareInImage(readback, 0, pp::Rect(dc.size()), color);
}
-bool TestGraphics2D::ResourceHealthCheck(pp::Instance* instance,
- pp::Graphics2D* context) {
- TestCompletionCallback callback(instance->pp_instance(), callback_type());
+std::string TestGraphics2D::FlushAndWaitForDone(pp::Graphics2D* context) {
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
callback.WaitForResult(context->Flush(callback.GetCallback()));
- if (callback.result() < 0)
- return callback.result() != PP_ERROR_FAILED;
- else if (callback.result() == 0)
- return false;
- return true;
-}
-
-bool TestGraphics2D::ResourceHealthCheckForC(pp::Instance* instance,
- PP_Resource graphics_2d) {
- TestCompletionCallback callback(instance->pp_instance(), callback_type());
- callback.WaitForResult(graphics_2d_interface_->Flush(
- graphics_2d, callback.GetCallback().pp_completion_callback()));
- if (callback.result() < 0)
- return callback.result() != PP_ERROR_FAILED;
- else if (callback.result() == 0)
- return false;
- return true;
-}
-
-bool TestGraphics2D::FlushAndWaitForDone(pp::Graphics2D* context) {
- int32_t flags = (force_async_ ? 0 : PP_COMPLETIONCALLBACK_FLAG_OPTIONAL);
- pp::CompletionCallback cc(&FlushCallbackQuitMessageLoop, this, flags);
- int32_t rv = context->Flush(cc);
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return false;
- if (rv == PP_OK)
- return true;
- if (rv != PP_OK_COMPLETIONPENDING)
- return false;
- testing_interface_->RunMessageLoop(instance_->pp_instance());
- return true;
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+ PASS();
}
void TestGraphics2D::FillRectInImage(pp::ImageData* image,
@@ -217,7 +203,8 @@
PP_Resource id = image.pp_resource();
dc->ReplaceContents(&image);
- if (!FlushAndWaitForDone(dc))
+ std::string result = FlushAndWaitForDone(dc);
+ if (!result.empty())
return 0;
return id;
@@ -263,36 +250,33 @@
image.pp_resource());
// Flush.
- if (graphics_2d_interface_->Flush(
- image.pp_resource(),
- PP_MakeOptionalCompletionCallback(&FlushCallbackNOP, NULL)) == PP_OK)
- return "Flush succeeded with a different resource";
- if (graphics_2d_interface_->Flush(
- null_context.pp_resource(),
- PP_MakeOptionalCompletionCallback(&FlushCallbackNOP, NULL)) == PP_OK)
- return "Flush succeeded with a NULL resource";
+ TestCompletionCallback cb(instance_->pp_instance(), PP_OPTIONAL);
+ cb.WaitForResult(
+ graphics_2d_interface_->Flush(image.pp_resource(),
+ cb.GetCallback().pp_completion_callback()));
+ ASSERT_EQ(PP_ERROR_BADRESOURCE, cb.result());
+ cb.WaitForResult(
+ graphics_2d_interface_->Flush(null_context.pp_resource(),
+ cb.GetCallback().pp_completion_callback()));
+ ASSERT_EQ(PP_ERROR_BADRESOURCE, cb.result());
// ReadImageData.
- if (testing_interface_->ReadImageData(image.pp_resource(),
- image.pp_resource(),
- &zero_zero))
- return "ReadImageData succeeded with a different resource";
- if (testing_interface_->ReadImageData(null_context.pp_resource(),
- image.pp_resource(),
- &zero_zero))
- return "ReadImageData succeeded with a NULL resource";
+ ASSERT_FALSE(testing_interface_->ReadImageData(image.pp_resource(),
+ image.pp_resource(),
+ &zero_zero));
+ ASSERT_FALSE(testing_interface_->ReadImageData(null_context.pp_resource(),
+ image.pp_resource(),
+ &zero_zero));
PASS();
}
std::string TestGraphics2D::TestInvalidSize() {
pp::Graphics2D a(instance_, pp::Size(16, 0), false);
- if (ResourceHealthCheck(instance_, &a))
- return "0 height accepted";
+ ASSERT_FALSE(CanFlushContext(instance_, &a));
pp::Graphics2D b(instance_, pp::Size(0, 16), false);
- if (ResourceHealthCheck(instance_, &b))
- return "0 height accepted";
+ ASSERT_FALSE(CanFlushContext(instance_, &b));
// Need to use the C API since pp::Size prevents negative sizes.
PP_Size size;
@@ -300,50 +284,49 @@
size.height = -16;
PP_Resource graphics = graphics_2d_interface_->Create(
instance_->pp_instance(), &size, PP_FALSE);
- ASSERT_FALSE(ResourceHealthCheckForC(instance_, graphics));
+ ASSERT_FALSE(CanFlushContextC(instance_, graphics, graphics_2d_interface_));
+ pp::Module::Get()->core()->ReleaseResource(graphics);
size.width = -16;
size.height = 16;
graphics = graphics_2d_interface_->Create(
instance_->pp_instance(), &size, PP_FALSE);
- ASSERT_FALSE(ResourceHealthCheckForC(instance_, graphics));
+ ASSERT_FALSE(CanFlushContextC(instance_, graphics, graphics_2d_interface_));
+ pp::Module::Get()->core()->ReleaseResource(graphics);
// Overflow to negative size
size.width = std::numeric_limits<int32_t>::max();
size.height = std::numeric_limits<int32_t>::max();
graphics = graphics_2d_interface_->Create(
instance_->pp_instance(), &size, PP_FALSE);
- ASSERT_FALSE(ResourceHealthCheckForC(instance_, graphics));
+ ASSERT_FALSE(CanFlushContextC(instance_, graphics, graphics_2d_interface_));
+ pp::Module::Get()->core()->ReleaseResource(graphics);
PASS();
}
std::string TestGraphics2D::TestHumongous() {
pp::Graphics2D a(instance_, pp::Size(100000, 100000), false);
- if (ResourceHealthCheck(instance_, &a))
- return "Humongous device created";
+ ASSERT_FALSE(CanFlushContext(instance_, &a));
PASS();
}
std::string TestGraphics2D::TestInitToZero() {
const int w = 15, h = 17;
pp::Graphics2D dc(instance_, pp::Size(w, h), false);
- if (dc.is_null())
- return "Failure creating a boring device";
+ ASSERT_FALSE(dc.is_null());
// Make an image with nonzero data in it (so we can test that zeros were
// actually read versus ReadImageData being a NOP).
pp::ImageData image(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
pp::Size(w, h), true);
- if (image.is_null())
- return "Failure to allocate an image";
+ ASSERT_FALSE(image.is_null());
+ ASSERT_FALSE(image.size().IsEmpty());
memset(image.data(), 0xFF, image.stride() * image.size().height() * 4);
// Read out the initial data from the device & check.
- if (!ReadImageData(dc, &image, pp::Point(0, 0)))
- return "Couldn't read image data";
- if (!IsSquareInImage(image, 0, pp::Rect(0, 0, w, h), 0))
- return "Got a nonzero pixel";
+ ASSERT_TRUE(ReadImageData(dc, &image, pp::Point(0, 0)));
+ ASSERT_TRUE(IsSquareInImage(image, 0, pp::Rect(0, 0, w, h), 0));
PASS();
}
@@ -352,19 +335,47 @@
const int w = 15, h = 17;
const bool always_opaque = (::rand() % 2 == 1);
pp::Graphics2D dc(instance_, pp::Size(w, h), always_opaque);
- if (dc.is_null())
- return "Failure creating a boring device";
+ ASSERT_FALSE(dc.is_null());
PP_Size size;
size.width = -1;
size.height = -1;
PP_Bool is_always_opaque = PP_FALSE;
- if (!graphics_2d_interface_->Describe(dc.pp_resource(), &size,
- &is_always_opaque))
- return "Describe failed";
- if (size.width != w || size.height != h ||
- is_always_opaque != PP_FromBool(always_opaque))
- return "Mismatch of data.";
+ ASSERT_TRUE(graphics_2d_interface_->Describe(dc.pp_resource(), &size,
+ &is_always_opaque));
+ ASSERT_EQ(w, size.width);
+ ASSERT_EQ(h, size.height);
+ ASSERT_EQ(PP_FromBool(always_opaque), is_always_opaque);
+
+ PASS();
+}
+
+std::string TestGraphics2D::TestScale() {
+ // Tests GetScale/SetScale
+ const int w = 20, h = 16;
+ const float scale = 1.0f/2.0f;
+ pp::Graphics2D dc(instance_, pp::Size(w, h), false);
+ ASSERT_FALSE(dc.is_null());
+ ASSERT_EQ(1.0, dc.GetScale());
+ ASSERT_TRUE(dc.SetScale(scale));
+ ASSERT_EQ(scale, dc.GetScale());
+ // Try setting a few invalid scale factors. Ensure that we catch these errors
+ // and don't change the actual scale
+ ASSERT_FALSE(dc.SetScale(-1.0f));
+ ASSERT_FALSE(dc.SetScale(0.0f));
+ ASSERT_EQ(scale, dc.GetScale());
+
+ // Verify that the context has the specified number of pixels, despite the
+ // non-identity scale
+ PP_Size size;
+ size.width = -1;
+ size.height = -1;
+ PP_Bool is_always_opaque = PP_FALSE;
+ ASSERT_TRUE(graphics_2d_interface_->Describe(dc.pp_resource(), &size,
+ &is_always_opaque));
+ ASSERT_EQ(w, size.width);
+ ASSERT_EQ(h, size.height);
+ ASSERT_EQ(PP_FALSE, is_always_opaque);
PASS();
}
@@ -372,12 +383,10 @@
std::string TestGraphics2D::TestPaint() {
const int w = 15, h = 17;
pp::Graphics2D dc(instance_, pp::Size(w, h), false);
- if (dc.is_null())
- return "Failure creating a boring device";
+ ASSERT_FALSE(dc.is_null());
// Make sure the device background is 0.
- if (!IsDCUniformColor(dc, 0))
- return "Bad initial color";
+ ASSERT_TRUE(IsDCUniformColor(dc, 0));
// Fill the backing store with white.
const uint32_t background_color = 0xFFFFFFFF;
@@ -385,35 +394,30 @@
pp::Size(w, h), false);
FillRectInImage(&background, pp::Rect(0, 0, w, h), background_color);
dc.PaintImageData(background, pp::Point(0, 0));
- if (!FlushAndWaitForDone(&dc))
- return "Couldn't flush to fill backing store";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
// Make an image to paint with that's opaque white and enqueue a paint.
const int fill_w = 2, fill_h = 3;
pp::ImageData fill(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
pp::Size(fill_w, fill_h), true);
- if (fill.is_null())
- return "Failure to allocate fill image";
+ ASSERT_FALSE(fill.is_null());
FillRectInImage(&fill, pp::Rect(fill.size()), background_color);
const int paint_x = 4, paint_y = 5;
dc.PaintImageData(fill, pp::Point(paint_x, paint_y));
// Validate that nothing has been actually painted.
- if (!IsDCUniformColor(dc, background_color))
- return "Image updated before flush (or failure in readback).";
+ ASSERT_TRUE(IsDCUniformColor(dc, background_color));
// The paint hasn't been flushed so we can still change the bitmap. Fill with
// 50% blue. This will also verify that the backing store is replaced
// with the contents rather than blended.
const uint32_t fill_color = 0x80000080;
FillRectInImage(&fill, pp::Rect(fill.size()), fill_color);
- if (!FlushAndWaitForDone(&dc))
- return "Couldn't flush 50% blue paint";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
- if (!IsSquareInDC(dc, background_color,
- pp::Rect(paint_x, paint_y, fill_w, fill_h),
- fill_color))
- return "Image not painted properly.";
+ ASSERT_TRUE(IsSquareInDC(dc, background_color,
+ pp::Rect(paint_x, paint_y, fill_w, fill_h),
+ fill_color));
// Reset the DC to blank white & paint our image slightly off the buffer.
// This should succeed. We also try painting the same thing where the
@@ -423,13 +427,11 @@
dc.PaintImageData(fill, pp::Point(second_paint_x, second_paint_y));
dc.PaintImageData(fill, pp::Point(second_paint_x, second_paint_y),
pp::Rect(-second_paint_x, -second_paint_y, 1, 1));
- if (!FlushAndWaitForDone(&dc))
- return "Couldn't flush second paint";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
// Now we should have a little bit of the image peeking out the top left.
- if (!IsSquareInDC(dc, background_color, pp::Rect(0, 0, 1, 1),
- fill_color))
- return "Partially offscreen paint failed.";
+ ASSERT_TRUE(IsSquareInDC(dc, background_color, pp::Rect(0, 0, 1, 1),
+ fill_color));
// Now repaint that top left pixel by doing a subset of the source image.
pp::ImageData subset(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
@@ -439,11 +441,9 @@
*subset.GetAddr32(pp::Point(subset_x, subset_y)) = subset_color;
dc.PaintImageData(subset, pp::Point(-subset_x, -subset_y),
pp::Rect(subset_x, subset_y, 1, 1));
- if (!FlushAndWaitForDone(&dc))
- return "Couldn't flush repaint";
- if (!IsSquareInDC(dc, background_color, pp::Rect(0, 0, 1, 1),
- subset_color))
- return "Subset paint failed.";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
+ ASSERT_TRUE(IsSquareInDC(dc, background_color, pp::Rect(0, 0, 1, 1),
+ subset_color));
PASS();
}
@@ -451,14 +451,11 @@
std::string TestGraphics2D::TestScroll() {
const int w = 115, h = 117;
pp::Graphics2D dc(instance_, pp::Size(w, h), false);
- if (dc.is_null())
- return "Failure creating a boring device.";
- if (!instance_->BindGraphics(dc))
- return "Failure to bind the boring device.";
+ ASSERT_FALSE(dc.is_null());
+ ASSERT_TRUE(instance_->BindGraphics(dc));
// Make sure the device background is 0.
- if (!IsDCUniformColor(dc, 0))
- return "Bad initial color.";
+ ASSERT_TRUE(IsDCUniformColor(dc, 0));
const int image_width = 15, image_height = 23;
pp::ImageData test_image(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
@@ -472,13 +469,11 @@
pp::ImageData readback_scroll(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
pp::Size(image_width, image_height), false);
- if (test_image.size() != pp::Size(image_width, image_height))
- return "Wrong test image size\n";
+ ASSERT_EQ(pp::Size(image_width, image_height), test_image.size());
int image_x = 51, image_y = 72;
dc.PaintImageData(test_image, pp::Point(image_x, image_y));
- if (!FlushAndWaitForDone(&dc))
- return "Couldn't flush to fill backing store.";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
// Test Case 1. Incorrect usage when scrolling image to a free space.
// The clip area is *not* the area to shift around within the graphics device
@@ -489,12 +484,10 @@
int scroll_x = image_x + dx, scroll_y = image_y + dy;
pp::Rect clip(image_x, image_y, image_width, image_height);
dc.Scroll(clip, pp::Point(dx, dy));
- if (!FlushAndWaitForDone(&dc))
- return "TC1, Couldn't flush to scroll.";
- if (!ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)))
- return "TC1, Couldn't read back scrolled image data.";
- if (!CompareImages(no_image, readback_scroll))
- return "TC1, Read back scrolled image is not the same as no image.";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
+ ASSERT_TRUE(
+ ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)));
+ ASSERT_TRUE(CompareImages(no_image, readback_scroll));
// Test Case 2.
// The amount is intended to place the image in the free space outside
@@ -503,12 +496,10 @@
scroll_x = 11, scroll_y = 24;
clip = pp::Rect(0, 0, w, h + 1);
dc.Scroll(clip, pp::Point(scroll_x - image_x, scroll_y - image_y));
- if (!FlushAndWaitForDone(&dc))
- return "TC2, Couldn't flush to scroll.";
- if (!ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)))
- return "TC2, Couldn't read back scrolled image data.";
- if (!CompareImages(no_image, readback_scroll))
- return "TC2, Read back scrolled image is not the same as no image.";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
+ ASSERT_TRUE(
+ ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)));
+ ASSERT_TRUE(CompareImages(no_image, readback_scroll));
// Test Case 3.
// The amount is intended to place the image in the free space outside
@@ -517,12 +508,10 @@
scroll_x = 11, scroll_y = 24;
clip = pp::Rect(0, 0, image_x, image_y);
dc.Scroll(clip, pp::Point(scroll_x - image_x, scroll_y - image_y));
- if (!FlushAndWaitForDone(&dc))
- return "TC3, Couldn't flush to scroll.";
- if (!ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)))
- return "TC3, Couldn't read back scrolled image data.";
- if (!CompareImages(no_image, readback_scroll))
- return "TC3, Read back scrolled image is not the same as no image.";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
+ ASSERT_TRUE(
+ ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)));
+ ASSERT_TRUE(CompareImages(no_image, readback_scroll));
// Test Case 4.
// Same as TC3, but the clip covers part of the image.
@@ -530,36 +519,30 @@
int part_w = image_width / 2, part_h = image_height / 2;
clip = pp::Rect(0, 0, image_x + part_w, image_y + part_h);
dc.Scroll(clip, pp::Point(scroll_x - image_x, scroll_y - image_y));
- if (!FlushAndWaitForDone(&dc))
- return "TC4, Couldn't flush to scroll.";
- if (!ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)))
- return "TC4, Couldn't read back scrolled image data.";
- if (CompareImages(test_image, readback_scroll))
- return "TC4, Read back scrolled image is the same as test image.";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
+ ASSERT_TRUE(
+ ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)));
+ ASSERT_FALSE(CompareImages(test_image, readback_scroll));
pp::Rect part_rect(part_w, part_h);
- if (!CompareImageRect(test_image, part_rect, readback_scroll, part_rect))
- return "TC4, Read back scrolled image is not the same as part test image.";
+ ASSERT_TRUE(
+ CompareImageRect(test_image, part_rect, readback_scroll, part_rect));
// Test Case 5
// Same as TC3, but the clip area covers the entire image.
// It will be scrolled to the intended origin.
clip = pp::Rect(0, 0, image_x + image_width, image_y + image_height);
dc.Scroll(clip, pp::Point(scroll_x - image_x, scroll_y - image_y));
- if (!FlushAndWaitForDone(&dc))
- return "TC5, Couldn't flush to scroll.";
- if (!ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)))
- return "TC5, Couldn't read back scrolled image data.";
- if (!CompareImages(test_image, readback_scroll))
- return "TC5, Read back scrolled image is not the same as test image.";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
+ ASSERT_TRUE(
+ ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)));
+ ASSERT_TRUE(CompareImages(test_image, readback_scroll));
// Note that the undefined area left by the scroll does not actually get
// cleared, so the original image is still there. This is not guaranteed and
// is not something for users to rely on, but we can test for this here, so
// we know when the underlying behavior changes.
- if (!ReadImageData(dc, &readback_image, pp::Point(image_x, image_y)))
- return "Couldn't read back original image data.";
- if (!CompareImages(test_image, readback_image))
- return "Read back original image is not the same as test image.";
+ ASSERT_TRUE(ReadImageData(dc, &readback_image, pp::Point(image_x, image_y)));
+ ASSERT_TRUE(CompareImages(test_image, readback_image));
// Test Case 6.
// Scroll image to an overlapping space. The clip area is limited
@@ -570,17 +553,14 @@
scroll_y = image_y + dy;
clip = pp::Rect(image_x, image_y, image_width, image_height);
dc.Scroll(clip, pp::Point(dx, dy));
- if (!FlushAndWaitForDone(&dc))
- return "TC6, Couldn't flush to scroll.";
- if (!ReadImageData(dc, &readback_image, pp::Point(image_x, image_y)))
- return "TC6, Couldn't read back image data.";
- if (CompareImages(test_image, readback_image))
- return "TC6, Read back image is still the same as test image.";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
+ ASSERT_TRUE(ReadImageData(dc, &readback_image, pp::Point(image_x, image_y)));
+ ASSERT_FALSE(CompareImages(test_image, readback_image));
pp::Rect scroll_rect(image_width - dx, image_height - dy);
- if (!ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)))
- return "TC6, Couldn't read back scrolled image data.";
- if (!CompareImageRect(test_image, scroll_rect, readback_scroll, scroll_rect))
- return "TC6, Read back scrolled image is not the same as part test image.";
+ ASSERT_TRUE(
+ ReadImageData(dc, &readback_scroll, pp::Point(scroll_x, scroll_y)));
+ ASSERT_TRUE(
+ CompareImageRect(test_image, scroll_rect, readback_scroll, scroll_rect));
PASS();
}
@@ -588,22 +568,19 @@
std::string TestGraphics2D::TestReplace() {
const int w = 15, h = 17;
pp::Graphics2D dc(instance_, pp::Size(w, h), false);
- if (dc.is_null())
- return "Failure creating a boring device";
+ ASSERT_FALSE(dc.is_null());
// Replacing with a different size image should fail.
pp::ImageData weird_size(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
pp::Size(w - 1, h), true);
- if (weird_size.is_null())
- return "Failure allocating the weird sized image";
+ ASSERT_FALSE(weird_size.is_null());
dc.ReplaceContents(&weird_size);
// Fill the background with blue but don't flush yet.
const int32_t background_color = 0xFF0000FF;
pp::ImageData background(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
pp::Size(w, h), true);
- if (background.is_null())
- return "Failure to allocate background image";
+ ASSERT_FALSE(background.is_null());
FillRectInImage(&background, pp::Rect(0, 0, w, h), background_color);
dc.PaintImageData(background, pp::Point(0, 0));
@@ -611,30 +588,25 @@
const int32_t swapped_color = 0x00FF00FF;
pp::ImageData swapped(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
pp::Size(w, h), true);
- if (swapped.is_null())
- return "Failure to allocate swapped image";
+ ASSERT_FALSE(swapped.is_null());
FillRectInImage(&swapped, pp::Rect(0, 0, w, h), swapped_color);
dc.ReplaceContents(&swapped);
// The background should be unchanged since we didn't flush yet.
- if (!IsDCUniformColor(dc, 0))
- return "Image updated before flush (or failure in readback).";
+ ASSERT_TRUE(IsDCUniformColor(dc, 0));
// Test the C++ wrapper. The size of the swapped image should be reset.
- if (swapped.pp_resource() || swapped.size().width() ||
- swapped.size().height() || swapped.data())
- return "Size of the swapped image should be reset.";
+ ASSERT_TRUE(!swapped.pp_resource() && !swapped.size().width() &&
+ !swapped.size().height() && !swapped.data());
// Painting with the swapped image should fail.
dc.PaintImageData(swapped, pp::Point(0, 0));
// Flush and make sure the result is correct.
- if (!FlushAndWaitForDone(&dc))
- return "Couldn't flush";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
// The background should be green from the swapped image.
- if (!IsDCUniformColor(dc, swapped_color))
- return "Flushed color incorrect (or failure in readback).";
+ ASSERT_TRUE(IsDCUniformColor(dc, swapped_color));
PASS();
}
@@ -644,50 +616,37 @@
// (which is the current one).
const int w = 15, h = 17;
pp::Graphics2D dc(instance_, pp::Size(w, h), false);
- if (dc.is_null())
- return "Failure creating a boring device";
+ ASSERT_FALSE(dc.is_null());
// Fill the background with blue but don't flush yet.
pp::ImageData background(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
pp::Size(w, h), true);
- if (background.is_null())
- return "Failure to allocate background image";
+ ASSERT_FALSE(background.is_null());
dc.PaintImageData(background, pp::Point(0, 0));
int32_t rv = dc.Flush(pp::BlockUntilComplete());
- if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING)
- return "Flush succeeded from the main thread with no callback.";
+ ASSERT_EQ(PP_ERROR_BLOCKS_MAIN_THREAD, rv);
// Test flushing with no operations still issues a callback.
// (This may also hang if the browser never issues the callback).
pp::Graphics2D dc_nopaints(instance_, pp::Size(w, h), false);
- if (dc.is_null())
- return "Failure creating the nopaint device";
- if (!FlushAndWaitForDone(&dc_nopaints))
- return "Couldn't flush the nopaint device";
+ ASSERT_FALSE(dc.is_null());
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc_nopaints));
- int32_t flags = (force_async_ ? 0 : PP_COMPLETIONCALLBACK_FLAG_OPTIONAL);
+ TestCompletionCallback callback_1(instance_->pp_instance(), callback_type());
// Test that multiple flushes fail if we don't get a callback in between.
- rv = dc_nopaints.Flush(pp::CompletionCallback(&FlushCallbackNOP, NULL,
- flags));
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return "Flush must complete asynchronously.";
- if (rv != PP_OK && rv != PP_OK_COMPLETIONPENDING)
- return "Couldn't flush first time for multiple flush test.";
-
+ rv = dc_nopaints.Flush(callback_1.GetCallback());
if (rv == PP_OK_COMPLETIONPENDING) {
// If the first flush completes asynchronously, then a second should fail.
- rv = dc_nopaints.Flush(pp::CompletionCallback(&FlushCallbackNOP, NULL,
- flags));
- if (force_async_) {
- if (rv != PP_OK_COMPLETIONPENDING)
- return "Second flush must fail asynchronously.";
- } else {
- if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING)
- return "Second flush succeeded before callback ran.";
- }
+ TestCompletionCallback callback_2(instance_->pp_instance(),
+ callback_type());
+ callback_2.WaitForResult(dc_nopaints.Flush(callback_2.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback_2);
+ ASSERT_EQ(PP_ERROR_INPROGRESS, callback_2.result());
}
+ callback_1.WaitForResult(rv);
+ ASSERT_EQ(PP_OK, callback_1.result());
PASS();
}
@@ -724,10 +683,8 @@
const PP_Time kFlushDelaySec = 1. / 30; // 30 fps
const int w = 80, h = 80;
pp::Graphics2D dc(instance_, pp::Size(w, h), true);
- if (dc.is_null())
- return "Failure creating a boring device";
- if (!instance_->BindGraphics(dc))
- return "Failure to bind the boring device.";
+ ASSERT_FALSE(dc.is_null());
+ ASSERT_TRUE(instance_->BindGraphics(dc));
// Squeeze from top until bottom half of plugin is out of screen.
ResetViewChangedState();
@@ -738,14 +695,12 @@
"big.setAttribute('id', 'big-div');"
"big.setAttribute('style', 'height: ' + offset + '; width: 100%;');"
"document.body.insertBefore(big, document.body.firstChild);");
- if (!WaitUntilViewChanged())
- return "View didn't change as expected";
+ ASSERT_TRUE(WaitUntilViewChanged());
// Allocate a red image chunk
pp::ImageData chunk(instance_, PP_IMAGEDATAFORMAT_RGBA_PREMUL,
pp::Size(w/8, h/8), true);
- if (chunk.is_null())
- return "Failure to allocate image";
+ ASSERT_FALSE(chunk.is_null());
const uint32_t kRed = 0xff0000ff;
FillRectInImage(&chunk, pp::Rect(chunk.size()), kRed);
@@ -753,21 +708,18 @@
dc.PaintImageData(chunk, pp::Point(0, h*0.75));
PP_Time begin = pp::Module::Get()->core()->GetTime();
- if (!FlushAndWaitForDone(&dc))
- return "Couldn't flush an invisible paint";
+ ASSERT_SUBTEST_SUCCESS(FlushAndWaitForDone(&dc));
PP_Time actual_time_elapsed = pp::Module::Get()->core()->GetTime() - begin;
// Expect actual_time_elapsed >= kFlushDelaySec, but loose a bit to avoid
// precision issue.
- if (actual_time_elapsed < kFlushDelaySec * 0.9)
- return "Offscreen painting should be delayed";
+ ASSERT_GE(actual_time_elapsed, kFlushDelaySec * 0.9);
// Remove the padding on the top since test cases here isn't independent.
instance_->EvalScript(
"var big = document.getElementById('big-div');"
"big.parentNode.removeChild(big);");
ResetViewChangedState();
- if (!WaitUntilViewChanged())
- return "View didn't change as expected";
+ ASSERT_TRUE(WaitUntilViewChanged());
PASS();
}
@@ -777,23 +729,16 @@
const int w = 20, h = 16;
const float scale = 1.0f/2.0f;
pp::Graphics2D dc(instance_, pp::Size(w, h), false);
- if (dc.is_null())
- return "Failure creating a boring device";
+ ASSERT_FALSE(dc.is_null());
pp::Graphics2D_Dev dc_dev(dc);
- if (dc_dev.GetScale() != 1.0f)
- return "GetScale returned unexpected value before SetScale";
- if (!dc_dev.SetScale(scale))
- return "SetScale failed";
- if (dc_dev.GetScale() != scale)
- return "GetScale mismatch with prior SetScale";
+ ASSERT_EQ(1.0f, dc_dev.GetScale());
+ ASSERT_TRUE(dc_dev.SetScale(scale));
+ ASSERT_EQ(scale, dc_dev.GetScale());
// Try setting a few invalid scale factors. Ensure that we catch these errors
// and don't change the actual scale
- if (dc_dev.SetScale(-1.0f))
- return "SetScale(-1f) did not fail";
- if (dc_dev.SetScale(0.0f))
- return "SetScale(0.0f) did not fail";
- if (dc_dev.GetScale() != scale)
- return "SetScale with invalid parameter overwrote the scale";
+ ASSERT_FALSE(dc_dev.SetScale(-1.0f));
+ ASSERT_FALSE(dc_dev.SetScale(0.0f));
+ ASSERT_EQ(scale, dc_dev.GetScale());
// Verify that the context has the specified number of pixels, despite the
// non-identity scale
@@ -801,12 +746,11 @@
size.width = -1;
size.height = -1;
PP_Bool is_always_opaque = PP_FALSE;
- if (!graphics_2d_interface_->Describe(dc_dev.pp_resource(), &size,
- &is_always_opaque))
- return "Describe failed";
- if (size.width != w || size.height != h ||
- is_always_opaque != PP_FromBool(false))
- return "Mismatch of data.";
+ ASSERT_TRUE(graphics_2d_interface_->Describe(dc_dev.pp_resource(), &size,
+ &is_always_opaque));
+ ASSERT_EQ(w, size.width);
+ ASSERT_EQ(h, size.height);
+ ASSERT_EQ(PP_FALSE, is_always_opaque);
PASS();
}
@@ -862,10 +806,8 @@
const int w = 115, h = 117;
pp::Graphics2D dc(instance_, pp::Size(w, h), false);
- if (dc.is_null())
- return "Failure creating device.";
- if (!instance_->BindGraphics(dc))
- return "Failure to bind the boring device.";
+ ASSERT_FALSE(dc.is_null());
+ ASSERT_TRUE(instance_->BindGraphics(dc));
ASSERT_TRUE(instance_->BindGraphics(pp::Graphics2D()));
ASSERT_TRUE(instance_->BindGraphics(pp::Graphics3D()));
diff --git a/ppapi/tests/test_graphics_2d.h b/ppapi/tests/test_graphics_2d.h
index 4107504..c905d8a 100644
--- a/ppapi/tests/test_graphics_2d.h
+++ b/ppapi/tests/test_graphics_2d.h
@@ -66,13 +66,10 @@
// Validates that the given device context is filled with the given color.
bool IsDCUniformColor(const pp::Graphics2D& dc, uint32_t color) const;
- // Returns true if Graphics2D resource is created correctly.
- bool ResourceHealthCheck(pp::Instance* instance, pp::Graphics2D* context);
- bool ResourceHealthCheckForC(pp::Instance* instance, PP_Resource graphics_2d);
-
// Issues a flush on the given device context and blocks until the flush
- // has issued its callback. Returns true on success.
- bool FlushAndWaitForDone(pp::Graphics2D* context);
+ // has issued its callback. Returns an empty string on success or an error
+ // message on failure.
+ std::string FlushAndWaitForDone(pp::Graphics2D* context);
// Creates an image and replaces the contents of the Graphics2D with the
// image, waiting for completion. This returns the resource ID of the image
@@ -96,6 +93,7 @@
std::string TestHumongous();
std::string TestInitToZero();
std::string TestDescribe();
+ std::string TestScale();
std::string TestPaint();
std::string TestScroll();
std::string TestReplace();
@@ -106,8 +104,8 @@
std::string TestBindNull();
// Used by the tests that access the C API directly.
- const PPB_Graphics2D* graphics_2d_interface_;
- const PPB_ImageData* image_data_interface_;
+ const PPB_Graphics2D_1_1* graphics_2d_interface_;
+ const PPB_ImageData_1_0* image_data_interface_;
// Used to indicate that DidChangeView has happened, in order to make plugin
// and ui synchronous.
diff --git a/ppapi/tests/test_graphics_3d.cc b/ppapi/tests/test_graphics_3d.cc
index 987d5a8..61bedbf 100644
--- a/ppapi/tests/test_graphics_3d.cc
+++ b/ppapi/tests/test_graphics_3d.cc
@@ -137,11 +137,8 @@
int32_t TestGraphics3D::SwapBuffersSync(pp::Graphics3D* context) {
TestCompletionCallback callback(instance_->pp_instance(), callback_type());
- int32_t rv = context->SwapBuffers(callback.GetCallback());
- if (rv != PP_OK_COMPLETIONPENDING)
- return rv;
-
- return callback.WaitForResult();
+ callback.WaitForResult(context->SwapBuffers(callback.GetCallback()));
+ return callback.result();
}
std::string TestGraphics3D::CheckPixelPPAPI(
diff --git a/ppapi/tests/test_host_resolver_private.cc b/ppapi/tests/test_host_resolver_private.cc
index 5531e83..72153af 100644
--- a/ppapi/tests/test_host_resolver_private.cc
+++ b/ppapi/tests/test_host_resolver_private.cc
@@ -42,33 +42,29 @@
void TestHostResolverPrivate::RunTests(const std::string& filter) {
RUN_TEST(Empty, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(Resolve, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ResolveIPv4, filter);
+ RUN_CALLBACK_TEST(TestHostResolverPrivate, Resolve, filter);
+ RUN_CALLBACK_TEST(TestHostResolverPrivate, ResolveIPv4, filter);
}
std::string TestHostResolverPrivate::SyncConnect(pp::TCPSocketPrivate* socket,
const std::string& host,
uint16_t port) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->Connect(host.c_str(), port, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket->Connect(host.c_str(), port, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
PASS();
}
std::string TestHostResolverPrivate::SyncConnect(
pp::TCPSocketPrivate* socket,
const PP_NetAddress_Private& address) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->ConnectWithNetAddress(&address, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket->ConnectWithNetAddress(&address, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
PASS();
}
@@ -76,15 +72,12 @@
char* buffer,
int32_t num_bytes,
int32_t* bytes_read) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->Read(buffer, num_bytes, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPSocket_Private::Read force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (num_bytes != rv)
- return ReportError("PPB_TCPSocket_Private::Read", rv);
- *bytes_read = rv;
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket->Read(buffer, num_bytes, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(num_bytes, callback.result());
+ *bytes_read = callback.result();
PASS();
}
@@ -92,15 +85,12 @@
const char* buffer,
int32_t num_bytes,
int32_t* bytes_written) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->Write(buffer, num_bytes, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPSocket_Private::Write force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (num_bytes != rv)
- return ReportError("PPB_TCPSocket_Private::Write", rv);
- *bytes_written = rv;
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket->Write(buffer, num_bytes, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(num_bytes, callback.result());
+ *bytes_written = callback.result();
PASS();
}
@@ -127,14 +117,10 @@
const std::string& host,
uint16_t port,
const PP_HostResolver_Private_Hint& hint) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = host_resolver->Resolve(host, port, hint, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_HostResolver_Private::Resolve force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("PPB_HostResolver_Private::Resolve", rv);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ host_resolver->Resolve(host, port, hint, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
PASS();
}
diff --git a/ppapi/tests/test_host_resolver_private_disallowed.cc b/ppapi/tests/test_host_resolver_private_disallowed.cc
index cc5bce0..3c0e0d5 100644
--- a/ppapi/tests/test_host_resolver_private_disallowed.cc
+++ b/ppapi/tests/test_host_resolver_private_disallowed.cc
@@ -33,7 +33,7 @@
}
void TestHostResolverPrivateDisallowed::RunTests(const std::string& filter) {
- RUN_TEST_FORCEASYNC_AND_NOT(Resolve, filter);
+ RUN_CALLBACK_TEST(TestHostResolverPrivateDisallowed, Resolve, filter);
}
std::string TestHostResolverPrivateDisallowed::TestResolve() {
@@ -41,14 +41,10 @@
PP_HostResolver_Private_Hint hint;
hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED;
hint.flags = PP_HOST_RESOLVER_FLAGS_CANONNAME;
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = host_resolver.Resolve(host_, port_, hint,
- callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_HostResolver_Private::Resolve force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_FAILED)
- return "PPB_HostResolver_Private can resolve without allowing switch";
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ host_resolver.Resolve(host_, port_, hint, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_ERROR_FAILED, callback.result());
PASS();
}
diff --git a/ppapi/tests/test_ime_input_event.cc b/ppapi/tests/test_ime_input_event.cc
index 804e17d..500fcbb 100644
--- a/ppapi/tests/test_ime_input_event.cc
+++ b/ppapi/tests/test_ime_input_event.cc
@@ -357,11 +357,11 @@
expected_events_.clear();
expected_events_.push_back(CreateImeCompositionStartEvent());
expected_events_.push_back(update_event);
- expected_events_.push_back(CreateImeCompositionEndEvent(""));
+ expected_events_.push_back(CreateImeCompositionEndEvent(std::string()));
// Simulate the case when IME canceled composition.
ASSERT_TRUE(SimulateInputEvent(update_event));
- ASSERT_TRUE(SimulateInputEvent(CreateImeCompositionEndEvent("")));
+ ASSERT_TRUE(SimulateInputEvent(CreateImeCompositionEndEvent(std::string())));
ASSERT_TRUE(expected_events_.empty());
PASS();
@@ -417,7 +417,7 @@
// Test for IME-unaware plugins. Cancel won't issue any events.
ASSERT_TRUE(SimulateInputEvent(update_event));
- ASSERT_TRUE(SimulateInputEvent(CreateImeCompositionEndEvent("")));
+ ASSERT_TRUE(SimulateInputEvent(CreateImeCompositionEndEvent(std::string())));
ASSERT_TRUE(expected_events_.empty());
PASS();
diff --git a/ppapi/tests/test_net_address_private_untrusted.cc b/ppapi/tests/test_net_address_private_untrusted.cc
index 7ad64e2..06db002 100644
--- a/ppapi/tests/test_net_address_private_untrusted.cc
+++ b/ppapi/tests/test_net_address_private_untrusted.cc
@@ -57,10 +57,9 @@
uint16_t port) {
TestCompletionCallback callback(instance_->pp_instance(), false);
- int32_t rv = socket->Connect(host.c_str(), port, callback.GetCallback());
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- return rv;
+ callback.WaitForResult(
+ socket->Connect(host.c_str(), port, callback.GetCallback()));
+ return callback.result();
}
std::string TestNetAddressPrivateUntrusted::TestAreEqual() {
diff --git a/ppapi/tests/test_pdf.cc b/ppapi/tests/test_pdf.cc
new file mode 100644
index 0000000..dbfc803
--- /dev/null
+++ b/ppapi/tests/test_pdf.cc
@@ -0,0 +1,46 @@
+// 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.
+
+#include "ppapi/tests/test_pdf.h"
+
+#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/cpp/image_data.h"
+#include "ppapi/cpp/point.h"
+#include "ppapi/cpp/private/pdf.h"
+#include "ppapi/cpp/var.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(PDF);
+
+TestPDF::TestPDF(TestingInstance* instance)
+ : TestCase(instance) {
+}
+
+void TestPDF::RunTests(const std::string& filter) {
+ RUN_TEST(GetLocalizedString, filter);
+ RUN_TEST(GetResourceImage, filter);
+}
+
+std::string TestPDF::TestGetLocalizedString() {
+ pp::Var string = pp::PDF::GetLocalizedString(instance_,
+ PP_RESOURCESTRING_PDFGETPASSWORD);
+ ASSERT_TRUE(string.is_string());
+ ASSERT_EQ("This document is password protected. Please enter a password.",
+ string.AsString());
+ PASS();
+}
+
+std::string TestPDF::TestGetResourceImage() {
+ pp::ImageData data =
+ pp::PDF::GetResourceImage(instance_, PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN);
+ ASSERT_EQ(43, data.size().width());
+ ASSERT_EQ(42, data.size().height());
+ for (int i = 0; i < data.size().width(); ++i) {
+ for (int j = 0; j < data.size().height(); ++j) {
+ pp::Point point(i, j);
+ ASSERT_NE(*data.GetAddr32(point), 0);
+ }
+ }
+ PASS();
+}
diff --git a/ppapi/tests/test_pdf.h b/ppapi/tests/test_pdf.h
new file mode 100644
index 0000000..5b3e52d
--- /dev/null
+++ b/ppapi/tests/test_pdf.h
@@ -0,0 +1,25 @@
+// 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.
+
+#ifndef PAPPI_TESTS_TEST_PDF_H_
+#define PAPPI_TESTS_TEST_PDF_H_
+
+#include <string>
+
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/tests/test_case.h"
+
+class TestPDF : public TestCase {
+ public:
+ explicit TestPDF(TestingInstance* instance);
+
+ // TestCase implementation.
+ virtual void RunTests(const std::string& filter);
+
+ private:
+ std::string TestGetLocalizedString();
+ std::string TestGetResourceImage();
+};
+
+#endif // PAPPI_TESTS_TEST_PDF_H_
diff --git a/ppapi/tests/test_post_message.cc b/ppapi/tests/test_post_message.cc
index 8b16620..39102e1 100644
--- a/ppapi/tests/test_post_message.cc
+++ b/ppapi/tests/test_post_message.cc
@@ -58,6 +58,23 @@
delete arg;
}
+class ScopedArrayBufferSizeSetter {
+ public:
+ ScopedArrayBufferSizeSetter(const PPB_Testing_Dev* interface,
+ PP_Instance instance,
+ uint32_t threshold)
+ : interface_(interface),
+ instance_(instance) {
+ interface_->SetMinimumArrayBufferSizeForShmem(instance_, threshold);
+ }
+ ~ScopedArrayBufferSizeSetter() {
+ interface_->SetMinimumArrayBufferSizeForShmem(instance_, 0);
+ }
+ private:
+ const PPB_Testing_Dev* interface_;
+ PP_Instance instance_;
+};
+
#define FINISHED_WAITING_MESSAGE "TEST_POST_MESSAGE_FINISHED_WAITING"
} // namespace
@@ -261,11 +278,10 @@
// TODO(sehr,dmichael): Add testing of longer array buffers when
// crbug.com/110086 is fixed.
-#if defined(OS_LINUX)
- uint32_t sizes[] = { 0, 100, 1000, 10000, 100000, 1000000 };
-#else
- uint32_t sizes[] = { 0, 100, 1000, 10000, 100000 };
-#endif
+ ScopedArrayBufferSizeSetter setter(testing_interface_,
+ instance_->pp_instance(),
+ 200);
+ uint32_t sizes[] = { 0, 100, 1000, 10000 };
for (size_t i = 0; i < sizeof(sizes)/sizeof(sizes[i]); ++i) {
std::ostringstream size_stream;
size_stream << sizes[i];
diff --git a/ppapi/tests/test_tcp_server_socket_private.cc b/ppapi/tests/test_tcp_server_socket_private.cc
index 26b43e6..47e3020 100644
--- a/ppapi/tests/test_tcp_server_socket_private.cc
+++ b/ppapi/tests/test_tcp_server_socket_private.cc
@@ -60,23 +60,19 @@
}
void TestTCPServerSocketPrivate::RunTests(const std::string& filter) {
- RUN_TEST_FORCEASYNC_AND_NOT(Listen, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(Backlog, filter);
+ RUN_CALLBACK_TEST(TestTCPServerSocketPrivate, Listen, filter);
+ RUN_CALLBACK_TEST(TestTCPServerSocketPrivate, Backlog, filter);
}
std::string TestTCPServerSocketPrivate::GetLocalAddress(
PP_NetAddress_Private* address) {
TCPSocketPrivate socket(instance_);
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket.Connect(host_.c_str(), port_, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("PPB_TCPSocket_Private::Connect", rv);
- if (!socket.GetLocalAddress(address))
- return ReportError("PPB_TCPSocket_Private::GetLocalAddress", 0);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket.Connect(host_.c_str(), port_, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+ ASSERT_TRUE(socket.GetLocalAddress(address));
socket.Disconnect();
PASS();
}
@@ -85,16 +81,13 @@
char* buffer,
size_t num_bytes) {
while (num_bytes > 0) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->Read(buffer, num_bytes, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPSocket_Private::Read force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv < 0)
- return ReportError("PPB_TCPSocket_Private::Read", rv);
- buffer += rv;
- num_bytes -= rv;
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket->Read(buffer, num_bytes, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_TRUE(callback.result() >= 0);
+ buffer += callback.result();
+ num_bytes -= callback.result();
}
PASS();
}
@@ -103,16 +96,13 @@
const char* buffer,
size_t num_bytes) {
while (num_bytes > 0) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->Write(buffer, num_bytes, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPSocket_Private::Write force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv < 0)
- return ReportError("PPB_TCPSocket_Private::Write", rv);
- buffer += rv;
- num_bytes -= rv;
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket->Write(buffer, num_bytes, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_TRUE(callback.result() >= 0);
+ buffer += callback.result();
+ num_bytes -= callback.result();
}
PASS();
}
@@ -120,14 +110,11 @@
std::string TestTCPServerSocketPrivate::SyncConnect(
TCPSocketPrivate* socket,
PP_NetAddress_Private* address) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->ConnectWithNetAddress(address, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("PPB_TCPSocket_Private::Connect", rv);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket->ConnectWithNetAddress(address, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
PASS();
}
@@ -153,20 +140,17 @@
if (!NetAddressPrivate::ReplacePort(base_address, port, address))
return ReportError("PPB_NetAddress_Private::ReplacePort", 0);
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->Listen(address, backlog, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPServerSocket_Private::Listen force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv == PP_OK) {
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket->Listen(address, backlog, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ if (callback.result() == PP_OK) {
is_free_port_found = true;
break;
}
}
- if (!is_free_port_found)
- return "Can't find available port";
+ ASSERT_TRUE(is_free_port_found);
PASS();
}
@@ -178,8 +162,17 @@
PP_NetAddress_Private address;
ASSERT_SUBTEST_SUCCESS(SyncListen(&server_socket, &address, kBacklog));
+ // We can't use a blocking callback for Accept, because it will wait forever
+ // for the client to connect, since the client connects after.
TestCompletionCallback accept_callback(instance_->pp_instance(),
- force_async_);
+ PP_REQUIRED);
+ // We need to make sure there's a message loop to run accept_callback on.
+ pp::MessageLoop current_thread_loop(pp::MessageLoop::GetCurrent());
+ if (current_thread_loop.is_null() && testing_interface_->IsOutOfProcess()) {
+ current_thread_loop = pp::MessageLoop(instance_);
+ current_thread_loop.AttachToCurrentThread();
+ }
+
PP_Resource resource;
int32_t accept_rv = server_socket.Accept(&resource,
accept_callback.GetCallback());
@@ -187,14 +180,9 @@
TCPSocketPrivate client_socket(instance_);
ForceConnect(&client_socket, &address);
- if (force_async_ && accept_rv != PP_OK_COMPLETIONPENDING) {
- return ReportError("PPB_TCPServerSocket_Private::Accept force_async",
- accept_rv);
- }
- if (accept_rv == PP_OK_COMPLETIONPENDING)
- accept_rv = accept_callback.WaitForResult();
- if (accept_rv != PP_OK)
- return ReportError("PPB_TCPServerSocket_Private::Accept", accept_rv);
+ accept_callback.WaitForResult(accept_rv);
+ CHECK_CALLBACK_BEHAVIOR(accept_callback);
+ ASSERT_EQ(PP_OK, accept_callback.result());
ASSERT_TRUE(resource != 0);
TCPSocketPrivate accepted_socket(pp::PassRef(), resource);
@@ -231,37 +219,29 @@
for (size_t i = 0; i < kBacklog; ++i) {
client_sockets[i] = new TCPSocketPrivate(instance_);
connect_callbacks[i] = new TestCompletionCallback(instance_->pp_instance(),
- force_async_);
+ callback_type());
connect_rv[i] = client_sockets[i]->ConnectWithNetAddress(
&address,
connect_callbacks[i]->GetCallback());
- if (force_async_ && connect_rv[i] != PP_OK_COMPLETIONPENDING) {
- return ReportError("PPB_TCPSocket_Private::Connect force_async",
- connect_rv[i]);
- }
}
std::vector<PP_Resource> resources(kBacklog);
std::vector<TCPSocketPrivate*> accepted_sockets(kBacklog);
for (size_t i = 0; i < kBacklog; ++i) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = server_socket.Accept(&resources[i], callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPServerSocket_Private::Accept force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("PPB_TCPServerSocket_Private::Accept", rv);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ server_socket.Accept(&resources[i], callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
ASSERT_TRUE(resources[i] != 0);
accepted_sockets[i] = new TCPSocketPrivate(pp::PassRef(), resources[i]);
}
for (size_t i = 0; i < kBacklog; ++i) {
- if (connect_rv[i] == PP_OK_COMPLETIONPENDING)
- connect_rv[i] = connect_callbacks[i]->WaitForResult();
- if (connect_rv[i] != PP_OK)
- return ReportError("PPB_TCPSocket_Private::Connect", connect_rv[i]);
+ connect_callbacks[i]->WaitForResult(connect_rv[i]);
+ CHECK_CALLBACK_BEHAVIOR(*connect_callbacks[i]);
+ ASSERT_EQ(PP_OK, connect_callbacks[i]->result());
}
for (size_t i = 0; i < kBacklog; ++i) {
diff --git a/ppapi/tests/test_tcp_server_socket_private_disallowed.cc b/ppapi/tests/test_tcp_server_socket_private_disallowed.cc
index 55a61a6..8c89a3a 100644
--- a/ppapi/tests/test_tcp_server_socket_private_disallowed.cc
+++ b/ppapi/tests/test_tcp_server_socket_private_disallowed.cc
@@ -53,7 +53,7 @@
}
void TestTCPServerSocketPrivateDisallowed::RunTests(const std::string& filter) {
- RUN_TEST_FORCEASYNC_AND_NOT(Listen, filter);
+ RUN_CALLBACK_TEST(TestTCPServerSocketPrivateDisallowed, Listen, filter);
}
std::string TestTCPServerSocketPrivateDisallowed::TestListen() {
@@ -69,17 +69,14 @@
ASSERT_TRUE(pp::NetAddressPrivate::ReplacePort(base_address,
port,
¤t_address));
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = tcp_server_socket_private_interface_->Listen(
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(tcp_server_socket_private_interface_->Listen(
socket,
¤t_address,
1,
- callback.GetCallback().pp_completion_callback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPServerSocket_Private::Listen force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- ASSERT_NE(PP_OK, rv);
+ callback.GetCallback().pp_completion_callback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_NE(PP_OK, callback.result());
}
PASS();
diff --git a/ppapi/tests/test_tcp_socket_private.cc b/ppapi/tests/test_tcp_socket_private.cc
index a15c36e..b6f158f 100644
--- a/ppapi/tests/test_tcp_socket_private.cc
+++ b/ppapi/tests/test_tcp_socket_private.cc
@@ -47,22 +47,20 @@
}
void TestTCPSocketPrivate::RunTests(const std::string& filter) {
- RUN_TEST_FORCEASYNC_AND_NOT(Basic, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ReadWrite, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ReadWriteSSL, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ConnectAddress, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(SetOption, filter);
+ RUN_CALLBACK_TEST(TestTCPSocketPrivate, Basic, filter);
+ RUN_CALLBACK_TEST(TestTCPSocketPrivate, ReadWrite, filter);
+ RUN_CALLBACK_TEST(TestTCPSocketPrivate, ReadWriteSSL, filter);
+ RUN_CALLBACK_TEST(TestTCPSocketPrivate, ConnectAddress, filter);
+ RUN_CALLBACK_TEST(TestTCPSocketPrivate, SetOption, filter);
}
std::string TestTCPSocketPrivate::TestBasic() {
pp::TCPSocketPrivate socket(instance_);
- TestCompletionCallback cb(instance_->pp_instance(), force_async_);
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
- int32_t rv = socket.Connect(host_.c_str(), port_, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ cb.WaitForResult(socket.Connect(host_.c_str(), port_, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
PP_NetAddress_Private unused;
// TODO(viettrungluu): check the values somehow.
@@ -76,13 +74,11 @@
std::string TestTCPSocketPrivate::TestReadWrite() {
pp::TCPSocketPrivate socket(instance_);
- TestCompletionCallback cb(instance_->pp_instance(), force_async_);
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
- int32_t rv = socket.Connect(host_.c_str(), port_, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ cb.WaitForResult(socket.Connect(host_.c_str(), port_, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
ASSERT_EQ(PP_OK, WriteStringToSocket(&socket, "GET / HTTP/1.0\r\n\r\n"));
@@ -98,19 +94,16 @@
std::string TestTCPSocketPrivate::TestReadWriteSSL() {
pp::TCPSocketPrivate socket(instance_);
- TestCompletionCallback cb(instance_->pp_instance(), force_async_);
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
- int32_t rv = socket.Connect(host_.c_str(), ssl_port_, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ cb.WaitForResult(socket.Connect(host_.c_str(), ssl_port_, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
- rv = socket.SSLHandshake(host_.c_str(), ssl_port_, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ cb.WaitForResult(
+ socket.SSLHandshake(host_.c_str(), ssl_port_, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
ASSERT_EQ(PP_OK, WriteStringToSocket(&socket, "GET / HTTP/1.0\r\n\r\n"));
@@ -130,12 +123,10 @@
// First, bring up a connection and grab the address.
{
pp::TCPSocketPrivate socket(instance_);
- TestCompletionCallback cb(instance_->pp_instance(), force_async_);
- int32_t rv = socket.Connect(host_.c_str(), port_, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
+ cb.WaitForResult(socket.Connect(host_.c_str(), port_, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
ASSERT_TRUE(socket.GetRemoteAddress(&address));
// Omit the |Disconnect()| here to make sure we don't crash if we just let
// the resource be destroyed.
@@ -143,12 +134,10 @@
// Connect to that address.
pp::TCPSocketPrivate socket(instance_);
- TestCompletionCallback cb(instance_->pp_instance(), force_async_);
- int32_t rv = socket.ConnectWithNetAddress(&address, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
+ cb.WaitForResult(socket.ConnectWithNetAddress(&address, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
// Make sure we can read/write to it properly (see |TestReadWrite()|).
ASSERT_EQ(PP_OK, WriteStringToSocket(&socket, "GET / HTTP/1.0\r\n\r\n"));
@@ -163,32 +152,26 @@
std::string TestTCPSocketPrivate::TestSetOption() {
pp::TCPSocketPrivate socket(instance_);
- TestCompletionCallback cb(instance_->pp_instance(), force_async_);
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
- int32_t rv = socket.SetOption(PP_TCPSOCKETOPTION_NO_DELAY, true,
- cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_ERROR_FAILED, rv);
+ cb.WaitForResult(
+ socket.SetOption(PP_TCPSOCKETOPTION_NO_DELAY, true, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_ERROR_FAILED, cb.result());
- rv = socket.Connect(host_.c_str(), port_, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ cb.WaitForResult(socket.Connect(host_.c_str(), port_, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
- rv = socket.SetOption(PP_TCPSOCKETOPTION_NO_DELAY, true, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ cb.WaitForResult(
+ socket.SetOption(PP_TCPSOCKETOPTION_NO_DELAY, true, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
- rv = socket.SetOption(PP_TCPSOCKETOPTION_INVALID, true, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_ERROR_BADARGUMENT, rv);
+ cb.WaitForResult(
+ socket.SetOption(PP_TCPSOCKETOPTION_INVALID, true, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_ERROR_BADARGUMENT, cb.result());
socket.Disconnect();
@@ -203,18 +186,17 @@
s->clear();
// Make sure we don't just hang if |Read()| spews.
while (s->size() < 1000000) {
- TestCompletionCallback cb(instance_->pp_instance(), force_async_);
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
int32_t rv = socket->Read(buffer, sizeof(buffer), cb.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+ if (callback_type() == PP_REQUIRED && rv != PP_OK_COMPLETIONPENDING)
return PP_ERROR_FAILED;
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- if (rv < 0)
- return rv;
- if (rv == 0)
+ cb.WaitForResult(rv);
+ if (cb.result() < 0)
+ return cb.result();
+ if (cb.result() == 0)
return PP_ERROR_FAILED; // Didn't get a \n-terminated line.
- s->reserve(s->size() + rv);
- for (int32_t i = 0; i < rv; i++) {
+ s->reserve(s->size() + cb.result());
+ for (int32_t i = 0; i < cb.result(); i++) {
s->push_back(buffer[i]);
if (buffer[i] == '\n')
return PP_OK;
@@ -228,18 +210,17 @@
const char* buffer = s.data();
size_t written = 0;
while (written < s.size()) {
- TestCompletionCallback cb(instance_->pp_instance(), force_async_);
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
int32_t rv = socket->Write(buffer + written, s.size() - written,
cb.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+ if (callback_type() == PP_REQUIRED && rv != PP_OK_COMPLETIONPENDING)
return PP_ERROR_FAILED;
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- if (rv < 0)
- return rv;
- if (rv == 0)
+ cb.WaitForResult(rv);
+ if (cb.result() < 0)
+ return cb.result();
+ if (cb.result() == 0)
return PP_ERROR_FAILED;
- written += rv;
+ written += cb.result();
}
if (written != s.size())
return PP_ERROR_FAILED;
diff --git a/ppapi/tests/test_tcp_socket_private_disallowed.cc b/ppapi/tests/test_tcp_socket_private_disallowed.cc
index 6325a4f..581b54b 100644
--- a/ppapi/tests/test_tcp_socket_private_disallowed.cc
+++ b/ppapi/tests/test_tcp_socket_private_disallowed.cc
@@ -39,15 +39,11 @@
tcp_socket_private_interface_->Create(instance_->pp_instance());
if (0 != socket) {
TestCompletionCallback callback(instance_->pp_instance());
- int32_t rv = tcp_socket_private_interface_->Connect(
+ callback.WaitForResult(tcp_socket_private_interface_->Connect(
socket, kServerName, kPort,
- callback.GetCallback().pp_completion_callback());
-
- if (PP_OK_COMPLETIONPENDING == rv)
- rv = callback.WaitForResult();
-
- if (PP_ERROR_FAILED != rv)
- return "PPB_TCPSocket_Private can connect without allowing switch";
+ callback.GetCallback().pp_completion_callback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_ERROR_FAILED, callback.result());
}
PASS();
}
diff --git a/ppapi/tests/test_tcp_socket_private_trusted.cc b/ppapi/tests/test_tcp_socket_private_trusted.cc
index 82c2257..1b0e7e7 100644
--- a/ppapi/tests/test_tcp_socket_private_trusted.cc
+++ b/ppapi/tests/test_tcp_socket_private_trusted.cc
@@ -35,24 +35,22 @@
}
void TestTCPSocketPrivateTrusted::RunTests(const std::string& filter) {
- RUN_TEST_FORCEASYNC_AND_NOT(GetServerCertificate, filter);
+ RUN_CALLBACK_TEST(TestTCPSocketPrivateTrusted, GetServerCertificate, filter);
}
std::string TestTCPSocketPrivateTrusted::TestGetServerCertificate() {
pp::TCPSocketPrivate socket(instance_);
- TestCompletionCallback cb(instance_->pp_instance(), force_async_);
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
- int32_t rv = socket.Connect(host_.c_str(), ssl_port_, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ cb.WaitForResult(
+ socket.Connect(host_.c_str(), ssl_port_, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
- rv = socket.SSLHandshake(host_.c_str(), ssl_port_, cb.GetCallback());
- ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = cb.WaitForResult();
- ASSERT_EQ(PP_OK, rv);
+ cb.WaitForResult(
+ socket.SSLHandshake(host_.c_str(), ssl_port_, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
const pp::X509CertificatePrivate& cert = socket.GetServerCertificate();
ASSERT_EQ(
diff --git a/ppapi/tests/test_truetype_font.cc b/ppapi/tests/test_truetype_font.cc
new file mode 100644
index 0000000..67587a0
--- /dev/null
+++ b/ppapi/tests/test_truetype_font.cc
@@ -0,0 +1,429 @@
+// 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.
+//
+// Tests PPB_TrueTypeFont interface.
+
+#include "ppapi/tests/test_truetype_font.h"
+
+#include <string.h>
+#include <algorithm>
+#include <limits>
+
+#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/dev/truetype_font_dev.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/var.h"
+#include "ppapi/tests/test_utils.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(TrueTypeFont);
+
+#define MAKE_TABLE_TAG(a, b, c, d) ((a) << 24) + ((b) << 16) + ((c) << 8) + (d)
+
+namespace {
+
+const PP_Resource kInvalidResource = 0;
+const PP_Instance kInvalidInstance = 0;
+
+// TrueType font header and table entry structs. See
+// https://developer.apple.com/fonts/TTRefMan/RM06/Chap6.html
+struct FontHeader {
+ int32_t font_type;
+ uint16_t num_tables;
+ uint16_t search_range;
+ uint16_t entry_selector;
+ uint16_t range_shift;
+};
+
+struct FontDirectoryEntry {
+ uint32_t tag;
+ uint32_t checksum;
+ uint32_t offset;
+ uint32_t logical_length;
+};
+
+uint32_t ReadBigEndian32(const void* ptr) {
+ const uint8_t* data = reinterpret_cast<const uint8_t*>(ptr);
+ return (data[3] << 0) | (data[2] << 8) | (data[1] << 16) | (data[0] << 24);
+}
+
+uint16_t ReadBigEndian16(const void* ptr) {
+ const uint8_t* data = reinterpret_cast<const uint8_t*>(ptr);
+ return (data[1] << 0) | (data[0] << 8);
+}
+
+}
+
+TestTrueTypeFont::TestTrueTypeFont(TestingInstance* instance)
+ : TestCase(instance),
+ ppb_truetype_font_interface_(NULL),
+ ppb_core_interface_(NULL),
+ ppb_var_interface_(NULL) {
+}
+
+bool TestTrueTypeFont::Init() {
+ ppb_truetype_font_interface_ = static_cast<const PPB_TrueTypeFont_Dev*>(
+ pp::Module::Get()->GetBrowserInterface(PPB_TRUETYPEFONT_DEV_INTERFACE));
+ ppb_core_interface_ = static_cast<const PPB_Core*>(
+ pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE));
+ ppb_var_interface_ = static_cast<const PPB_Var*>(
+ pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE));
+ if (!ppb_truetype_font_interface_)
+ instance_->AppendError("PPB_TrueTypeFont_Dev interface not available");
+ if (!ppb_core_interface_)
+ instance_->AppendError("PPB_Core interface not available");
+ if (!ppb_var_interface_)
+ instance_->AppendError("PPB_Var interface not available");
+
+ return true;
+}
+
+TestTrueTypeFont::~TestTrueTypeFont() {
+}
+
+void TestTrueTypeFont::RunTests(const std::string& filter) {
+ RUN_TEST(GetFontFamilies, filter);
+ RUN_TEST(GetFontsInFamily, filter);
+ RUN_TEST(Create, filter);
+ RUN_TEST(Describe, filter);
+ RUN_TEST(GetTableTags, filter);
+ RUN_TEST(GetTable, filter);
+}
+
+std::string TestTrueTypeFont::TestGetFontFamilies() {
+ {
+ // A valid instance should be able to enumerate fonts.
+ TestCompletionCallbackWithOutput< std::vector<pp::Var> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(pp::TrueTypeFont_Dev::GetFontFamilies(instance_,
+ cc.GetCallback()));
+ const std::vector<pp::Var> font_families = cc.output();
+ // We should get some font families on any platform.
+ ASSERT_NE(0, font_families.size());
+ ASSERT_EQ(static_cast<int32_t>(font_families.size()), cc.result());
+ // Make sure at least one family is a non-empty string.
+ ASSERT_NE(0, font_families[0].AsString().size());
+ }
+ {
+ // Using an invalid instance should fail.
+ TestCompletionCallbackWithOutput< std::vector<pp::Var> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(
+ ppb_truetype_font_interface_->GetFontFamilies(
+ kInvalidInstance,
+ cc.GetCallback().output(),
+ cc.GetCallback().pp_completion_callback()));
+ ASSERT_TRUE(cc.result() == PP_ERROR_FAILED ||
+ cc.result() == PP_ERROR_BADARGUMENT);
+ ASSERT_EQ(0, cc.output().size());
+ }
+
+ PASS();
+}
+
+std::string TestTrueTypeFont::TestGetFontsInFamily() {
+ {
+ // Get the list of all font families.
+ TestCompletionCallbackWithOutput< std::vector<pp::Var> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(pp::TrueTypeFont_Dev::GetFontFamilies(instance_,
+ cc.GetCallback()));
+ // Try to use a common family that is likely to have multiple variations.
+ const std::vector<pp::Var> families = cc.output();
+ pp::Var family("Arial");
+ if (std::find(families.begin(), families.end(), family) == families.end()) {
+ family = pp::Var("Times");
+ if (std::find(families.begin(), families.end(), family) == families.end())
+ family = families[0]; // Just use the first family.
+ }
+
+ // GetFontsInFamily: A valid instance should be able to enumerate fonts
+ // in a given family.
+ TestCompletionCallbackWithOutput< std::vector<pp::TrueTypeFontDesc_Dev> >
+ cc2(instance_->pp_instance(), false);
+ cc2.WaitForResult(pp::TrueTypeFont_Dev::GetFontsInFamily(
+ instance_,
+ family,
+ cc2.GetCallback()));
+ std::vector<pp::TrueTypeFontDesc_Dev> fonts_in_family = cc2.output();
+ ASSERT_NE(0, fonts_in_family.size());
+ ASSERT_EQ(static_cast<int32_t>(fonts_in_family.size()), cc2.result());
+
+ // We should be able to create any of the returned fonts without fallback.
+ for (size_t i = 0; i < fonts_in_family.size(); ++i) {
+ pp::TrueTypeFontDesc_Dev& font_in_family = fonts_in_family[i];
+ pp::TrueTypeFont_Dev font(instance_, font_in_family);
+ TestCompletionCallbackWithOutput<pp::TrueTypeFontDesc_Dev> cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(font.Describe(cc.GetCallback()));
+ const pp::TrueTypeFontDesc_Dev desc = cc.output();
+
+ ASSERT_EQ(family, desc.family());
+ ASSERT_EQ(font_in_family.style(), desc.style());
+ ASSERT_EQ(font_in_family.weight(), desc.weight());
+ }
+ }
+ {
+ // Using an invalid instance should fail.
+ TestCompletionCallbackWithOutput< std::vector<pp::TrueTypeFontDesc_Dev> >
+ cc(instance_->pp_instance(), false);
+ pp::Var family("Times");
+ cc.WaitForResult(
+ ppb_truetype_font_interface_->GetFontsInFamily(
+ kInvalidInstance,
+ family.pp_var(),
+ cc.GetCallback().output(),
+ cc.GetCallback().pp_completion_callback()));
+ ASSERT_TRUE(cc.result() == PP_ERROR_FAILED ||
+ cc.result() == PP_ERROR_BADARGUMENT);
+ ASSERT_EQ(0, cc.output().size());
+ }
+
+ PASS();
+}
+
+std::string TestTrueTypeFont::TestCreate() {
+ PP_Resource font;
+ PP_TrueTypeFontDesc_Dev desc = {
+ PP_MakeUndefined(),
+ PP_TRUETYPEFONTFAMILY_SERIF,
+ PP_TRUETYPEFONTSTYLE_NORMAL,
+ PP_TRUETYPEFONTWEIGHT_NORMAL,
+ PP_TRUETYPEFONTWIDTH_NORMAL,
+ PP_TRUETYPEFONTCHARSET_DEFAULT
+ };
+ // Creating a font from an invalid instance returns an invalid resource.
+ font = ppb_truetype_font_interface_->Create(kInvalidInstance, &desc);
+ ASSERT_EQ(kInvalidResource, font);
+ ASSERT_NE(PP_TRUE, ppb_truetype_font_interface_->IsTrueTypeFont(font));
+
+ // Creating a font from a valid instance returns a font resource.
+ font = ppb_truetype_font_interface_->Create(instance_->pp_instance(), &desc);
+ ASSERT_NE(kInvalidResource, font);
+ ASSERT_EQ(PP_TRUE, ppb_truetype_font_interface_->IsTrueTypeFont(font));
+
+ ppb_core_interface_->ReleaseResource(font);
+ // Once released, the resource shouldn't be a font.
+ ASSERT_NE(PP_TRUE, ppb_truetype_font_interface_->IsTrueTypeFont(font));
+
+ PASS();
+}
+
+std::string TestTrueTypeFont::TestDescribe() {
+ pp::TrueTypeFontDesc_Dev create_desc;
+ create_desc.set_generic_family(PP_TRUETYPEFONTFAMILY_SERIF);
+ create_desc.set_style(PP_TRUETYPEFONTSTYLE_NORMAL);
+ create_desc.set_weight(PP_TRUETYPEFONTWEIGHT_NORMAL);
+ pp::TrueTypeFont_Dev font(instance_, create_desc);
+ // Describe: See what font-matching did with a generic font. We should always
+ // be able to Create a generic Serif font.
+ TestCompletionCallbackWithOutput<pp::TrueTypeFontDesc_Dev> cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(font.Describe(cc.GetCallback()));
+ const pp::TrueTypeFontDesc_Dev desc = cc.output();
+ ASSERT_NE(0, desc.family().AsString().size());
+ ASSERT_EQ(PP_TRUETYPEFONTFAMILY_SERIF, desc.generic_family());
+ ASSERT_EQ(PP_TRUETYPEFONTSTYLE_NORMAL, desc.style());
+ ASSERT_EQ(PP_TRUETYPEFONTWEIGHT_NORMAL, desc.weight());
+
+ // Describe an invalid resource should fail.
+ PP_TrueTypeFontDesc_Dev fail_desc;
+ memset(&fail_desc, 0, sizeof(fail_desc));
+ fail_desc.family = PP_MakeUndefined();
+ // Create a shallow copy to check that no data is changed.
+ PP_TrueTypeFontDesc_Dev fail_desc_copy;
+ memcpy(&fail_desc_copy, &fail_desc, sizeof(fail_desc));
+
+ cc.WaitForResult(
+ ppb_truetype_font_interface_->Describe(
+ kInvalidResource,
+ &fail_desc,
+ cc.GetCallback().pp_completion_callback()));
+ ASSERT_EQ(PP_ERROR_BADRESOURCE, cc.result());
+ ASSERT_EQ(PP_VARTYPE_UNDEFINED, fail_desc.family.type);
+ ASSERT_EQ(0, memcmp(&fail_desc, &fail_desc_copy, sizeof(fail_desc)));
+
+ PASS();
+}
+
+std::string TestTrueTypeFont::TestGetTableTags() {
+ pp::TrueTypeFontDesc_Dev desc;
+ pp::TrueTypeFont_Dev font(instance_, desc);
+ {
+ TestCompletionCallbackWithOutput< std::vector<uint32_t> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(font.GetTableTags(cc.GetCallback()));
+ std::vector<uint32_t> tags = cc.output();
+ ASSERT_NE(0, tags.size());
+ ASSERT_EQ(static_cast<int32_t>(tags.size()), cc.result());
+ // Tags will vary depending on the actual font that the host platform
+ // chooses. Check that all required TrueType tags are present.
+ const int required_tag_count = 9;
+ uint32_t required_tags[required_tag_count] = {
+ // Note: these must be sorted for std::includes below.
+ MAKE_TABLE_TAG('c', 'm', 'a', 'p'),
+ MAKE_TABLE_TAG('g', 'l', 'y', 'f'),
+ MAKE_TABLE_TAG('h', 'e', 'a', 'd'),
+ MAKE_TABLE_TAG('h', 'h', 'e', 'a'),
+ MAKE_TABLE_TAG('h', 'm', 't', 'x'),
+ MAKE_TABLE_TAG('l', 'o', 'c', 'a'),
+ MAKE_TABLE_TAG('m', 'a', 'x', 'p'),
+ MAKE_TABLE_TAG('n', 'a', 'm', 'e'),
+ MAKE_TABLE_TAG('p', 'o', 's', 't')
+ };
+ std::sort(tags.begin(), tags.end());
+ ASSERT_TRUE(std::includes(tags.begin(),
+ tags.end(),
+ required_tags,
+ required_tags + required_tag_count));
+ }
+ {
+ // Invalid resource should fail and write no data.
+ TestCompletionCallbackWithOutput< std::vector<uint32_t> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(
+ ppb_truetype_font_interface_->GetTableTags(
+ kInvalidResource,
+ cc.GetCallback().output(),
+ cc.GetCallback().pp_completion_callback()));
+ ASSERT_EQ(PP_ERROR_BADRESOURCE, cc.result());
+ ASSERT_EQ(0, cc.output().size());
+ }
+
+ PASS();
+}
+
+std::string TestTrueTypeFont::TestGetTable() {
+ pp::TrueTypeFontDesc_Dev desc;
+ pp::TrueTypeFont_Dev font(instance_, desc);
+
+ {
+ // Getting a required table from a valid font should succeed.
+ TestCompletionCallbackWithOutput< std::vector<char> > cc1(
+ instance_->pp_instance(), false);
+ cc1.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'),
+ 0, std::numeric_limits<int32_t>::max(),
+ cc1.GetCallback()));
+ const std::vector<char> cmap_data = cc1.output();
+ ASSERT_NE(0, cmap_data.size());
+ ASSERT_EQ(static_cast<int32_t>(cmap_data.size()), cc1.result());
+
+ // Passing 0 for the table tag should return the entire font.
+ TestCompletionCallbackWithOutput< std::vector<char> > cc2(
+ instance_->pp_instance(), false);
+ cc2.WaitForResult(font.GetTable(0 /* table_tag */,
+ 0, std::numeric_limits<int32_t>::max(),
+ cc2.GetCallback()));
+ const std::vector<char> entire_font = cc2.output();
+ ASSERT_NE(0, entire_font.size());
+ ASSERT_EQ(static_cast<int32_t>(entire_font.size()), cc2.result());
+
+ // Verify that the CMAP table is in entire_font, and that it's identical
+ // to the one we retrieved above. Note that since the font header and table
+ // directory are in file (big-endian) order, we need to byte swap tags and
+ // numbers.
+ const size_t kHeaderSize = sizeof(FontHeader);
+ const size_t kEntrySize = sizeof(FontDirectoryEntry);
+ ASSERT_TRUE(kHeaderSize < entire_font.size());
+ FontHeader header;
+ memcpy(&header, &entire_font[0], kHeaderSize);
+ uint16_t num_tables = ReadBigEndian16(&header.num_tables);
+ std::vector<FontDirectoryEntry> directory(num_tables);
+ size_t directory_size = kEntrySize * num_tables;
+ ASSERT_TRUE(kHeaderSize + directory_size < entire_font.size());
+ memcpy(&directory[0], &entire_font[kHeaderSize], directory_size);
+ const FontDirectoryEntry* cmap_entry = NULL;
+ for (uint16_t i = 0; i < num_tables; i++) {
+ if (ReadBigEndian32(&directory[i].tag) ==
+ MAKE_TABLE_TAG('c', 'm', 'a', 'p')) {
+ cmap_entry = &directory[i];
+ break;
+ }
+ }
+ ASSERT_NE(NULL, cmap_entry);
+
+ uint32_t logical_length = ReadBigEndian32(&cmap_entry->logical_length);
+ uint32_t table_offset = ReadBigEndian32(&cmap_entry->offset);
+ ASSERT_EQ(static_cast<size_t>(logical_length), cmap_data.size());
+ ASSERT_TRUE(static_cast<size_t>(table_offset + logical_length) <
+ entire_font.size());
+ const char* cmap_table = &entire_font[0] + table_offset;
+ ASSERT_EQ(0, memcmp(cmap_table, &cmap_data[0], cmap_data.size()));
+
+ // Use offset and max_data_length to restrict the data. Read a part of
+ // the 'CMAP' table.
+ TestCompletionCallbackWithOutput< std::vector<char> > cc3(
+ instance_->pp_instance(), false);
+ const int32_t kOffset = 4;
+ int32_t partial_cmap_size = static_cast<int32_t>(cmap_data.size() - 64);
+ cc3.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'),
+ kOffset,
+ partial_cmap_size,
+ cc3.GetCallback()));
+ const std::vector<char> partial_cmap_data = cc3.output();
+ ASSERT_EQ(partial_cmap_data.size(), static_cast<size_t>(cc3.result()));
+ ASSERT_EQ(partial_cmap_data.size(), static_cast<size_t>(partial_cmap_size));
+ ASSERT_EQ(0, memcmp(cmap_table + kOffset, &partial_cmap_data[0],
+ partial_cmap_size));
+ }
+ {
+ // Getting an invalid table should fail ('zzzz' should be safely invalid).
+ TestCompletionCallbackWithOutput< std::vector<char> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('z', 'z', 'z', 'z'),
+ 0, std::numeric_limits<int32_t>::max(),
+ cc.GetCallback()));
+ ASSERT_EQ(0, cc.output().size());
+ ASSERT_EQ(PP_ERROR_FAILED, cc.result());
+ }
+ {
+ // GetTable on an invalid resource should fail with a bad resource error
+ // and write no data.
+ TestCompletionCallbackWithOutput< std::vector<char> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(
+ ppb_truetype_font_interface_->GetTable(
+ kInvalidResource,
+ MAKE_TABLE_TAG('c', 'm', 'a', 'p'),
+ 0, std::numeric_limits<int32_t>::max(),
+ cc.GetCallback().output(),
+ cc.GetCallback().pp_completion_callback()));
+ ASSERT_EQ(PP_ERROR_BADRESOURCE, cc.result());
+ ASSERT_EQ(0, cc.output().size());
+ }
+ {
+ // Negative offset should fail with a bad argument error and write no data.
+ TestCompletionCallbackWithOutput< std::vector<char> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'),
+ -100, 0,
+ cc.GetCallback()));
+ ASSERT_EQ(PP_ERROR_BADARGUMENT, cc.result());
+ ASSERT_EQ(0, cc.output().size());
+ }
+ {
+ // Offset larger than file size succeeds but returns no data.
+ TestCompletionCallbackWithOutput< std::vector<char> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'),
+ 1 << 28, 0,
+ cc.GetCallback()));
+ ASSERT_EQ(PP_OK, cc.result());
+ ASSERT_EQ(0, cc.output().size());
+ }
+ {
+ // Negative max_data_length should fail with a bad argument error and write
+ // no data.
+ TestCompletionCallbackWithOutput< std::vector<char> > cc(
+ instance_->pp_instance(), false);
+ cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'),
+ 0, -100,
+ cc.GetCallback()));
+ ASSERT_EQ(PP_ERROR_BADARGUMENT, cc.result());
+ ASSERT_EQ(0, cc.output().size());
+ }
+
+ PASS();
+}
diff --git a/ppapi/tests/test_truetype_font.h b/ppapi/tests/test_truetype_font.h
new file mode 100644
index 0000000..70ed8f9
--- /dev/null
+++ b/ppapi/tests/test_truetype_font.h
@@ -0,0 +1,37 @@
+// 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_TRUETYPE_FONT_H_
+#define PAPPI_TESTS_TEST_TRUETYPE_FONT_H_
+
+#include <string>
+
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
+#include "ppapi/c/ppb_core.h"
+#include "ppapi/c/ppb_var.h"
+#include "ppapi/tests/test_case.h"
+
+class TestTrueTypeFont : public TestCase {
+ public:
+ explicit TestTrueTypeFont(TestingInstance* instance);
+ virtual ~TestTrueTypeFont();
+
+ private:
+ // TestCase implementation.
+ virtual bool Init();
+ virtual void RunTests(const std::string& filter);
+
+ std::string TestGetFontFamilies();
+ std::string TestGetFontsInFamily();
+ std::string TestCreate();
+ std::string TestDescribe();
+ std::string TestGetTableTags();
+ std::string TestGetTable();
+
+ const PPB_TrueTypeFont_Dev* ppb_truetype_font_interface_;
+ const PPB_Core* ppb_core_interface_;
+ const PPB_Var* ppb_var_interface_;
+};
+
+#endif // PAPPI_TESTS_TEST_TRUETYPE_FONT_H_
diff --git a/ppapi/tests/test_udp_socket_private.cc b/ppapi/tests/test_udp_socket_private.cc
index 995b53a..1380135 100644
--- a/ppapi/tests/test_udp_socket_private.cc
+++ b/ppapi/tests/test_udp_socket_private.cc
@@ -54,25 +54,21 @@
}
void TestUDPSocketPrivate::RunTests(const std::string& filter) {
- RUN_TEST_FORCEASYNC_AND_NOT(Connect, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ConnectFailure, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(Broadcast, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(SetSocketFeatureErrors, filter);
+ RUN_CALLBACK_TEST(TestUDPSocketPrivate, Connect, filter);
+ RUN_CALLBACK_TEST(TestUDPSocketPrivate, ConnectFailure, filter);
+ RUN_CALLBACK_TEST(TestUDPSocketPrivate, Broadcast, filter);
+ RUN_CALLBACK_TEST(TestUDPSocketPrivate, SetSocketFeatureErrors, filter);
}
std::string TestUDPSocketPrivate::GetLocalAddress(
PP_NetAddress_Private* address) {
pp::TCPSocketPrivate socket(instance_);
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket.Connect(host_.c_str(), port_, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_TCPSocket_Private::Connect force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("PPB_TCPSocket_Private::Connect", rv);
- if (!socket.GetLocalAddress(address))
- return "PPB_TCPSocket_Private::GetLocalAddress: Failed";
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket.Connect(host_.c_str(), port_, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
+ ASSERT_TRUE(socket.GetLocalAddress(address));
socket.Disconnect();
PASS();
}
@@ -94,14 +90,10 @@
std::string TestUDPSocketPrivate::BindUDPSocket(
pp::UDPSocketPrivate* socket,
PP_NetAddress_Private* address) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->Bind(address, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_UDPSocket_Private::Bind force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("PPB_UDPSocket_Private::Bind", rv);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(socket->Bind(address, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_OK, callback.result());
PASS();
}
@@ -130,16 +122,11 @@
std::string TestUDPSocketPrivate::BindUDPSocketFailure(
pp::UDPSocketPrivate* socket,
PP_NetAddress_Private *address) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->Bind(address, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_UDPSocket_Private::Bind force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv == PP_OK)
- return ReportError("PPB_UDPSocket_Private::Bind", rv);
- if (socket->GetBoundAddress(address))
- return "PPB_UDPSocket_Private::GetBoundAddress: Failed";
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(socket->Bind(address, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_NE(PP_OK, callback.result());
+ ASSERT_FALSE(socket->GetBoundAddress(address));
PASS();
}
@@ -148,14 +135,12 @@
size_t size,
std::string* message) {
std::vector<char> buffer(size);
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
- int32_t rv = socket->RecvFrom(&buffer[0], size, callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_UDPSocket_Private::RecvFrom force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv < 0 || size != static_cast<size_t>(rv))
- return ReportError("PPB_UDPSocket_Private::RecvFrom", rv);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ socket->RecvFrom(&buffer[0], size, callback.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_FALSE(callback.result() < 0);
+ ASSERT_EQ(size, static_cast<size_t>(callback.result()));
message->assign(buffer.begin(), buffer.end());
PASS();
}
@@ -164,20 +149,16 @@
pp::UDPSocketPrivate* source,
PP_NetAddress_Private* address,
const std::string& message) {
- TestCompletionCallback callback(instance_->pp_instance(), force_async_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
int32_t rv = source->SendTo(message.c_str(), message.size(), address,
callback.GetCallback());
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("PPB_UDPSocket_Private::SendTo force_async", rv);
-
std::string str;
ASSERT_SUBTEST_SUCCESS(ReadSocket(target, address, message.size(), &str));
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv < 0 || message.size() != static_cast<size_t>(rv))
- return ReportError("PPB_UDPSocket_Private::SendTo", rv);
-
+ callback.WaitForResult(rv);
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_FALSE(callback.result() < 0);
+ ASSERT_EQ(message.size(), static_cast<size_t>(callback.result()));
ASSERT_EQ(message, str);
PASS();
}
diff --git a/ppapi/tests/test_udp_socket_private_disallowed.cc b/ppapi/tests/test_udp_socket_private_disallowed.cc
index 655ed35..aaaeba1 100644
--- a/ppapi/tests/test_udp_socket_private_disallowed.cc
+++ b/ppapi/tests/test_udp_socket_private_disallowed.cc
@@ -36,14 +36,10 @@
pp::NetAddressPrivate::GetAnyAddress(false, &addr);
TestCompletionCallback callback(instance_->pp_instance());
- int32_t rv = udp_socket_private_interface_->Bind(socket, &addr,
- callback.GetCallback().pp_completion_callback());
-
- if (PP_OK_COMPLETIONPENDING == rv)
- rv = callback.WaitForResult();
-
- if (PP_ERROR_FAILED != rv)
- return "PPB_UDPSocket_Private can bind without allowing switch";
+ callback.WaitForResult(udp_socket_private_interface_->Bind(socket, &addr,
+ callback.GetCallback().pp_completion_callback()));
+ CHECK_CALLBACK_BEHAVIOR(callback);
+ ASSERT_EQ(PP_ERROR_FAILED, callback.result());
}
PASS();
}
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc
index 112a483..0978f0e 100644
--- a/ppapi/tests/test_url_loader.cc
+++ b/ppapi/tests/test_url_loader.cc
@@ -375,7 +375,7 @@
request.SetURL("/echo");
request.SetMethod("POST");
request.AppendDataToBody("", 0);
- return LoadAndCompareBody(request, "");
+ return LoadAndCompareBody(request, std::string());
}
std::string TestURLLoader::TestBinaryDataPOST() {
@@ -558,11 +558,12 @@
// valid token (containing special characters like CR, LF).
// http://www.w3.org/TR/XMLHttpRequest/
{
- ASSERT_EQ(OpenUntrusted("cOnNeCt", ""), PP_ERROR_NOACCESS);
- ASSERT_EQ(OpenUntrusted("tRaCk", ""), PP_ERROR_NOACCESS);
- ASSERT_EQ(OpenUntrusted("tRaCe", ""), PP_ERROR_NOACCESS);
- ASSERT_EQ(OpenUntrusted("POST\x0d\x0ax-csrf-token:\x20test1234", ""),
- PP_ERROR_NOACCESS);
+ ASSERT_EQ(OpenUntrusted("cOnNeCt", std::string()), PP_ERROR_NOACCESS);
+ ASSERT_EQ(OpenUntrusted("tRaCk", std::string()), PP_ERROR_NOACCESS);
+ ASSERT_EQ(OpenUntrusted("tRaCe", std::string()), PP_ERROR_NOACCESS);
+ ASSERT_EQ(
+ OpenUntrusted("POST\x0d\x0ax-csrf-token:\x20test1234", std::string()),
+ PP_ERROR_NOACCESS);
}
// HTTP methods are restricted only for untrusted loaders. Try all headers
// that are forbidden by http://www.w3.org/TR/XMLHttpRequest/.
@@ -619,9 +620,9 @@
std::string TestURLLoader::TestTrustedHttpRequests() {
// Trusted requests can use restricted methods.
{
- ASSERT_EQ(OpenTrusted("cOnNeCt", ""), PP_OK);
- ASSERT_EQ(OpenTrusted("tRaCk", ""), PP_OK);
- ASSERT_EQ(OpenTrusted("tRaCe", ""), PP_OK);
+ ASSERT_EQ(OpenTrusted("cOnNeCt", std::string()), PP_OK);
+ ASSERT_EQ(OpenTrusted("tRaCk", std::string()), PP_OK);
+ ASSERT_EQ(OpenTrusted("tRaCe", std::string()), PP_OK);
}
// Trusted requests can use restricted headers.
{
@@ -791,12 +792,12 @@
total_bytes_to_be_received);
if (bytes_received == total_bytes_to_be_received)
break;
- // TODO(dmichael): This should probably compare pp::MessageLoop::GetCurrent
- // with GetForMainThread. We only need to yield on the main
- // thread.
- if (callback_type() != PP_BLOCKING) {
- pp::Module::Get()->core()->CallOnMainThread(10, callback.GetCallback());
- callback.WaitForResult();
+ // Yield if we're on the main thread, so that URLLoader can receive more
+ // data.
+ if (pp::Module::Get()->core()->IsMainThread()) {
+ NestedEvent event(instance_->pp_instance());
+ event.PostSignal(10);
+ event.Wait();
}
}
diff --git a/ppapi/tests/test_url_request.cc b/ppapi/tests/test_url_request.cc
index 00e6d2e..fd904db 100644
--- a/ppapi/tests/test_url_request.cc
+++ b/ppapi/tests/test_url_request.cc
@@ -111,7 +111,7 @@
// IsURLRequestInfo: Released URLRequestInfo resource -> false.
ppb_core_interface_->ReleaseResource(url_request);
- ASSERT_NE(PP_TRUE, ppb_url_request_interface_->IsURLRequestInfo(url_request))
+ ASSERT_NE(PP_TRUE, ppb_url_request_interface_->IsURLRequestInfo(url_request));
return error; // == PASS() if empty.
}
diff --git a/ppapi/tests/test_utils.cc b/ppapi/tests/test_utils.cc
index e28afda..4d251d2 100644
--- a/ppapi/tests/test_utils.cc
+++ b/ppapi/tests/test_utils.cc
@@ -72,6 +72,7 @@
}
void NestedEvent::Wait() {
+ PP_DCHECK(pp::Module::Get()->core()->IsMainThread());
// Don't allow nesting more than once; it doesn't work with the code as-is,
// and probably is a bad idea most of the time anyway.
PP_DCHECK(!waiting_);
@@ -84,17 +85,35 @@
}
void NestedEvent::Signal() {
+ if (pp::Module::Get()->core()->IsMainThread())
+ SignalOnMainThread();
+ else
+ PostSignal(0);
+}
+
+void NestedEvent::PostSignal(int32_t wait_ms) {
+ pp::Module::Get()->core()->CallOnMainThread(
+ wait_ms,
+ pp::CompletionCallback(&SignalThunk, this),
+ 0);
+}
+
+void NestedEvent::Reset() {
+ PP_DCHECK(pp::Module::Get()->core()->IsMainThread());
+ // It doesn't make sense to reset when we're still waiting.
+ PP_DCHECK(!waiting_);
+ signalled_ = false;
+}
+
+void NestedEvent::SignalOnMainThread() {
+ PP_DCHECK(pp::Module::Get()->core()->IsMainThread());
signalled_ = true;
if (waiting_)
GetTestingInterface()->QuitMessageLoop(instance_);
}
-void NestedEvent::Reset() {
- // It doesn't make sense to reset when we're still waiting.
- PP_DCHECK(!waiting_);
- // We must have already been Signalled().
- PP_DCHECK(signalled_);
- signalled_ = false;
+void NestedEvent::SignalThunk(void* event, int32_t /* result */) {
+ static_cast<NestedEvent*>(event)->SignalOnMainThread();
}
TestCompletionCallback::TestCompletionCallback(PP_Instance instance)
@@ -105,7 +124,6 @@
// what the tests currently expect.
callback_type_(PP_OPTIONAL),
post_quit_task_(false),
- run_count_(0), // TODO(dmichael): Remove when all tests are updated.
instance_(instance),
delegate_(NULL) {
}
@@ -132,17 +150,6 @@
delegate_(NULL) {
}
-int32_t TestCompletionCallback::WaitForResult() {
- PP_DCHECK(!wait_for_result_called_);
- wait_for_result_called_ = true;
- errors_.clear();
- if (!have_result_) {
- post_quit_task_ = true;
- RunMessageLoop();
- }
- return result_;
-}
-
void TestCompletionCallback::WaitForResult(int32_t result) {
PP_DCHECK(!wait_for_result_called_);
wait_for_result_called_ = true;
@@ -211,7 +218,6 @@
result_ = PP_OK_COMPLETIONPENDING;
have_result_ = false;
post_quit_task_ = false;
- run_count_ = 0; // TODO(dmichael): Remove when all tests are updated.
delegate_ = NULL;
errors_.clear();
}
@@ -225,7 +231,6 @@
PP_DCHECK(!callback->have_result_);
callback->result_ = result;
callback->have_result_ = true;
- callback->run_count_++; // TODO(dmichael): Remove when all tests are updated.
if (callback->delegate_)
callback->delegate_->OnCallback(user_data, result);
if (callback->post_quit_task_) {
diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h
index e61efbd..bc28bb0 100644
--- a/ppapi/tests/test_utils.h
+++ b/ppapi/tests/test_utils.h
@@ -41,6 +41,10 @@
// void TestFullscreen::DidChangeView(const pp::View& view) {
// nested_event_.Signal();
// }
+//
+// All methods except Signal and PostSignal must be invoked on the main thread.
+// It's OK to signal from a background thread, so you can (for example) Signal()
+// from the Audio thread.
class NestedEvent {
public:
explicit NestedEvent(PP_Instance instance)
@@ -50,10 +54,18 @@
// has already been called, return immediately without running a nested loop.
void Wait();
// Signal the NestedEvent. If Wait() has been called, quit the message loop.
+ // This can be called from any thread.
void Signal();
+ // Signal the NestedEvent in |wait_ms| milliseconds. This can be called from
+ // any thread.
+ void PostSignal(int32_t wait_ms);
+
// Reset the NestedEvent so it can be used again.
void Reset();
private:
+ void SignalOnMainThread();
+ static void SignalThunk(void* async_event, int32_t result);
+
PP_Instance instance_;
bool waiting_;
bool signalled_;
@@ -81,14 +93,6 @@
// The delegate will be reset when Reset() or GetCallback() is called.
void SetDelegate(Delegate* delegate) { delegate_ = delegate; }
- // Waits for the callback to be called and returns the
- // result. Returns immediately if the callback was previously called
- // and the result wasn't returned (i.e. each result value received
- // by the callback is returned by WaitForResult() once and only
- // once). DEPRECATED: Please use the one below.
- // TODO(dmichael): Remove this one when all the tests are updated.
- int32_t WaitForResult();
-
// Wait for a result, given the return from the call which took this callback
// as a parameter. If |result| is PP_OK_COMPLETIONPENDING, WaitForResult will
// block until its callback has been invoked (in some cases, this will already
@@ -134,12 +138,6 @@
// TestCompletionCallback.
pp::CompletionCallback GetCallback();
- // TODO(dmichael): Remove run_count when all tests are updated. Most cases
- // that use this can simply use CHECK_CALLBACK_BEHAVIOR.
- unsigned run_count() const { return run_count_; }
- // TODO(dmichael): Remove this; tests should use Reset() instead.
- void reset_run_count() { run_count_ = 0; }
-
bool failed() { return !errors_.empty(); }
const std::string& errors() { return errors_; }
@@ -148,8 +146,11 @@
// Reset so that this callback can be used again.
void Reset();
- protected:
+ CallbackType callback_type() { return callback_type_; }
+ void set_target_loop(const pp::MessageLoop& loop) { target_loop_ = loop; }
static void Handler(void* user_data, int32_t result);
+
+ protected:
void RunMessageLoop();
void QuitMessageLoop();
@@ -163,61 +164,116 @@
CallbackType callback_type_;
bool post_quit_task_;
std::string errors_;
- unsigned run_count_;
PP_Instance instance_;
Delegate* delegate_;
pp::MessageLoop target_loop_;
};
-template <typename OutputT>
-class TestCompletionCallbackWithOutput : public TestCompletionCallback {
+namespace internal {
+
+template <typename OutputT, typename CallbackT>
+class TestCompletionCallbackWithOutputBase {
public:
- explicit TestCompletionCallbackWithOutput(PP_Instance instance) :
- TestCompletionCallback(instance) {
+ explicit TestCompletionCallbackWithOutputBase(PP_Instance instance)
+ : callback_(instance) {
}
- TestCompletionCallbackWithOutput(PP_Instance instance, bool force_async) :
- TestCompletionCallback(instance, force_async) {
+ TestCompletionCallbackWithOutputBase(PP_Instance instance, bool force_async)
+ : callback_(instance, force_async) {
}
- TestCompletionCallbackWithOutput(PP_Instance instance,
- CallbackType callback_type) :
- TestCompletionCallback(instance, callback_type) {
+ TestCompletionCallbackWithOutputBase(PP_Instance instance,
+ CallbackType callback_type)
+ : callback_(instance, callback_type) {
}
- pp::CompletionCallbackWithOutput<OutputT> GetCallbackWithOutput();
- operator pp::CompletionCallbackWithOutput<OutputT>() {
- return GetCallbackWithOutput();
+ CallbackT GetCallback();
+ OutputT output() {
+ return CallbackT::TraitsType::StorageToPluginArg(
+ output_storage_);
}
- const OutputT& output() { return output_storage_.output(); }
+ // Delegate functions to TestCompletionCallback
+ void SetDelegate(TestCompletionCallback::Delegate* delegate) {
+ callback_.SetDelegate(delegate);
+ }
+ void WaitForResult(int32_t result) { callback_.WaitForResult(result); }
+ void WaitForAbortResult(int32_t result) {
+ callback_.WaitForAbortResult(result);
+ }
+ bool failed() { return callback_.failed(); }
+ const std::string& errors() { return callback_.errors(); }
+ int32_t result() const { return callback_.result(); }
+ void Reset() { return callback_.Reset(); }
- typename pp::CompletionCallbackWithOutput<OutputT>::OutputStorageType
- output_storage_;
+ private:
+ TestCompletionCallback callback_;
+ typename CallbackT::OutputStorageType output_storage_;
};
-template <typename OutputT>
-pp::CompletionCallbackWithOutput<OutputT>
-TestCompletionCallbackWithOutput<OutputT>::GetCallbackWithOutput() {
- Reset();
- if (callback_type_ == PP_BLOCKING) {
- pp::CompletionCallbackWithOutput<OutputT> cc(
- &TestCompletionCallback::Handler,
- this,
- &output_storage_);
+template <typename OutputT, typename CallbackT>
+CallbackT
+TestCompletionCallbackWithOutputBase<OutputT, CallbackT>::GetCallback() {
+ callback_.Reset();
+ if (callback_.callback_type() == PP_BLOCKING) {
+ CallbackT cc(&output_storage_);
return cc;
}
- target_loop_ = pp::MessageLoop::GetCurrent();
- pp::CompletionCallbackWithOutput<OutputT> cc(
- &TestCompletionCallback::Handler,
- this,
- &output_storage_);
- if (callback_type_ == PP_OPTIONAL)
+ callback_.set_target_loop(pp::MessageLoop::GetCurrent());
+ CallbackT cc(&TestCompletionCallback::Handler, this, &output_storage_);
+ if (callback_.callback_type() == PP_OPTIONAL)
cc.set_flags(PP_COMPLETIONCALLBACK_FLAG_OPTIONAL);
return cc;
}
+} // namespace internal
+
+template <typename OutputT>
+class TestCompletionCallbackWithOutput
+ : public internal::TestCompletionCallbackWithOutputBase<
+ OutputT, pp::CompletionCallbackWithOutput<OutputT> > {
+ public:
+ explicit TestCompletionCallbackWithOutput(PP_Instance instance)
+ : BaseType(instance) {
+ }
+
+ TestCompletionCallbackWithOutput(PP_Instance instance, bool force_async)
+ : BaseType(instance, force_async) {
+ }
+
+ TestCompletionCallbackWithOutput(PP_Instance instance,
+ CallbackType callback_type)
+ : BaseType(instance, callback_type) {
+ }
+
+ private:
+ typedef internal::TestCompletionCallbackWithOutputBase<
+ OutputT, pp::CompletionCallbackWithOutput<OutputT> > BaseType;
+};
+
+template <typename OutputT>
+class TestExtCompletionCallbackWithOutput
+ : public internal::TestCompletionCallbackWithOutputBase<
+ OutputT, pp::ext::ExtCompletionCallbackWithOutput<OutputT> > {
+ public:
+ explicit TestExtCompletionCallbackWithOutput(PP_Instance instance)
+ : BaseType(instance) {
+ }
+
+ TestExtCompletionCallbackWithOutput(PP_Instance instance, bool force_async)
+ : BaseType(instance, force_async) {
+ }
+
+ TestExtCompletionCallbackWithOutput(PP_Instance instance,
+ CallbackType callback_type)
+ : BaseType(instance, callback_type) {
+ }
+
+ private:
+ typedef internal::TestCompletionCallbackWithOutputBase<
+ OutputT, pp::ext::ExtCompletionCallbackWithOutput<OutputT> > BaseType;
+};
// Verifies that the callback didn't record any errors. If the callback is run
// in an unexpected way (e.g., if it's invoked asynchronously when the call
@@ -225,7 +281,8 @@
#define CHECK_CALLBACK_BEHAVIOR(callback) \
do { \
if ((callback).failed()) \
- return (callback).errors(); \
+ return MakeFailureMessage(__FILE__, __LINE__, \
+ (callback).errors().c_str()); \
} while (false)
/*
diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc
index c0f813e..9a3839b 100644
--- a/ppapi/tests/test_websocket.cc
+++ b/ppapi/tests/test_websocket.cc
@@ -31,7 +31,7 @@
#include "ppapi/tests/testing_instance.h"
#include "ppapi/utility/websocket/websocket_api.h"
-// net::TestServer serves WebSocket service for testing.
+// net::SpawnedTestServer serves WebSocket service for testing.
// Following URLs are handled by pywebsocket handlers in
// net/data/websocket/*_wsh.py.
const char kEchoServerURL[] = "echo-with-no-extension";
@@ -350,18 +350,18 @@
ASSERT_EQ(0U, close_code);
PP_Var close_reason = websocket_interface_->GetCloseReason(ws);
- ASSERT_TRUE(AreEqualWithString(close_reason, ""));
+ ASSERT_TRUE(AreEqualWithString(close_reason, std::string()));
ReleaseVar(close_reason);
PP_Bool close_was_clean = websocket_interface_->GetCloseWasClean(ws);
ASSERT_EQ(PP_FALSE, close_was_clean);
PP_Var extensions = websocket_interface_->GetExtensions(ws);
- ASSERT_TRUE(AreEqualWithString(extensions, ""));
+ ASSERT_TRUE(AreEqualWithString(extensions, std::string()));
ReleaseVar(extensions);
PP_Var protocol = websocket_interface_->GetProtocol(ws);
- ASSERT_TRUE(AreEqualWithString(protocol, ""));
+ ASSERT_TRUE(AreEqualWithString(protocol, std::string()));
ReleaseVar(protocol);
PP_WebSocketReadyState ready_state =
@@ -369,7 +369,7 @@
ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID, ready_state);
PP_Var url = websocket_interface_->GetURL(ws);
- ASSERT_TRUE(AreEqualWithString(url, ""));
+ ASSERT_TRUE(AreEqualWithString(url, std::string()));
ReleaseVar(url);
core_interface_->ReleaseResource(ws);
@@ -398,7 +398,7 @@
for (int i = 0; kInvalidURLs[i]; ++i) {
int32_t result;
- ws = Connect(kInvalidURLs[i], &result, "");
+ ws = Connect(kInvalidURLs[i], &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_ERROR_BADARGUMENT, result);
@@ -448,7 +448,7 @@
std::string TestWebSocket::TestGetURL() {
for (int i = 0; kInvalidURLs[i]; ++i) {
int32_t result;
- PP_Resource ws = Connect(kInvalidURLs[i], &result, "");
+ PP_Resource ws = Connect(kInvalidURLs[i], &result, std::string());
ASSERT_TRUE(ws);
PP_Var url = websocket_interface_->GetURL(ws);
ASSERT_TRUE(AreEqualWithString(url, kInvalidURLs[i]));
@@ -463,11 +463,11 @@
std::string TestWebSocket::TestValidConnect() {
int32_t result;
- PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
PP_Var extensions = websocket_interface_->GetExtensions(ws);
- ASSERT_TRUE(AreEqualWithString(extensions, ""));
+ ASSERT_TRUE(AreEqualWithString(extensions, std::string()));
core_interface_->ReleaseResource(ws);
ReleaseVar(extensions);
@@ -489,7 +489,7 @@
// Close with bad arguments.
int32_t result;
- ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
callback.WaitForResult(websocket_interface_->Close(
@@ -498,7 +498,7 @@
core_interface_->ReleaseResource(ws);
// Close with PP_VARTYPE_NULL.
- ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
callback.WaitForResult(websocket_interface_->Close(
@@ -508,7 +508,7 @@
core_interface_->ReleaseResource(ws);
// Close with PP_VARTYPE_NULL and ongoing receive message.
- ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
PP_Var receive_message_var;
@@ -532,7 +532,7 @@
core_interface_->ReleaseResource(ws);
// Close twice.
- ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
result = websocket_interface_->Close(
@@ -569,7 +569,7 @@
// Close.
int32_t result;
- PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
callback.WaitForResult(websocket_interface_->Close(
@@ -580,7 +580,7 @@
core_interface_->ReleaseResource(ws);
// Close without code and reason.
- ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
callback.WaitForResult(websocket_interface_->Close(
@@ -590,7 +590,7 @@
core_interface_->ReleaseResource(ws);
// Close with PP_VARTYPE_UNDEFINED.
- ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
callback.WaitForResult(websocket_interface_->Close(
@@ -620,7 +620,7 @@
// Close in closing.
// The first close will be done successfully, then the second one failed with
// with PP_ERROR_INPROGRESS immediately.
- ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
result = websocket_interface_->Close(
@@ -636,7 +636,7 @@
core_interface_->ReleaseResource(ws);
// Close with ongoing receive message.
- ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
PP_Var receive_message_var;
@@ -655,7 +655,7 @@
core_interface_->ReleaseResource(ws);
// Close with PP_VARTYPE_UNDEFINED and ongoing receive message.
- ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ws = Connect(GetFullURL(kEchoServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
result = websocket_interface_->ReceiveMessage(
@@ -673,7 +673,8 @@
core_interface_->ReleaseResource(ws);
// Server initiated closing handshake.
- ws = Connect(GetFullURL(kCloseWithCodeAndReasonServerURL), &result, "");
+ ws = Connect(
+ GetFullURL(kCloseWithCodeAndReasonServerURL), &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
// Text messsage "1000 bye" requests the server to initiate closing handshake
@@ -720,7 +721,8 @@
std::string TestWebSocket::TestTextSendReceive() {
// Connect to test echo server.
int32_t connect_result;
- PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &connect_result, "");
+ PP_Resource ws =
+ Connect(GetFullURL(kEchoServerURL), &connect_result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, connect_result);
@@ -747,7 +749,8 @@
std::string TestWebSocket::TestBinarySendReceive() {
// Connect to test echo server.
int32_t connect_result;
- PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &connect_result, "");
+ PP_Resource ws =
+ Connect(GetFullURL(kEchoServerURL), &connect_result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, connect_result);
@@ -776,7 +779,8 @@
std::string TestWebSocket::TestStressedSendReceive() {
// Connect to test echo server.
int32_t connect_result;
- PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &connect_result, "");
+ PP_Resource ws =
+ Connect(GetFullURL(kEchoServerURL), &connect_result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, connect_result);
@@ -836,7 +840,8 @@
std::string TestWebSocket::TestBufferedAmount() {
// Connect to test echo server.
int32_t connect_result;
- PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &connect_result, "");
+ PP_Resource ws =
+ Connect(GetFullURL(kEchoServerURL), &connect_result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, connect_result);
@@ -876,7 +881,7 @@
// After connection closure, all sending requests fail and just increase
// the bufferedAmount property.
- PP_Var empty_string = CreateVarString("");
+ PP_Var empty_string = CreateVarString(std::string());
result = websocket_interface_->SendMessage(ws, empty_string);
ASSERT_EQ(PP_ERROR_FAILED, result);
buffered_amount = websocket_interface_->GetBufferedAmount(ws);
@@ -919,7 +924,7 @@
ASSERT_EQ(PP_ERROR_ABORTED, connect_callback.result());
// Test the behavior for Close().
- ws = Connect(url, &result, "");
+ ws = Connect(url, &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
PP_Var reason_var = CreateVarString("abort");
@@ -936,7 +941,7 @@
// Test the behavior for ReceiveMessage().
// Make sure the simplest case to wait for data which never arrives, here.
- ws = Connect(url, &result, "");
+ ws = Connect(url, &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
PP_Var receive_var;
@@ -952,7 +957,7 @@
// Release the resource in the aborting receive completion callback which is
// introduced by calling Close().
- ws = Connect(url, &result, "");
+ ws = Connect(url, &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
result = websocket_interface_->ReceiveMessage(
@@ -986,7 +991,7 @@
int32_t result;
std::string url = GetFullURL(kEchoServerURL);
- PP_Resource ws = Connect(url, &result, "");
+ PP_Resource ws = Connect(url, &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
result = websocket_interface_->SendMessage(ws, large_var);
@@ -1001,7 +1006,7 @@
// Release the resource in the close completion callback.
int32_t result;
std::string url = GetFullURL(kEchoServerURL);
- PP_Resource ws = Connect(url, &result, "");
+ PP_Resource ws = Connect(url, &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
TestCompletionCallback close_callback(
@@ -1034,7 +1039,7 @@
// released while the next message is going to be received.
const int trial_count = 8;
for (int trial = 1; trial <= trial_count; trial++) {
- ws = Connect(url, &result, "");
+ ws = Connect(url, &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
for (int i = 0; i <= trial_count; ++i) {
@@ -1060,7 +1065,7 @@
}
// Same test, but the last receiving message is large message over 64KiB.
for (int trial = 1; trial <= trial_count; trial++) {
- ws = Connect(url, &result, "");
+ ws = Connect(url, &result, std::string());
ASSERT_TRUE(ws);
ASSERT_EQ(PP_OK, result);
for (int i = 0; i <= trial_count; ++i) {
@@ -1102,12 +1107,12 @@
// Check uninitialized properties access.
ASSERT_EQ(0, ws.GetBufferedAmount());
ASSERT_EQ(0, ws.GetCloseCode());
- ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), ""));
+ ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), std::string()));
ASSERT_EQ(false, ws.GetCloseWasClean());
- ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), ""));
- ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), ""));
+ ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), std::string()));
+ ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), std::string()));
ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID, ws.GetReadyState());
- ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), ""));
+ ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), std::string()));
// Check communication interfaces (connect, send, receive, and close).
TestCompletionCallback connect_callback(
@@ -1163,7 +1168,7 @@
ASSERT_TRUE(
AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str()));
ASSERT_EQ(true, ws.GetCloseWasClean());
- ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), ""));
+ ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), std::string()));
ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED, ws.GetReadyState());
ASSERT_TRUE(AreEqualWithString(
ws.GetURL().pp_var(), GetFullURL(kCloseServerURL).c_str()));
@@ -1268,7 +1273,8 @@
const std::vector<WebSocketEvent>& events = websocket.GetSeenEvents();
ASSERT_EQ(1U, events.size());
ASSERT_EQ(WebSocketEvent::EVENT_OPEN, events[0].event_type);
- ASSERT_TRUE(AreEqualWithString(websocket.GetExtensions().pp_var(), ""));
+ ASSERT_TRUE(
+ AreEqualWithString(websocket.GetExtensions().pp_var(), std::string()));
PASS();
}
@@ -1360,7 +1366,7 @@
ASSERT_EQ(PP_ERROR_INPROGRESS, result);
websocket.WaitForClosed();
const std::vector<WebSocketEvent>& events = websocket.GetSeenEvents();
- ASSERT_TRUE(events.size() == 2 || events.size() == 3)
+ ASSERT_TRUE(events.size() == 2 || events.size() == 3);
int index = 0;
if (events.size() == 3)
ASSERT_EQ(WebSocketEvent::EVENT_OPEN, events[index++].event_type);
@@ -1496,7 +1502,7 @@
// After connection closure, all sending requests fail and just increase
// the bufferedAmount property.
- result = websocket.Send(pp::Var(std::string("")));
+ result = websocket.Send(pp::Var(std::string()));
ASSERT_EQ(PP_ERROR_FAILED, result);
buffered_amount = websocket.GetBufferedAmount();
ASSERT_EQ(base_buffered_amount + kMessageFrameOverhead, buffered_amount);
diff --git a/ppapi/tests/test_x509_certificate_private.cc b/ppapi/tests/test_x509_certificate_private.cc
index 6aee30f..fab2f21 100644
--- a/ppapi/tests/test_x509_certificate_private.cc
+++ b/ppapi/tests/test_x509_certificate_private.cc
@@ -166,22 +166,30 @@
PP_X509CERTIFICATE_PRIVATE_SUBJECT_COUNTRY_NAME, "US"));
ASSERT_TRUE(FieldMatchesString(certificate,
PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_NAME, "Google Inc"));
- ASSERT_TRUE(FieldMatchesString(certificate,
- PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_UNIT_NAME, ""));
+ ASSERT_TRUE(FieldMatchesString(
+ certificate,
+ PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_UNIT_NAME,
+ std::string()));
ASSERT_TRUE(FieldMatchesString(certificate,
PP_X509CERTIFICATE_PRIVATE_ISSUER_COMMON_NAME, "Thawte SGC CA"));
- ASSERT_TRUE(FieldMatchesString(certificate,
- PP_X509CERTIFICATE_PRIVATE_ISSUER_LOCALITY_NAME, ""));
- ASSERT_TRUE(FieldMatchesString(certificate,
- PP_X509CERTIFICATE_PRIVATE_ISSUER_STATE_OR_PROVINCE_NAME, ""));
- ASSERT_TRUE(FieldMatchesString(certificate,
- PP_X509CERTIFICATE_PRIVATE_ISSUER_COUNTRY_NAME, "ZA"));
+ ASSERT_TRUE(
+ FieldMatchesString(certificate,
+ PP_X509CERTIFICATE_PRIVATE_ISSUER_LOCALITY_NAME,
+ std::string()));
+ ASSERT_TRUE(FieldMatchesString(
+ certificate,
+ PP_X509CERTIFICATE_PRIVATE_ISSUER_STATE_OR_PROVINCE_NAME,
+ std::string()));
+ ASSERT_TRUE(FieldMatchesString(
+ certificate, PP_X509CERTIFICATE_PRIVATE_ISSUER_COUNTRY_NAME, "ZA"));
ASSERT_TRUE(FieldMatchesString(certificate,
PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_NAME,
"Thawte Consulting (Pty) Ltd."));
- ASSERT_TRUE(FieldMatchesString(certificate,
- PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_UNIT_NAME, ""));
+ ASSERT_TRUE(FieldMatchesString(
+ certificate,
+ PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_UNIT_NAME,
+ std::string()));
ASSERT_FALSE(FieldIsNull(certificate,
PP_X509CERTIFICATE_PRIVATE_SERIAL_NUMBER));
diff --git a/ppapi/thunk/enter.cc b/ppapi/thunk/enter.cc
index 0248eba..02151eb 100644
--- a/ppapi/thunk/enter.cc
+++ b/ppapi/thunk/enter.cc
@@ -63,7 +63,9 @@
const PP_CompletionCallback& callback)
: resource_(GetSingletonResource(instance, resource_id)),
retval_(PP_OK) {
- DCHECK(resource_);
+ DCHECK(resource_ || !instance);
+ if (!resource_)
+ retval_ = PP_ERROR_BADARGUMENT;
callback_ = new TrackedCallback(resource_, callback);
}
@@ -153,8 +155,8 @@
// the plugin won't expect any return code other than
// PP_OK_COMPLETIONPENDING. So we crash to make the problem more obvious.
if (callback_->is_required()) {
- std::string message("Attempted to use a required callback, but there"
- "is no attached message loop on which to run the"
+ std::string message("Attempted to use a required callback, but there "
+ "is no attached message loop on which to run the "
"callback.");
PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR,
std::string(), message);
diff --git a/ppapi/thunk/extensions_common_api.h b/ppapi/thunk/extensions_common_api.h
new file mode 100644
index 0000000..7772c5c
--- /dev/null
+++ b/ppapi/thunk/extensions_common_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_EXTENSIONS_COMMON_API_H_
+#define PPAPI_THUNK_EXTENSIONS_COMMON_API_H_
+
+#include <string>
+#include <vector>
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT ExtensionsCommon_API {
+ public:
+ virtual ~ExtensionsCommon_API() {}
+
+ virtual int32_t Call(const std::string& request_name,
+ const std::vector<PP_Var>& input_args,
+ const std::vector<PP_Var*>& output_args,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Post(const std::string& request_name,
+ const std::vector<PP_Var>& args) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ EXTENSIONS_COMMON_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_EXTENSIONS_COMMON_API_H_
diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h
index 60ac0bb..94dd53f 100644
--- a/ppapi/thunk/interfaces_ppb_private.h
+++ b/ppapi/thunk/interfaces_ppb_private.h
@@ -47,6 +47,11 @@
// This uses the FileIO API which is declared in the public stable file.
PROXIED_IFACE(NoAPIName, PPB_FILEIOTRUSTED_INTERFACE_0_4, PPB_FileIOTrusted_0_4)
+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 059f603..b00bddc 100644
--- a/ppapi/thunk/interfaces_ppb_private_no_permissions.h
+++ b/ppapi/thunk/interfaces_ppb_private_no_permissions.h
@@ -44,4 +44,7 @@
PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2,
PPB_NetworkMonitor_Private_0_2)
+PROXIED_IFACE(NoAPIName, PPB_FILEIO_PRIVATE_INTERFACE_0_1,
+ PPB_FileIO_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 90d00c5..707e0e5 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -12,6 +12,10 @@
PROXIED_IFACE(PPB_Instance, "PPB_Console(Dev);0.1", PPB_Console_1_0)
PROXIED_IFACE(NoAPIName, PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4,
PPB_CursorControl_Dev_0_4)
+PROXIED_IFACE(NoAPIName, PPB_EXT_ALARMS_DEV_INTERFACE_0_1,
+ PPB_Ext_Alarms_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_EXT_SOCKET_DEV_INTERFACE_0_1,
+ PPB_Ext_Socket_Dev_0_1)
PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_5,
PPB_FileChooser_Dev_0_5)
PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_6,
@@ -57,14 +61,10 @@
PPB_GLESChromiumTextureMapping_Dev_0_1)
PROXIED_IFACE(NoAPIName, PPB_CRYPTO_DEV_INTERFACE_0_1, PPB_Crypto_Dev_0_1)
PROXIED_IFACE(NoAPIName, PPB_DEVICEREF_DEV_INTERFACE_0_1, PPB_DeviceRef_Dev_0_1)
-PROXIED_IFACE(NoAPIName, PPB_DIRECTORYREADER_DEV_INTERFACE_0_6,
- PPB_DirectoryReader_Dev_0_6)
PROXIED_IFACE(NoAPIName, PPB_GRAPHICS2D_DEV_INTERFACE_0_1,
PPB_Graphics2D_Dev_0_1)
PROXIED_IFACE(PPB_Instance, PPB_CHAR_SET_DEV_INTERFACE_0_4, PPB_CharSet_Dev_0_4)
PROXIED_IFACE(PPB_Instance, PPB_URLUTIL_DEV_INTERFACE_0_6, PPB_URLUtil_Dev_0_6)
-PROXIED_IFACE(PPB_Instance, PPB_PRINTING_DEV_INTERFACE_0_6,
- PPB_Printing_Dev_0_6)
UNPROXIED_IFACE(PPB_Scrollbar, PPB_SCROLLBAR_DEV_INTERFACE_0_5,
PPB_Scrollbar_Dev_0_5)
PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_1,
diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h
index 3bf9479..14b539f 100644
--- a/ppapi/thunk/interfaces_ppb_public_stable.h
+++ b/ppapi/thunk/interfaces_ppb_public_stable.h
@@ -20,7 +20,6 @@
PROXIED_API(PPB_Audio)
PROXIED_API(PPB_Core)
PROXIED_API(PPB_FileRef)
-PROXIED_API(PPB_FileSystem)
PROXIED_API(PPB_Graphics3D)
PROXIED_API(PPB_ImageData)
PROXIED_API(PPB_Instance)
@@ -48,7 +47,8 @@
// Note: Core is special and is registered manually.
PROXIED_IFACE(PPB_Audio, PPB_AUDIO_INTERFACE_1_0, PPB_Audio_1_0)
PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_0, PPB_FileRef_1_0)
-PROXIED_IFACE(PPB_FileSystem, PPB_FILESYSTEM_INTERFACE_1_0, PPB_FileSystem_1_0)
+PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_1, PPB_FileRef_1_1)
+PROXIED_IFACE(NoAPIName, PPB_FILESYSTEM_INTERFACE_1_0, PPB_FileSystem_1_0)
PROXIED_IFACE(PPB_Graphics3D, PPB_GRAPHICS_3D_INTERFACE_1_0, PPB_Graphics3D_1_0)
PROXIED_IFACE(PPB_ImageData, PPB_IMAGEDATA_INTERFACE_1_0, PPB_ImageData_1_0)
PROXIED_IFACE(PPB_Instance, PPB_CONSOLE_INTERFACE_1_0, PPB_Console_1_0)
@@ -57,6 +57,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_INPUT_EVENT_INTERFACE_1_0, PPB_InputEvent_1_0)
PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0,
PPB_KeyboardInputEvent_1_0)
@@ -81,6 +82,7 @@
// Note: PPB_Var and PPB_VarArrayBuffer are special and registered manually.
PROXIED_IFACE(NoAPIName, PPB_VIEW_INTERFACE_1_0, PPB_View_1_0)
+PROXIED_IFACE(NoAPIName, PPB_VIEW_INTERFACE_1_1, PPB_View_1_1)
// This has no corresponding _Proxy object since it does no IPC.
PROXIED_IFACE(NoAPIName, PPB_AUDIO_CONFIG_INTERFACE_1_0, PPB_AudioConfig_1_0)
diff --git a/ppapi/thunk/ppb_audio_api.h b/ppapi/thunk/ppb_audio_api.h
index f637799..25a1eb3 100644
--- a/ppapi/thunk/ppb_audio_api.h
+++ b/ppapi/thunk/ppb_audio_api.h
@@ -25,7 +25,7 @@
virtual PP_Bool StopPlayback() = 0;
// Trusted API.
- virtual int32_t OpenTrusted(
+ virtual int32_t Open(
PP_Resource config_id,
scoped_refptr<TrackedCallback> create_callback) = 0;
virtual int32_t GetSyncSocket(int* sync_socket) = 0;
diff --git a/ppapi/thunk/ppb_audio_config_thunk.cc b/ppapi/thunk/ppb_audio_config_thunk.cc
index 2dfa112..b06affd 100644
--- a/ppapi/thunk/ppb_audio_config_thunk.cc
+++ b/ppapi/thunk/ppb_audio_config_thunk.cc
@@ -16,6 +16,7 @@
PP_Resource CreateStereo16bit(PP_Instance instance,
PP_AudioSampleRate sample_rate,
uint32_t sample_frame_count) {
+ VLOG(4) << "PPB_AudioConfig::CreateStereo16Bit()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -25,6 +26,7 @@
uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate,
uint32_t requested_sample_frame_count) {
+ VLOG(4) << "PPB_AudioConfig::RecommendSampleFrameCount()";
return PPB_AudioConfig_Shared::RecommendSampleFrameCount_1_0(sample_rate,
requested_sample_frame_count);
}
@@ -32,6 +34,7 @@
uint32_t RecommendSampleFrameCount_1_1(PP_Instance instance,
PP_AudioSampleRate sample_rate,
uint32_t requested_sample_frame_count) {
+ VLOG(4) << "PPB_AudioConfig::RecommendSampleFrameCount()";
EnterInstance enter(instance);
if (enter.failed())
return 0;
@@ -41,11 +44,13 @@
PP_Bool IsAudioConfig(PP_Resource resource) {
+ VLOG(4) << "PPB_AudioConfig::IsAudioConfig()";
EnterResource<PPB_AudioConfig_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
PP_AudioSampleRate GetSampleRate(PP_Resource config_id) {
+ VLOG(4) << "PPB_AudioConfig::GetSampleRate()";
EnterResource<PPB_AudioConfig_API> enter(config_id, true);
if (enter.failed())
return PP_AUDIOSAMPLERATE_NONE;
@@ -53,6 +58,7 @@
}
uint32_t GetSampleFrameCount(PP_Resource config_id) {
+ VLOG(4) << "PPB_AudioConfig::GetSampleFrameCount()";
EnterResource<PPB_AudioConfig_API> enter(config_id, true);
if (enter.failed())
return 0;
@@ -60,6 +66,7 @@
}
PP_AudioSampleRate RecommendSampleRate(PP_Instance instance) {
+ VLOG(4) << "PPB_AudioConfig::RecommendSampleRate()";
EnterInstance enter(instance);
if (enter.failed())
return PP_AUDIOSAMPLERATE_NONE;
diff --git a/ppapi/thunk/ppb_audio_input_dev_thunk.cc b/ppapi/thunk/ppb_audio_input_dev_thunk.cc
index 7a23c63..2a78737 100644
--- a/ppapi/thunk/ppb_audio_input_dev_thunk.cc
+++ b/ppapi/thunk/ppb_audio_input_dev_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 dev/ppb_audio_input_dev.idl modified Fri Feb 22 11:43:43 2013.
+// 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"
@@ -20,6 +20,7 @@
namespace {
PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_AudioInput_Dev::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -27,6 +28,7 @@
}
PP_Bool IsAudioInput(PP_Resource resource) {
+ VLOG(4) << "PPB_AudioInput_Dev::IsAudioInput()";
EnterResource<PPB_AudioInput_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
@@ -34,6 +36,7 @@
int32_t EnumerateDevices_0_2(PP_Resource audio_input,
PP_Resource* devices,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_AudioInput_Dev::EnumerateDevices()";
EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true);
if (enter.failed())
return enter.retval();
@@ -45,6 +48,7 @@
int32_t EnumerateDevices(PP_Resource audio_input,
struct PP_ArrayOutput output,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_AudioInput_Dev::EnumerateDevices()";
EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true);
if (enter.failed())
return enter.retval();
@@ -55,6 +59,7 @@
int32_t MonitorDeviceChange(PP_Resource audio_input,
PP_MonitorDeviceChangeCallback callback,
void* user_data) {
+ VLOG(4) << "PPB_AudioInput_Dev::MonitorDeviceChange()";
EnterResource<PPB_AudioInput_API> enter(audio_input, true);
if (enter.failed())
return enter.retval();
@@ -67,6 +72,7 @@
PPB_AudioInput_Callback 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();
@@ -78,6 +84,7 @@
}
PP_Resource GetCurrentConfig(PP_Resource audio_input) {
+ VLOG(4) << "PPB_AudioInput_Dev::GetCurrentConfig()";
EnterResource<PPB_AudioInput_API> enter(audio_input, true);
if (enter.failed())
return 0;
@@ -85,6 +92,7 @@
}
PP_Bool StartCapture(PP_Resource audio_input) {
+ VLOG(4) << "PPB_AudioInput_Dev::StartCapture()";
EnterResource<PPB_AudioInput_API> enter(audio_input, true);
if (enter.failed())
return PP_FALSE;
@@ -92,6 +100,7 @@
}
PP_Bool StopCapture(PP_Resource audio_input) {
+ VLOG(4) << "PPB_AudioInput_Dev::StopCapture()";
EnterResource<PPB_AudioInput_API> enter(audio_input, true);
if (enter.failed())
return PP_FALSE;
@@ -99,9 +108,11 @@
}
void Close(PP_Resource audio_input) {
+ VLOG(4) << "PPB_AudioInput_Dev::Close()";
EnterResource<PPB_AudioInput_API> enter(audio_input, true);
- if (enter.succeeded())
- enter.object()->Close();
+ if (enter.failed())
+ return;
+ enter.object()->Close();
}
const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_dev_thunk_0_2 = {
diff --git a/ppapi/thunk/ppb_audio_thunk.cc b/ppapi/thunk/ppb_audio_thunk.cc
index 1bd1692..5dddb89 100644
--- a/ppapi/thunk/ppb_audio_thunk.cc
+++ b/ppapi/thunk/ppb_audio_thunk.cc
@@ -22,6 +22,7 @@
PP_Resource config,
PPB_Audio_Callback audio_callback,
void* user_data) {
+ VLOG(4) << "PPB_Audio::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -32,11 +33,13 @@
}
PP_Bool IsAudio(PP_Resource resource) {
+ VLOG(4) << "PPB_Audio::IsAudio()";
EnterResource<PPB_Audio_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
PP_Resource GetCurrentConfig(PP_Resource audio) {
+ VLOG(4) << "PPB_Audio::GetCurrentConfig()";
EnterResource<PPB_Audio_API> enter(audio, true);
if (enter.failed())
return 0;
@@ -44,6 +47,7 @@
}
PP_Bool StartPlayback(PP_Resource audio) {
+ VLOG(4) << "PPB_Audio::StartPlayback()";
EnterResource<PPB_Audio_API> enter(audio, true);
if (enter.failed())
return PP_FALSE;
@@ -51,6 +55,7 @@
}
PP_Bool StopPlayback(PP_Resource audio) {
+ VLOG(4) << "PPB_Audio::StopPlayback()";
EnterResource<PPB_Audio_API> enter(audio, true);
if (enter.failed())
return PP_FALSE;
diff --git a/ppapi/thunk/ppb_audio_trusted_thunk.cc b/ppapi/thunk/ppb_audio_trusted_thunk.cc
index 9484d69..6f70a53 100644
--- a/ppapi/thunk/ppb_audio_trusted_thunk.cc
+++ b/ppapi/thunk/ppb_audio_trusted_thunk.cc
@@ -2,65 +2,70 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// From trusted/ppb_audio_trusted.idl modified Mon Apr 22 12:01:08 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/trusted/ppb_audio_trusted.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/ppb_audio_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
namespace {
-typedef EnterResource<PPB_Audio_API> EnterAudio;
-
-PP_Resource Create(PP_Instance instance_id) {
- EnterResourceCreation enter(instance_id);
+PP_Resource CreateTrusted(PP_Instance instance) {
+ VLOG(4) << "PPB_AudioTrusted::CreateTrusted()";
+ EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
- return enter.functions()->CreateAudioTrusted(instance_id);
+ return enter.functions()->CreateAudioTrusted(instance);
}
-int32_t Open(PP_Resource audio_id,
- PP_Resource config_id,
- PP_CompletionCallback callback) {
- EnterAudio enter(audio_id, callback, true);
+int32_t Open(PP_Resource audio,
+ PP_Resource config,
+ struct PP_CompletionCallback create_callback) {
+ VLOG(4) << "PPB_AudioTrusted::Open()";
+ EnterResource<PPB_Audio_API> enter(audio, create_callback, true);
if (enter.failed())
return enter.retval();
- return enter.SetResult(enter.object()->OpenTrusted(config_id,
- enter.callback()));
+ return enter.SetResult(enter.object()->Open(config, enter.callback()));
}
-int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) {
- EnterAudio enter(audio_id, true);
+int32_t GetSyncSocket(PP_Resource audio, int* sync_socket) {
+ VLOG(4) << "PPB_AudioTrusted::GetSyncSocket()";
+ EnterResource<PPB_Audio_API> enter(audio, true);
if (enter.failed())
return enter.retval();
return enter.object()->GetSyncSocket(sync_socket);
}
-int32_t GetSharedMemory(PP_Resource audio_id,
+int32_t GetSharedMemory(PP_Resource audio,
int* shm_handle,
uint32_t* shm_size) {
- EnterAudio enter(audio_id, true);
+ VLOG(4) << "PPB_AudioTrusted::GetSharedMemory()";
+ EnterResource<PPB_Audio_API> enter(audio, true);
if (enter.failed())
return enter.retval();
return enter.object()->GetSharedMemory(shm_handle, shm_size);
}
-const PPB_AudioTrusted g_ppb_audio_trusted_thunk = {
- &Create,
+const PPB_AudioTrusted_0_6 g_ppb_audiotrusted_thunk_0_6 = {
+ &CreateTrusted,
&Open,
&GetSyncSocket,
- &GetSharedMemory,
+ &GetSharedMemory
};
} // namespace
const PPB_AudioTrusted_0_6* GetPPB_AudioTrusted_0_6_Thunk() {
- return &g_ppb_audio_trusted_thunk;
+ return &g_ppb_audiotrusted_thunk_0_6;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_buffer_trusted_thunk.cc b/ppapi/thunk/ppb_buffer_trusted_thunk.cc
index 7aa2750..86505e0 100644
--- a/ppapi/thunk/ppb_buffer_trusted_thunk.cc
+++ b/ppapi/thunk/ppb_buffer_trusted_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 trusted/ppb_buffer_trusted.idl modified Wed Feb 6 15:21:31 2013.
+// From trusted/ppb_buffer_trusted.idl modified Thu Feb 28 11:58:17 2013.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/trusted/ppb_buffer_trusted.h"
@@ -19,6 +19,7 @@
namespace {
int32_t GetSharedMemory(PP_Resource buffer, int* handle) {
+ VLOG(4) << "PPB_BufferTrusted::GetSharedMemory()";
EnterResource<PPB_Buffer_API> enter(buffer, true);
if (enter.failed())
return enter.retval();
diff --git a/ppapi/thunk/ppb_console_thunk.cc b/ppapi/thunk/ppb_console_thunk.cc
index 2dd5481..80b115c 100644
--- a/ppapi/thunk/ppb_console_thunk.cc
+++ b/ppapi/thunk/ppb_console_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_console.idl modified Thu Dec 20 13:10:26 2012.
+// From ppb_console.idl modified Tue Apr 16 11:25:44 2013.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_console.h"
@@ -18,18 +18,22 @@
namespace {
void Log(PP_Instance instance, PP_LogLevel level, struct PP_Var value) {
+ VLOG(4) << "PPB_Console::Log()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->Log(instance, level, value);
+ if (enter.failed())
+ return;
+ enter.functions()->Log(instance, level, value);
}
void LogWithSource(PP_Instance instance,
PP_LogLevel level,
struct PP_Var source,
struct PP_Var value) {
+ VLOG(4) << "PPB_Console::LogWithSource()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->LogWithSource(instance, level, source, value);
+ if (enter.failed())
+ return;
+ enter.functions()->LogWithSource(instance, level, source, value);
}
const PPB_Console_1_0 g_ppb_console_thunk_1_0 = {
diff --git a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
index c6417b4..9450eed 100644
--- a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
+++ b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// From private/ppb_content_decryptor_private.idl,
-// modified Mon Feb 25 14:49:36 2013.
+// modified Tue Apr 16 11:25:44 2013.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
@@ -22,17 +22,21 @@
struct PP_Var key_system,
struct PP_Var session_id,
struct PP_Var init_data) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::NeedKey()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->NeedKey(instance, key_system, session_id, init_data);
+ if (enter.failed())
+ return;
+ enter.functions()->NeedKey(instance, key_system, session_id, init_data);
}
void KeyAdded(PP_Instance instance,
struct PP_Var key_system,
struct PP_Var session_id) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::KeyAdded()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->KeyAdded(instance, key_system, session_id);
+ if (enter.failed())
+ return;
+ enter.functions()->KeyAdded(instance, key_system, session_id);
}
void KeyMessage(PP_Instance instance,
@@ -40,13 +44,15 @@
struct PP_Var session_id,
struct PP_Var message,
struct PP_Var default_url) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::KeyMessage()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->KeyMessage(instance,
- key_system,
- session_id,
- message,
- default_url);
+ if (enter.failed())
+ return;
+ enter.functions()->KeyMessage(instance,
+ key_system,
+ session_id,
+ message,
+ default_url);
}
void KeyError(PP_Instance instance,
@@ -54,74 +60,88 @@
struct PP_Var session_id,
int32_t media_error,
int32_t system_code) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::KeyError()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->KeyError(instance,
- key_system,
- session_id,
- media_error,
- system_code);
+ if (enter.failed())
+ return;
+ enter.functions()->KeyError(instance,
+ key_system,
+ session_id,
+ media_error,
+ system_code);
}
void DeliverBlock(PP_Instance instance,
PP_Resource decrypted_block,
const struct PP_DecryptedBlockInfo* decrypted_block_info) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->DeliverBlock(instance,
- decrypted_block,
- decrypted_block_info);
+ if (enter.failed())
+ return;
+ enter.functions()->DeliverBlock(instance,
+ decrypted_block,
+ decrypted_block_info);
}
void DecoderInitializeDone(PP_Instance instance,
PP_DecryptorStreamType decoder_type,
uint32_t request_id,
PP_Bool success) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DecoderInitializeDone()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->DecoderInitializeDone(instance,
- decoder_type,
- request_id,
- success);
+ if (enter.failed())
+ return;
+ enter.functions()->DecoderInitializeDone(instance,
+ decoder_type,
+ request_id,
+ success);
}
void DecoderDeinitializeDone(PP_Instance instance,
PP_DecryptorStreamType decoder_type,
uint32_t request_id) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DecoderDeinitializeDone()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->DecoderDeinitializeDone(instance,
- decoder_type,
- request_id);
+ if (enter.failed())
+ return;
+ enter.functions()->DecoderDeinitializeDone(instance,
+ decoder_type,
+ request_id);
}
void DecoderResetDone(PP_Instance instance,
PP_DecryptorStreamType decoder_type,
uint32_t request_id) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DecoderResetDone()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->DecoderResetDone(instance, decoder_type, request_id);
+ if (enter.failed())
+ return;
+ enter.functions()->DecoderResetDone(instance, decoder_type, request_id);
}
void DeliverFrame(PP_Instance instance,
PP_Resource decrypted_frame,
const struct PP_DecryptedFrameInfo* decrypted_frame_info) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DeliverFrame()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->DeliverFrame(instance,
- decrypted_frame,
- decrypted_frame_info);
+ if (enter.failed())
+ return;
+ enter.functions()->DeliverFrame(instance,
+ decrypted_frame,
+ decrypted_frame_info);
}
void DeliverSamples(
PP_Instance instance,
PP_Resource audio_frames,
const struct PP_DecryptedBlockInfo* decrypted_block_info) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->DeliverSamples(instance,
- audio_frames,
- decrypted_block_info);
+ if (enter.failed())
+ return;
+ enter.functions()->DeliverSamples(instance,
+ audio_frames,
+ decrypted_block_info);
}
const PPB_ContentDecryptor_Private_0_6
diff --git a/ppapi/thunk/ppb_device_ref_dev_thunk.cc b/ppapi/thunk/ppb_device_ref_dev_thunk.cc
index 6e16288..9045cd8 100644
--- a/ppapi/thunk/ppb_device_ref_dev_thunk.cc
+++ b/ppapi/thunk/ppb_device_ref_dev_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 dev/ppb_device_ref_dev.idl modified Tue Jan 22 12:22:52 2013.
+// From dev/ppb_device_ref_dev.idl modified Thu Dec 20 13:10:26 2012.
#include "ppapi/c/dev/ppb_device_ref_dev.h"
#include "ppapi/c/pp_errors.h"
@@ -19,11 +19,13 @@
namespace {
PP_Bool IsDeviceRef(PP_Resource resource) {
+ VLOG(4) << "PPB_DeviceRef_Dev::IsDeviceRef()";
EnterResource<PPB_DeviceRef_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
PP_DeviceType_Dev GetType(PP_Resource device_ref) {
+ VLOG(4) << "PPB_DeviceRef_Dev::GetType()";
EnterResource<PPB_DeviceRef_API> enter(device_ref, true);
if (enter.failed())
return PP_DEVICETYPE_DEV_INVALID;
@@ -31,6 +33,7 @@
}
struct PP_Var GetName(PP_Resource device_ref) {
+ VLOG(4) << "PPB_DeviceRef_Dev::GetName()";
EnterResource<PPB_DeviceRef_API> enter(device_ref, true);
if (enter.failed())
return PP_MakeUndefined();
diff --git a/ppapi/thunk/ppb_directory_reader_api.h b/ppapi/thunk/ppb_directory_reader_api.h
deleted file mode 100644
index cf71ddf..0000000
--- a/ppapi/thunk/ppb_directory_reader_api.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-
-#ifndef PPAPI_THUNK_DIRECTORY_READER_API_H_
-#define PPAPI_THUNK_DIRECTORY_READER_API_H_
-
-#include "base/memory/ref_counted.h"
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
-
-namespace ppapi {
-
-class TrackedCallback;
-
-namespace thunk {
-
-class PPB_DirectoryReader_API {
- public:
- virtual ~PPB_DirectoryReader_API() {}
-
- virtual int32_t ReadEntries(const PP_ArrayOutput& output,
- scoped_refptr<TrackedCallback> callback) = 0;
-};
-
-} // namespace thunk
-} // namespace ppapi
-
-#endif // PPAPI_THUNK_DIRECTORY_READER_API_H_
diff --git a/ppapi/thunk/ppb_directory_reader_thunk.cc b/ppapi/thunk/ppb_directory_reader_thunk.cc
deleted file mode 100644
index aaee6f7..0000000
--- a/ppapi/thunk/ppb_directory_reader_thunk.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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.
-
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/shared_impl/proxy_lock.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
-#include "ppapi/thunk/ppb_directory_reader_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-PP_Resource Create(PP_Resource directory_ref) {
- ppapi::ProxyAutoLock lock;
- Resource* object =
- PpapiGlobals::Get()->GetResourceTracker()->GetResource(directory_ref);
- if (!object)
- return 0;
- EnterResourceCreationNoLock enter(object->pp_instance());
- if (enter.failed())
- return 0;
- return enter.functions()->CreateDirectoryReader(
- object->pp_instance(), directory_ref);
-}
-
-PP_Bool IsDirectoryReader(PP_Resource resource) {
- EnterResource<PPB_DirectoryReader_API> enter(resource, false);
- return PP_FromBool(enter.succeeded());
-}
-
-int32_t ReadEntries(PP_Resource directory_reader,
- PP_ArrayOutput output,
- PP_CompletionCallback callback) {
- EnterResource<PPB_DirectoryReader_API> enter(
- directory_reader, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->ReadEntries(output, enter.callback()));
-}
-
-const PPB_DirectoryReader_Dev g_ppb_directory_reader_thunk = {
- &Create,
- &IsDirectoryReader,
- &ReadEntries
-};
-
-} // namespace
-
-const PPB_DirectoryReader_Dev_0_6* GetPPB_DirectoryReader_Dev_0_6_Thunk() {
- return &g_ppb_directory_reader_thunk;
-}
-
-} // namespace thunk
-} // namespace ppapi
diff --git a/ppapi/thunk/ppb_ext_alarms_thunk.cc b/ppapi/thunk/ppb_ext_alarms_thunk.cc
new file mode 100644
index 0000000..cd805ae
--- /dev/null
+++ b/ppapi/thunk/ppb_ext_alarms_thunk.cc
@@ -0,0 +1,95 @@
+// 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 <vector>
+
+#include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/extensions_common_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void Create(PP_Instance instance,
+ PP_Var name,
+ PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ args.push_back(name);
+ args.push_back(alarm_info);
+ enter.functions()->Post("alarms.create", args);
+}
+
+int32_t Get(PP_Instance instance,
+ PP_Var name,
+ PP_Ext_Alarms_Alarm_Dev* alarm,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(name);
+ output_args.push_back(alarm);
+ return enter.SetResult(enter.functions()->Call(
+ "alarms.get", input_args, output_args, enter.callback()));
+}
+
+int32_t GetAll(PP_Instance instance,
+ PP_Ext_Alarms_Alarm_Dev_Array* alarms,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ output_args.push_back(alarms);
+ return enter.SetResult(enter.functions()->Call(
+ "alarms.getAll", input_args, output_args, enter.callback()));
+}
+
+void Clear(PP_Instance instance, PP_Var name) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ args.push_back(name);
+ enter.functions()->Post("alarms.clear", args);
+}
+
+void ClearAll(PP_Instance instance) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ enter.functions()->Post("alarms.clearAll", args);
+}
+
+const PPB_Ext_Alarms_Dev_0_1 g_ppb_ext_alarms_dev_0_1_thunk = {
+ &Create,
+ &Get,
+ &GetAll,
+ &Clear,
+ &ClearAll
+};
+
+} // namespace
+
+const PPB_Ext_Alarms_Dev_0_1* GetPPB_Ext_Alarms_Dev_0_1_Thunk() {
+ return &g_ppb_ext_alarms_dev_0_1_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_ext_socket_thunk.cc b/ppapi/thunk/ppb_ext_socket_thunk.cc
new file mode 100644
index 0000000..18ba462
--- /dev/null
+++ b/ppapi/thunk/ppb_ext_socket_thunk.cc
@@ -0,0 +1,306 @@
+// 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 <vector>
+
+#include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/extensions_common_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+// TODO(yzshen): The socket API should directly communicate with the browser
+// process, instead of going by way of the renderer process.
+
+int32_t Create(PP_Instance instance,
+ PP_Ext_Socket_SocketType_Dev type,
+ PP_Ext_Socket_CreateOptions_Dev options,
+ PP_Ext_Socket_CreateInfo_Dev* create_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(type);
+ input_args.push_back(options);
+ output_args.push_back(create_info);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.create", input_args, output_args, enter.callback()));
+}
+
+void Destroy(PP_Instance instance, PP_Var socket_id) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ args.push_back(socket_id);
+ enter.functions()->Post("socket.destroy", args);
+}
+
+int32_t Connect(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var hostname,
+ PP_Var port,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(hostname);
+ input_args.push_back(port);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.connect", input_args, output_args, enter.callback()));
+}
+
+int32_t Bind(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var address,
+ PP_Var port,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(address);
+ input_args.push_back(port);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.bind", input_args, output_args, enter.callback()));
+}
+
+void Disconnect(PP_Instance instance, PP_Var socket_id) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ args.push_back(socket_id);
+ enter.functions()->Post("socket.disconnect", args);
+}
+
+int32_t Read(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var buffer_size,
+ PP_Ext_Socket_ReadInfo_Dev* read_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(buffer_size);
+ output_args.push_back(read_info);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.read", input_args, output_args, enter.callback()));
+}
+
+int32_t Write(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var data,
+ PP_Ext_Socket_WriteInfo_Dev* write_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(data);
+ output_args.push_back(write_info);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.write", input_args, output_args, enter.callback()));
+}
+
+int32_t RecvFrom(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var buffer_size,
+ PP_Ext_Socket_RecvFromInfo_Dev* recv_from_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(buffer_size);
+ output_args.push_back(recv_from_info);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.recvFrom", input_args, output_args, enter.callback()));
+}
+
+int32_t SendTo(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var data,
+ PP_Var address,
+ PP_Var port,
+ PP_Ext_Socket_WriteInfo_Dev* write_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(data);
+ input_args.push_back(address);
+ input_args.push_back(port);
+ output_args.push_back(write_info);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.sendTo", input_args, output_args, enter.callback()));
+}
+
+int32_t Listen(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var address,
+ PP_Var port,
+ PP_Var backlog,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(address);
+ input_args.push_back(port);
+ input_args.push_back(backlog);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.listen", input_args, output_args, enter.callback()));
+}
+
+int32_t Accept(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Ext_Socket_AcceptInfo_Dev* accept_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ output_args.push_back(accept_info);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.accept", input_args, output_args, enter.callback()));
+}
+
+int32_t SetKeepAlive(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var enable,
+ PP_Var delay,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(enable);
+ input_args.push_back(delay);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.setKeepAlive", input_args, output_args, enter.callback()));
+}
+
+int32_t SetNoDelay(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var no_delay,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(no_delay);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.setNoDelay", input_args, output_args, enter.callback()));
+}
+
+int32_t GetInfo(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Ext_Socket_SocketInfo_Dev* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.getInfo", input_args, output_args, enter.callback()));
+}
+
+int32_t GetNetworkList(PP_Instance instance,
+ PP_Ext_Socket_NetworkInterface_Dev_Array* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->Call(
+ "socket.getNetworkList", input_args, output_args, enter.callback()));
+}
+
+const PPB_Ext_Socket_Dev_0_1 g_ppb_ext_socket_dev_0_1_thunk = {
+ &Create,
+ &Destroy,
+ &Connect,
+ &Bind,
+ &Disconnect,
+ &Read,
+ &Write,
+ &RecvFrom,
+ &SendTo,
+ &Listen,
+ &Accept,
+ &SetKeepAlive,
+ &SetNoDelay,
+ &GetInfo,
+ &GetNetworkList
+};
+
+} // namespace
+
+const PPB_Ext_Socket_Dev_0_1* GetPPB_Ext_Socket_Dev_0_1_Thunk() {
+ return &g_ppb_ext_socket_dev_0_1_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_file_chooser_dev_thunk.cc b/ppapi/thunk/ppb_file_chooser_dev_thunk.cc
new file mode 100644
index 0000000..fe1aa0d
--- /dev/null
+++ b/ppapi/thunk/ppb_file_chooser_dev_thunk.cc
@@ -0,0 +1,88 @@
+// 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 dev/ppb_file_chooser_dev.idl modified Mon Apr 1 08:24:03 2013.
+
+#include "ppapi/c/dev/ppb_file_chooser_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_chooser_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance,
+ PP_FileChooserMode_Dev mode,
+ struct PP_Var accept_types) {
+ VLOG(4) << "PPB_FileChooser_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFileChooser(instance, mode, accept_types);
+}
+
+PP_Bool IsFileChooser(PP_Resource resource) {
+ VLOG(4) << "PPB_FileChooser_Dev::IsFileChooser()";
+ EnterResource<PPB_FileChooser_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Show_0_5(PP_Resource chooser, struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileChooser_Dev::Show()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Show0_5(enter.callback()));
+}
+
+PP_Resource GetNextChosenFile(PP_Resource chooser) {
+ VLOG(4) << "PPB_FileChooser_Dev::GetNextChosenFile()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetNextChosenFile();
+}
+
+int32_t Show(PP_Resource chooser,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileChooser_Dev::Show()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Show(output, enter.callback()));
+}
+
+const PPB_FileChooser_Dev_0_5 g_ppb_filechooser_dev_thunk_0_5 = {
+ &Create,
+ &IsFileChooser,
+ &Show_0_5,
+ &GetNextChosenFile
+};
+
+const PPB_FileChooser_Dev_0_6 g_ppb_filechooser_dev_thunk_0_6 = {
+ &Create,
+ &IsFileChooser,
+ &Show
+};
+
+} // namespace
+
+const PPB_FileChooser_Dev_0_5* GetPPB_FileChooser_Dev_0_5_Thunk() {
+ return &g_ppb_filechooser_dev_thunk_0_5;
+}
+
+const PPB_FileChooser_Dev_0_6* GetPPB_FileChooser_Dev_0_6_Thunk() {
+ return &g_ppb_filechooser_dev_thunk_0_6;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_file_chooser_thunk.cc b/ppapi/thunk/ppb_file_chooser_thunk.cc
deleted file mode 100644
index c52125a..0000000
--- a/ppapi/thunk/ppb_file_chooser_thunk.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-// 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.
-
-#include "ppapi/c/dev/ppb_file_chooser_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/shared_impl/var.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
-#include "ppapi/thunk/ppb_file_chooser_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-PP_Resource Create(PP_Instance instance,
- PP_FileChooserMode_Dev mode,
- struct PP_Var accept_types) {
- EnterResourceCreation enter(instance);
- if (enter.failed())
- return 0;
- scoped_refptr<StringVar> string_var =
- StringVar::FromPPVar(accept_types);
- std::string str = string_var ? string_var->value() : std::string();
- return enter.functions()->CreateFileChooser(instance, mode, str.c_str());
-}
-
-PP_Bool IsFileChooser(PP_Resource resource) {
- EnterResource<PPB_FileChooser_API> enter(resource, false);
- return PP_FromBool(enter.succeeded());
-}
-
-int32_t Show0_5(PP_Resource chooser, PP_CompletionCallback callback) {
- EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->Show0_5(enter.callback()));
-}
-
-PP_Resource GetNextChosenFile0_5(PP_Resource chooser) {
- EnterResource<PPB_FileChooser_API> enter(chooser, true);
- if (enter.failed())
- return 0;
- return enter.object()->GetNextChosenFile();
-}
-
-int32_t Show(PP_Resource chooser,
- PP_ArrayOutput output,
- PP_CompletionCallback callback) {
- EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->Show(output, enter.callback()));
-}
-
-int32_t ShowWithoutUserGesture0_5(PP_Resource chooser,
- PP_Bool save_as,
- PP_Var suggested_file_name,
- PP_CompletionCallback callback) {
- EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5(
- save_as, suggested_file_name, enter.callback()));
-}
-
-int32_t ShowWithoutUserGesture0_6(PP_Resource chooser,
- PP_Bool save_as,
- PP_Var suggested_file_name,
- PP_ArrayOutput output,
- PP_CompletionCallback callback) {
- EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->ShowWithoutUserGesture(
- save_as, suggested_file_name, output, enter.callback()));
-}
-
-const PPB_FileChooser_Dev_0_5 g_ppb_file_chooser_0_5_thunk = {
- &Create,
- &IsFileChooser,
- &Show0_5,
- &GetNextChosenFile0_5
-};
-
-const PPB_FileChooser_Dev_0_6 g_ppb_file_chooser_0_6_thunk = {
- &Create,
- &IsFileChooser,
- &Show
-};
-
-const PPB_FileChooserTrusted_0_5 g_ppb_file_chooser_trusted_0_5_thunk = {
- &ShowWithoutUserGesture0_5
-};
-
-const PPB_FileChooserTrusted_0_6 g_ppb_file_chooser_trusted_0_6_thunk = {
- &ShowWithoutUserGesture0_6
-};
-
-} // namespace
-
-const PPB_FileChooser_Dev_0_5* GetPPB_FileChooser_Dev_0_5_Thunk() {
- return &g_ppb_file_chooser_0_5_thunk;
-}
-
-const PPB_FileChooser_Dev_0_6* GetPPB_FileChooser_Dev_0_6_Thunk() {
- return &g_ppb_file_chooser_0_6_thunk;
-}
-
-const PPB_FileChooserTrusted_0_5* GetPPB_FileChooserTrusted_0_5_Thunk() {
- return &g_ppb_file_chooser_trusted_0_5_thunk;
-}
-
-const PPB_FileChooserTrusted_0_6* GetPPB_FileChooserTrusted_0_6_Thunk() {
- return &g_ppb_file_chooser_trusted_0_6_thunk;
-}
-
-} // namespace thunk
-} // namespace ppapi
diff --git a/ppapi/thunk/ppb_file_chooser_trusted_thunk.cc b/ppapi/thunk/ppb_file_chooser_trusted_thunk.cc
new file mode 100644
index 0000000..552bee0
--- /dev/null
+++ b/ppapi/thunk/ppb_file_chooser_trusted_thunk.cc
@@ -0,0 +1,72 @@
+// 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 trusted/ppb_file_chooser_trusted.idl,
+// modified Mon Apr 1 08:24:03 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_chooser_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t ShowWithoutUserGesture_0_5(PP_Resource chooser,
+ PP_Bool save_as,
+ struct PP_Var suggested_file_name,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5(
+ save_as,
+ suggested_file_name,
+ enter.callback()));
+}
+
+int32_t ShowWithoutUserGesture(PP_Resource chooser,
+ PP_Bool save_as,
+ struct PP_Var suggested_file_name,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ShowWithoutUserGesture(
+ save_as,
+ suggested_file_name,
+ output,
+ enter.callback()));
+}
+
+const PPB_FileChooserTrusted_0_5 g_ppb_filechoosertrusted_thunk_0_5 = {
+ &ShowWithoutUserGesture_0_5
+};
+
+const PPB_FileChooserTrusted_0_6 g_ppb_filechoosertrusted_thunk_0_6 = {
+ &ShowWithoutUserGesture
+};
+
+} // namespace
+
+const PPB_FileChooserTrusted_0_5* GetPPB_FileChooserTrusted_0_5_Thunk() {
+ return &g_ppb_filechoosertrusted_thunk_0_5;
+}
+
+const PPB_FileChooserTrusted_0_6* GetPPB_FileChooserTrusted_0_6_Thunk() {
+ return &g_ppb_filechoosertrusted_thunk_0_6;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_file_io_api.h b/ppapi/thunk/ppb_file_io_api.h
index b7b3d90..ec7f16d 100644
--- a/ppapi/thunk/ppb_file_io_api.h
+++ b/ppapi/thunk/ppb_file_io_api.h
@@ -7,6 +7,7 @@
#include "base/memory/ref_counted.h"
#include "ppapi/c/ppb_file_io.h"
+#include "ppapi/c/private/pp_file_handle.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
namespace ppapi {
@@ -51,6 +52,11 @@
scoped_refptr<TrackedCallback> callback) = 0;
virtual int32_t WillSetLength(int64_t length,
scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Private API.
+ virtual int32_t RequestOSFileHandle(
+ PP_FileHandle* handle,
+ scoped_refptr<TrackedCallback> callback) = 0;
};
} // namespace thunk
diff --git a/ppapi/thunk/ppb_file_io_private_thunk.cc b/ppapi/thunk/ppb_file_io_private_thunk.cc
new file mode 100644
index 0000000..20c7971
--- /dev/null
+++ b/ppapi/thunk/ppb_file_io_private_thunk.cc
@@ -0,0 +1,44 @@
+// 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.
+
+// From private/ppb_file_io_private.idl modified Tue Mar 26 15:29:46 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_file_io_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_io_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t RequestOSFileHandle(PP_Resource file_io,
+ PP_FileHandle* handle,
+ struct PP_CompletionCallback callback) {
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->RequestOSFileHandle(
+ handle,
+ enter.callback()));
+}
+
+const PPB_FileIO_Private_0_1 g_ppb_fileio_private_thunk_0_1 = {
+ &RequestOSFileHandle
+};
+
+} // namespace
+
+const PPB_FileIO_Private_0_1* GetPPB_FileIO_Private_0_1_Thunk() {
+ return &g_ppb_fileio_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_file_io_thunk.cc b/ppapi/thunk/ppb_file_io_thunk.cc
index 52bc524..331d190 100644
--- a/ppapi/thunk/ppb_file_io_thunk.cc
+++ b/ppapi/thunk/ppb_file_io_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_file_io.idl modified Thu Dec 20 13:10:26 2012.
+// From ppb_file_io.idl modified Tue Apr 16 11:25:44 2013.
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
@@ -20,6 +20,7 @@
namespace {
PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_FileIO::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -27,6 +28,7 @@
}
PP_Bool IsFileIO(PP_Resource resource) {
+ VLOG(4) << "PPB_FileIO::IsFileIO()";
EnterResource<PPB_FileIO_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
@@ -35,6 +37,7 @@
PP_Resource file_ref,
int32_t open_flags,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Open()";
EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
if (enter.failed())
return enter.retval();
@@ -46,6 +49,7 @@
int32_t Query(PP_Resource file_io,
struct PP_FileInfo* info,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Query()";
EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
if (enter.failed())
return enter.retval();
@@ -56,6 +60,7 @@
PP_Time last_access_time,
PP_Time last_modified_time,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Touch()";
EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
if (enter.failed())
return enter.retval();
@@ -69,6 +74,7 @@
char* buffer,
int32_t bytes_to_read,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Read()";
EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
if (enter.failed())
return enter.retval();
@@ -83,6 +89,7 @@
const char* buffer,
int32_t bytes_to_write,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Write()";
EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
if (enter.failed())
return enter.retval();
@@ -95,6 +102,7 @@
int32_t SetLength(PP_Resource file_io,
int64_t length,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::SetLength()";
EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
if (enter.failed())
return enter.retval();
@@ -102,6 +110,7 @@
}
int32_t Flush(PP_Resource file_io, struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Flush()";
EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
if (enter.failed())
return enter.retval();
@@ -109,9 +118,11 @@
}
void Close(PP_Resource file_io) {
+ VLOG(4) << "PPB_FileIO::Close()";
EnterResource<PPB_FileIO_API> enter(file_io, true);
- if (enter.succeeded())
- enter.object()->Close();
+ if (enter.failed())
+ return;
+ enter.object()->Close();
}
int32_t ReadToArray(PP_Resource file_io,
@@ -119,6 +130,7 @@
int32_t max_read_length,
struct PP_ArrayOutput* output,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::ReadToArray()";
EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
if (enter.failed())
return enter.retval();
diff --git a/ppapi/thunk/ppb_file_ref_api.h b/ppapi/thunk/ppb_file_ref_api.h
index 0f9bbaa..ba92b63 100644
--- a/ppapi/thunk/ppb_file_ref_api.h
+++ b/ppapi/thunk/ppb_file_ref_api.h
@@ -5,6 +5,9 @@
#ifndef PPAPI_THUNK_PPB_FILE_REF_API_H_
#define PPAPI_THUNK_PPB_FILE_REF_API_H_
+#include <vector>
+
+#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
@@ -32,6 +35,26 @@
virtual int32_t Delete(scoped_refptr<TrackedCallback> callback) = 0;
virtual int32_t Rename(PP_Resource new_file_ref,
scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Query(PP_FileInfo* info,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t ReadDirectoryEntries(
+ const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ // We define variants of Query and ReadDirectoryEntries because
+ // 1. we need to take linked_ptr instead of raw pointers to avoid
+ // use-after-free, and 2. we don't use PP_ArrayOutput for the
+ // communication between renderers and the browser in
+ // ReadDirectoryEntries. The *InHost functions must not be called in
+ // plugins, and Query and ReadDirectoryEntries must not be called in
+ // renderers.
+ // TODO(hamaji): These functions must be removed when we move
+ // FileRef to the new resource design. http://crbug.com/225441
+ virtual int32_t QueryInHost(linked_ptr<PP_FileInfo> info,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ 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) = 0;
// Internal function for use in proxying. Returns the internal CreateInfo
// (the contained resource does not carry a ref on behalf of the caller).
diff --git a/ppapi/thunk/ppb_file_ref_thunk.cc b/ppapi/thunk/ppb_file_ref_thunk.cc
index 74db508..beb0e41 100644
--- a/ppapi/thunk/ppb_file_ref_thunk.cc
+++ b/ppapi/thunk/ppb_file_ref_thunk.cc
@@ -12,6 +12,7 @@
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/ppb_file_ref_api.h"
+#include "ppapi/thunk/ppb_file_system_api.h"
#include "ppapi/thunk/resource_creation_api.h"
namespace ppapi {
@@ -22,23 +23,26 @@
typedef EnterResource<PPB_FileRef_API> EnterFileRef;
PP_Resource Create(PP_Resource file_system, const char* path) {
+ VLOG(4) << "PPB_FileRef::Create()";
ppapi::ProxyAutoLock lock;
- Resource* object =
- PpapiGlobals::Get()->GetResourceTracker()->GetResource(file_system);
- if (!object)
+ EnterResourceNoLock<PPB_FileSystem_API> enter_file_system(file_system, true);
+ if (enter_file_system.failed())
return 0;
- EnterResourceCreationNoLock enter(object->pp_instance());
+ PP_Instance instance = enter_file_system.resource()->pp_instance();
+ EnterResourceCreationNoLock enter(instance);
if (enter.failed())
return 0;
- return enter.functions()->CreateFileRef(file_system, path);
+ return enter.functions()->CreateFileRef(instance, file_system, path);
}
PP_Bool IsFileRef(PP_Resource resource) {
+ VLOG(4) << "PPB_FileRef::IsFileRef()";
EnterFileRef enter(resource, false);
return PP_FromBool(enter.succeeded());
}
PP_FileSystemType GetFileSystemType(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetFileSystemType()";
EnterFileRef enter(file_ref, true);
if (enter.failed())
return PP_FILESYSTEMTYPE_INVALID;
@@ -46,6 +50,7 @@
}
PP_Var GetName(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetName()";
EnterFileRef enter(file_ref, true);
if (enter.failed())
return PP_MakeUndefined();
@@ -53,6 +58,7 @@
}
PP_Var GetPath(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetPath()";
EnterFileRef enter(file_ref, true);
if (enter.failed())
return PP_MakeUndefined();
@@ -60,6 +66,7 @@
}
PP_Resource GetParent(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetParent()";
EnterFileRef enter(file_ref, true);
if (enter.failed())
return 0;
@@ -69,6 +76,7 @@
int32_t MakeDirectory(PP_Resource directory_ref,
PP_Bool make_ancestors,
PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::MakeDirectory()";
EnterFileRef enter(directory_ref, callback, true);
if (enter.failed())
return enter.retval();
@@ -80,6 +88,7 @@
PP_Time last_access_time,
PP_Time last_modified_time,
PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::Touch()";
EnterFileRef enter(file_ref, callback, true);
if (enter.failed())
return enter.retval();
@@ -89,6 +98,7 @@
int32_t Delete(PP_Resource file_ref,
PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::Delete()";
EnterFileRef enter(file_ref, callback, true);
if (enter.failed())
return enter.retval();
@@ -98,6 +108,7 @@
int32_t Rename(PP_Resource file_ref,
PP_Resource new_file_ref,
PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::Rename()";
EnterFileRef enter(file_ref, callback, true);
if (enter.failed())
return enter.retval();
@@ -105,14 +116,36 @@
enter.callback()));
}
+int32_t Query(PP_Resource file_ref,
+ PP_FileInfo* info,
+ PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::Query()";
+ EnterFileRef enter(file_ref, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Query(info,
+ enter.callback()));
+}
+
+int32_t ReadDirectoryEntries(PP_Resource file_ref,
+ PP_ArrayOutput output,
+ PP_CompletionCallback callback) {
+ EnterFileRef enter(file_ref, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ReadDirectoryEntries(
+ output, enter.callback()));
+}
+
PP_Var GetAbsolutePath(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetAbsolutePath";
EnterFileRef enter(file_ref, true);
if (enter.failed())
return PP_MakeUndefined();
return enter.object()->GetAbsolutePath();
}
-const PPB_FileRef g_ppb_file_ref_thunk = {
+const PPB_FileRef_1_0 g_ppb_file_ref_thunk_1_0 = {
&Create,
&IsFileRef,
&GetFileSystemType,
@@ -125,6 +158,21 @@
&Rename
};
+const PPB_FileRef_1_1 g_ppb_file_ref_thunk_1_1 = {
+ &Create,
+ &IsFileRef,
+ &GetFileSystemType,
+ &GetName,
+ &GetPath,
+ &GetParent,
+ &MakeDirectory,
+ &Touch,
+ &Delete,
+ &Rename,
+ &Query,
+ &ReadDirectoryEntries
+};
+
const PPB_FileRefPrivate g_ppb_file_ref_private_thunk = {
&GetAbsolutePath
};
@@ -132,7 +180,11 @@
} // namespace
const PPB_FileRef_1_0* GetPPB_FileRef_1_0_Thunk() {
- return &g_ppb_file_ref_thunk;
+ return &g_ppb_file_ref_thunk_1_0;
+}
+
+const PPB_FileRef_1_1* GetPPB_FileRef_1_1_Thunk() {
+ return &g_ppb_file_ref_thunk_1_1;
}
const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() {
diff --git a/ppapi/thunk/ppb_file_system_thunk.cc b/ppapi/thunk/ppb_file_system_thunk.cc
index df02ec6..8a608ac 100644
--- a/ppapi/thunk/ppb_file_system_thunk.cc
+++ b/ppapi/thunk/ppb_file_system_thunk.cc
@@ -20,6 +20,7 @@
namespace {
PP_Resource Create(PP_Instance instance, PP_FileSystemType type) {
+ VLOG(4) << "PPB_FileSystem::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -27,6 +28,7 @@
}
PP_Bool IsFileSystem(PP_Resource resource) {
+ VLOG(4) << "PPB_FileSystem::IsFileSystem()";
EnterResource<PPB_FileSystem_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
@@ -34,6 +36,7 @@
int32_t Open(PP_Resource file_system,
int64_t expected_size,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileSystem::Open()";
EnterResource<PPB_FileSystem_API> enter(file_system, callback, true);
if (enter.failed())
return enter.retval();
@@ -41,6 +44,7 @@
}
PP_FileSystemType GetType(PP_Resource file_system) {
+ VLOG(4) << "PPB_FileSystem::GetType()";
EnterResource<PPB_FileSystem_API> enter(file_system, true);
if (enter.failed())
return PP_FILESYSTEMTYPE_INVALID;
diff --git a/ppapi/thunk/ppb_find_dev_thunk.cc b/ppapi/thunk/ppb_find_dev_thunk.cc
index 84b94dc..79a1085 100644
--- a/ppapi/thunk/ppb_find_dev_thunk.cc
+++ b/ppapi/thunk/ppb_find_dev_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 dev/ppb_find_dev.idl modified Tue Dec 4 10:44:11 2012.
+// From dev/ppb_find_dev.idl modified Tue Apr 16 11:25:44 2013.
#include "ppapi/c/dev/ppb_find_dev.h"
#include "ppapi/c/pp_errors.h"
@@ -20,17 +20,19 @@
void NumberOfFindResultsChanged(PP_Instance instance,
int32_t total,
PP_Bool final_result) {
+ VLOG(4) << "PPB_Find_Dev::NumberOfFindResultsChanged()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->NumberOfFindResultsChanged(instance,
- total,
- final_result);
+ if (enter.failed())
+ return;
+ enter.functions()->NumberOfFindResultsChanged(instance, total, final_result);
}
void SelectedFindResultChanged(PP_Instance instance, int32_t index) {
+ VLOG(4) << "PPB_Find_Dev::SelectedFindResultChanged()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->SelectedFindResultChanged(instance, index);
+ if (enter.failed())
+ return;
+ enter.functions()->SelectedFindResultChanged(instance, index);
}
const PPB_Find_Dev_0_3 g_ppb_find_dev_thunk_0_3 = {
diff --git a/ppapi/thunk/ppb_flash_clipboard_thunk.cc b/ppapi/thunk/ppb_flash_clipboard_thunk.cc
index fcdc52e..359d78f 100644
--- a/ppapi/thunk/ppb_flash_clipboard_thunk.cc
+++ b/ppapi/thunk/ppb_flash_clipboard_thunk.cc
@@ -70,7 +70,7 @@
uint32_t data_item_count,
const PP_Flash_Clipboard_Format formats[],
const PP_Var data_items[]) {
- scoped_array<uint32_t> new_formats(new uint32_t[data_item_count]);
+ scoped_ptr<uint32_t[]> new_formats(new uint32_t[data_item_count]);
for (uint32_t i = 0; i < data_item_count; ++i)
new_formats[i] = static_cast<uint32_t>(formats[i]);
return WriteData(instance, clipboard_type, data_item_count,
diff --git a/ppapi/thunk/ppb_flash_device_id_thunk.cc b/ppapi/thunk/ppb_flash_device_id_thunk.cc
index 09a3749..595fdc7 100644
--- a/ppapi/thunk/ppb_flash_device_id_thunk.cc
+++ b/ppapi/thunk/ppb_flash_device_id_thunk.cc
@@ -20,6 +20,7 @@
namespace {
PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_Flash_DeviceID::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -29,6 +30,7 @@
int32_t GetDeviceID(PP_Resource device_id,
struct PP_Var* id,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Flash_DeviceID::GetDeviceID()";
EnterResource<PPB_Flash_DeviceID_API> enter(device_id, callback, true);
if (enter.failed())
return enter.retval();
diff --git a/ppapi/thunk/ppb_fullscreen_thunk.cc b/ppapi/thunk/ppb_fullscreen_thunk.cc
index d8904f2..9e07356 100644
--- a/ppapi/thunk/ppb_fullscreen_thunk.cc
+++ b/ppapi/thunk/ppb_fullscreen_thunk.cc
@@ -2,12 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// From ppb_fullscreen.idl modified Wed May 1 09:47:29 2013.
+
+#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_fullscreen.h"
-#include "ppapi/shared_impl/ppb_view_shared.h"
-#include "ppapi/thunk/thunk.h"
+#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
@@ -15,30 +18,30 @@
namespace {
PP_Bool IsFullscreen(PP_Instance instance) {
+ VLOG(4) << "PPB_Fullscreen::IsFullscreen()";
EnterInstance enter(instance);
if (enter.failed())
return PP_FALSE;
- const ViewData* view = enter.functions()->GetViewData(instance);
- if (!view)
- return PP_FALSE;
- return PP_FromBool(view->is_fullscreen);
+ return enter.functions()->IsFullscreen(instance);
}
PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) {
+ VLOG(4) << "PPB_Fullscreen::SetFullscreen()";
EnterInstance enter(instance);
if (enter.failed())
return PP_FALSE;
return enter.functions()->SetFullscreen(instance, fullscreen);
}
-PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) {
+PP_Bool GetScreenSize(PP_Instance instance, struct PP_Size* size) {
+ VLOG(4) << "PPB_Fullscreen::GetScreenSize()";
EnterInstance enter(instance);
if (enter.failed())
return PP_FALSE;
return enter.functions()->GetScreenSize(instance, size);
}
-const PPB_Fullscreen g_ppb_fullscreen_thunk = {
+const PPB_Fullscreen_1_0 g_ppb_fullscreen_thunk_1_0 = {
&IsFullscreen,
&SetFullscreen,
&GetScreenSize
@@ -47,7 +50,7 @@
} // namespace
const PPB_Fullscreen_1_0* GetPPB_Fullscreen_1_0_Thunk() {
- return &g_ppb_fullscreen_thunk;
+ return &g_ppb_fullscreen_thunk_1_0;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_gamepad_thunk.cc b/ppapi/thunk/ppb_gamepad_thunk.cc
index 34386c6..e36af34 100644
--- a/ppapi/thunk/ppb_gamepad_thunk.cc
+++ b/ppapi/thunk/ppb_gamepad_thunk.cc
@@ -2,38 +2,42 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// From ppb_gamepad.idl modified Wed Apr 17 11:16:00 2013.
+
#include <string.h>
+#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_gamepad.h"
-#include "ppapi/thunk/thunk.h"
+#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_gamepad_api.h"
#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
namespace {
-void SampleGamepads(PP_Instance instance, PP_GamepadsSampleData* data) {
+void Sample(PP_Instance instance, struct PP_GamepadsSampleData* data) {
+ VLOG(4) << "PPB_Gamepad::Sample()";
EnterInstanceAPI<PPB_Gamepad_API> enter(instance);
- if (enter.succeeded()) {
- enter.functions()->Sample(instance, data);
+ if (enter.failed()) {
+ memset(data, 0, sizeof(*data));
return;
}
- // Failure, zero out.
- memset(data, 0, sizeof(PP_GamepadsSampleData));
+ enter.functions()->Sample(instance, data);
}
-const PPB_Gamepad g_ppb_gamepad_thunk = {
- &SampleGamepads,
+const PPB_Gamepad_1_0 g_ppb_gamepad_thunk_1_0 = {
+ &Sample
};
} // namespace
-const PPB_Gamepad* GetPPB_Gamepad_1_0_Thunk() {
- return &g_ppb_gamepad_thunk;
+const PPB_Gamepad_1_0* GetPPB_Gamepad_1_0_Thunk() {
+ return &g_ppb_gamepad_thunk_1_0;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_graphics_2d_api.h b/ppapi/thunk/ppb_graphics_2d_api.h
index e6357c3..4e1bda3 100644
--- a/ppapi/thunk/ppb_graphics_2d_api.h
+++ b/ppapi/thunk/ppb_graphics_2d_api.h
@@ -31,20 +31,11 @@
virtual void Scroll(const PP_Rect* clip_rect,
const PP_Point* amount) = 0;
virtual void ReplaceContents(PP_Resource image_data) = 0;
- virtual bool SetScale(float scale) = 0;
- virtual float GetScale() = 0;
+ virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0;
- // When |old_image_data| is non-null and the flush is executing a replace
- // contents (which leaves the "old" ImageData unowned), the resource ID of
- // the old image data will be placed into |*old_image_data| synchronously
- // (not when the flush callback completes).
- //
- // When this happens, a reference to this resource will be transferred to the
- // caller. If there is no replace contents operation, old_image_data will be
- // ignored. If |*old_image_data| is null, then the old image data will be
- // destroyed if there was one.
- virtual int32_t Flush(scoped_refptr<TrackedCallback> callback,
- PP_Resource* old_image_data) = 0;
+ // Dev interface.
+ virtual PP_Bool SetScale(float scale) = 0;
+ virtual float GetScale() = 0;
// Test only
virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0;
diff --git a/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc b/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc
new file mode 100644
index 0000000..760ecee
--- /dev/null
+++ b/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc
@@ -0,0 +1,49 @@
+// 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 dev/ppb_graphics_2d_dev.idl modified Fri Apr 26 08:52:02 2013.
+
+#include "ppapi/c/dev/ppb_graphics_2d_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_graphics_2d_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool SetScale(PP_Resource resource, float scale) {
+ VLOG(4) << "PPB_Graphics2D_Dev::SetScale()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->SetScale(scale);
+}
+
+float GetScale(PP_Resource resource) {
+ VLOG(4) << "PPB_Graphics2D_Dev::GetScale()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, true);
+ if (enter.failed())
+ return 0.0f;
+ return enter.object()->GetScale();
+}
+
+const PPB_Graphics2D_Dev_0_1 g_ppb_graphics2d_dev_thunk_0_1 = {
+ &SetScale,
+ &GetScale
+};
+
+} // namespace
+
+const PPB_Graphics2D_Dev_0_1* GetPPB_Graphics2D_Dev_0_1_Thunk() {
+ return &g_ppb_graphics2d_dev_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_graphics_2d_thunk.cc b/ppapi/thunk/ppb_graphics_2d_thunk.cc
index e6c0366..9eefee2 100644
--- a/ppapi/thunk/ppb_graphics_2d_thunk.cc
+++ b/ppapi/thunk/ppb_graphics_2d_thunk.cc
@@ -2,13 +2,17 @@
// 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_graphics_2d_dev.h"
+// From ppb_graphics_2d.idl modified Fri Apr 26 08:49:08 2013.
+
+#include <string.h>
+
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_graphics_2d_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
@@ -17,30 +21,30 @@
namespace {
-typedef EnterResource<PPB_Graphics2D_API> EnterGraphics2D;
-
PP_Resource Create(PP_Instance instance,
- const PP_Size* size,
+ const struct PP_Size* size,
PP_Bool is_always_opaque) {
+ VLOG(4) << "PPB_Graphics2D::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
- return enter.functions()->CreateGraphics2D(instance, *size, is_always_opaque);
+ return enter.functions()->CreateGraphics2D(instance, size, is_always_opaque);
}
PP_Bool IsGraphics2D(PP_Resource resource) {
- EnterGraphics2D enter(resource, false);
- return enter.succeeded() ? PP_TRUE : PP_FALSE;
+ VLOG(4) << "PPB_Graphics2D::IsGraphics2D()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
}
PP_Bool Describe(PP_Resource graphics_2d,
- PP_Size* size,
+ struct PP_Size* size,
PP_Bool* is_always_opaque) {
- EnterGraphics2D enter(graphics_2d, true);
+ VLOG(4) << "PPB_Graphics2D::Describe()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true);
if (enter.failed()) {
- size->width = 0;
- size->height = 0;
- *is_always_opaque = PP_FALSE;
+ memset(size, 0, sizeof(*size));
+ memset(is_always_opaque, 0, sizeof(*is_always_opaque));
return PP_FALSE;
}
return enter.object()->Describe(size, is_always_opaque);
@@ -48,52 +52,58 @@
void PaintImageData(PP_Resource graphics_2d,
PP_Resource image_data,
- const PP_Point* top_left,
- const PP_Rect* src_rect) {
- EnterGraphics2D enter(graphics_2d, true);
+ const struct PP_Point* top_left,
+ const struct PP_Rect* src_rect) {
+ VLOG(4) << "PPB_Graphics2D::PaintImageData()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true);
if (enter.failed())
return;
enter.object()->PaintImageData(image_data, top_left, src_rect);
}
void Scroll(PP_Resource graphics_2d,
- const PP_Rect* clip_rect,
- const PP_Point* amount) {
- EnterGraphics2D enter(graphics_2d, true);
+ const struct PP_Rect* clip_rect,
+ const struct PP_Point* amount) {
+ VLOG(4) << "PPB_Graphics2D::Scroll()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true);
if (enter.failed())
return;
enter.object()->Scroll(clip_rect, amount);
}
void ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) {
- EnterGraphics2D enter(graphics_2d, true);
+ VLOG(4) << "PPB_Graphics2D::ReplaceContents()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true);
if (enter.failed())
return;
enter.object()->ReplaceContents(image_data);
}
-int32_t Flush(PP_Resource graphics_2d, PP_CompletionCallback callback) {
- EnterGraphics2D enter(graphics_2d, callback, true);
+int32_t Flush(PP_Resource graphics_2d, struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Graphics2D::Flush()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, callback, true);
if (enter.failed())
return enter.retval();
- return enter.SetResult(enter.object()->Flush(enter.callback(), NULL));
+ return enter.SetResult(enter.object()->Flush(enter.callback()));
}
-PP_Bool SetScale(PP_Resource graphics_2d, float scale) {
- EnterGraphics2D enter(graphics_2d, true);
+PP_Bool SetScale(PP_Resource resource, float scale) {
+ VLOG(4) << "PPB_Graphics2D::SetScale()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, true);
if (enter.failed())
return PP_FALSE;
- return PP_FromBool(enter.object()->SetScale(scale));
+ return enter.object()->SetScale(scale);
}
-float GetScale(PP_Resource graphics_2d) {
- EnterGraphics2D enter(graphics_2d, true);
+float GetScale(PP_Resource resource) {
+ VLOG(4) << "PPB_Graphics2D::GetScale()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, true);
if (enter.failed())
return 0.0f;
return enter.object()->GetScale();
}
-const PPB_Graphics2D g_ppb_graphics_2d_thunk = {
+const PPB_Graphics2D_1_0 g_ppb_graphics2d_thunk_1_0 = {
&Create,
&IsGraphics2D,
&Describe,
@@ -103,7 +113,14 @@
&Flush
};
-const PPB_Graphics2D_Dev g_ppb_graphics_2d_dev_thunk = {
+const PPB_Graphics2D_1_1 g_ppb_graphics2d_thunk_1_1 = {
+ &Create,
+ &IsGraphics2D,
+ &Describe,
+ &PaintImageData,
+ &Scroll,
+ &ReplaceContents,
+ &Flush,
&SetScale,
&GetScale
};
@@ -111,11 +128,11 @@
} // namespace
const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() {
- return &g_ppb_graphics_2d_thunk;
+ return &g_ppb_graphics2d_thunk_1_0;
}
-const PPB_Graphics2D_Dev_0_1* GetPPB_Graphics2D_Dev_0_1_Thunk() {
- return &g_ppb_graphics_2d_dev_thunk;
+const PPB_Graphics2D_1_1* GetPPB_Graphics2D_1_1_Thunk() {
+ return &g_ppb_graphics2d_thunk_1_1;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_graphics_3d_api.h b/ppapi/thunk/ppb_graphics_3d_api.h
index 4c7dbe6..dc53b13 100644
--- a/ppapi/thunk/ppb_graphics_3d_api.h
+++ b/ppapi/thunk/ppb_graphics_3d_api.h
@@ -27,6 +27,7 @@
virtual int32_t GetError() = 0;
virtual int32_t ResizeBuffers(int32_t width, int32_t height) = 0;
virtual int32_t SwapBuffers(scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) = 0;
// Graphics3DTrusted API.
virtual PP_Bool InitCommandBuffer() = 0;
diff --git a/ppapi/thunk/ppb_graphics_3d_thunk.cc b/ppapi/thunk/ppb_graphics_3d_thunk.cc
index eb079bb..cc00696 100644
--- a/ppapi/thunk/ppb_graphics_3d_thunk.cc
+++ b/ppapi/thunk/ppb_graphics_3d_thunk.cc
@@ -2,79 +2,93 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// From ppb_graphics_3d.idl modified Mon Apr 1 08:24:03 2013.
+
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_graphics_3d.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/ppb_graphics_3d_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
namespace {
-typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D;
-
-int32_t GetAttribMaxValue(PP_Instance instance,
+int32_t GetAttribMaxValue(PP_Resource instance,
int32_t attribute,
int32_t* value) {
- // TODO(alokp): Implement me.
- return PP_ERROR_FAILED;
+ VLOG(4) << "PPB_Graphics3D::GetAttribMaxValue()";
+ EnterResource<PPB_Graphics3D_API> enter(instance, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->GetAttribMaxValue(attribute, value);
}
PP_Resource Create(PP_Instance instance,
PP_Resource share_context,
const int32_t attrib_list[]) {
+ VLOG(4) << "PPB_Graphics3D::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
- return enter.functions()->CreateGraphics3D(
- instance, share_context, attrib_list);
+ return enter.functions()->CreateGraphics3D(instance,
+ share_context,
+ attrib_list);
}
PP_Bool IsGraphics3D(PP_Resource resource) {
- EnterGraphics3D enter(resource, false);
+ VLOG(4) << "PPB_Graphics3D::IsGraphics3D()";
+ EnterResource<PPB_Graphics3D_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
-int32_t GetAttribs(PP_Resource graphics_3d, int32_t attrib_list[]) {
- EnterGraphics3D enter(graphics_3d, true);
+int32_t GetAttribs(PP_Resource context, int32_t attrib_list[]) {
+ VLOG(4) << "PPB_Graphics3D::GetAttribs()";
+ EnterResource<PPB_Graphics3D_API> enter(context, true);
if (enter.failed())
return enter.retval();
return enter.object()->GetAttribs(attrib_list);
}
-int32_t SetAttribs(PP_Resource graphics_3d, const int32_t attrib_list[]) {
- EnterGraphics3D enter(graphics_3d, true);
+int32_t SetAttribs(PP_Resource context, const int32_t attrib_list[]) {
+ VLOG(4) << "PPB_Graphics3D::SetAttribs()";
+ EnterResource<PPB_Graphics3D_API> enter(context, true);
if (enter.failed())
return enter.retval();
return enter.object()->SetAttribs(attrib_list);
}
-int32_t GetError(PP_Resource graphics_3d) {
- EnterGraphics3D enter(graphics_3d, true);
+int32_t GetError(PP_Resource context) {
+ VLOG(4) << "PPB_Graphics3D::GetError()";
+ EnterResource<PPB_Graphics3D_API> enter(context, true);
if (enter.failed())
return enter.retval();
return enter.object()->GetError();
}
-int32_t ResizeBuffers(PP_Resource graphics_3d, int32_t width, int32_t height) {
- EnterGraphics3D enter(graphics_3d, true);
+int32_t ResizeBuffers(PP_Resource context, int32_t width, int32_t height) {
+ VLOG(4) << "PPB_Graphics3D::ResizeBuffers()";
+ EnterResource<PPB_Graphics3D_API> enter(context, true);
if (enter.failed())
return enter.retval();
return enter.object()->ResizeBuffers(width, height);
}
-int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) {
- EnterGraphics3D enter(graphics_3d, callback, true);
+int32_t SwapBuffers(PP_Resource context,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Graphics3D::SwapBuffers()";
+ EnterResource<PPB_Graphics3D_API> enter(context, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->SwapBuffers(enter.callback()));
}
-const PPB_Graphics3D g_ppb_graphics_3d_thunk = {
+const PPB_Graphics3D_1_0 g_ppb_graphics3d_thunk_1_0 = {
&GetAttribMaxValue,
&Create,
&IsGraphics3D,
@@ -88,7 +102,7 @@
} // namespace
const PPB_Graphics3D_1_0* GetPPB_Graphics3D_1_0_Thunk() {
- return &g_ppb_graphics_3d_thunk;
+ return &g_ppb_graphics3d_thunk_1_0;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_image_data_api.h b/ppapi/thunk/ppb_image_data_api.h
index 9546304..f916ede 100644
--- a/ppapi/thunk/ppb_image_data_api.h
+++ b/ppapi/thunk/ppb_image_data_api.h
@@ -43,10 +43,12 @@
// * Within untrusted code (which does not have skia).
virtual SkCanvas* GetCanvas() = 0;
- // Sets whether this image was used in a ReplaceContents call. If the
- // current implementation supports image data recycling (only supported
- // out-of-process then it will be marked for potential re-use.
- virtual void SetUsedInReplaceContents() = 0;
+ // Signal that this image is a good candidate for reuse. Call this from APIs
+ // that receive ImageData resources of a fixed size and where the plugin will
+ // release its reference to the ImageData. If the current implementation
+ // supports image data reuse (only supported out-of-process) then the
+ // ImageData will be marked and potentially cached for re-use.
+ virtual void SetIsCandidateForReuse() = 0;
};
} // namespace thunk
diff --git a/ppapi/thunk/ppb_image_data_thunk.cc b/ppapi/thunk/ppb_image_data_thunk.cc
index f50842e..d26904a 100644
--- a/ppapi/thunk/ppb_image_data_thunk.cc
+++ b/ppapi/thunk/ppb_image_data_thunk.cc
@@ -2,11 +2,17 @@
// 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.
+
+#include <string.h>
+
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/shared_impl/ppb_image_data_shared.h"
+#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_image_data_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
@@ -15,69 +21,76 @@
namespace {
-PP_ImageDataFormat GetNativeImageDataFormat() {
- return ppapi::PPB_ImageData_Shared::GetNativeImageDataFormat();
+PP_ImageDataFormat GetNativeImageDataFormat(void) {
+ VLOG(4) << "PPB_ImageData::GetNativeImageDataFormat()";
+ return PPB_ImageData_Shared::GetNativeImageDataFormat();
}
PP_Bool IsImageDataFormatSupported(PP_ImageDataFormat format) {
- return ppapi::PPB_ImageData_Shared::IsImageDataFormatSupported(format)
- ? PP_TRUE : PP_FALSE;
+ VLOG(4) << "PPB_ImageData::IsImageDataFormatSupported()";
+ return PPB_ImageData_Shared::IsImageDataFormatSupported(format);
}
PP_Resource Create(PP_Instance instance,
PP_ImageDataFormat format,
- const PP_Size* size,
+ const struct PP_Size* size,
PP_Bool init_to_zero) {
+ VLOG(4) << "PPB_ImageData::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
- return enter.functions()->CreateImageData(instance, format,
- *size, init_to_zero);
+ return enter.functions()->CreateImageData(instance,
+ format,
+ size,
+ init_to_zero);
}
-PP_Bool IsImageData(PP_Resource resource) {
- EnterResource<PPB_ImageData_API> enter(resource, false);
- return enter.succeeded() ? PP_TRUE : PP_FALSE;
+PP_Bool IsImageData(PP_Resource image_data) {
+ VLOG(4) << "PPB_ImageData::IsImageData()";
+ EnterResource<PPB_ImageData_API> enter(image_data, false);
+ return PP_FromBool(enter.succeeded());
}
-PP_Bool Describe(PP_Resource resource, PP_ImageDataDesc* desc) {
- // Give predictable values on failure.
- memset(desc, 0, sizeof(PP_ImageDataDesc));
-
- EnterResource<PPB_ImageData_API> enter(resource, true);
- if (enter.failed())
+PP_Bool Describe(PP_Resource image_data, struct PP_ImageDataDesc* desc) {
+ VLOG(4) << "PPB_ImageData::Describe()";
+ EnterResource<PPB_ImageData_API> enter(image_data, true);
+ if (enter.failed()) {
+ memset(desc, 0, sizeof(*desc));
return PP_FALSE;
+ }
return enter.object()->Describe(desc);
}
-void* Map(PP_Resource resource) {
- EnterResource<PPB_ImageData_API> enter(resource, true);
+void* Map(PP_Resource image_data) {
+ VLOG(4) << "PPB_ImageData::Map()";
+ EnterResource<PPB_ImageData_API> enter(image_data, true);
if (enter.failed())
return NULL;
return enter.object()->Map();
}
-void Unmap(PP_Resource resource) {
- EnterResource<PPB_ImageData_API> enter(resource, true);
+void Unmap(PP_Resource image_data) {
+ VLOG(4) << "PPB_ImageData::Unmap()";
+ EnterResource<PPB_ImageData_API> enter(image_data, true);
if (enter.failed())
return;
enter.object()->Unmap();
}
-const PPB_ImageData g_ppb_image_data_thunk = {
+const PPB_ImageData_1_0 g_ppb_imagedata_thunk_1_0 = {
&GetNativeImageDataFormat,
&IsImageDataFormatSupported,
&Create,
&IsImageData,
&Describe,
&Map,
- &Unmap,
+ &Unmap
};
} // namespace
const PPB_ImageData_1_0* GetPPB_ImageData_1_0_Thunk() {
- return &g_ppb_image_data_thunk;
+ return &g_ppb_imagedata_thunk_1_0;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc
index 4efbc18..ef495d1 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -19,6 +19,7 @@
// InputEvent ------------------------------------------------------------------
int32_t RequestInputEvents(PP_Instance instance, uint32_t event_classes) {
+ VLOG(4) << "PPB_InputEvent::RequestInputEvents()";
EnterInstance enter(instance);
if (enter.failed())
return enter.retval();
@@ -27,6 +28,7 @@
int32_t RequestFilteringInputEvents(PP_Instance instance,
uint32_t event_classes) {
+ VLOG(4) << "PPB_InputEvent::RequestFilteringInputEvents()";
EnterInstance enter(instance);
if (enter.failed())
return enter.retval();
@@ -36,17 +38,20 @@
void ClearInputEventRequest(PP_Instance instance,
uint32_t event_classes) {
+ VLOG(4) << "PPB_InputEvent::ClearInputEventRequest()";
EnterInstance enter(instance);
if (enter.succeeded())
enter.functions()->ClearInputEventRequest(instance, event_classes);
}
PP_Bool IsInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_InputEvent::IsInputEvent()";
EnterInputEvent enter(resource, false);
return enter.succeeded() ? PP_TRUE : PP_FALSE;
}
PP_InputEvent_Type GetType(PP_Resource event) {
+ VLOG(4) << "PPB_InputEvent::GetType()";
EnterInputEvent enter(event, true);
if (enter.failed())
return PP_INPUTEVENT_TYPE_UNDEFINED;
@@ -54,6 +59,7 @@
}
PP_TimeTicks GetTimeStamp(PP_Resource event) {
+ VLOG(4) << "PPB_InputEvent::GetTimeStamp()";
EnterInputEvent enter(event, true);
if (enter.failed())
return 0.0;
@@ -61,6 +67,7 @@
}
uint32_t GetModifiers(PP_Resource event) {
+ VLOG(4) << "PPB_InputEvent::GetModifiers()";
EnterInputEvent enter(event, true);
if (enter.failed())
return 0;
@@ -86,6 +93,7 @@
PP_InputEvent_MouseButton mouse_button,
const PP_Point* mouse_position,
int32_t click_count) {
+ VLOG(4) << "PPB_MouseInputEvent::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -105,6 +113,7 @@
const PP_Point* mouse_position,
int32_t click_count,
const PP_Point* mouse_movement) {
+ VLOG(4) << "PPB_MouseInputEvent::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -115,6 +124,7 @@
}
PP_Bool IsMouseInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_MouseInputEvent::IsMouseInputEvent()";
if (!IsInputEvent(resource))
return PP_FALSE; // Prevent warning log in GetType.
PP_InputEvent_Type type = GetType(resource);
@@ -127,6 +137,7 @@
}
PP_InputEvent_MouseButton GetMouseButton(PP_Resource mouse_event) {
+ VLOG(4) << "PPB_MouseInputEvent::GetButton()";
EnterInputEvent enter(mouse_event, true);
if (enter.failed())
return PP_INPUTEVENT_MOUSEBUTTON_NONE;
@@ -134,6 +145,7 @@
}
PP_Point GetMousePosition(PP_Resource mouse_event) {
+ VLOG(4) << "PPB_MouseInputEvent::GetPosition()";
EnterInputEvent enter(mouse_event, true);
if (enter.failed())
return PP_MakePoint(0, 0);
@@ -141,6 +153,7 @@
}
int32_t GetMouseClickCount(PP_Resource mouse_event) {
+ VLOG(4) << "PPB_MouseInputEvent::GetClickCount()";
EnterInputEvent enter(mouse_event, true);
if (enter.failed())
return 0;
@@ -148,6 +161,7 @@
}
PP_Point GetMouseMovement(PP_Resource mouse_event) {
+ VLOG(4) << "PPB_MouseInputEvent::GetMovement()";
EnterInputEvent enter(mouse_event, true);
if (enter.failed())
return PP_MakePoint(0, 0);
@@ -179,6 +193,7 @@
const PP_FloatPoint* wheel_delta,
const PP_FloatPoint* wheel_ticks,
PP_Bool scroll_by_page) {
+ VLOG(4) << "PPB_WheelInputEvent::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -188,6 +203,7 @@
}
PP_Bool IsWheelInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_WheelInputEvent::IsWheelInputEvent()";
if (!IsInputEvent(resource))
return PP_FALSE; // Prevent warning log in GetType.
PP_InputEvent_Type type = GetType(resource);
@@ -195,6 +211,7 @@
}
PP_FloatPoint GetWheelDelta(PP_Resource wheel_event) {
+ VLOG(4) << "PPB_WheelInputEvent::GetDelta()";
EnterInputEvent enter(wheel_event, true);
if (enter.failed())
return PP_MakeFloatPoint(0.0f, 0.0f);
@@ -202,6 +219,7 @@
}
PP_FloatPoint GetWheelTicks(PP_Resource wheel_event) {
+ VLOG(4) << "PPB_WheelInputEvent::GetTicks()";
EnterInputEvent enter(wheel_event, true);
if (enter.failed())
return PP_MakeFloatPoint(0.0f, 0.0f);
@@ -209,6 +227,7 @@
}
PP_Bool GetWheelScrollByPage(PP_Resource wheel_event) {
+ VLOG(4) << "PPB_WheelInputEvent::GetScrollByPage()";
EnterInputEvent enter(wheel_event, true);
if (enter.failed())
return PP_FALSE;
@@ -231,6 +250,7 @@
uint32_t modifiers,
uint32_t key_code,
struct PP_Var character_text) {
+ VLOG(4) << "PPB_KeyboardInputEvent::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -240,6 +260,7 @@
}
PP_Bool IsKeyboardInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_KeyboardInputEvent::IsKeyboardInputEvent()";
if (!IsInputEvent(resource))
return PP_FALSE; // Prevent warning log in GetType.
PP_InputEvent_Type type = GetType(resource);
@@ -250,6 +271,7 @@
}
uint32_t GetKeyCode(PP_Resource key_event) {
+ VLOG(4) << "PPB_KeyboardInputEvent::GetKeyCode()";
EnterInputEvent enter(key_event, true);
if (enter.failed())
return 0;
@@ -257,6 +279,7 @@
}
PP_Var GetCharacterText(PP_Resource character_event) {
+ VLOG(4) << "PPB_KeyboardInputEvent::GetCharacterText()";
EnterInputEvent enter(character_event, true);
if (enter.failed())
return PP_MakeUndefined();
@@ -273,6 +296,7 @@
// _Dev interface.
PP_Bool SetUsbKeyCode(PP_Resource key_event, uint32_t usb_key_code) {
+ VLOG(4) << "PPB_KeyboardInputEvent_Dev::SetUsbKeyCode()";
EnterInputEvent enter(key_event, true);
if (enter.failed())
return PP_FALSE;
@@ -280,6 +304,7 @@
}
uint32_t GetUsbKeyCode(PP_Resource key_event) {
+ VLOG(4) << "PPB_KeyboardInputEvent_Dev::GetUsbKeyCode()";
EnterInputEvent enter(key_event, true);
if (enter.failed())
return 0;
@@ -302,6 +327,7 @@
int32_t target_segment,
uint32_t selection_start,
uint32_t selection_end) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -314,6 +340,7 @@
}
PP_Bool IsIMEInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::IsIMEInputEvent()";
if (!IsInputEvent(resource))
return PP_FALSE; // Prevent warning log in GetType.
PP_InputEvent_Type type = GetType(resource);
@@ -324,10 +351,12 @@
}
PP_Var GetIMEText(PP_Resource ime_event) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetText()";
return GetCharacterText(ime_event);
}
uint32_t GetIMESegmentNumber(PP_Resource ime_event) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetSegmentNumber()";
EnterInputEvent enter(ime_event, true);
if (enter.failed())
return 0;
@@ -335,6 +364,7 @@
}
uint32_t GetIMESegmentOffset(PP_Resource ime_event, uint32_t index) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetSegmentOffset()";
EnterInputEvent enter(ime_event, true);
if (enter.failed())
return 0;
@@ -342,6 +372,7 @@
}
int32_t GetIMETargetSegment(PP_Resource ime_event) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetTargetSegment()";
EnterInputEvent enter(ime_event, true);
if (enter.failed())
return -1;
@@ -349,6 +380,7 @@
}
void GetIMESelection(PP_Resource ime_event, uint32_t* start, uint32_t* end) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetSelection()";
EnterInputEvent enter(ime_event, true);
if (enter.failed()) {
if (start)
@@ -385,6 +417,7 @@
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
uint32_t modifiers) {
+ VLOG(4) << "PPB_TouchInputEvent::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -395,6 +428,7 @@
void AddTouchPoint(PP_Resource touch_event,
PP_TouchListType list,
const PP_TouchPoint* point) {
+ VLOG(4) << "PPB_TouchInputEvent::AddTouchPoint()";
EnterInputEvent enter(touch_event, true);
if (enter.failed())
return;
@@ -402,6 +436,7 @@
}
PP_Bool IsTouchInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_TouchInputEvent::IsTouchInputEvent()";
if (!IsInputEvent(resource))
return PP_FALSE; // Prevent warning log in GetType.
PP_InputEvent_Type type = GetType(resource);
@@ -412,6 +447,7 @@
}
uint32_t GetTouchCount(PP_Resource touch_event, PP_TouchListType list) {
+ VLOG(4) << "PPB_TouchInputEvent::GetTouchCount()";
EnterInputEvent enter(touch_event, true);
if (enter.failed())
return 0;
@@ -421,6 +457,7 @@
struct PP_TouchPoint GetTouchByIndex(PP_Resource touch_event,
PP_TouchListType list,
uint32_t index) {
+ VLOG(4) << "PPB_TouchInputEvent::GetTouchByIndex()";
EnterInputEvent enter(touch_event, true);
if (enter.failed())
return PP_MakeTouchPoint();
@@ -430,6 +467,7 @@
struct PP_TouchPoint GetTouchById(PP_Resource touch_event,
PP_TouchListType list,
uint32_t id) {
+ VLOG(4) << "PPB_TouchInputEvent::GetTouchById()";
EnterInputEvent enter(touch_event, true);
if (enter.failed())
return PP_MakeTouchPoint();
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index 9c7e1c1..0bd2afe 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -85,6 +85,7 @@
int32_t index) = 0;
// Fullscreen.
+ virtual PP_Bool IsFullscreen(PP_Instance instance) = 0;
virtual PP_Bool SetFullscreen(PP_Instance instance,
PP_Bool fullscreen) = 0;
virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) = 0;
diff --git a/ppapi/thunk/ppb_instance_private_thunk.cc b/ppapi/thunk/ppb_instance_private_thunk.cc
index 6205cd1..0d9c10b 100644
--- a/ppapi/thunk/ppb_instance_private_thunk.cc
+++ b/ppapi/thunk/ppb_instance_private_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 private/ppb_instance_private.idl modified Thu Dec 27 10:36:33 2012.
+// From private/ppb_instance_private.idl modified Thu Feb 28 11:58:17 2013.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_instance_private.h"
@@ -18,6 +18,7 @@
namespace {
struct PP_Var GetWindowObject(PP_Instance instance) {
+ VLOG(4) << "PPB_Instance_Private::GetWindowObject()";
EnterInstance enter(instance);
if (enter.failed())
return PP_MakeUndefined();
@@ -25,6 +26,7 @@
}
struct PP_Var GetOwnerElementObject(PP_Instance instance) {
+ VLOG(4) << "PPB_Instance_Private::GetOwnerElementObject()";
EnterInstance enter(instance);
if (enter.failed())
return PP_MakeUndefined();
@@ -34,6 +36,7 @@
struct PP_Var ExecuteScript(PP_Instance instance,
struct PP_Var script,
struct PP_Var* exception) {
+ VLOG(4) << "PPB_Instance_Private::ExecuteScript()";
EnterInstance enter(instance);
if (enter.failed())
return PP_MakeUndefined();
diff --git a/ppapi/thunk/ppb_instance_thunk.cc b/ppapi/thunk/ppb_instance_thunk.cc
index cf4b782..f55c7ee 100644
--- a/ppapi/thunk/ppb_instance_thunk.cc
+++ b/ppapi/thunk/ppb_instance_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_instance.idl modified Thu Dec 27 10:36:33 2012.
+// From ppb_instance.idl modified Thu Feb 28 11:58:17 2013.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_instance.h"
@@ -18,6 +18,7 @@
namespace {
PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) {
+ VLOG(4) << "PPB_Instance::BindGraphics()";
EnterInstance enter(instance);
if (enter.failed())
return PP_FALSE;
@@ -25,6 +26,7 @@
}
PP_Bool IsFullFrame(PP_Instance instance) {
+ VLOG(4) << "PPB_Instance::IsFullFrame()";
EnterInstance enter(instance);
if (enter.failed())
return PP_FALSE;
diff --git a/ppapi/thunk/ppb_messaging_thunk.cc b/ppapi/thunk/ppb_messaging_thunk.cc
index 7f01c7c..d485b3d 100644
--- a/ppapi/thunk/ppb_messaging_thunk.cc
+++ b/ppapi/thunk/ppb_messaging_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_messaging.idl modified Mon Jan 14 14:09:38 2013.
+// From ppb_messaging.idl modified Tue Apr 16 11:25:44 2013.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_messaging.h"
@@ -18,9 +18,11 @@
namespace {
void PostMessage(PP_Instance instance, struct PP_Var message) {
+ VLOG(4) << "PPB_Messaging::PostMessage()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->PostMessage(instance, message);
+ if (enter.failed())
+ return;
+ enter.functions()->PostMessage(instance, message);
}
const PPB_Messaging_1_0 g_ppb_messaging_thunk_1_0 = {
diff --git a/ppapi/thunk/ppb_mouse_cursor_thunk.cc b/ppapi/thunk/ppb_mouse_cursor_thunk.cc
index 278e422..beb8263 100644
--- a/ppapi/thunk/ppb_mouse_cursor_thunk.cc
+++ b/ppapi/thunk/ppb_mouse_cursor_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_mouse_cursor.idl modified Mon Feb 25 16:10:34 2013.
+// From ppb_mouse_cursor.idl modified Mon Apr 1 08:24:03 2013.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_mouse_cursor.h"
@@ -21,6 +21,7 @@
enum PP_MouseCursor_Type type,
PP_Resource image,
const struct PP_Point* hot_spot) {
+ VLOG(4) << "PPB_MouseCursor::SetCursor()";
EnterInstance enter(instance);
if (enter.failed())
return PP_FALSE;
diff --git a/ppapi/thunk/ppb_mouse_lock_thunk.cc b/ppapi/thunk/ppb_mouse_lock_thunk.cc
index cf2530f..bd1a193 100644
--- a/ppapi/thunk/ppb_mouse_lock_thunk.cc
+++ b/ppapi/thunk/ppb_mouse_lock_thunk.cc
@@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// From ppb_mouse_lock.idl modified Thu Apr 18 10:43:11 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_mouse_lock.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
namespace ppapi {
@@ -14,7 +18,8 @@
namespace {
-int32_t LockMouse(PP_Instance instance, PP_CompletionCallback callback) {
+int32_t LockMouse(PP_Instance instance, struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_MouseLock::LockMouse()";
EnterInstance enter(instance, callback);
if (enter.failed())
return enter.retval();
@@ -23,13 +28,13 @@
}
void UnlockMouse(PP_Instance instance) {
+ VLOG(4) << "PPB_MouseLock::UnlockMouse()";
EnterInstance enter(instance);
- if (enter.failed())
- return;
- enter.functions()->UnlockMouse(instance);
+ if (enter.succeeded())
+ enter.functions()->UnlockMouse(instance);
}
-const PPB_MouseLock g_ppb_mouse_lock_thunk = {
+const PPB_MouseLock_1_0 g_ppb_mouselock_thunk_1_0 = {
&LockMouse,
&UnlockMouse
};
@@ -37,7 +42,7 @@
} // namespace
const PPB_MouseLock_1_0* GetPPB_MouseLock_1_0_Thunk() {
- return &g_ppb_mouse_lock_thunk;
+ return &g_ppb_mouselock_thunk_1_0;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_network_list_private_api.h b/ppapi/thunk/ppb_network_list_api.h
similarity index 80%
rename from ppapi/thunk/ppb_network_list_private_api.h
rename to ppapi/thunk/ppb_network_list_api.h
index ea91349..bbadded 100644
--- a/ppapi/thunk/ppb_network_list_private_api.h
+++ b/ppapi/thunk/ppb_network_list_api.h
@@ -2,8 +2,8 @@
// 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_LIST_PRIVATE_API_H_
-#define PPAPI_THUNK_PPB_NETWORK_LIST_PRIVATE_API_H_
+#ifndef PPAPI_THUNK_PPB_NETWORK_LIST_API_H_
+#define PPAPI_THUNK_PPB_NETWORK_LIST_API_H_
#include <vector>
@@ -17,14 +17,15 @@
namespace thunk {
-class PPAPI_THUNK_EXPORT PPB_NetworkList_Private_API {
+class PPAPI_THUNK_EXPORT PPB_NetworkList_API {
public:
- virtual ~PPB_NetworkList_Private_API() {}
+ virtual ~PPB_NetworkList_API() {}
// This function is not exposed through the C API, but returns the
// internal data for easy proxying.
virtual const NetworkList& GetNetworkListData() const = 0;
+ // Private API
virtual uint32_t GetCount() = 0;
virtual PP_Var GetName(uint32_t index) = 0;
virtual PP_NetworkListType_Private GetType(uint32_t index) = 0;
@@ -39,4 +40,4 @@
} // namespace thunk
} // namespace ppapi
-#endif // PPAPI_THUNK_PPB_NETWORK_LIST_PRIVATE_API_H_
+#endif // PPAPI_THUNK_PPB_NETWORK_LIST_API_H_
diff --git a/ppapi/thunk/ppb_network_list_private_thunk.cc b/ppapi/thunk/ppb_network_list_private_thunk.cc
index a5ee1e4..211c793 100644
--- a/ppapi/thunk/ppb_network_list_private_thunk.cc
+++ b/ppapi/thunk/ppb_network_list_private_thunk.cc
@@ -2,76 +2,89 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// From private/ppb_network_list_private.idl,
+// modified Tue Apr 16 11:25:45 2013.
+
#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_network_list_private.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_list_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
-#include "ppapi/thunk/ppb_network_list_private_api.h"
namespace ppapi {
namespace thunk {
namespace {
-typedef EnterResource<PPB_NetworkList_Private_API> EnterNetworkList;
-
PP_Bool IsNetworkList(PP_Resource resource) {
- EnterNetworkList enter(resource, false);
+ VLOG(4) << "PPB_NetworkList_Private::IsNetworkList()";
+ EnterResource<PPB_NetworkList_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
-uint32_t GetCount(PP_Resource network_list) {
- EnterNetworkList enter(network_list, true);
+uint32_t GetCount(PP_Resource resource) {
+ VLOG(4) << "PPB_NetworkList_Private::GetCount()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
if (enter.failed())
return 0;
return enter.object()->GetCount();
}
-PP_Var GetName(PP_Resource network_list, uint32_t index) {
- EnterNetworkList enter(network_list, true);
+struct PP_Var GetName(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetName()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
if (enter.failed())
return PP_MakeUndefined();
return enter.object()->GetName(index);
}
-PP_NetworkListType_Private GetType(PP_Resource network_list, uint32_t index) {
- EnterNetworkList enter(network_list, true);
+PP_NetworkListType_Private GetType(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetType()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
if (enter.failed())
return PP_NETWORKLIST_UNKNOWN;
return enter.object()->GetType(index);
}
-PP_NetworkListState_Private GetState(PP_Resource network_list, uint32_t index) {
- EnterNetworkList enter(network_list, true);
+PP_NetworkListState_Private GetState(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetState()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
if (enter.failed())
return PP_NETWORKLIST_DOWN;
return enter.object()->GetState(index);
}
-int32_t GetIpAddresses(PP_Resource network_list,
+int32_t GetIpAddresses(PP_Resource resource,
uint32_t index,
struct PP_NetAddress_Private addresses[],
uint32_t count) {
- EnterNetworkList enter(network_list, true);
+ VLOG(4) << "PPB_NetworkList_Private::GetIpAddresses()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
if (enter.failed())
return enter.retval();
return enter.object()->GetIpAddresses(index, addresses, count);
}
-PP_Var GetDisplayName(PP_Resource network_list, uint32_t index) {
- EnterNetworkList enter(network_list, true);
+struct PP_Var GetDisplayName(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetDisplayName()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
if (enter.failed())
return PP_MakeUndefined();
return enter.object()->GetDisplayName(index);
}
-uint32_t GetMTU(PP_Resource network_list, uint32_t index) {
- EnterNetworkList enter(network_list, true);
+uint32_t GetMTU(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetMTU()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
if (enter.failed())
return 0;
return enter.object()->GetMTU(index);
}
-const PPB_NetworkList_Private g_ppb_network_list_private_thunk = {
+const PPB_NetworkList_Private_0_2 g_ppb_networklist_private_thunk_0_2 = {
&IsNetworkList,
&GetCount,
&GetName,
@@ -79,13 +92,13 @@
&GetState,
&GetIpAddresses,
&GetDisplayName,
- &GetMTU,
+ &GetMTU
};
} // namespace
const PPB_NetworkList_Private_0_2* GetPPB_NetworkList_Private_0_2_Thunk() {
- return &g_ppb_network_list_private_thunk;
+ return &g_ppb_networklist_private_thunk_0_2;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_pdf_api.h b/ppapi/thunk/ppb_pdf_api.h
index 93458ef..c5d276a 100644
--- a/ppapi/thunk/ppb_pdf_api.h
+++ b/ppapi/thunk/ppb_pdf_api.h
@@ -6,37 +6,31 @@
#define PPAPI_THUNK_PPB_PDF_API_H_
#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
namespace ppapi {
namespace thunk {
class PPB_PDF_API {
public:
- virtual PP_Var GetLocalizedString(PP_Instance instance,
- PP_ResourceString string_id) = 0;
- virtual PP_Resource GetResourceImage(PP_Instance instance,
- PP_ResourceImage image_id) = 0;
- virtual void SearchString(PP_Instance instance,
- const unsigned short* input_string,
+ virtual PP_Var GetLocalizedString(PP_ResourceString string_id) = 0;
+ virtual PP_Resource GetResourceImage(PP_ResourceImage image_id) = 0;
+ virtual void SearchString(const unsigned short* input_string,
const unsigned short* input_term,
bool case_sensitive,
PP_PrivateFindResult** results,
int* count) = 0;
- virtual void DidStartLoading(PP_Instance instance) = 0;
- virtual void DidStopLoading(PP_Instance instance) = 0;
- virtual void SetContentRestriction(PP_Instance instance,
- int restrictions) = 0;
- virtual void HistogramPDFPageCount(PP_Instance instance, int count) = 0;
- virtual void UserMetricsRecordAction(PP_Instance instance,
- const PP_Var& action) = 0;
- virtual void HasUnsupportedFeature(PP_Instance instance) = 0;
- virtual void SaveAs(PP_Instance instance) = 0;
- virtual PP_Bool IsFeatureEnabled(PP_Instance instance,
- PP_PDFFeature feature) = 0;
- virtual void Print(PP_Instance instance) = 0;
- virtual PP_Resource GetResourceImageForScale(PP_Instance instance,
- PP_ResourceImage image_id,
- int scale) = 0;
+ virtual void DidStartLoading() = 0;
+ virtual void DidStopLoading() = 0;
+ virtual void SetContentRestriction(int restrictions) = 0;
+ virtual void HistogramPDFPageCount(int count) = 0;
+ virtual void UserMetricsRecordAction(const PP_Var& action) = 0;
+ virtual void HasUnsupportedFeature() = 0;
+ virtual void SaveAs() = 0;
+ virtual PP_Bool IsFeatureEnabled(PP_PDFFeature feature) = 0;
+ virtual void Print() = 0;
+ virtual PP_Resource GetResourceImageForScale(PP_ResourceImage image_id,
+ float scale) = 0;
static const SingletonResourceID kSingletonResourceID = PDF_SINGLETON_ID;
};
@@ -44,4 +38,4 @@
} // namespace thunk
} // namespace ppapi
-#endif // PPAPI_THUNK__API_H_
+#endif // PPAPI_THUNK_PPB_PDF_API_H_
diff --git a/ppapi/thunk/ppb_pdf_thunk.cc b/ppapi/thunk/ppb_pdf_thunk.cc
index 4216a2b..94334d1 100644
--- a/ppapi/thunk/ppb_pdf_thunk.cc
+++ b/ppapi/thunk/ppb_pdf_thunk.cc
@@ -6,7 +6,9 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_pdf.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_font_file_api.h"
#include "ppapi/thunk/ppb_pdf_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
namespace ppapi {
@@ -18,7 +20,7 @@
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.failed())
return PP_MakeUndefined();
- return enter.functions()->GetLocalizedString(instance, string_id);
+ return enter.functions()->GetLocalizedString(string_id);
}
PP_Resource GetResourceImage(PP_Instance instance,
@@ -26,25 +28,33 @@
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.failed())
return 0;
- return enter.functions()->GetResourceImage(instance, image_id);
+ return enter.functions()->GetResourceImage(image_id);
}
PP_Resource GetFontFileWithFallback(
PP_Instance instance,
- const PP_FontDescription_Dev* description,
+ const PP_BrowserFont_Trusted_Description* description,
PP_PrivateFontCharset charset) {
- // Not implemented out-of-process.
- NOTIMPLEMENTED();
- return 0;
+ // TODO(raymes): Eventually we should replace the use of this function with
+ // either PPB_Flash_Font_File or PPB_TrueType_Font directly in the PDF code.
+ // For now just call into PPB_Flash_Font_File which has the exact same API.
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFlashFontFile(instance, description, charset);
}
bool GetFontTableForPrivateFontFile(PP_Resource font_file,
uint32_t table,
void* output,
uint32_t* output_length) {
- // Not implemented out-of-process.
- NOTIMPLEMENTED();
- return false;
+ // TODO(raymes): Eventually we should replace the use of this function with
+ // either PPB_Flash_Font_File or PPB_TrueType_Font directly in the PDF code.
+ // For now just call into PPB_Flash_Font_File which has the exact same API.
+ EnterResource<PPB_Flash_FontFile_API> enter(font_file, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_ToBool(enter.object()->GetFontTable(table, output, output_length));
}
void SearchString(PP_Instance instance,
@@ -56,63 +66,62 @@
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.failed())
return;
- enter.functions()->SearchString(instance, string, term, case_sensitive,
- results, count);
+ enter.functions()->SearchString(string, term, case_sensitive, results, count);
}
void DidStartLoading(PP_Instance instance) {
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.succeeded())
- enter.functions()->DidStartLoading(instance);
+ enter.functions()->DidStartLoading();
}
void DidStopLoading(PP_Instance instance) {
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.succeeded())
- enter.functions()->DidStopLoading(instance);
+ enter.functions()->DidStopLoading();
}
void SetContentRestriction(PP_Instance instance, int restrictions) {
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.succeeded())
- enter.functions()->SetContentRestriction(instance, restrictions);
+ enter.functions()->SetContentRestriction(restrictions);
}
void HistogramPDFPageCount(PP_Instance instance, int count) {
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.succeeded())
- enter.functions()->HistogramPDFPageCount(instance, count);
+ enter.functions()->HistogramPDFPageCount(count);
}
void UserMetricsRecordAction(PP_Instance instance, PP_Var action) {
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.succeeded())
- enter.functions()->UserMetricsRecordAction(instance, action);
+ enter.functions()->UserMetricsRecordAction(action);
}
void HasUnsupportedFeature(PP_Instance instance) {
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.succeeded())
- enter.functions()->HasUnsupportedFeature(instance);
+ enter.functions()->HasUnsupportedFeature();
}
void SaveAs(PP_Instance instance) {
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.succeeded())
- enter.functions()->SaveAs(instance);
+ enter.functions()->SaveAs();
}
void Print(PP_Instance instance) {
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.succeeded())
- enter.functions()->Print(instance);
+ enter.functions()->Print();
}
PP_Bool IsFeatureEnabled(PP_Instance instance, PP_PDFFeature feature) {
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.failed())
return PP_FALSE;
- return enter.functions()->IsFeatureEnabled(instance, feature);
+ return enter.functions()->IsFeatureEnabled(feature);
}
PP_Resource GetResourceImageForScale(PP_Instance instance,
@@ -121,7 +130,7 @@
EnterInstanceAPI<PPB_PDF_API> enter(instance);
if (enter.failed())
return 0;
- return enter.functions()->GetResourceImageForScale(instance, image_id, scale);
+ return enter.functions()->GetResourceImageForScale(image_id, scale);
}
const PPB_PDF g_ppb_pdf_thunk = {
diff --git a/ppapi/thunk/ppb_printing_dev_thunk.cc b/ppapi/thunk/ppb_printing_dev_thunk.cc
new file mode 100644
index 0000000..117ef17
--- /dev/null
+++ b/ppapi/thunk/ppb_printing_dev_thunk.cc
@@ -0,0 +1,54 @@
+// 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 dev/ppb_printing_dev.idl modified Fri Apr 19 10:45:09 2013.
+
+#include "ppapi/c/dev/ppb_printing_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_printing_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_Printing_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreatePrinting(instance);
+}
+
+int32_t GetDefaultPrintSettings(PP_Resource resource,
+ struct PP_PrintSettings_Dev* print_settings,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Printing_Dev::GetDefaultPrintSettings()";
+ EnterResource<PPB_Printing_API> enter(resource, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetDefaultPrintSettings(
+ print_settings,
+ enter.callback()));
+}
+
+const PPB_Printing_Dev_0_7 g_ppb_printing_dev_thunk_0_7 = {
+ &Create,
+ &GetDefaultPrintSettings
+};
+
+} // namespace
+
+const PPB_Printing_Dev_0_7* GetPPB_Printing_Dev_0_7_Thunk() {
+ return &g_ppb_printing_dev_thunk_0_7;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_printing_thunk.cc b/ppapi/thunk/ppb_printing_thunk.cc
deleted file mode 100644
index 2fc34e3..0000000
--- a/ppapi/thunk/ppb_printing_thunk.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// 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.
-
-#include "ppapi/c/dev/pp_print_settings_dev.h"
-#include "ppapi/c/dev/ppb_printing_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_printing_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-#include "ppapi/thunk/thunk.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-PP_Bool GetDefaultPrintSettings_0_6(PP_Instance instance,
- PP_PrintSettings_Dev* print_settings) {
- // TODO(raymes): This is obsolete now. Just return some default settings.
- // Remove this when all versions of Flash we care about are no longer using
- // it.
- PP_PrintSettings_Dev default_settings = {
- // |printable_area|: all of the sheet of paper.
- { { 0, 0 }, { 612, 792 } },
- // |content_area|: 0.5" margins all around.
- { { 36, 36 }, { 540, 720 } },
- // |paper_size|: 8.5" x 11" (US letter).
- { 612, 792 },
- 300, // |dpi|.
- PP_PRINTORIENTATION_NORMAL, // |orientation|.
- PP_PRINTSCALINGOPTION_NONE, // |print_scaling_option|.
- PP_FALSE, // |grayscale|.
- PP_PRINTOUTPUTFORMAT_PDF // |format|.
- };
- *print_settings = default_settings;
- return PP_TRUE;
-}
-
-PP_Resource Create(PP_Instance instance) {
- EnterResourceCreation enter(instance);
- if (enter.failed())
- return 0;
- return enter.functions()->CreatePrinting(instance);
-}
-
-int32_t GetDefaultPrintSettings(PP_Resource resource,
- PP_PrintSettings_Dev* print_settings,
- PP_CompletionCallback callback) {
- EnterResource<PPB_Printing_API> enter(resource, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(
- enter.object()->GetDefaultPrintSettings(print_settings,
- enter.callback()));
-}
-
-const PPB_Printing_Dev_0_6 g_ppb_printing_dev_thunk_0_6 = {
- &GetDefaultPrintSettings_0_6,
-};
-
-const PPB_Printing_Dev g_ppb_printing_dev_thunk_0_7 = {
- &Create,
- &GetDefaultPrintSettings,
-};
-
-} // namespace
-
-const PPB_Printing_Dev_0_6* GetPPB_Printing_Dev_0_6_Thunk() {
- return &g_ppb_printing_dev_thunk_0_6;
-}
-
-const PPB_Printing_Dev_0_7* GetPPB_Printing_Dev_0_7_Thunk() {
- return &g_ppb_printing_dev_thunk_0_7;
-}
-
-} // namespace thunk
-} // namespace ppapi
diff --git a/ppapi/thunk/ppb_resource_array_dev_thunk.cc b/ppapi/thunk/ppb_resource_array_dev_thunk.cc
index d9d5d48..6d51a56 100644
--- a/ppapi/thunk/ppb_resource_array_dev_thunk.cc
+++ b/ppapi/thunk/ppb_resource_array_dev_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 dev/ppb_resource_array_dev.idl modified Tue Dec 4 10:44:11 2012.
+// From dev/ppb_resource_array_dev.idl modified Thu Dec 20 13:10:26 2012.
#include "ppapi/c/dev/ppb_resource_array_dev.h"
#include "ppapi/c/pp_errors.h"
@@ -21,6 +21,7 @@
PP_Resource Create(PP_Instance instance,
const PP_Resource elements[],
uint32_t size) {
+ VLOG(4) << "PPB_ResourceArray_Dev::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -28,11 +29,13 @@
}
PP_Bool IsResourceArray(PP_Resource resource) {
+ VLOG(4) << "PPB_ResourceArray_Dev::IsResourceArray()";
EnterResource<PPB_ResourceArray_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
uint32_t GetSize(PP_Resource resource_array) {
+ VLOG(4) << "PPB_ResourceArray_Dev::GetSize()";
EnterResource<PPB_ResourceArray_API> enter(resource_array, true);
if (enter.failed())
return 0;
@@ -40,6 +43,7 @@
}
PP_Resource GetAt(PP_Resource resource_array, uint32_t index) {
+ VLOG(4) << "PPB_ResourceArray_Dev::GetAt()";
EnterResource<PPB_ResourceArray_API> enter(resource_array, true);
if (enter.failed())
return 0;
diff --git a/ppapi/thunk/ppb_truetype_font_dev_thunk.cc b/ppapi/thunk/ppb_truetype_font_dev_thunk.cc
new file mode 100644
index 0000000..afed58e
--- /dev/null
+++ b/ppapi/thunk/ppb_truetype_font_dev_thunk.cc
@@ -0,0 +1,121 @@
+// 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.
+
+// From dev/ppb_truetype_font_dev.idl modified Wed Apr 17 15:38:46 2013.
+
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_truetype_font_api.h"
+#include "ppapi/thunk/ppb_truetype_font_singleton_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t GetFontFamilies(PP_Instance instance,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::GetFontFamilies()";
+ EnterInstanceAPI<PPB_TrueTypeFont_Singleton_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.functions()->GetFontFamilies(
+ instance,
+ output,
+ enter.callback()));
+}
+
+int32_t GetFontsInFamily(PP_Instance instance,
+ struct PP_Var family,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::GetFontsInFamily()";
+ EnterInstanceAPI<PPB_TrueTypeFont_Singleton_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.functions()->GetFontsInFamily(
+ instance,
+ family,
+ output,
+ enter.callback()));
+}
+
+PP_Resource Create(PP_Instance instance,
+ const struct PP_TrueTypeFontDesc_Dev* desc) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateTrueTypeFont(instance, desc);
+}
+
+PP_Bool IsTrueTypeFont(PP_Resource resource) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::IsTrueTypeFont()";
+ EnterResource<PPB_TrueTypeFont_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Describe(PP_Resource font,
+ struct PP_TrueTypeFontDesc_Dev* desc,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::Describe()";
+ EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Describe(desc, enter.callback()));
+}
+
+int32_t GetTableTags(PP_Resource font,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::GetTableTags()";
+ EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetTableTags(output,
+ enter.callback()));
+}
+
+int32_t GetTable(PP_Resource font,
+ uint32_t table,
+ int32_t offset,
+ int32_t max_data_length,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::GetTable()";
+ EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetTable(table,
+ offset,
+ max_data_length,
+ output,
+ enter.callback()));
+}
+
+const PPB_TrueTypeFont_Dev_0_1 g_ppb_truetypefont_dev_thunk_0_1 = {
+ &GetFontFamilies,
+ &GetFontsInFamily,
+ &Create,
+ &IsTrueTypeFont,
+ &Describe,
+ &GetTableTags,
+ &GetTable
+};
+
+} // namespace
+
+const PPB_TrueTypeFont_Dev_0_1* GetPPB_TrueTypeFont_Dev_0_1_Thunk() {
+ return &g_ppb_truetypefont_dev_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_truetype_font_singleton_api.h b/ppapi/thunk/ppb_truetype_font_singleton_api.h
index 514bab1..97c727d 100644
--- a/ppapi/thunk/ppb_truetype_font_singleton_api.h
+++ b/ppapi/thunk/ppb_truetype_font_singleton_api.h
@@ -24,6 +24,12 @@
const PP_ArrayOutput& output,
const scoped_refptr<TrackedCallback>& callback) = 0;
+ virtual int32_t GetFontsInFamily(
+ PP_Instance instance,
+ PP_Var family,
+ const PP_ArrayOutput& output,
+ const scoped_refptr<TrackedCallback>& callback) = 0;
+
static const SingletonResourceID kSingletonResourceID =
TRUETYPE_FONT_SINGLETON_ID;
};
diff --git a/ppapi/thunk/ppb_truetype_font_thunk.cc b/ppapi/thunk/ppb_truetype_font_thunk.cc
deleted file mode 100644
index b941c84..0000000
--- a/ppapi/thunk/ppb_truetype_font_thunk.cc
+++ /dev/null
@@ -1,94 +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/c/dev/ppb_truetype_font_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_instance_api.h"
-#include "ppapi/thunk/ppb_truetype_font_api.h"
-#include "ppapi/thunk/ppb_truetype_font_singleton_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-#include "ppapi/thunk/thunk.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-int32_t GetFontFamilies(PP_Instance instance,
- PP_ArrayOutput output,
- PP_CompletionCallback callback) {
- EnterInstanceAPI<PPB_TrueTypeFont_Singleton_API> enter(instance, callback);
- if (enter.failed())
- return PP_ERROR_FAILED;
- return enter.functions()->GetFontFamilies(instance, output, enter.callback());
-}
-
-PP_Resource Create(PP_Instance instance,
- const PP_TrueTypeFontDesc_Dev* desc) {
- EnterResourceCreation enter(instance);
- if (enter.failed())
- return 0;
- return enter.functions()->CreateTrueTypeFont(instance, *desc);
-}
-
-PP_Bool IsFont(PP_Resource resource) {
- EnterResource<PPB_TrueTypeFont_API> enter(resource, false);
- return PP_FromBool(enter.succeeded());
-}
-
-int32_t Describe(PP_Resource font,
- PP_TrueTypeFontDesc_Dev* desc,
- PP_CompletionCallback callback) {
- EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->Describe(desc, enter.callback()));
-}
-
-int32_t GetTableTags(PP_Resource font,
- PP_ArrayOutput output,
- PP_CompletionCallback callback) {
- EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->GetTableTags(output,
- enter.callback()));
-}
-
-int32_t GetTable(PP_Resource font,
- uint32_t table,
- int32_t offset,
- int32_t max_data_length,
- PP_ArrayOutput output,
- PP_CompletionCallback callback) {
- EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->GetTable(table,
- offset,
- max_data_length,
- output,
- enter.callback()));
-}
-
-const PPB_TrueTypeFont_Dev_0_1 g_ppb_truetypefont_thunk_0_1 = {
- &GetFontFamilies,
- &Create,
- &IsFont,
- &Describe,
- &GetTableTags,
- &GetTable
-};
-
-} // namespace
-
-const PPB_TrueTypeFont_Dev_0_1* GetPPB_TrueTypeFont_Dev_0_1_Thunk() {
- return &g_ppb_truetypefont_thunk_0_1;
-}
-
-} // namespace thunk
-} // namespace ppapi
diff --git a/ppapi/thunk/ppb_url_loader_api.h b/ppapi/thunk/ppb_url_loader_api.h
index 0fe8e04..00d4690 100644
--- a/ppapi/thunk/ppb_url_loader_api.h
+++ b/ppapi/thunk/ppb_url_loader_api.h
@@ -47,7 +47,8 @@
// Trusted API.
virtual void GrantUniversalAccess() = 0;
- virtual void SetStatusCallback(PP_URLLoaderTrusted_StatusCallback cb) = 0;
+ virtual void RegisterStatusCallback(
+ PP_URLLoaderTrusted_StatusCallback cb) = 0;
// Internal function. This will fill in the given response info data and
// return true on sucesss. If the dowbload was to a file, there will be one
diff --git a/ppapi/thunk/ppb_url_loader_thunk.cc b/ppapi/thunk/ppb_url_loader_thunk.cc
index 23113cd..7df78b9 100644
--- a/ppapi/thunk/ppb_url_loader_thunk.cc
+++ b/ppapi/thunk/ppb_url_loader_thunk.cc
@@ -2,22 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// From ppb_url_loader.idl modified Wed Apr 17 11:16:00 2013.
+
+#include <string.h>
+
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/ppb_url_loader_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
namespace {
-typedef EnterResource<PPB_URLLoader_API> EnterURLLoader;
-
PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_URLLoader::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -25,22 +30,25 @@
}
PP_Bool IsURLLoader(PP_Resource resource) {
- EnterURLLoader enter(resource, false);
+ VLOG(4) << "PPB_URLLoader::IsURLLoader()";
+ EnterResource<PPB_URLLoader_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
int32_t Open(PP_Resource loader,
- PP_Resource request_id,
- PP_CompletionCallback callback) {
- EnterURLLoader enter(loader, callback, true);
+ PP_Resource request_info,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::Open()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
if (enter.failed())
return enter.retval();
- return enter.SetResult(enter.object()->Open(request_id, enter.callback()));
+ return enter.SetResult(enter.object()->Open(request_info, enter.callback()));
}
int32_t FollowRedirect(PP_Resource loader,
- PP_CompletionCallback callback) {
- EnterURLLoader enter(loader, callback, true);
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::FollowRedirect()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->FollowRedirect(enter.callback()));
@@ -49,23 +57,24 @@
PP_Bool GetUploadProgress(PP_Resource loader,
int64_t* bytes_sent,
int64_t* total_bytes_to_be_sent) {
- EnterURLLoader enter(loader, true);
+ VLOG(4) << "PPB_URLLoader::GetUploadProgress()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
if (enter.failed()) {
- *bytes_sent = 0;
- *total_bytes_to_be_sent = 0;
+ memset(bytes_sent, 0, sizeof(*bytes_sent));
+ memset(total_bytes_to_be_sent, 0, sizeof(*total_bytes_to_be_sent));
return PP_FALSE;
}
- return enter.object()->GetUploadProgress(bytes_sent,
- total_bytes_to_be_sent);
+ return enter.object()->GetUploadProgress(bytes_sent, total_bytes_to_be_sent);
}
PP_Bool GetDownloadProgress(PP_Resource loader,
int64_t* bytes_received,
int64_t* total_bytes_to_be_received) {
- EnterURLLoader enter(loader, true);
+ VLOG(4) << "PPB_URLLoader::GetDownloadProgress()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
if (enter.failed()) {
- *bytes_received = 0;
- *total_bytes_to_be_received = 0;
+ memset(bytes_received, 0, sizeof(*bytes_received));
+ memset(total_bytes_to_be_received, 0, sizeof(*total_bytes_to_be_received));
return PP_FALSE;
}
return enter.object()->GetDownloadProgress(bytes_received,
@@ -73,7 +82,8 @@
}
PP_Resource GetResponseInfo(PP_Resource loader) {
- EnterURLLoader enter(loader, true);
+ VLOG(4) << "PPB_URLLoader::GetResponseInfo()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
if (enter.failed())
return 0;
return enter.object()->GetResponseInfo();
@@ -82,43 +92,35 @@
int32_t ReadResponseBody(PP_Resource loader,
void* buffer,
int32_t bytes_to_read,
- PP_CompletionCallback callback) {
- EnterURLLoader enter(loader, callback, true);
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::ReadResponseBody()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
if (enter.failed())
return enter.retval();
- return enter.SetResult(enter.object()->ReadResponseBody(buffer, bytes_to_read,
+ return enter.SetResult(enter.object()->ReadResponseBody(buffer,
+ bytes_to_read,
enter.callback()));
}
int32_t FinishStreamingToFile(PP_Resource loader,
- PP_CompletionCallback callback) {
- EnterURLLoader enter(loader, callback, true);
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::FinishStreamingToFile()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
if (enter.failed())
return enter.retval();
- return enter.SetResult(
- enter.object()->FinishStreamingToFile(enter.callback()));
+ return enter.SetResult(enter.object()->FinishStreamingToFile(
+ enter.callback()));
}
void Close(PP_Resource loader) {
- EnterURLLoader enter(loader, true);
- if (enter.succeeded())
- enter.object()->Close();
+ VLOG(4) << "PPB_URLLoader::Close()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
+ if (enter.failed())
+ return;
+ enter.object()->Close();
}
-void GrantUniversalAccess(PP_Resource loader) {
- EnterURLLoader enter(loader, true);
- if (enter.succeeded())
- enter.object()->GrantUniversalAccess();
-}
-
-void SetStatusCallback(PP_Resource loader,
- PP_URLLoaderTrusted_StatusCallback cb) {
- EnterURLLoader enter(loader, true);
- if (enter.succeeded())
- enter.object()->SetStatusCallback(cb);
-}
-
-const PPB_URLLoader g_ppb_urlloader_thunk = {
+const PPB_URLLoader_1_0 g_ppb_urlloader_thunk_1_0 = {
&Create,
&IsURLLoader,
&Open,
@@ -131,19 +133,10 @@
&Close
};
-const PPB_URLLoaderTrusted g_ppb_urlloader_trusted_thunk = {
- &GrantUniversalAccess,
- &SetStatusCallback
-};
-
} // namespace
const PPB_URLLoader_1_0* GetPPB_URLLoader_1_0_Thunk() {
- return &g_ppb_urlloader_thunk;
-}
-
-const PPB_URLLoaderTrusted_0_3* GetPPB_URLLoaderTrusted_0_3_Thunk() {
- return &g_ppb_urlloader_trusted_thunk;
+ return &g_ppb_urlloader_thunk_1_0;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_url_loader_trusted_thunk.cc b/ppapi/thunk/ppb_url_loader_trusted_thunk.cc
new file mode 100644
index 0000000..3082f36
--- /dev/null
+++ b/ppapi/thunk/ppb_url_loader_trusted_thunk.cc
@@ -0,0 +1,50 @@
+// 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 trusted/ppb_url_loader_trusted.idl modified Wed Apr 17 11:16:00 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_url_loader_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void GrantUniversalAccess(PP_Resource loader) {
+ VLOG(4) << "PPB_URLLoaderTrusted::GrantUniversalAccess()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
+ if (enter.failed())
+ return;
+ enter.object()->GrantUniversalAccess();
+}
+
+void RegisterStatusCallback(PP_Resource loader,
+ PP_URLLoaderTrusted_StatusCallback cb) {
+ VLOG(4) << "PPB_URLLoaderTrusted::RegisterStatusCallback()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
+ if (enter.failed())
+ return;
+ enter.object()->RegisterStatusCallback(cb);
+}
+
+const PPB_URLLoaderTrusted_0_3 g_ppb_urlloadertrusted_thunk_0_3 = {
+ &GrantUniversalAccess,
+ &RegisterStatusCallback
+};
+
+} // namespace
+
+const PPB_URLLoaderTrusted_0_3* GetPPB_URLLoaderTrusted_0_3_Thunk() {
+ return &g_ppb_urlloadertrusted_thunk_0_3;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_url_request_info_thunk.cc b/ppapi/thunk/ppb_url_request_info_thunk.cc
index 19176c3..c6a7397 100644
--- a/ppapi/thunk/ppb_url_request_info_thunk.cc
+++ b/ppapi/thunk/ppb_url_request_info_thunk.cc
@@ -2,11 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ppapi/shared_impl/url_request_info_data.h"
-#include "ppapi/thunk/thunk.h"
+// From ppb_url_request_info.idl modified Mon Apr 1 08:24:03 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_url_request_info.h"
+#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/ppb_url_request_info_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
@@ -14,29 +19,31 @@
namespace {
PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_URLRequestInfo::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
- return enter.functions()->CreateURLRequestInfo(
- instance, URLRequestInfoData());
+ return enter.functions()->CreateURLRequestInfo(instance);
}
PP_Bool IsURLRequestInfo(PP_Resource resource) {
+ VLOG(4) << "PPB_URLRequestInfo::IsURLRequestInfo()";
EnterResource<PPB_URLRequestInfo_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
PP_Bool SetProperty(PP_Resource request,
PP_URLRequestProperty property,
- PP_Var var) {
+ struct PP_Var value) {
+ VLOG(4) << "PPB_URLRequestInfo::SetProperty()";
EnterResource<PPB_URLRequestInfo_API> enter(request, true);
if (enter.failed())
return PP_FALSE;
- return enter.object()->SetProperty(property, var);
+ return enter.object()->SetProperty(property, value);
}
-PP_Bool AppendDataToBody(PP_Resource request,
- const void* data, uint32_t len) {
+PP_Bool AppendDataToBody(PP_Resource request, const void* data, uint32_t len) {
+ VLOG(4) << "PPB_URLRequestInfo::AppendDataToBody()";
EnterResource<PPB_URLRequestInfo_API> enter(request, true);
if (enter.failed())
return PP_FALSE;
@@ -48,15 +55,17 @@
int64_t start_offset,
int64_t number_of_bytes,
PP_Time expected_last_modified_time) {
+ VLOG(4) << "PPB_URLRequestInfo::AppendFileToBody()";
EnterResource<PPB_URLRequestInfo_API> enter(request, true);
if (enter.failed())
return PP_FALSE;
- return enter.object()->AppendFileToBody(file_ref, start_offset,
+ return enter.object()->AppendFileToBody(file_ref,
+ start_offset,
number_of_bytes,
expected_last_modified_time);
}
-const PPB_URLRequestInfo g_ppb_url_request_info_thunk = {
+const PPB_URLRequestInfo_1_0 g_ppb_urlrequestinfo_thunk_1_0 = {
&Create,
&IsURLRequestInfo,
&SetProperty,
@@ -67,7 +76,7 @@
} // namespace
const PPB_URLRequestInfo_1_0* GetPPB_URLRequestInfo_1_0_Thunk() {
- return &g_ppb_url_request_info_thunk;
+ return &g_ppb_urlrequestinfo_thunk_1_0;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_url_response_info_thunk.cc b/ppapi/thunk/ppb_url_response_info_thunk.cc
index c0b36ff..fe6ef08 100644
--- a/ppapi/thunk/ppb_url_response_info_thunk.cc
+++ b/ppapi/thunk/ppb_url_response_info_thunk.cc
@@ -2,10 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ppapi/thunk/thunk.h"
+// From ppb_url_response_info.idl modified Thu Apr 25 13:21:08 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_url_response_info.h"
+#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/ppb_url_response_info_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
@@ -13,25 +19,29 @@
namespace {
PP_Bool IsURLResponseInfo(PP_Resource resource) {
+ VLOG(4) << "PPB_URLResponseInfo::IsURLResponseInfo()";
EnterResource<PPB_URLResponseInfo_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
-PP_Var GetProperty(PP_Resource response, PP_URLResponseProperty property) {
+struct PP_Var GetProperty(PP_Resource response,
+ PP_URLResponseProperty property) {
+ VLOG(4) << "PPB_URLResponseInfo::GetProperty()";
EnterResource<PPB_URLResponseInfo_API> enter(response, true);
- if (!enter.succeeded())
+ if (enter.failed())
return PP_MakeUndefined();
return enter.object()->GetProperty(property);
}
PP_Resource GetBodyAsFileRef(PP_Resource response) {
+ VLOG(4) << "PPB_URLResponseInfo::GetBodyAsFileRef()";
EnterResource<PPB_URLResponseInfo_API> enter(response, true);
- if (!enter.succeeded())
+ if (enter.failed())
return 0;
return enter.object()->GetBodyAsFileRef();
}
-const PPB_URLResponseInfo g_ppb_url_response_info_thunk = {
+const PPB_URLResponseInfo_1_0 g_ppb_urlresponseinfo_thunk_1_0 = {
&IsURLResponseInfo,
&GetProperty,
&GetBodyAsFileRef
@@ -40,7 +50,7 @@
} // namespace
const PPB_URLResponseInfo_1_0* GetPPB_URLResponseInfo_1_0_Thunk() {
- return &g_ppb_url_response_info_thunk;
+ return &g_ppb_urlresponseinfo_thunk_1_0;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_video_destination_private_api.h b/ppapi/thunk/ppb_video_destination_private_api.h
new file mode 100644
index 0000000..49a696a
--- /dev/null
+++ b/ppapi/thunk/ppb_video_destination_private_api.h
@@ -0,0 +1,32 @@
+// 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_VIDEO_DESTINATION_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_VIDEO_DESTINATION_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_VideoFrame_Private;
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_VideoDestination_Private_API {
+ public:
+ virtual ~PPB_VideoDestination_Private_API() {}
+
+ virtual int32_t Open(const PP_Var& stream_url,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t PutFrame(const PP_VideoFrame_Private& frame) = 0;
+ virtual void Close() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_VIDEO_DESTINATION_PRIVATE_API_H_
diff --git a/ppapi/thunk/ppb_video_destination_private_thunk.cc b/ppapi/thunk/ppb_video_destination_private_thunk.cc
new file mode 100644
index 0000000..072b135
--- /dev/null
+++ b/ppapi/thunk/ppb_video_destination_private_thunk.cc
@@ -0,0 +1,74 @@
+// 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/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
+#include "ppapi/c/private/ppb_video_destination_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_video_destination_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateVideoDestination(instance);
+}
+
+PP_Bool IsVideoDestination(PP_Resource resource) {
+ EnterResource<PPB_VideoDestination_Private_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Open(PP_Resource destination,
+ PP_Var stream_url,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_VideoDestination_Private_API> enter(destination,
+ callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open(stream_url, enter.callback()));
+}
+
+int32_t PutFrame(PP_Resource destination,
+ const PP_VideoFrame_Private* frame) {
+ EnterResource<PPB_VideoDestination_Private_API> enter(destination, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->PutFrame(*frame));
+}
+
+void Close(PP_Resource destination) {
+ EnterResource<PPB_VideoDestination_Private_API> enter(destination, true);
+ if (enter.succeeded())
+ enter.object()->Close();
+}
+
+const PPB_VideoDestination_Private_0_1
+ g_ppb_video_destination_private_thunk_0_1 = {
+ &Create,
+ &IsVideoDestination,
+ &Open,
+ &PutFrame,
+ &Close
+};
+
+} // namespace
+
+const PPB_VideoDestination_Private_0_1*
+ GetPPB_VideoDestination_Private_0_1_Thunk() {
+ return &g_ppb_video_destination_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_video_source_private_api.h b/ppapi/thunk/ppb_video_source_private_api.h
new file mode 100644
index 0000000..c732051
--- /dev/null
+++ b/ppapi/thunk/ppb_video_source_private_api.h
@@ -0,0 +1,33 @@
+// 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_VIDEO_SOURCE_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_VIDEO_SOURCE_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_VideoFrame_Private;
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_VideoSource_Private_API {
+ public:
+ virtual ~PPB_VideoSource_Private_API() {}
+
+ virtual int32_t Open(const PP_Var& stream_url,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t GetFrame(PP_VideoFrame_Private* frame,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Close() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_VIDEO_SOURCE_PRIVATE_API_H_
diff --git a/ppapi/thunk/ppb_video_source_private_thunk.cc b/ppapi/thunk/ppb_video_source_private_thunk.cc
new file mode 100644
index 0000000..a2910a5
--- /dev/null
+++ b/ppapi/thunk/ppb_video_source_private_thunk.cc
@@ -0,0 +1,71 @@
+// 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/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
+#include "ppapi/c/private/ppb_video_source_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_video_source_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateVideoSource(instance);
+}
+
+PP_Bool IsVideoSource(PP_Resource resource) {
+ EnterResource<PPB_VideoSource_Private_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Open(PP_Resource source,
+ PP_Var stream_url,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_VideoSource_Private_API> enter(source, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open(stream_url, enter.callback()));
+}
+
+int32_t GetFrame(PP_Resource source,
+ PP_VideoFrame_Private* frame,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_VideoSource_Private_API> enter(source, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetFrame(frame, enter.callback()));
+}
+
+void Close(PP_Resource source) {
+ EnterResource<PPB_VideoSource_Private_API> enter(source, true);
+ if (enter.succeeded())
+ enter.object()->Close();
+}
+
+const PPB_VideoSource_Private_0_1 g_ppb_video_source_private_thunk_0_1 = {
+ &Create,
+ &IsVideoSource,
+ &Open,
+ &GetFrame,
+ &Close
+};
+
+} // namespace
+
+const PPB_VideoSource_Private_0_1* GetPPB_VideoSource_Private_0_1_Thunk() {
+ return &g_ppb_video_source_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_view_dev_thunk.cc b/ppapi/thunk/ppb_view_dev_thunk.cc
index 188c807..d3a6374 100644
--- a/ppapi/thunk/ppb_view_dev_thunk.cc
+++ b/ppapi/thunk/ppb_view_dev_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 dev/ppb_view_dev.idl modified Fri Feb 8 14:28:54 2013.
+// From dev/ppb_view_dev.idl modified Thu Mar 28 11:12:59 2013.
#include "ppapi/c/dev/ppb_view_dev.h"
#include "ppapi/c/pp_errors.h"
@@ -19,6 +19,7 @@
namespace {
float GetDeviceScale(PP_Resource resource) {
+ VLOG(4) << "PPB_View_Dev::GetDeviceScale()";
EnterResource<PPB_View_API> enter(resource, true);
if (enter.failed())
return 0.0f;
@@ -26,6 +27,7 @@
}
float GetCSSScale(PP_Resource resource) {
+ VLOG(4) << "PPB_View_Dev::GetCSSScale()";
EnterResource<PPB_View_API> enter(resource, true);
if (enter.failed())
return 0.0f;
diff --git a/ppapi/thunk/ppb_view_thunk.cc b/ppapi/thunk/ppb_view_thunk.cc
index 1aa16e6..3014099 100644
--- a/ppapi/thunk/ppb_view_thunk.cc
+++ b/ppapi/thunk/ppb_view_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_view.idl modified Fri Feb 8 14:28:54 2013.
+// From ppb_view.idl modified Wed Apr 10 14:15:15 2013.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_view.h"
@@ -19,11 +19,13 @@
namespace {
PP_Bool IsView(PP_Resource resource) {
+ VLOG(4) << "PPB_View::IsView()";
EnterResource<PPB_View_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
PP_Bool GetRect(PP_Resource resource, struct PP_Rect* rect) {
+ VLOG(4) << "PPB_View::GetRect()";
EnterResource<PPB_View_API> enter(resource, true);
if (enter.failed())
return PP_FALSE;
@@ -31,6 +33,7 @@
}
PP_Bool IsFullscreen(PP_Resource resource) {
+ VLOG(4) << "PPB_View::IsFullscreen()";
EnterResource<PPB_View_API> enter(resource, true);
if (enter.failed())
return PP_FALSE;
@@ -38,6 +41,7 @@
}
PP_Bool IsVisible(PP_Resource resource) {
+ VLOG(4) << "PPB_View::IsVisible()";
EnterResource<PPB_View_API> enter(resource, true);
if (enter.failed())
return PP_FALSE;
@@ -45,6 +49,7 @@
}
PP_Bool IsPageVisible(PP_Resource resource) {
+ VLOG(4) << "PPB_View::IsPageVisible()";
EnterResource<PPB_View_API> enter(resource, true);
if (enter.failed())
return PP_FALSE;
@@ -52,12 +57,29 @@
}
PP_Bool GetClipRect(PP_Resource resource, struct PP_Rect* clip) {
+ VLOG(4) << "PPB_View::GetClipRect()";
EnterResource<PPB_View_API> enter(resource, true);
if (enter.failed())
return PP_FALSE;
return enter.object()->GetClipRect(clip);
}
+float GetDeviceScale(PP_Resource resource) {
+ VLOG(4) << "PPB_View::GetDeviceScale()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return 0.0f;
+ return enter.object()->GetDeviceScale();
+}
+
+float GetCSSScale(PP_Resource resource) {
+ VLOG(4) << "PPB_View::GetCSSScale()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return 0.0f;
+ return enter.object()->GetCSSScale();
+}
+
const PPB_View_1_0 g_ppb_view_thunk_1_0 = {
&IsView,
&GetRect,
@@ -67,11 +89,26 @@
&GetClipRect
};
+const PPB_View_1_1 g_ppb_view_thunk_1_1 = {
+ &IsView,
+ &GetRect,
+ &IsFullscreen,
+ &IsVisible,
+ &IsPageVisible,
+ &GetClipRect,
+ &GetDeviceScale,
+ &GetCSSScale
+};
+
} // namespace
const PPB_View_1_0* GetPPB_View_1_0_Thunk() {
return &g_ppb_view_thunk_1_0;
}
+const PPB_View_1_1* GetPPB_View_1_1_Thunk() {
+ return &g_ppb_view_thunk_1_1;
+}
+
} // namespace thunk
} // namespace ppapi
diff --git a/ppapi/thunk/ppb_websocket_thunk.cc b/ppapi/thunk/ppb_websocket_thunk.cc
index 527e143..1040665 100644
--- a/ppapi/thunk/ppb_websocket_thunk.cc
+++ b/ppapi/thunk/ppb_websocket_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_websocket.idl modified Thu Dec 27 10:36:33 2012.
+// From ppb_websocket.idl modified Thu Feb 28 11:58:17 2013.
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
@@ -20,6 +20,7 @@
namespace {
PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_WebSocket::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -27,6 +28,7 @@
}
PP_Bool IsWebSocket(PP_Resource resource) {
+ VLOG(4) << "PPB_WebSocket::IsWebSocket()";
EnterResource<PPB_WebSocket_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
@@ -36,6 +38,7 @@
const struct PP_Var protocols[],
uint32_t protocol_count,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_WebSocket::Connect()";
EnterResource<PPB_WebSocket_API> enter(web_socket, callback, false);
if (enter.failed())
return enter.retval();
@@ -49,6 +52,7 @@
uint16_t code,
struct PP_Var reason,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_WebSocket::Close()";
EnterResource<PPB_WebSocket_API> enter(web_socket, callback, false);
if (enter.failed())
return enter.retval();
@@ -58,6 +62,7 @@
int32_t ReceiveMessage(PP_Resource web_socket,
struct PP_Var* message,
struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_WebSocket::ReceiveMessage()";
EnterResource<PPB_WebSocket_API> enter(web_socket, callback, false);
if (enter.failed())
return enter.retval();
@@ -66,6 +71,7 @@
}
int32_t SendMessage(PP_Resource web_socket, struct PP_Var message) {
+ VLOG(4) << "PPB_WebSocket::SendMessage()";
EnterResource<PPB_WebSocket_API> enter(web_socket, false);
if (enter.failed())
return enter.retval();
@@ -73,6 +79,7 @@
}
uint64_t GetBufferedAmount(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetBufferedAmount()";
EnterResource<PPB_WebSocket_API> enter(web_socket, false);
if (enter.failed())
return 0;
@@ -80,6 +87,7 @@
}
uint16_t GetCloseCode(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetCloseCode()";
EnterResource<PPB_WebSocket_API> enter(web_socket, false);
if (enter.failed())
return 0;
@@ -87,6 +95,7 @@
}
struct PP_Var GetCloseReason(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetCloseReason()";
EnterResource<PPB_WebSocket_API> enter(web_socket, false);
if (enter.failed())
return PP_MakeUndefined();
@@ -94,6 +103,7 @@
}
PP_Bool GetCloseWasClean(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetCloseWasClean()";
EnterResource<PPB_WebSocket_API> enter(web_socket, false);
if (enter.failed())
return PP_FALSE;
@@ -101,6 +111,7 @@
}
struct PP_Var GetExtensions(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetExtensions()";
EnterResource<PPB_WebSocket_API> enter(web_socket, false);
if (enter.failed())
return PP_MakeUndefined();
@@ -108,6 +119,7 @@
}
struct PP_Var GetProtocol(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetProtocol()";
EnterResource<PPB_WebSocket_API> enter(web_socket, false);
if (enter.failed())
return PP_MakeUndefined();
@@ -115,6 +127,7 @@
}
PP_WebSocketReadyState GetReadyState(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetReadyState()";
EnterResource<PPB_WebSocket_API> enter(web_socket, false);
if (enter.failed())
return PP_WEBSOCKETREADYSTATE_INVALID;
@@ -122,6 +135,7 @@
}
struct PP_Var GetURL(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetURL()";
EnterResource<PPB_WebSocket_API> enter(web_socket, false);
if (enter.failed())
return PP_MakeUndefined();
diff --git a/ppapi/thunk/ppb_widget_dev_thunk.cc b/ppapi/thunk/ppb_widget_dev_thunk.cc
index c3cf34b..2232371 100644
--- a/ppapi/thunk/ppb_widget_dev_thunk.cc
+++ b/ppapi/thunk/ppb_widget_dev_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 dev/ppb_widget_dev.idl modified Wed Nov 28 12:14:51 2012.
+// From dev/ppb_widget_dev.idl modified Tue Apr 16 11:25:44 2013.
#include "ppapi/c/dev/ppb_widget_dev.h"
#include "ppapi/c/pp_errors.h"
@@ -19,6 +19,7 @@
namespace {
PP_Bool IsWidget(PP_Resource resource) {
+ VLOG(4) << "PPB_Widget_Dev::IsWidget()";
EnterResource<PPB_Widget_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
@@ -26,6 +27,7 @@
PP_Bool Paint(PP_Resource widget,
const struct PP_Rect* rect,
PP_Resource image) {
+ VLOG(4) << "PPB_Widget_Dev::Paint()";
EnterResource<PPB_Widget_API> enter(widget, false);
if (enter.failed())
return PP_FALSE;
@@ -33,6 +35,7 @@
}
PP_Bool HandleEvent(PP_Resource widget, PP_Resource input_event) {
+ VLOG(4) << "PPB_Widget_Dev::HandleEvent()";
EnterResource<PPB_Widget_API> enter(widget, false);
if (enter.failed())
return PP_FALSE;
@@ -40,6 +43,7 @@
}
PP_Bool GetLocation(PP_Resource widget, struct PP_Rect* location) {
+ VLOG(4) << "PPB_Widget_Dev::GetLocation()";
EnterResource<PPB_Widget_API> enter(widget, false);
if (enter.failed())
return PP_FALSE;
@@ -47,15 +51,19 @@
}
void SetLocation(PP_Resource widget, const struct PP_Rect* location) {
+ VLOG(4) << "PPB_Widget_Dev::SetLocation()";
EnterResource<PPB_Widget_API> enter(widget, false);
- if (enter.succeeded())
- enter.object()->SetLocation(location);
+ if (enter.failed())
+ return;
+ enter.object()->SetLocation(location);
}
void SetScale(PP_Resource widget, float scale) {
+ VLOG(4) << "PPB_Widget_Dev::SetScale()";
EnterResource<PPB_Widget_API> enter(widget, false);
- if (enter.succeeded())
- enter.object()->SetScale(scale);
+ if (enter.failed())
+ return;
+ enter.object()->SetScale(scale);
}
const PPB_Widget_Dev_0_3 g_ppb_widget_dev_thunk_0_3 = {
diff --git a/ppapi/thunk/ppb_zoom_dev_thunk.cc b/ppapi/thunk/ppb_zoom_dev_thunk.cc
new file mode 100644
index 0000000..ab0c874
--- /dev/null
+++ b/ppapi/thunk/ppb_zoom_dev_thunk.cc
@@ -0,0 +1,52 @@
+// 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 dev/ppb_zoom_dev.idl modified Wed Apr 24 13:31:08 2013.
+
+#include "ppapi/c/dev/ppb_zoom_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void ZoomChanged(PP_Instance instance, double factor) {
+ VLOG(4) << "PPB_Zoom_Dev::ZoomChanged()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->ZoomChanged(instance, factor);
+}
+
+void ZoomLimitsChanged(PP_Instance instance,
+ double minimum_factor,
+ double maximum_factor) {
+ VLOG(4) << "PPB_Zoom_Dev::ZoomLimitsChanged()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->ZoomLimitsChanged(instance,
+ minimum_factor,
+ maximum_factor);
+}
+
+const PPB_Zoom_Dev_0_2 g_ppb_zoom_dev_thunk_0_2 = {
+ &ZoomChanged,
+ &ZoomLimitsChanged
+};
+
+} // namespace
+
+const PPB_Zoom_Dev_0_2* GetPPB_Zoom_Dev_0_2_Thunk() {
+ return &g_ppb_zoom_dev_thunk_0_2;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_zoom_thunk.cc b/ppapi/thunk/ppb_zoom_thunk.cc
deleted file mode 100644
index 193e856..0000000
--- a/ppapi/thunk/ppb_zoom_thunk.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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.
-
-#include "ppapi/c/dev/ppb_zoom_dev.h"
-#include "ppapi/thunk/thunk.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_instance_api.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-void ZoomChanged(PP_Instance instance, double factor) {
- EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->ZoomChanged(instance, factor);
-}
-
-void ZoomLimitsChanged(PP_Instance instance,
- double minimum_factor,
- double maximum_factor) {
- EnterInstance enter(instance);
- if (enter.succeeded()) {
- enter.functions()->ZoomLimitsChanged(instance,
- minimum_factor, maximum_factor);
- }
-}
-
-const PPB_Zoom_Dev g_ppb_zoom_thunk = {
- &ZoomChanged,
- &ZoomLimitsChanged
-};
-
-} // namespace
-
-const PPB_Zoom_Dev_0_2* GetPPB_Zoom_Dev_0_2_Thunk() {
- return &g_ppb_zoom_thunk;
-}
-
-} // namespace thunk
-} // namespace ppapi
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index 377424a..d2c5129 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -44,7 +44,8 @@
virtual ~ResourceCreationAPI() {}
virtual PP_Resource CreateFileIO(PP_Instance instance) = 0;
- virtual PP_Resource CreateFileRef(PP_Resource file_system,
+ virtual PP_Resource CreateFileRef(PP_Instance instance,
+ PP_Resource file_system,
const char* path) = 0;
virtual PP_Resource CreateFileSystem(PP_Instance instance,
PP_FileSystemType type) = 0;
@@ -83,11 +84,10 @@
uint32_t size) = 0;
virtual PP_Resource CreateTrueTypeFont(
PP_Instance instance,
- const PP_TrueTypeFontDesc_Dev& desc) = 0;
+ const PP_TrueTypeFontDesc_Dev* desc) = 0;
virtual PP_Resource CreateURLLoader(PP_Instance instance) = 0;
virtual PP_Resource CreateURLRequestInfo(
- PP_Instance instance,
- const URLRequestInfoData& data) = 0;
+ PP_Instance instance) = 0;
// Passes a reference to the file_ref_resource, which is a process-local
// resource corresponding to the body_as_file_ref host resource in |data|,
@@ -115,9 +115,9 @@
uint32_t sample_frame_count) = 0;
virtual PP_Resource CreateFileChooser(PP_Instance instance,
PP_FileChooserMode_Dev mode,
- const char* accept_types) = 0;
+ const PP_Var& accept_types) = 0;
virtual PP_Resource CreateGraphics2D(PP_Instance instance,
- const PP_Size& size,
+ const PP_Size* size,
PP_Bool is_always_opaque) = 0;
virtual PP_Resource CreateGraphics3D(PP_Instance instance,
PP_Resource share_context,
@@ -128,11 +128,11 @@
virtual PP_Resource CreateHostResolverPrivate(PP_Instance instance) = 0;
virtual PP_Resource CreateImageData(PP_Instance instance,
PP_ImageDataFormat format,
- const PP_Size& size,
+ const PP_Size* size,
PP_Bool init_to_zero) = 0;
virtual PP_Resource CreateImageDataNaCl(PP_Instance instance,
PP_ImageDataFormat format,
- const PP_Size& size,
+ const PP_Size* size,
PP_Bool init_to_zero) = 0;
virtual PP_Resource CreateNetworkMonitor(
PP_Instance instance,
@@ -151,9 +151,6 @@
PP_Instance instance,
const PP_BrowserFont_Trusted_Description* description) = 0;
virtual PP_Resource CreateBuffer(PP_Instance instance, uint32_t size) = 0;
- virtual PP_Resource CreateDirectoryReader(
- PP_Instance instance,
- PP_Resource directory_ref) = 0;
virtual PP_Resource CreateFlashDeviceID(PP_Instance instance) = 0;
virtual PP_Resource CreateFlashFontFile(
PP_Instance instance,
@@ -170,6 +167,8 @@
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;
diff --git a/ppapi/utility/completion_callback_factory.h b/ppapi/utility/completion_callback_factory.h
index 885767b..37d787e 100644
--- a/ppapi/utility/completion_callback_factory.h
+++ b/ppapi/utility/completion_callback_factory.h
@@ -185,6 +185,10 @@
/// is to accept your output argument as a non-const reference and to swap()
/// the argument with a vector of your own to store it. This means you don't
/// have to copy the buffer to consume it.
+///
+/// NewExtCallbackWithOutput is similar to NewCallbackWithOutput. It creates
+/// ext::ExtCompletionCallbackWithOutput instances which are used by APIs within
+/// the pp::ext namespace.
template <typename T, typename ThreadTraits = ThreadSafeThreadTraits>
class CompletionCallbackFactory {
public:
@@ -279,7 +283,7 @@
/// NewCallbackWithOutput() allocates a new, single-use
/// <code>CompletionCallback</code> where the browser will pass an additional
- /// parameter comtaining the result of the request. The
+ /// parameter containing the result of the request. The
/// <code>CompletionCallback</code> must be run in order for the memory
/// allocated by the methods to be freed.
///
@@ -291,9 +295,33 @@
CompletionCallbackWithOutput<
typename internal::TypeUnwrapper<Output>::StorageType>
NewCallbackWithOutput(void (T::*method)(int32_t, Output)) {
- return NewCallbackWithOutputHelper(new DispatcherWithOutput0<
- typename internal::TypeUnwrapper<Output>::StorageType,
- void (T::*)(int32_t, Output)>(method));
+ typedef typename internal::TypeUnwrapper<Output>::StorageType
+ OutputStorageType;
+ typedef CompletionCallbackWithOutput<OutputStorageType> CallbackType;
+ typedef DispatcherWithOutput0<
+ typename CallbackType::TraitsType,
+ OutputStorageType,
+ void (T::*)(int32_t, Output)> DispatcherType;
+ return NewCallbackWithOutputHelper<CallbackType>(
+ new DispatcherType(method));
+ }
+
+ /// Similar to NewCallbackWithOutput(), but returns an
+ /// <code>ext::ExtCompletionCallbackWithOutput</code>.
+ template <typename Output>
+ ext::ExtCompletionCallbackWithOutput<
+ typename internal::TypeUnwrapper<Output>::StorageType>
+ NewExtCallbackWithOutput(void (T::*method)(int32_t, Output)) {
+ typedef typename internal::TypeUnwrapper<Output>::StorageType
+ OutputStorageType;
+ typedef ext::ExtCompletionCallbackWithOutput<OutputStorageType>
+ CallbackType;
+ typedef DispatcherWithOutput0<
+ typename CallbackType::TraitsType,
+ OutputStorageType,
+ void (T::*)(int32_t, Output)> DispatcherType;
+ return NewCallbackWithOutputHelper<CallbackType>(
+ new DispatcherType(method));
}
/// NewCallback() allocates a new, single-use <code>CompletionCallback</code>.
@@ -337,7 +365,7 @@
/// NewCallbackWithOutput() allocates a new, single-use
/// <code>CompletionCallback</code> where the browser will pass an additional
- /// parameter comtaining the result of the request. The
+ /// parameter containing the result of the request. The
/// <code>CompletionCallback</code> must be run in order for the memory
/// allocated by the methods to be freed.
///
@@ -353,10 +381,36 @@
typename internal::TypeUnwrapper<Output>::StorageType>
NewCallbackWithOutput(void (T::*method)(int32_t, Output, A),
const A& a) {
- return NewCallbackWithOutputHelper(new DispatcherWithOutput1<
- typename internal::TypeUnwrapper<Output>::StorageType,
+ typedef typename internal::TypeUnwrapper<Output>::StorageType
+ OutputStorageType;
+ typedef CompletionCallbackWithOutput<OutputStorageType> CallbackType;
+ typedef DispatcherWithOutput1<
+ typename CallbackType::TraitsType,
+ OutputStorageType,
void (T::*)(int32_t, Output, A),
- typename internal::TypeUnwrapper<A>::StorageType>(method, a));
+ typename internal::TypeUnwrapper<A>::StorageType> DispatcherType;
+ return NewCallbackWithOutputHelper<CallbackType>(
+ new DispatcherType(method, a));
+ }
+
+ /// Similar to NewCallbackWithOutput(), but returns an
+ /// <code>ext::ExtCompletionCallbackWithOutput</code>.
+ template <typename Output, typename A>
+ ext::ExtCompletionCallbackWithOutput<
+ typename internal::TypeUnwrapper<Output>::StorageType>
+ NewExtCallbackWithOutput(void (T::*method)(int32_t, Output, A),
+ const A& a) {
+ typedef typename internal::TypeUnwrapper<Output>::StorageType
+ OutputStorageType;
+ typedef ext::ExtCompletionCallbackWithOutput<OutputStorageType>
+ CallbackType;
+ typedef DispatcherWithOutput1<
+ typename CallbackType::TraitsType,
+ OutputStorageType,
+ void (T::*)(int32_t, Output, A),
+ typename internal::TypeUnwrapper<A>::StorageType> DispatcherType;
+ return NewCallbackWithOutputHelper<CallbackType>(
+ new DispatcherType(method, a));
}
/// NewCallback() allocates a new, single-use
@@ -407,7 +461,7 @@
/// NewCallbackWithOutput() allocates a new, single-use
/// <code>CompletionCallback</code> where the browser will pass an additional
- /// parameter comtaining the result of the request. The
+ /// parameter containing the result of the request. The
/// <code>CompletionCallback</code> must be run in order for the memory
/// allocated by the methods to be freed.
///
@@ -427,11 +481,39 @@
NewCallbackWithOutput(void (T::*method)(int32_t, Output, A, B),
const A& a,
const B& b) {
- return NewCallbackWithOutputHelper(new DispatcherWithOutput2<
- typename internal::TypeUnwrapper<Output>::StorageType,
+ typedef typename internal::TypeUnwrapper<Output>::StorageType
+ OutputStorageType;
+ typedef CompletionCallbackWithOutput<OutputStorageType> CallbackType;
+ typedef DispatcherWithOutput2<
+ typename CallbackType::TraitsType,
+ OutputStorageType,
void (T::*)(int32_t, Output, A, B),
typename internal::TypeUnwrapper<A>::StorageType,
- typename internal::TypeUnwrapper<B>::StorageType>(method, a, b));
+ typename internal::TypeUnwrapper<B>::StorageType> DispatcherType;
+ return NewCallbackWithOutputHelper<CallbackType>(
+ new DispatcherType(method, a, b));
+ }
+
+ /// Similar to NewCallbackWithOutput(), but returns an
+ /// <code>ext::ExtCompletionCallbackWithOutput</code>.
+ template <typename Output, typename A, typename B>
+ ext::ExtCompletionCallbackWithOutput<
+ typename internal::TypeUnwrapper<Output>::StorageType>
+ NewExtCallbackWithOutput(void (T::*method)(int32_t, Output, A, B),
+ const A& a,
+ const B& b) {
+ typedef typename internal::TypeUnwrapper<Output>::StorageType
+ OutputStorageType;
+ typedef ext::ExtCompletionCallbackWithOutput<OutputStorageType>
+ CallbackType;
+ typedef DispatcherWithOutput2<
+ typename CallbackType::TraitsType,
+ OutputStorageType,
+ void (T::*)(int32_t, Output, A, B),
+ typename internal::TypeUnwrapper<A>::StorageType,
+ typename internal::TypeUnwrapper<B>::StorageType> DispatcherType;
+ return NewCallbackWithOutputHelper<CallbackType>(
+ new DispatcherType(method, a, b));
}
/// NewCallback() allocates a new, single-use
@@ -493,7 +575,7 @@
/// NewCallbackWithOutput() allocates a new, single-use
/// <code>CompletionCallback</code> where the browser will pass an additional
- /// parameter comtaining the result of the request. The
+ /// parameter containing the result of the request. The
/// <code>CompletionCallback</code> must be run in order for the memory
/// allocated by the methods to be freed.
///
@@ -516,12 +598,42 @@
const A& a,
const B& b,
const C& c) {
- return NewCallbackWithOutputHelper(new DispatcherWithOutput3<
- typename internal::TypeUnwrapper<Output>::StorageType,
+ typedef typename internal::TypeUnwrapper<Output>::StorageType
+ OutputStorageType;
+ typedef CompletionCallbackWithOutput<OutputStorageType> CallbackType;
+ typedef DispatcherWithOutput3<
+ typename CallbackType::TraitsType,
+ OutputStorageType,
void (T::*)(int32_t, Output, A, B, C),
typename internal::TypeUnwrapper<A>::StorageType,
typename internal::TypeUnwrapper<B>::StorageType,
- typename internal::TypeUnwrapper<C>::StorageType>(method, a, b, c));
+ typename internal::TypeUnwrapper<C>::StorageType> DispatcherType;
+ return NewCallbackWithOutputHelper<CallbackType>(
+ new DispatcherType(method, a, b, c));
+ }
+
+ /// Similar to NewCallbackWithOutput(), but returns an
+ /// <code>ext::ExtCompletionCallbackWithOutput</code>.
+ template <typename Output, typename A, typename B, typename C>
+ ext::ExtCompletionCallbackWithOutput<
+ typename internal::TypeUnwrapper<Output>::StorageType>
+ NewExtCallbackWithOutput(void (T::*method)(int32_t, Output, A, B, C),
+ const A& a,
+ const B& b,
+ const C& c) {
+ typedef typename internal::TypeUnwrapper<Output>::StorageType
+ OutputStorageType;
+ typedef ext::ExtCompletionCallbackWithOutput<OutputStorageType>
+ CallbackType;
+ typedef DispatcherWithOutput3<
+ typename CallbackType::TraitsType,
+ OutputStorageType,
+ void (T::*)(int32_t, Output, A, B, C),
+ typename internal::TypeUnwrapper<A>::StorageType,
+ typename internal::TypeUnwrapper<B>::StorageType,
+ typename internal::TypeUnwrapper<C>::StorageType> DispatcherType;
+ return NewCallbackWithOutputHelper<CallbackType>(
+ new DispatcherType(method, a, b, c));
}
private:
@@ -608,11 +720,10 @@
Method method_;
};
- template <typename Output, typename Method>
+ template <typename Traits, typename Output, typename Method>
class DispatcherWithOutput0 {
public:
typedef Output OutputType;
- typedef internal::CallbackOutputTraits<Output> Traits;
DispatcherWithOutput0()
: method_(NULL),
@@ -659,11 +770,10 @@
A a_;
};
- template <typename Output, typename Method, typename A>
+ template <typename Traits, typename Output, typename Method, typename A>
class DispatcherWithOutput1 {
public:
typedef Output OutputType;
- typedef internal::CallbackOutputTraits<Output> Traits;
DispatcherWithOutput1()
: method_(NULL),
@@ -716,11 +826,14 @@
B b_;
};
- template <typename Output, typename Method, typename A, typename B>
+ template <typename Traits,
+ typename Output,
+ typename Method,
+ typename A,
+ typename B>
class DispatcherWithOutput2 {
public:
typedef Output OutputType;
- typedef internal::CallbackOutputTraits<Output> Traits;
DispatcherWithOutput2()
: method_(NULL),
@@ -779,12 +892,15 @@
C c_;
};
- template <typename Output, typename Method, typename A, typename B,
+ template <typename Traits,
+ typename Output,
+ typename Method,
+ typename A,
+ typename B,
typename C>
class DispatcherWithOutput3 {
public:
typedef Output OutputType;
- typedef internal::CallbackOutputTraits<Output> Traits;
DispatcherWithOutput3()
: method_(NULL),
@@ -849,20 +965,17 @@
}
// Takes ownership of the dispatcher pointer, which should be heap allocated.
- template <typename Dispatcher> CompletionCallbackWithOutput<
- typename internal::TypeUnwrapper<
- typename Dispatcher::OutputType>::StorageType>
- NewCallbackWithOutputHelper(Dispatcher* dispatcher) {
+ template <typename Callback, typename Dispatcher>
+ Callback NewCallbackWithOutputHelper(Dispatcher* dispatcher) {
typename ThreadTraits::AutoLock lock(lock_);
PP_DCHECK(object_); // Expects a non-null object!
CallbackData<Dispatcher>* data =
new CallbackData<Dispatcher>(back_pointer_, dispatcher);
- return CompletionCallbackWithOutput<typename Dispatcher::OutputType>(
- &CallbackData<Dispatcher>::Thunk,
- data,
- data->dispatcher()->output());
+ return Callback(&CallbackData<Dispatcher>::Thunk,
+ data,
+ data->dispatcher()->output());
}
// Disallowed: