diff options
author | Andras Becsi <andras.becsi@digia.com> | 2014-03-18 13:16:26 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-03-20 15:55:39 +0100 |
commit | 3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch) | |
tree | 92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/ppapi | |
parent | e90d7c4b152c56919d963987e2503f9909a666d2 (diff) | |
download | qtwebengine-chromium-3f0f86b0caed75241fa71c95a5d73bc0164348c5.tar.gz |
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies
needed on Windows.
Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42
Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu>
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/ppapi')
261 files changed, 6455 insertions, 5468 deletions
diff --git a/chromium/ppapi/OWNERS b/chromium/ppapi/OWNERS index c4871e2a789..30159636d2f 100644 --- a/chromium/ppapi/OWNERS +++ b/chromium/ppapi/OWNERS @@ -2,4 +2,5 @@ bbudge@chromium.org brettw@chromium.org dmichael@chromium.org raymes@chromium.org +teravest@chromium.org yzshen@chromium.org diff --git a/chromium/ppapi/PRESUBMIT.py b/chromium/ppapi/PRESUBMIT.py index 7d6a400bd4d..46038fbe70e 100644 --- a/chromium/ppapi/PRESUBMIT.py +++ b/chromium/ppapi/PRESUBMIT.py @@ -43,7 +43,8 @@ def RunUnittests(input_api, output_api): # Verify that the files do not contain a 'TODO' in them. RE_TODO = re.compile(r'\WTODO\W', flags=re.I) def CheckTODO(input_api, output_api): - files = input_api.LocalPaths() + live_files = input_api.AffectedFiles(include_deletes=False) + files = [f.LocalPath() for f in live_files] todo = [] for filename in files: @@ -81,7 +82,8 @@ def CheckTODO(input_api, output_api): # Verify that no CPP wrappers use un-versioned PPB interface name macros. RE_UNVERSIONED_PPB = re.compile(r'\bPPB_\w+_INTERFACE\b') def CheckUnversionedPPB(input_api, output_api): - files = input_api.LocalPaths() + live_files = input_api.AffectedFiles(include_deletes=False) + files = [f.LocalPath() for f in live_files] todo = [] for filename in files: diff --git a/chromium/ppapi/README.chromium b/chromium/ppapi/README.chromium deleted file mode 100644 index 5d0b4244e21..00000000000 --- a/chromium/ppapi/README.chromium +++ /dev/null @@ -1,4 +0,0 @@ -Name: PPAPI -URL: http://code.google.com/p/ppapi -License: BSD and MIT -Security Critical: yes diff --git a/chromium/ppapi/api/OWNERS b/chromium/ppapi/api/OWNERS deleted file mode 100644 index f7c2b723263..00000000000 --- a/chromium/ppapi/api/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -noelallen@chromium.org -binji@chromium.org -nfullagar@chromium.org diff --git a/chromium/ppapi/api/dev/pp_optional_structs_dev.idl b/chromium/ppapi/api/dev/pp_optional_structs_dev.idl new file mode 100644 index 00000000000..3e0829fe40f --- /dev/null +++ b/chromium/ppapi/api/dev/pp_optional_structs_dev.idl @@ -0,0 +1,14 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines optional structs for primitive types. + */ + +struct PP_Optional_Double_Dev { + double_t value; + PP_Bool is_set; +}; + diff --git a/chromium/ppapi/api/dev/ppb_alarms_dev.idl b/chromium/ppapi/api/dev/ppb_alarms_dev.idl new file mode 100644 index 00000000000..b2345c4c5cb --- /dev/null +++ b/chromium/ppapi/api/dev/ppb_alarms_dev.idl @@ -0,0 +1,181 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the Pepper equivalent of the <code>chrome.alarms</code> + * extension API. + */ + +label Chrome { + M33 = 0.1 +}; + +struct PP_Alarms_Alarm_Dev { + /** + * Name of this alarm. + */ + PP_Var name; + /** + * Time at which this alarm was scheduled to fire, in milliseconds past the + * epoch. For performance reasons, the alarm may have been delayed an + * arbitrary amount beyond this. + */ + double_t scheduled_time; + /** + * If set, the alarm is a repeating alarm and will fire again in + * <code>period_in_minutes</code> minutes. + */ + PP_Optional_Double_Dev period_in_minutes; +}; + +struct PP_Alarms_AlarmCreateInfo_Dev { + /** + * Time at which the alarm should fire, in milliseconds past the epoch. + */ + PP_Optional_Double_Dev when; + /** + * Length of time in minutes after which the + * <code>PP_Alarms_OnAlarm_Dev</code> event should fire. + */ + PP_Optional_Double_Dev delay_in_minutes; + /** + * If set, the <code>PP_Alarms_OnAlarm_Dev</code> event should fire every + * <code>period_in_minutes</code> minutes after the initial event specified by + * <code>when</code> or <code>delay_in_minutes</code>. If not set, the alarm + * will only fire once. + */ + PP_Optional_Double_Dev period_in_minutes; +}; + +struct PP_Alarms_Alarm_Array_Dev { + uint32_t size; + [size_is(count)] PP_Alarms_Alarm_Dev[] elements; +}; + +/** + * Fired when an alarm has elapsed. Useful for event pages. + * + * @param[in] listener_id The listener ID. + * @param[inout] user_data The opaque pointer that was used when registering the + * listener. + * @param[in] alarm The alarm that has elapsed. + */ +typedef void PP_Alarms_OnAlarm_Dev( + [in] uint32_t listener_id, + [inout] mem_t user_data, + [in] PP_Alarms_Alarm_Dev alarm); + +interface PPB_Alarms_Dev { + /** + * Creates an alarm. Near the time(s) specified by <code>alarm_info</code>, + * the <code>PP_Alarms_OnAlarm_Dev</code> event is fired. If there is another + * alarm with the same name (or no name if none is specified), it will be + * cancelled and replaced by this alarm. + * + * In order to reduce the load on the user's machine, Chrome limits alarms + * to at most once every 1 minute but may delay them an arbitrary amount more. + * That is, setting + * <code>PP_Alarms_AlarmCreateInfo_Dev.delay_in_minutes</code> or + * <code>PP_Alarms_AlarmCreateInfo_Dev.period_in_minutes</code> to less than + * <code>1</code> will not be honored and will cause a warning. + * <code>PP_Alarms_AlarmCreateInfo_Dev.when</code> can be set to less than 1 + * minute after "now" without warning but won't actually cause the alarm to + * fire for at least 1 minute. + * + * To help you debug your app or extension, when you've loaded it unpacked, + * there's no limit to how often the alarm can fire. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to + * identify this alarm. Defaults to the empty string. + * @param[in] alarm_info Describes when the alarm should fire. The initial + * time must be specified by either <code>when</code> or + * <code>delay_in_minutes</code> (but not both). If + * <code>period_in_minutes</code> is set, the alarm will repeat every + * <code>period_in_minutes</code> minutes after the initial event. If neither + * <code>when</code> or <code>delay_in_minutes</code> is set for a repeating + * alarm, <code>period_in_minutes</code> is used as the default for + * <code>delay_in_minutes</code>. + */ + void Create( + [in] PP_Instance instance, + [in] PP_Var name, + [in] PP_Alarms_AlarmCreateInfo_Dev alarm_info); + + /** + * Retrieves details about the specified alarm. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. The name of the + * alarm to get. Defaults to the empty string. + * @param[out] alarm A <code>PP_Alarms_Alarm_Dev</code> struct to store the + * output result. + * @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 Get( + [in] PP_Instance instance, + [in] PP_Var name, + [out] PP_Alarms_Alarm_Dev alarm, + [in] PP_CompletionCallback callback); + + /** + * Gets an array of all the alarms. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[out] alarms A <code>PP_Alarms_Alarm_Array_Dev</code> to store the + * output result. + * @param[in] array_allocator A <code>PP_ArrayOutput</code> to allocate memory + * for <code>alarms</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 GetAll( + [in] PP_Instance instance, + [out] PP_Alarms_Alarm_Array_Dev alarms, + [in] PP_ArrayOutput array_allocator, + [in] PP_CompletionCallback callback); + + /** + * Clears the alarm with the given name. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. The name of the + * alarm to clear. Defaults to the empty string. + */ + void Clear( + [in] PP_Instance instance, + [in] PP_Var name); + + /** + * Clears all alarms. + * + * @param[in] instance A <code>PP_Instance</code>. + */ + void ClearAll( + [in] PP_Instance instance); + + /** + * Registers <code>PP_Alarms_OnAlarm_Dev</code> event. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] callback The callback to receive notifications. + * @param[inout] user_data An opaque pointer that will be passed to + * <code>callback</code>. + * + * @return A listener ID, or 0 if failed. + * + * TODO(yzshen): add a PPB_Events_Dev interface for unregistering: + * void UnregisterListener(PP_instance instance, uint32_t listener_id); + */ + uint32_t AddOnAlarmListener( + [in] PP_Instance instance, + [in] PP_Alarms_OnAlarm_Dev callback, + [inout] mem_t user_data); +}; diff --git a/chromium/ppapi/api/dev/ppb_file_io_dev.idl b/chromium/ppapi/api/dev/ppb_file_io_dev.idl new file mode 100644 index 00000000000..82a64521116 --- /dev/null +++ b/chromium/ppapi/api/dev/ppb_file_io_dev.idl @@ -0,0 +1,116 @@ +/* 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 methods for use with a PPB_FileIO resource that may become + * stable in the future. For now, they can be used only in plugins with DEV + * permissions. + */ + +label Chrome { + M31 = 0.1 +}; + +/** + * The PP_FileMapProtection values indicate the permissions requested for the + * file mapping. These should be used in a uint32_t bitfield. + */ +[assert_size(4)] + enum PP_FileMapProtection { + /** Requests read access to the mapped address. */ + PP_FILEMAPPROTECTION_READ = 1u << 0, + + /** Requests write access to the mapped address. */ + PP_FILEMAPPROTECTION_WRITE = 1u << 1 +}; + +/** + * The PP_FileMapFlags contain flag values for use with Map(). + */ +[assert_size(4)] + enum PP_FileMapFlags { + /** + * Requests a shared mapping. If this flag is set, changes written to the + * memory region will be reflected in the underlying file and will thus + * eventually be visible to other processes which have opened the file. The + * file may not actually be updated until Unmap() is called. This is only + * valid if the PPB_FileIO resource was opened with write permission. + */ + PP_FILEMAPFLAG_SHARED = 1u << 0, + + /** + * Requests a copy-on-write mapping. If this flag is set, changes are not + * written to the underlying file, but only in the memory of the process + * (copy-on-write). + */ + PP_FILEMAPFLAG_PRIVATE = 1u << 1, + + /** + * Forces Map() to map the file contents at the provided |address|. If Map() + * can not comply, Map() will fail. + */ + PP_FILEMAPFLAG_FIXED = 1u << 2 +}; + +/** + * PPB_FileIO_Dev contains functions that are usable with PPB_FileIO resources + * but aren't yet considered stable yet and thus are not supported for general + * NaCl or PNaCl apps yet. Features here are being tested and refined for + * possible future inclusion in (stable) PPB_FileIO. + */ +interface PPB_FileIO_Dev { + /** + * Map() maps the contents from an offset of the file into memory. + * + * @param[in] file_io A PP_Resource corresponding to a file. + * @param[in] length The number of bytes to map. + * @param[in] map_protection A bitfield containing values from + * PP_FileMapProtection, indicating what memory operations should be permitted + * on the mapped region. + * @param[in] map_flags A bitfield containing values from + * PP_FileMapFlags, providing options for the behavior of Map. If the region + * is to be writeable, then exactly one of PP_FILEMAPFLAG_SHARED or + * PP_FILEMAPFLAG_PRIVATE must be set. + * @param[in] offset The offset into the file. Must be a multiple of the + * Map page size as returned by GetMapPageSize. + * @param[inout] address The value of |*address|, if non-NULL, will be used as + * a hint to determine where in memory the file should be mapped. If the value + * is NULL, the host operating system will choose |address|. Upon + * Map() completing, |*address| will contain the actual memory location at + * which the file was mapped. If the plugin provides a non-NULL |*address|, it + * must be a multiple of the map page size as returned by GetMapPageSize(). + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Map(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t Map([in] PP_Resource file_io, + [in] int64_t length, + [in] uint32_t map_protection, + [in] uint32_t map_flags, + [in] int64_t offset, + [inout] mem_ptr_t address, + [in] PP_CompletionCallback callback); + + /** + * Unmap() deletes the mapping of the specified address address to a + * file io. The specified address must have been retrieved with + * Map(). + * @param[in] file_io A PP_Resource corresponding to a file. + * @param[in] address The starting address of the address in memory to + * be unmapped. + * @param[in] length The length of the region to unmap. + */ + void Unmap(PP_Resource file_io, mem_t address, int64_t length); + + /** + * GetMapPageSize() returns the size of pages that Map() uses. Returns 0 on + * failure. + */ + [on_failure=0] + int64_t GetMapPageSize(PP_Resource file_io); +}; + diff --git a/chromium/ppapi/api/dev/ppb_graphics_2d_dev.idl b/chromium/ppapi/api/dev/ppb_graphics_2d_dev.idl index 33b5f59318a..28a844416a6 100644 --- a/chromium/ppapi/api/dev/ppb_graphics_2d_dev.idl +++ b/chromium/ppapi/api/dev/ppb_graphics_2d_dev.idl @@ -8,7 +8,28 @@ [generate_thunk] label Chrome { - M22 = 0.1 + M22 = 0.1, + M32 = 0.2 +}; + +/** + * These options affect how the existing graphics context is displayed when a + * plugin is resized. + */ +[assert_size(4)] +enum PP_Graphics2D_Dev_ResizeMode { + /** + * In this mode, the context does not change size or offset. If the backing + * store is the same size as the plugin element, this will result in the + * pixels on the right side of the plugin element being unavailable, revealing + * the contents underneath it. + */ + PP_GRAPHICS2D_DEV_RESIZEMODE_DEFAULT, + /** + * In this mode, the context and its offset are scaled relative to how much + * the plugin element has been resized. + */ + PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH }; /* PPB_Graphics2D_Dev interface */ @@ -24,7 +45,7 @@ interface PPB_Graphics2D_Dev { * 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] 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 @@ -45,5 +66,31 @@ interface PPB_Graphics2D_Dev { */ float_t GetScale( [in] PP_Resource resource); -}; + + /*** + * Sets the offset into the plugin element at which the graphics context is + * painted. This allows a portion of the plugin element to be painted to. + * The new offset will only be applied after Flush() has been called. + * + * @param[in] resource A <code>Graphics2D</code> context resource. + * @param[in] offset The offset at which the context should be painted. + */ + [version=0.2] + void SetOffset( + [in] PP_Resource resource, + [in] PP_Point offset); + + /*** + * Sets the resize mode for the graphics context. When a plugin element is + * resized in the DOM, it takes time for the plugin to update the graphics + * context in the renderer. These options affect how the existing context is + * displayed until the backing store is updated by the plugin. + * + * @param[in] resource A <code>Graphics2D</code> context resource. + * @param[in] resize_mode The resize mode to change this context to. + */ + void SetResizeMode( + [in] PP_Resource resource, + [in] PP_Graphics2D_Dev_ResizeMode resize_mode); +}; diff --git a/chromium/ppapi/api/dev/ppb_truetype_font_dev.idl b/chromium/ppapi/api/dev/ppb_truetype_font_dev.idl index b327eec681b..8a3ff2b0f0a 100644 --- a/chromium/ppapi/api/dev/ppb_truetype_font_dev.idl +++ b/chromium/ppapi/api/dev/ppb_truetype_font_dev.idl @@ -249,7 +249,8 @@ interface PPB_TrueTypeFont_Dev { * @param[in] table A 4 byte value indicating which table to copy. * For example, 'glyf' will cause the outline table to be copied into the * output array. A zero tag value will cause the entire font to be copied. - * @param[in] offset The offset into the font table. + * @param[in] offset The offset into the font table. Passing an offset + * greater than or equal to the table size will succeed with 0 bytes copied. * @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. diff --git a/chromium/ppapi/api/dev/ppb_url_util_dev.idl b/chromium/ppapi/api/dev/ppb_url_util_dev.idl index 6cd0e756740..f3eb66f90f1 100644 --- a/chromium/ppapi/api/dev/ppb_url_util_dev.idl +++ b/chromium/ppapi/api/dev/ppb_url_util_dev.idl @@ -7,8 +7,6 @@ * This file defines the <code>PPB_URLUtil_Dev</code> interface. */ -[generate_thunk] - label Chrome { M17 = 0.6, M31 = 0.7 diff --git a/chromium/ppapi/api/dev/ppb_var_resource_dev.idl b/chromium/ppapi/api/dev/ppb_var_resource_dev.idl new file mode 100644 index 00000000000..2e5a6f307cc --- /dev/null +++ b/chromium/ppapi/api/dev/ppb_var_resource_dev.idl @@ -0,0 +1,38 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the <code>PPB_VarResource</code> struct providing + * a way to interact with resource vars. + */ + +label Chrome { + M32 = 0.1 +}; + +[macro="PPB_VAR_RESOURCE_DEV_INTERFACE"] +interface PPB_VarResource_Dev { + /** + * Converts a resource-type var to a <code>PP_Resource</code>. + * + * @param[in] var A <code>PP_Var</code> struct containing a resource-type var. + * + * @return A <code>PP_Resource</code> retrieved from the var, or 0 if the var + * is not a resource. The reference count of the resource is incremented on + * behalf of the caller. + */ + PP_Resource VarToResource([in] PP_Var var); + + /** + * Creates a new <code>PP_Var</code> from a given resource. + * + * @param[in] resource A <code>PP_Resource</code> to be wrapped in a var. + * + * @return A <code>PP_Var</code> created for this resource, with type + * <code>PP_VARTYPE_RESOURCE</code>. The reference count of the var is set to + * 1 on behalf of the caller. + */ + PP_Var VarFromResource([in] PP_Resource resource); +}; diff --git a/chromium/ppapi/api/dev/ppb_video_decoder_dev.idl b/chromium/ppapi/api/dev/ppb_video_decoder_dev.idl index 5b1a94eaa1d..da408c94fce 100644 --- a/chromium/ppapi/api/dev/ppb_video_decoder_dev.idl +++ b/chromium/ppapi/api/dev/ppb_video_decoder_dev.idl @@ -62,7 +62,8 @@ interface PPB_VideoDecoder_Dev { * * Parameters: * |video_decoder| is the previously created handle to the decoder resource. - * |bitstream_buffer| is the bitstream buffer that contains the input data. + * |bitstream_buffer| is the bitstream buffer that contains at most one + * input frame. * |callback| will be called when |bitstream_buffer| has been processed by * the decoder. * diff --git a/chromium/ppapi/api/dev/ppp_video_decoder_dev.idl b/chromium/ppapi/api/dev/ppp_video_decoder_dev.idl index 1f6d8c66c44..42546ec18d8 100644 --- a/chromium/ppapi/api/dev/ppp_video_decoder_dev.idl +++ b/chromium/ppapi/api/dev/ppp_video_decoder_dev.idl @@ -7,8 +7,6 @@ * This file defines the <code>PPP_VideoDecoder_Dev</code> interface. */ label Chrome { - M14 = 0.9, - M18 = 0.10, M21 = 0.11 }; @@ -33,28 +31,8 @@ interface PPP_VideoDecoder_Dev { * |decoder| the PPB_VideoDecoder_Dev resource. * |req_num_of_bufs| tells how many buffers are needed by the decoder. * |dimensions| tells the dimensions of the buffer to allocate. - */ - [deprecate=0.11] - void ProvidePictureBuffers( - [in] PP_Instance instance, - [in] PP_Resource decoder, - [in] uint32_t req_num_of_bufs, - [in] PP_Size dimensions); - - /** - * Callback function to provide buffers for the decoded output pictures. If - * succeeds plugin must provide buffers through AssignPictureBuffers function - * to the API. If |req_num_of_bufs| matching exactly the specification - * given in the parameters cannot be allocated decoder should be destroyed. - * - * Decoding will not proceed until buffers have been provided. - * - * Parameters: - * |instance| the plugin instance to which the callback is responding. - * |decoder| the PPB_VideoDecoder_Dev resource. - * |req_num_of_bufs| tells how many buffers are needed by the decoder. - * |dimensions| tells the dimensions of the buffer to allocate. - * |texture_target| the type of texture used. + * |texture_target| the type of texture used. Sample targets in use are + * TEXTURE_2D (most platforms) and TEXTURE_EXTERNAL_OES (on ARM). */ [version=0.11] void ProvidePictureBuffers( @@ -94,20 +72,6 @@ interface PPP_VideoDecoder_Dev { [in] PP_Picture_Dev picture); /** - * Callback function to tell the plugin that decoder has decoded end of stream - * marker and output all the pictures that should be displayed from the - * stream. - * - * Parameters: - * |instance| the plugin instance to which the callback is responding. - * |decoder| the PPB_VideoDecoder_Dev resource. - */ - [deprecate=0.10] - void EndOfStream( - [in] PP_Instance instance, - [in] PP_Resource decoder); - - /** * Error handler callback for decoder to deliver information about detected * errors to the plugin. * diff --git a/chromium/ppapi/api/extensions/dev/ppb_ext_alarms_dev.idl b/chromium/ppapi/api/extensions/dev/ppb_ext_alarms_dev.idl deleted file mode 100644 index 9e1fc65e292..00000000000 --- a/chromium/ppapi/api/extensions/dev/ppb_ext_alarms_dev.idl +++ /dev/null @@ -1,178 +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. - */ - -/** - * This file defines the Pepper equivalent of the <code>chrome.alarms</code> - * extension API. - */ - -label Chrome { - M27 = 0.1 -}; - -#inline c -#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h" -#endinl - -/** - * A dictionary <code>PP_Var</code> which contains: - * - "name" : string <code>PP_Var</code> - * Name of this alarm. - * - * - "scheduledTime" : double <code>PP_Var</code> - * Time at which this alarm was scheduled to fire, in milliseconds past the - * epoch (e.g. <code>Date.now() + n</code>). For performance reasons, the - * alarm may have been delayed an arbitrary amount beyond this. - * - * - "periodInMinutes" : double or undefined <code>PP_Var</code> - * If not undefined, the alarm is a repeating alarm and will fire again in - * <var>periodInMinutes</var> minutes. - */ -typedef PP_Var PP_Ext_Alarms_Alarm_Dev; - -/** - * A dictionary <code>PP_Var</code> which contains - * - "when" : double or undefined <code>PP_Var</code> - * Time at which the alarm should fire, in milliseconds past the epoch - * (e.g. <code>Date.now() + n</code>). - * - * - "delayInMinutes" : double or undefined <code>PP_Var</code> - * Length of time in minutes after which the - * <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire. - * - * - "periodInMinutes" : double or undefined <code>PP_Var</code> - * If set, the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire every - * <var>periodInMinutes</var> minutes after the initial event specified by - * <var>when</var> or <var>delayInMinutes</var>. If not set, the alarm will - * only fire once. - */ -typedef PP_Var PP_Ext_Alarms_AlarmCreateInfo_Dev; - -/** - * An array <code>PP_Var</code> which contains elements of - * <code>PP_Ext_Alarms_Alarm_Dev</code>. - */ -typedef PP_Var PP_Ext_Alarms_Alarm_Dev_Array; - -interface PPB_Ext_Alarms_Dev { - /** - * Creates an alarm. Near the time(s) specified by <var>alarm_info</var>, - * the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event is fired. If there is - * another alarm with the same name (or no name if none is specified), it will - * be cancelled and replaced by this alarm. - * - * In order to reduce the load on the user's machine, Chrome limits alarms - * to at most once every 1 minute but may delay them an arbitrary amount - * more. That is, setting - * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.delayInMinutes - * delayInMinutes]</code> or - * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.periodInMinutes - * periodInMinutes]</code> to less than <code>1</code> will not be honored - * and will cause a warning. - * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.when when]</code> can be set - * to less than 1 minute after "now" without warning but won't actually cause - * the alarm to fire for at least 1 minute. - * - * To help you debug your app or extension, when you've loaded it unpacked, - * there's no limit to how often the alarm can fire. - * - * @param[in] instance A <code>PP_Instance</code>. - * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to - * identify this alarm. Defaults to the empty string. - * @param[in] alarm_info A <code>PP_Var</code> whose contents conform to the - * description of <code>PP_Ext_Alarms_AlarmCreateInfo_Dev</code>. Describes - * when the alarm should fire. The initial time must be specified by either - * <var>when</var> or <var>delayInMinutes</var> (but not both). If - * <var>periodInMinutes</var> is set, the alarm will repeat every - * <var>periodInMinutes</var> minutes after the initial event. If neither - * <var>when</var> or <var>delayInMinutes</var> is set for a repeating alarm, - * <var>periodInMinutes</var> is used as the default for - * <var>delayInMinutes</var>. - */ - void Create( - [in] PP_Instance instance, - [in] PP_Var name, - [in] PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info); - - /** - * Retrieves details about the specified alarm. - * - * @param[in] instance A <code>PP_Instance</code>. - * @param[in] name A string or undefined <code>PP_Var</code>. The name of the - * alarm to get. Defaults to the empty string. - * @param[out] alarm A <code>PP_Var</code> whose contents conform to the - * description of <code>PP_Ext_Alarms_Alarm_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 Get( - [in] PP_Instance instance, - [in] PP_Var name, - [out] PP_Ext_Alarms_Alarm_Dev alarm, - [in] PP_CompletionCallback callback); - - /** - * Gets an array of all the alarms. - * - * @param[in] instance A <code>PP_Instance</code>. - * @param[out] alarms A <code>PP_Var</code> whose contents conform to the - * description of <code>PP_Ext_Alarms_Alarm_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 GetAll( - [in] PP_Instance instance, - [out] PP_Ext_Alarms_Alarm_Dev_Array alarms, - [in] PP_CompletionCallback callback); - - /** - * Clears the alarm with the given name. - * - * @param[in] instance A <code>PP_Instance</code>. - * @param[in] name A string or undefined <code>PP_Var</code>. The name of the - * alarm to clear. Defaults to the empty string. - */ - void Clear( - [in] PP_Instance instance, - [in] PP_Var name); - - /** - * Clears all alarms. - * - * @param[in] instance A <code>PP_Instance</code>. - */ - void ClearAll( - [in] PP_Instance instance); -}; - -/** - * Fired when an alarm has elapsed. Useful for event pages. - * - * @param[in] listener_id The listener ID. - * @param[inout] user_data The opaque pointer that was used when registering the - * listener. - * @param[in] alarm A <code>PP_Var</code> whose contents conform to the - * description of <code>PP_Ext_Alarms_Alarm_Dev</code>. The alarm that has - * elapsed. - */ -typedef void PP_Ext_Alarms_OnAlarm_Func_Dev_0_1( - [in] uint32_t listener_id, - [inout] mem_t user_data, - [in] PP_Ext_Alarms_Alarm_Dev alarm); - -#inline c -PP_INLINE struct PP_Ext_EventListener PP_Ext_Alarms_OnAlarm_Dev_0_1( - PP_Ext_Alarms_OnAlarm_Func_Dev_0_1 func, - void* user_data) { - return PP_Ext_MakeEventListener("alarms.onAlarm;0.1", - (PP_Ext_GenericFuncType)(func), user_data); -} - -#define PP_Ext_Alarms_OnAlarm_Dev PP_Ext_Alarms_OnAlarm_Dev_0_1 -#endinl diff --git a/chromium/ppapi/api/extensions/dev/ppb_ext_events_dev.idl b/chromium/ppapi/api/extensions/dev/ppb_ext_events_dev.idl deleted file mode 100644 index cfcc809c7cc..00000000000 --- a/chromium/ppapi/api/extensions/dev/ppb_ext_events_dev.idl +++ /dev/null @@ -1,87 +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. - */ - -label Chrome { - M27 = 0.1 -}; - -/** - * Used to represent arbitrary C function pointers. Please note that usually - * the function that a <code>PP_Ext_GenericFuncType</code> pointer points to - * has a different signature than <code>void (*)()</code>. - */ -typedef void PP_Ext_GenericFuncType(); - -/** - * An event listener that can be registered with the browser and receive - * notifications via the callback function. - * - * A function is defined for each event type to return a properly-filled - * <code>PP_Ext_EventListener</code> struct, for example, - * <code>PP_Ext_Alarms_OnAlarm_Dev()</code>. - */ -[passByValue] -struct PP_Ext_EventListener { - /** - * The name of the event to register to. - */ - cstr_t event_name; - /** - * A callback function whose signature is determined by - * <code>event_name</code>. All calls will happen on the same thread as the - * one on which <code>AddListener()</code> is called. - */ - PP_Ext_GenericFuncType func; - /** - * An opaque pointer that will be passed to <code>func</code>. - */ - mem_t user_data; -}; - -interface PPB_Ext_Events_Dev { - /** - * Registers a listener to an event. - * - * @param[in] instance A <code>PP_Instance</code> identifying one instance of - * a module. - * @param[in] listener A <code>PP_Ext_EventListener</code> struct. - * - * @return An listener ID, or 0 if failed. - */ - uint32_t AddListener( - [in] PP_Instance instance, - [in] PP_Ext_EventListener listener); - - /** - * Deregisters a listener. - * - * @param[in] instance A <code>PP_Instance</code> identifying one instance of - * a module. - * @param[in] listener_id The ID returned by <code>AddListener()</code>. - */ - void RemoveListener( - [in] PP_Instance instance, - [in] uint32_t listener_id); -}; - -#inline c -/** - * Creates a <code>PP_Ext_EventListener</code> struct. - * - * Usually you should not call it directly. Instead you should call those - * functions that return a <code>PP_Ext_EventListener</code> struct for a - * specific event type, for example, <code>PP_Ext_Alarms_OnAlarm_Dev()</code>. - */ -PP_INLINE struct PP_Ext_EventListener PP_Ext_MakeEventListener( - const char* event_name, - PP_Ext_GenericFuncType func, - void* user_data) { - struct PP_Ext_EventListener listener; - listener.event_name = event_name; - listener.func = func; - listener.user_data = user_data; - return listener; -} -#endinl diff --git a/chromium/ppapi/api/pp_array_output.idl b/chromium/ppapi/api/pp_array_output.idl index be1aca7bf83..8e04a4cc9d7 100644 --- a/chromium/ppapi/api/pp_array_output.idl +++ b/chromium/ppapi/api/pp_array_output.idl @@ -9,7 +9,7 @@ * * This function will be called reentrantly. This means that if you call a * function PPB_Foo.GetData(&array_output), GetData will call your - * GetDataBuffer function before it returns. + * GetDataBuffer function before it returns. * * This function will be called even when returning 0-length arrays, so be sure * your implementation can support that. You can return NULL for 0 length @@ -34,7 +34,10 @@ * @param element_size The size of each element in bytes. * * @return Returns a pointer to the allocated memory. On failure, returns null. - * You can also return null if the element_count is 0. + * You can also return null if the element_count is 0. When a non-null value is + * returned, the buffer must remain valid until after the callback runs. If used + * with a blocking callback, the buffer must remain valid until after the + * function returns. The plugin can then free any memory that it allocated. */ typedef mem_t PP_ArrayOutput_GetDataBuffer([inout] mem_t user_data, [in] uint32_t element_count, @@ -78,7 +81,7 @@ typedef mem_t PP_ArrayOutput_GetDataBuffer([inout] mem_t user_data, [passByValue] struct PP_ArrayOutput { /** - * A pointer to the allocation function that the browser implements. + * A pointer to the allocation function that the browser will call. */ PP_ArrayOutput_GetDataBuffer GetDataBuffer; diff --git a/chromium/ppapi/api/pp_stdint.idl b/chromium/ppapi/api/pp_stdint.idl index 0a6d6b6a78b..9f54d63bad3 100644 --- a/chromium/ppapi/api/pp_stdint.idl +++ b/chromium/ppapi/api/pp_stdint.idl @@ -40,6 +40,9 @@ describe { /** Pointer to memory (void *). */ mem_t; + /** Pointer to pointer to memory (void **). */ + mem_ptr_t; + /** Pointer to null terminated string (char *). */ str_t; diff --git a/chromium/ppapi/api/ppb_file_io.idl b/chromium/ppapi/api/ppb_file_io.idl index 2e43ec54c1c..9b8c9e22bdf 100644 --- a/chromium/ppapi/api/ppb_file_io.idl +++ b/chromium/ppapi/api/ppb_file_io.idl @@ -121,7 +121,9 @@ interface PPB_FileIO { * @param[out] info The <code>PP_FileInfo</code> structure representing all * information about the file. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Query(). + * completion of Query(). <code>info</code> must remain valid until after the + * callback runs. If you pass a blocking callback, <code>info</code> must + * remain valid until after Query() returns. * * @return An int32_t containing an error code from <code>pp_errors.h</code>. * PP_ERROR_FAILED will be returned if the file isn't opened, and @@ -158,6 +160,7 @@ interface PPB_FileIO { * large enough to hold the specified number of bytes to read. This function * might perform a partial read, meaning all the requested bytes * might not be returned, even if the end of the file has not been reached. + * The FileIO object must have been opened with read access. * * ReadToArray() is preferred to Read() when doing asynchronous operations. * @@ -168,7 +171,9 @@ interface PPB_FileIO { * @param[in] bytes_to_read The number of bytes to read from * <code>offset</code>. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Read(). + * completion of Read(). <code>buffer</code> must remain valid until after + * the callback runs. If you pass a blocking callback, <code>buffer</code> + * must remain valid until after Read() returns. * * @return The number of bytes read or an error code from * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was @@ -260,7 +265,8 @@ interface PPB_FileIO { /** * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be * provided so that output will be stored in its allocated buffer. This - * function might perform a partial read. + * function might perform a partial read. The FileIO object must have been + * opened with read access. * * @param[in] file_io A <code>PP_Resource</code> corresponding to a file * FileIO. diff --git a/chromium/ppapi/api/private/finish_writing_these/ppb_pdf.idl b/chromium/ppapi/api/private/finish_writing_these/ppb_pdf.idl index 3038d92b30d..d586f09c38f 100644 --- a/chromium/ppapi/api/private/finish_writing_these/ppb_pdf.idl +++ b/chromium/ppapi/api/private/finish_writing_these/ppb_pdf.idl @@ -146,4 +146,8 @@ interface PPB_PDF_0_1 { PP_Var ModalPromptForPassword( [in] PP_Instance instance, [in] PP_Var message); + + /* Returns PP_TRUE if the plugin is out of process. */ + PP_Bool IsOutOfProcess( + [in] PP_Instance instance); }; diff --git a/chromium/ppapi/api/private/pp_content_decryptor.idl b/chromium/ppapi/api/private/pp_content_decryptor.idl index aba404f8bb4..41a39974083 100644 --- a/chromium/ppapi/api/private/pp_content_decryptor.idl +++ b/chromium/ppapi/api/private/pp_content_decryptor.idl @@ -140,6 +140,20 @@ enum PP_DecryptedFrameFormat { }; /** + * <code>PP_DecryptedSampleFormat</code> contains audio sample formats. + */ +[assert_size(4)] +enum PP_DecryptedSampleFormat { + PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDSAMPLEFORMAT_U8 = 1, + PP_DECRYPTEDSAMPLEFORMAT_S16 = 2, + PP_DECRYPTEDSAMPLEFORMAT_S32 = 3, + PP_DECRYPTEDSAMPLEFORMAT_F32 = 4, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16 = 5, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32 = 6 +}; + +/** * The <code>PP_DecryptResult</code> enum contains decryption and decoding * result constants. */ @@ -235,6 +249,40 @@ struct PP_DecryptedFrameInfo { }; /** + * <code>PP_DecryptedSampleInfo</code> contains the result of the + * decrypt and decode operation on the associated samples, information required + * to access the sample data in buffer, and tracking info. + */ +[assert_size(32)] +struct PP_DecryptedSampleInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + + /** + * Format of the decrypted samples. + */ + PP_DecryptedSampleFormat format; + + /** + * Size in bytes of decrypted samples. + */ + uint32_t data_size; + + /** + * 4-byte padding to make the size of <code>PP_DecryptedSampleInfo</code> + * a multiple of 8 bytes. The value of this field should not be used. + */ + uint32_t padding; + + /** + * Information needed by the client to track the decrypted samples. + */ + PP_DecryptTrackingInfo tracking_info; +}; + +/** * <code>PP_AudioCodec</code> contains audio codec type constants. */ [assert_size(4)] diff --git a/chromium/ppapi/api/private/ppb_content_decryptor_private.idl b/chromium/ppapi/api/private/ppb_content_decryptor_private.idl index 8859448d689..cade7245984 100644 --- a/chromium/ppapi/api/private/ppb_content_decryptor_private.idl +++ b/chromium/ppapi/api/private/ppb_content_decryptor_private.idl @@ -12,92 +12,107 @@ [generate_thunk] label Chrome { - M31 = 0.7 + M33 = 0.9 }; /** * <code>PPB_ContentDecryptor_Private</code> structure contains the function * pointers the browser must implement to support plugins implementing the * <code>PPP_ContentDecryptor_Private</code> interface. This interface provides - * browser side support for the Content Decryption Module (CDM) for v0.1 of the - * proposed Encrypted Media Extensions: http://goo.gl/rbdnR + * browser side support for the Content Decryption Module (CDM) for Encrypted + * Media Extensions: http://www.w3.org/TR/encrypted-media/ */ interface PPB_ContentDecryptor_Private { /** - * A key has been added as the result of a call to the <code>AddKey()</code> - * method on the <code>PPP_ContentDecryptor_Private</code> interface. + * A session has been created by the CDM. * - * Note: The above describes the most simple case. Depending on the key - * system, a series of <code>KeyMessage()</code> calls from the CDM will be - * sent to the browser, and then on to the web application. The web - * application must then provide more data to the CDM by directing the browser - * to pass the data to the CDM via calls to <code>AddKey()</code> on the - * <code>PPP_ContentDecryptor_Private</code> interface. - * The CDM must call <code>KeyAdded()</code> when the sequence is completed, - * and, in response, the browser must notify the web application. + * @param[in] session_id Identifies the session for which the CDM + * created a session. * - * @param[in] key_system A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the name of the key system. + * @param[in] web_session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the string for the + * MediaKeySession's sessionId attribute. * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. */ - void KeyAdded( + void SessionCreated( [in] PP_Instance instance, - [in] PP_Var key_system, - [in] PP_Var session_id); + [in] uint32_t session_id, + [in] PP_Var web_session_id); /** * A message or request has been generated for key_system in the CDM, and * must be sent to the web application. * - * For example, when the browser invokes <code>GenerateKeyRequest()</code> + * For example, when the browser invokes <code>CreateSession()</code> * on the <code>PPP_ContentDecryptor_Private</code> interface, the plugin - * must send a key message containing the key request. - * - * Note that <code>KeyMessage()</code> can be used for purposes other than - * responses to <code>GenerateKeyRequest()</code> calls. See also the text - * in the comment for <code>KeyAdded()</code>, which describes a sequence of - * <code>AddKey()</code> and <code>KeyMessage()</code> calls required to - * prepare for decryption. + * must send a message containing the license request. * - * @param[in] key_system A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the name of the key system. + * Note that <code>SessionMessage()</code> can be used for purposes other than + * responses to <code>CreateSession()</code> calls. See also the text + * in the comment for <code>SessionReady()</code>, which describes a sequence + * of <code>UpdateSession()</code> and <code>SessionMessage()</code> calls + * required to prepare for decryption. * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. + * @param[in] session_id Identifies the session for which the message + * is intended. * * @param[in] message A <code>PP_Var</code> of type * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the message. * - * @param[in] default_url A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the default URL for the message. + * @param[in] destination_url A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the destination URL for the + * message. */ - void KeyMessage( + void SessionMessage( [in] PP_Instance instance, - [in] PP_Var key_system, - [in] PP_Var session_id, + [in] uint32_t session_id, [in] PP_Var message, - [in] PP_Var default_url); + [in] PP_Var destination_url); + + /** + * The session is now ready to decrypt the media stream. + * + * Note: The above describes the most simple case. Depending on the key + * system, a series of <code>SessionMessage()</code> calls from the CDM will + * be sent to the browser, and then on to the web application. The web + * application must then provide more data to the CDM by directing the browser + * to pass the data to the CDM via calls to <code>UpdateSession()</code> on + * the <code>PPP_ContentDecryptor_Private</code> interface. + * The CDM must call <code>SessionReady()</code> when the sequence is + * completed, and, in response, the browser must notify the web application. + * + * @param[in] session_id Identifies the session that is ready. + */ + void SessionReady( + [in] PP_Instance instance, + [in] uint32_t session_id); + + /** + * The session has been closed as the result of a call to the + * <code>ReleaseSession()</code> method on the + * <code>PPP_ContentDecryptor_Private</code> interface, or due to other + * factors as determined by the CDM. + * + * @param[in] session_id Identifies the session that is closed. + */ + void SessionClosed( + [in] PP_Instance instance, + [in] uint32_t session_id); /** * An error occurred in a <code>PPP_ContentDecryptor_Private</code> method, * or within the plugin implementing the interface. * - * @param[in] key_system A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the name of the key system. - * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. + * @param[in] session_id Identifies the session for which the error + * is intended. * * @param[in] media_error A MediaKeyError. * * @param[in] system_error A system error code. */ - void KeyError( + void SessionError( [in] PP_Instance instance, - [in] PP_Var key_system, - [in] PP_Var session_id, + [in] uint32_t session_id, [in] int32_t media_error, [in] int32_t system_code); @@ -228,12 +243,12 @@ interface PPB_ContentDecryptor_Private { * <code>PPB_Buffer_Dev</code> resource that contains a decrypted buffer * of decoded audio samples. * - * @param[in] decrypted_block_info A <code>PP_DecryptedBlockInfo</code> that - * contains the tracking info and result code associated with the - * <code>decrypted_block</code>. + * @param[in] decrypted_sample_info A <code>PP_DecryptedSampleInfo</code> that + * contains the tracking info and result code associated with the decrypted + * samples. */ void DeliverSamples( [in] PP_Instance instance, [in] PP_Resource audio_frames, - [in] PP_DecryptedBlockInfo decrypted_block_info); + [in] PP_DecryptedSampleInfo decrypted_sample_info); }; diff --git a/chromium/ppapi/api/private/ppb_ext_crx_file_system_private.idl b/chromium/ppapi/api/private/ppb_ext_crx_file_system_private.idl index 045864199d5..5c46de72623 100644 --- a/chromium/ppapi/api/private/ppb_ext_crx_file_system_private.idl +++ b/chromium/ppapi/api/private/ppb_ext_crx_file_system_private.idl @@ -3,8 +3,6 @@ * found in the LICENSE file. */ -[generate_thunk,thunk_include="ppapi/thunk/ppb_ext_crx_file_system_private_api.h"] - /** * This file contains the <code>PPB_Ext_CrxFileSystem_Private</code> interface. */ @@ -27,7 +25,6 @@ interface PPB_Ext_CrxFileSystem_Private { * * @return An int32_t containing an error code from <code>pp_errors.h</code>. */ - [singleton,api=PPB_Ext_CrxFileSystem_Private_API] int32_t Open([in] PP_Instance instance, [out] PP_Resource file_system, [in] PP_CompletionCallback callback); diff --git a/chromium/ppapi/api/private/ppb_flash_drm.idl b/chromium/ppapi/api/private/ppb_flash_drm.idl index 3131972406f..c6f6efff5ae 100644 --- a/chromium/ppapi/api/private/ppb_flash_drm.idl +++ b/chromium/ppapi/api/private/ppb_flash_drm.idl @@ -10,7 +10,8 @@ [generate_thunk] label Chrome { - M29 = 1.0 + M29 = 1.0, + M33 = 1.1 }; /** @@ -48,5 +49,15 @@ interface PPB_Flash_DRM { int32_t GetVoucherFile([in] PP_Resource drm, [out] PP_Resource file_ref, [in] PP_CompletionCallback callback); + + /** + * Asynchronously returns a value indicating whether the monitor on which the + * plugin instance is displayed is external. |callback| will be called upon + * completion. + */ + [version=1.1] + int32_t MonitorIsExternal([in] PP_Resource drm, + [out] PP_Bool is_external, + [in] PP_CompletionCallback callback); }; diff --git a/chromium/ppapi/api/private/ppb_isolated_file_system_private.idl b/chromium/ppapi/api/private/ppb_isolated_file_system_private.idl new file mode 100644 index 00000000000..c42d5201236 --- /dev/null +++ b/chromium/ppapi/api/private/ppb_isolated_file_system_private.idl @@ -0,0 +1,54 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +[generate_thunk,thunk_include="ppapi/thunk/ppb_isolated_file_system_private_api.h"] + +/** + * This file contains the <code>PPB_IsolatedFileSystem_Private</code> interface. + */ +label Chrome { + M33 = 0.2 +}; + + +/** + * The <code>PP_IsolatedFileSystemType_Private</code> values indicate the type + * of isolated file systems. + */ +[assert_size(4)] +enum PP_IsolatedFileSystemType_Private { + /** Type for invalid file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID = 0, + /** Type for CRX file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX = 1, + /** Type for PluginPrivate file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE = 2 +}; + +/* <code>PPB_IsolatedFileSystem_Private</code> interface */ +interface PPB_IsolatedFileSystem_Private { + /** + * Open() opens a file system corresponding the given file system type. + * + * When opening the CRX file system, this should be called from an extension + * context, otherwise it will fail. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the file system. + * @param[in] type A file system type as defined by + * <code>PP_IsolatedFileSystemType_Private</code> enum. + * @param[out] file_system An output <code>PP_Resource</code> corresponding + * to a PPB_FileSystem. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + [singleton,api=PPB_IsolatedFileSystem_Private_API] + int32_t Open([in] PP_Instance instance, + [in] PP_IsolatedFileSystemType_Private type, + [out] PP_Resource file_system, + [in] PP_CompletionCallback callback); +}; diff --git a/chromium/ppapi/api/private/ppb_nacl_private.idl b/chromium/ppapi/api/private/ppb_nacl_private.idl index 4bb602f59c8..4e215d7fa89 100644 --- a/chromium/ppapi/api/private/ppb_nacl_private.idl +++ b/chromium/ppapi/api/private/ppb_nacl_private.idl @@ -24,6 +24,17 @@ enum PP_NaClError { PP_NACL_MANIFEST_MISSING_ARCH = 0 }; +/** Event types that NaCl may use when reporting load progress or errors. */ +enum PP_NaClEventType { + PP_NACL_EVENT_LOADSTART, + PP_NACL_EVENT_PROGRESS, + PP_NACL_EVENT_ERROR, + PP_NACL_EVENT_ABORT, + PP_NACL_EVENT_LOAD, + PP_NACL_EVENT_LOADEND, + PP_NACL_EVENT_CRASH +}; + /* PPB_NaCl_Private */ interface PPB_NaCl_Private { /* Launches NaCl's sel_ldr process. Returns PP_EXTERNAL_PLUGIN_OK on success @@ -87,14 +98,6 @@ interface PPB_NaCl_Private { [in] uint32_t desired_access, [in] uint32_t options); - /* Check if PNaCl is installed and attempt to install if necessary. - * Callback is called when the check is done and PNaCl is already installed, - * or after an on-demand install is attempted. Called back with PP_OK if - * PNaCl is available. Called back with an error otherwise. - */ - int32_t EnsurePnaclInstalled([in] PP_Instance instance, - [in] PP_CompletionCallback callback); - /* Returns a read-only file descriptor of a file rooted in the Pnacl * component directory, or an invalid handle on failure. */ @@ -143,14 +146,6 @@ interface PPB_NaCl_Private { void ReportTranslationFinished([in] PP_Instance instance, [in] PP_Bool success); - /* Return true if we are off the record. - */ - PP_Bool IsOffTheRecord(); - - /* Return true if PNaCl is turned on. - */ - PP_Bool IsPnaclEnabled(); - /* Display a UI message to the user. */ PP_ExternalPluginResult ReportNaClError([in] PP_Instance instance, [in] PP_NaClError message_id); @@ -163,4 +158,22 @@ interface PPB_NaCl_Private { [in] str_t file_url, [out] uint64_t file_token_lo, [out] uint64_t file_token_hi); + + + /* Dispatch a progress event on the DOM element where the given instance is + * embedded. + */ + void DispatchEvent([in] PP_Instance instance, + [in] PP_NaClEventType event_type, + [in] PP_Var resource_url, + [in] PP_Bool length_is_computable, + [in] uint64_t loaded_bytes, + [in] uint64_t total_bytes); + + /* Sets a read-only property on the <embed> DOM element that corresponds to + * the given instance. + */ + void SetReadOnlyProperty([in] PP_Instance instance, + [in] PP_Var key, + [in] PP_Var value); }; diff --git a/chromium/ppapi/api/private/ppb_output_protection_private.idl b/chromium/ppapi/api/private/ppb_output_protection_private.idl index 395d2533991..44a2585be05 100644 --- a/chromium/ppapi/api/private/ppb_output_protection_private.idl +++ b/chromium/ppapi/api/private/ppb_output_protection_private.idl @@ -32,7 +32,8 @@ label Chrome { PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA = 1 << 2, PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI = 1 << 3, PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI = 1 << 4, - PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5 + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK = 1 << 6 }; /** @@ -124,9 +125,12 @@ interface PPB_OutputProtection_Private { * @param[in] desired_protection_mask The desired protection methods, which * is a bit-mask of the <code>PP_OutputProtectionMethod_Private</code> * values. - * @param[in] callback A <code>PP_CompletionCallback</code> to be called when - * the protection request has been made. This may be before the protection - * have actually been applied. Call QueryStatus to get protection status. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called with + * <code>PP_OK</code> when the protection request has been made. This may be + * before the protection have actually been applied. Call QueryStatus to get + * protection status. If it failed to make the protection request, the + * callback is called with <code>PP_ERROR_FAILED</code> and there is no need + * to call QueryStatus(). * * @return An int32_t containing an error code from <code>pp_errors.h</code>. */ diff --git a/chromium/ppapi/api/private/ppb_platform_verification_private.idl b/chromium/ppapi/api/private/ppb_platform_verification_private.idl index 86e4d16685b..87df6af7e22 100644 --- a/chromium/ppapi/api/private/ppb_platform_verification_private.idl +++ b/chromium/ppapi/api/private/ppb_platform_verification_private.idl @@ -11,7 +11,7 @@ [generate_thunk] label Chrome { - M31 = 0.1 + M32 = 0.2 }; /** @@ -48,25 +48,6 @@ interface PPB_PlatformVerification_Private { PP_Bool IsPlatformVerification([in] PP_Resource resource); /** - * Check if the underlying host platform can be challenged; i.e., verified as - * a trusted platform. Useful for avoiding unnecessary work on platforms - * which will always fail; i.e. dev mode Chrome OS. - - * @param[out] can_challenge_platform A <code>PP_Bool</code> which is set to - * <code>PP_TRUE</code> if a platform challenge might pass and - * <code>PP_FALSE</code> if it definitely won't. - * - * @param[in] callback A <code>PP_CompletionCallback</code> to be called after - * the method has been completed. This callback will only run if the return - * code is <code>PP_OK_COMPLETIONPENDING</code>. - * - * @return An int32_t containing an error code from <code>pp_errors.h</code>. - */ - int32_t CanChallengePlatform([in] PP_Resource instance, - [out] PP_Bool can_challenge_platform, - [in] PP_CompletionCallback callback); - - /** * Requests a platform challenge for a given service id. * * @param[in] service_id A <code>PP_Var</code> of type diff --git a/chromium/ppapi/api/dev/ppb_testing_dev.idl b/chromium/ppapi/api/private/ppb_testing_private.idl index c114db00e29..98ddfc84bba 100644 --- a/chromium/ppapi/api/dev/ppb_testing_dev.idl +++ b/chromium/ppapi/api/private/ppb_testing_private.idl @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 The Chromium Authors. All rights reserved. +/* Copyright 2013 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -10,14 +10,10 @@ */ label Chrome { - M14 = 0.7, - M15 = 0.8, - M17 = 0.9, - M18 = 0.91, - M28 = 0.92 + M33 = 1.0 }; -interface PPB_Testing_Dev { +interface PPB_Testing_Private { /** * Reads the bitmap data out of the backing store for the given * DeviceContext2D and into the given image. If the data was successfully @@ -102,7 +98,6 @@ interface PPB_Testing_Dev { * slightly alter the mouse position, due to coordinate transforms it * performs. */ - [version=0.8] void SimulateInputEvent([in] PP_Instance instance, [in] PP_Resource input_event); @@ -113,7 +108,6 @@ interface PPB_Testing_Dev { * and fill in the components structure. This pointer may be NULL * to specify that no component information is necessary. */ - [version=0.9] PP_Var GetDocumentURL([in] PP_Instance instance, [out] PP_URLComponents_Dev components); @@ -125,7 +119,6 @@ interface PPB_Testing_Dev { * subset of |array_size| vars is written to |live_vars|. The reference count * of the returned PP_Vars will *not* be affected by this call. */ - [version=0.91] uint32_t GetLiveVars([size_as=array_size] PP_Var[] live_vars, [in] uint32_t array_size); @@ -136,7 +129,6 @@ interface PPB_Testing_Dev { * (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/chromium/ppapi/api/private/ppp_content_decryptor_private.idl b/chromium/ppapi/api/private/ppp_content_decryptor_private.idl index 5eba37a8c2a..b943efe4a8b 100644 --- a/chromium/ppapi/api/private/ppp_content_decryptor_private.idl +++ b/chromium/ppapi/api/private/ppp_content_decryptor_private.idl @@ -9,15 +9,15 @@ * Decryption Modules, not normal plugins. */ label Chrome { - M31 = 0.7 + M33 = 0.9 }; /** * <code>PPP_ContentDecryptor_Private</code> structure contains the function * pointers the decryption plugin must implement to provide services needed by * the browser. This interface provides the plugin side support for the Content - * Decryption Module (CDM) for v0.1 of the proposed Encrypted Media Extensions: - * http://goo.gl/rbdnR + * Decryption Module (CDM) for Encrypted Media Extensions: + * http://www.w3.org/TR/encrypted-media/ */ interface PPP_ContentDecryptor_Private { /** @@ -25,26 +25,24 @@ interface PPP_ContentDecryptor_Private { * * @param[in] key_system A <code>PP_Var</code> of type * <code>PP_VARTYPE_STRING</code> containing the name of the key system. - * - * @param[in] can_challenge_platform A <code>PP_Bool</code> that - * indicates if the underlying host platform can be challenged; - * i.e., verified as a trusted platform. */ void Initialize( [in] PP_Instance instance, - [in] PP_Var key_system, - [in] PP_Bool can_challenge_platform); + [in] PP_Var key_system); /** - * Generates a key request. key_system specifies the key or licensing system - * to use. type contains the MIME type of init_data. init_data is a data - * buffer containing data for use in generating the request. + * Creates a session. <code>type</code> contains the MIME type of + * <code>init_data</code>. <code>init_data</code> is a data buffer + * containing data for use in generating the request. * - * Note: <code>GenerateKeyRequest()</code> must create the session ID used in + * Note: <code>CreateSession()</code> must create the session ID used in * other methods on this interface. The session ID must be provided to the - * browser by the CDM via <code>KeyMessage()</code> on the + * browser by the CDM via <code>SessionCreated()</code> on the * <code>PPB_ContentDecryptor_Private</code> interface. * + * @param[in] session_id A reference for the session for which a session + * should be generated. + * * @param[in] type A <code>PP_Var</code> of type * <code>PP_VARTYPE_STRING</code> containing the MIME type for init_data. * @@ -52,48 +50,44 @@ interface PPP_ContentDecryptor_Private { * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific * initialization data. */ - void GenerateKeyRequest( + void CreateSession( [in] PP_Instance instance, + [in] uint32_t session_id, [in] PP_Var type, [in] PP_Var init_data); /** - * Provides a key or license to the decryptor for decrypting media data. + * Provides a license or other message to the decryptor. * - * When the CDM needs more information to complete addition of the key it - * will call <code>KeyMessage()</code> on the - * <code>PPB_ContentDecryptor_Private</code> interface, which the browser - * passes to the application. When the key is ready to use, the CDM - * must call call <code>KeyAdded()</code> on the + * When the CDM needs more information, it must call + * <code>SessionMessage()</code> on the + * <code>PPB_ContentDecryptor_Private</code> interface, and the browser + * must notify the web application. When the CDM has finished processing + * <code>response</code> and needs no more information, it must call + * <code>SessionReady()</code> on the * <code>PPB_ContentDecryptor_Private</code> interface, and the browser * must notify the web application. * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. - * - * @param[in] key A <code>PP_Var</code> of type - * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the decryption key, license, - * or other message for the given session ID. + * @param[in] session_id A reference for the session to update. * - * @param[in] init_data A <code>PP_Var</code> of type - * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific - * initialization data. + * @param[in] response A <code>PP_Var</code> of type + * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other + * message for the given session ID. */ - void AddKey( + void UpdateSession( [in] PP_Instance instance, - [in] PP_Var session_id, - [in] PP_Var key, - [in] PP_Var init_data); + [in] uint32_t session_id, + [in] PP_Var response); /** - * Cancels a pending key request for the specified session ID. + * Release the specified session and related resources. * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. + * @param[in] session_id A reference for the session that should be + * released. */ - void CancelKeyRequest( + void ReleaseSession( [in] PP_Instance instance, - [in] PP_Var session_id); + [in] uint32_t session_id); /** * Decrypts the block and returns the unencrypted block via diff --git a/chromium/ppapi/api/trusted/ppb_file_io_trusted.idl b/chromium/ppapi/api/trusted/ppb_file_io_trusted.idl deleted file mode 100644 index 7ba20deb4bf..00000000000 --- a/chromium/ppapi/api/trusted/ppb_file_io_trusted.idl +++ /dev/null @@ -1,53 +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 trusted file IO interface - */ - -label Chrome { - M14= 0.4 -}; - -// Available only to trusted implementations. -interface PPB_FileIOTrusted { - /** - * Returns a file descriptor corresponding to the given FileIO object. On - * Windows, returns a HANDLE; on all other platforms, returns a POSIX file - * 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); - - /** - * Notifies the browser that underlying file will be modified. This gives - * the browser the opportunity to apply quota restrictions and possibly - * return an error to indicate that the write is not allowed. - */ - int32_t WillWrite([in] PP_Resource file_io, - [in] int64_t offset, - [in] int32_t bytes_to_write, - [in] PP_CompletionCallback callback); - - /** - * Notifies the browser that underlying file will be modified. This gives - * the browser the opportunity to apply quota restrictions and possibly - * return an error to indicate that the write is not allowed. - * - * TODO(darin): Maybe unify the above into a single WillChangeFileSize - * method? The above methods have the advantage of mapping to PPB_FileIO - * Write and SetLength calls. WillChangeFileSize would require the caller to - * compute the file size resulting from a Write call, which may be - * undesirable. - */ - int32_t WillSetLength([in] PP_Resource file_io, - [in] int64_t length, - [in] PP_CompletionCallback callback); - -}; - diff --git a/chromium/ppapi/c/dev/pp_optional_structs_dev.h b/chromium/ppapi/c/dev/pp_optional_structs_dev.h new file mode 100644 index 00000000000..06608febb73 --- /dev/null +++ b/chromium/ppapi/c/dev/pp_optional_structs_dev.h @@ -0,0 +1,34 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/pp_optional_structs_dev.idl modified Tue Dec 10 17:39:38 2013. */ + +#ifndef PPAPI_C_DEV_PP_OPTIONAL_STRUCTS_DEV_H_ +#define PPAPI_C_DEV_PP_OPTIONAL_STRUCTS_DEV_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines optional structs for primitive types. + */ + + +/** + * @addtogroup Structs + * @{ + */ +struct PP_Optional_Double_Dev { + double value; + PP_Bool is_set; +}; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PP_OPTIONAL_STRUCTS_DEV_H_ */ + diff --git a/chromium/ppapi/c/dev/ppb_alarms_dev.h b/chromium/ppapi/c/dev/ppb_alarms_dev.h new file mode 100644 index 00000000000..96617930b3e --- /dev/null +++ b/chromium/ppapi/c/dev/ppb_alarms_dev.h @@ -0,0 +1,210 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_alarms_dev.idl modified Tue Dec 10 17:40:20 2013. */ + +#ifndef PPAPI_C_DEV_PPB_ALARMS_DEV_H_ +#define PPAPI_C_DEV_PPB_ALARMS_DEV_H_ + +#include "ppapi/c/dev/pp_optional_structs_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_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_ALARMS_DEV_INTERFACE_0_1 "PPB_Alarms(Dev);0.1" +#define PPB_ALARMS_DEV_INTERFACE PPB_ALARMS_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines the Pepper equivalent of the <code>chrome.alarms</code> + * extension API. + */ + + +/** + * @addtogroup Structs + * @{ + */ +struct PP_Alarms_Alarm_Dev { + /** + * Name of this alarm. + */ + struct PP_Var name; + /** + * Time at which this alarm was scheduled to fire, in milliseconds past the + * epoch. For performance reasons, the alarm may have been delayed an + * arbitrary amount beyond this. + */ + double scheduled_time; + /** + * If set, the alarm is a repeating alarm and will fire again in + * <code>period_in_minutes</code> minutes. + */ + struct PP_Optional_Double_Dev period_in_minutes; +}; + +struct PP_Alarms_AlarmCreateInfo_Dev { + /** + * Time at which the alarm should fire, in milliseconds past the epoch. + */ + struct PP_Optional_Double_Dev when; + /** + * Length of time in minutes after which the + * <code>PP_Alarms_OnAlarm_Dev</code> event should fire. + */ + struct PP_Optional_Double_Dev delay_in_minutes; + /** + * If set, the <code>PP_Alarms_OnAlarm_Dev</code> event should fire every + * <code>period_in_minutes</code> minutes after the initial event specified by + * <code>when</code> or <code>delay_in_minutes</code>. If not set, the alarm + * will only fire once. + */ + struct PP_Optional_Double_Dev period_in_minutes; +}; + +struct PP_Alarms_Alarm_Array_Dev { + uint32_t size; + struct PP_Alarms_Alarm_Dev *elements; +}; +/** + * @} + */ + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * Fired when an alarm has elapsed. Useful for event pages. + * + * @param[in] listener_id The listener ID. + * @param[inout] user_data The opaque pointer that was used when registering the + * listener. + * @param[in] alarm The alarm that has elapsed. + */ +typedef void (*PP_Alarms_OnAlarm_Dev)( + uint32_t listener_id, + void* user_data, + const struct PP_Alarms_Alarm_Dev* alarm); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Alarms_Dev_0_1 { + /** + * Creates an alarm. Near the time(s) specified by <code>alarm_info</code>, + * the <code>PP_Alarms_OnAlarm_Dev</code> event is fired. If there is another + * alarm with the same name (or no name if none is specified), it will be + * cancelled and replaced by this alarm. + * + * In order to reduce the load on the user's machine, Chrome limits alarms + * to at most once every 1 minute but may delay them an arbitrary amount more. + * That is, setting + * <code>PP_Alarms_AlarmCreateInfo_Dev.delay_in_minutes</code> or + * <code>PP_Alarms_AlarmCreateInfo_Dev.period_in_minutes</code> to less than + * <code>1</code> will not be honored and will cause a warning. + * <code>PP_Alarms_AlarmCreateInfo_Dev.when</code> can be set to less than 1 + * minute after "now" without warning but won't actually cause the alarm to + * fire for at least 1 minute. + * + * To help you debug your app or extension, when you've loaded it unpacked, + * there's no limit to how often the alarm can fire. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to + * identify this alarm. Defaults to the empty string. + * @param[in] alarm_info Describes when the alarm should fire. The initial + * time must be specified by either <code>when</code> or + * <code>delay_in_minutes</code> (but not both). If + * <code>period_in_minutes</code> is set, the alarm will repeat every + * <code>period_in_minutes</code> minutes after the initial event. If neither + * <code>when</code> or <code>delay_in_minutes</code> is set for a repeating + * alarm, <code>period_in_minutes</code> is used as the default for + * <code>delay_in_minutes</code>. + */ + void (*Create)(PP_Instance instance, + struct PP_Var name, + const struct PP_Alarms_AlarmCreateInfo_Dev* alarm_info); + /** + * Retrieves details about the specified alarm. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. The name of the + * alarm to get. Defaults to the empty string. + * @param[out] alarm A <code>PP_Alarms_Alarm_Dev</code> struct to store the + * output result. + * @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 (*Get)(PP_Instance instance, + struct PP_Var name, + struct PP_Alarms_Alarm_Dev* alarm, + struct PP_CompletionCallback callback); + /** + * Gets an array of all the alarms. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[out] alarms A <code>PP_Alarms_Alarm_Array_Dev</code> to store the + * output result. + * @param[in] array_allocator A <code>PP_ArrayOutput</code> to allocate memory + * for <code>alarms</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 (*GetAll)(PP_Instance instance, + struct PP_Alarms_Alarm_Array_Dev* alarms, + struct PP_ArrayOutput array_allocator, + struct PP_CompletionCallback callback); + /** + * Clears the alarm with the given name. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. The name of the + * alarm to clear. Defaults to the empty string. + */ + void (*Clear)(PP_Instance instance, struct PP_Var name); + /** + * Clears all alarms. + * + * @param[in] instance A <code>PP_Instance</code>. + */ + void (*ClearAll)(PP_Instance instance); + /** + * Registers <code>PP_Alarms_OnAlarm_Dev</code> event. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] callback The callback to receive notifications. + * @param[inout] user_data An opaque pointer that will be passed to + * <code>callback</code>. + * + * @return A listener ID, or 0 if failed. + * + * TODO(yzshen): add a PPB_Events_Dev interface for unregistering: + * void UnregisterListener(PP_instance instance, uint32_t listener_id); + */ + uint32_t (*AddOnAlarmListener)(PP_Instance instance, + PP_Alarms_OnAlarm_Dev callback, + void* user_data); +}; + +typedef struct PPB_Alarms_Dev_0_1 PPB_Alarms_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_ALARMS_DEV_H_ */ + diff --git a/chromium/ppapi/c/dev/ppb_file_io_dev.h b/chromium/ppapi/c/dev/ppb_file_io_dev.h new file mode 100644 index 00000000000..a60d3a64c10 --- /dev/null +++ b/chromium/ppapi/c/dev/ppb_file_io_dev.h @@ -0,0 +1,138 @@ +/* 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_file_io_dev.idl modified Thu Sep 19 10:07:03 2013. */ + +#ifndef PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ +#define PPAPI_C_DEV_PPB_FILE_IO_DEV_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_DEV_INTERFACE_0_1 "PPB_FileIO(Dev);0.1" +#define PPB_FILEIO_DEV_INTERFACE PPB_FILEIO_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines methods for use with a PPB_FileIO resource that may become + * stable in the future. For now, they can be used only in plugins with DEV + * permissions. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_FileMapProtection values indicate the permissions requested for the + * file mapping. These should be used in a uint32_t bitfield. + */ +typedef enum { + /** Requests read access to the mapped address. */ + PP_FILEMAPPROTECTION_READ = 1u << 0, + /** Requests write access to the mapped address. */ + PP_FILEMAPPROTECTION_WRITE = 1u << 1 +} PP_FileMapProtection; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileMapProtection, 4); + +/** + * The PP_FileMapFlags contain flag values for use with Map(). + */ +typedef enum { + /** + * Requests a shared mapping. If this flag is set, changes written to the + * memory region will be reflected in the underlying file and will thus + * eventually be visible to other processes which have opened the file. The + * file may not actually be updated until Unmap() is called. This is only + * valid if the PPB_FileIO resource was opened with write permission. + */ + PP_FILEMAPFLAG_SHARED = 1u << 0, + /** + * Requests a copy-on-write mapping. If this flag is set, changes are not + * written to the underlying file, but only in the memory of the process + * (copy-on-write). + */ + PP_FILEMAPFLAG_PRIVATE = 1u << 1, + /** + * Forces Map() to map the file contents at the provided |address|. If Map() + * can not comply, Map() will fail. + */ + PP_FILEMAPFLAG_FIXED = 1u << 2 +} PP_FileMapFlags; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileMapFlags, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_FileIO_Dev contains functions that are usable with PPB_FileIO resources + * but aren't yet considered stable yet and thus are not supported for general + * NaCl or PNaCl apps yet. Features here are being tested and refined for + * possible future inclusion in (stable) PPB_FileIO. + */ +struct PPB_FileIO_Dev_0_1 { + /** + * Map() maps the contents from an offset of the file into memory. + * + * @param[in] file_io A PP_Resource corresponding to a file. + * @param[in] length The number of bytes to map. + * @param[in] map_protection A bitfield containing values from + * PP_FileMapProtection, indicating what memory operations should be permitted + * on the mapped region. + * @param[in] map_flags A bitfield containing values from + * PP_FileMapFlags, providing options for the behavior of Map. If the region + * is to be writeable, then exactly one of PP_FILEMAPFLAG_SHARED or + * PP_FILEMAPFLAG_PRIVATE must be set. + * @param[in] offset The offset into the file. Must be a multiple of the + * Map page size as returned by GetMapPageSize. + * @param[inout] address The value of |*address|, if non-NULL, will be used as + * a hint to determine where in memory the file should be mapped. If the value + * is NULL, the host operating system will choose |address|. Upon + * Map() completing, |*address| will contain the actual memory location at + * which the file was mapped. If the plugin provides a non-NULL |*address|, it + * must be a multiple of the map page size as returned by GetMapPageSize(). + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Map(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Map)(PP_Resource file_io, + int64_t length, + uint32_t map_protection, + uint32_t map_flags, + int64_t offset, + void** address, + struct PP_CompletionCallback callback); + /** + * Unmap() deletes the mapping of the specified address address to a + * file io. The specified address must have been retrieved with + * Map(). + * @param[in] file_io A PP_Resource corresponding to a file. + * @param[in] address The starting address of the address in memory to + * be unmapped. + * @param[in] length The length of the region to unmap. + */ + void (*Unmap)(PP_Resource file_io, void* address, int64_t length); + /** + * GetMapPageSize() returns the size of pages that Map() uses. Returns 0 on + * failure. + */ + int64_t (*GetMapPageSize)(PP_Resource file_io); +}; + +typedef struct PPB_FileIO_Dev_0_1 PPB_FileIO_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ */ + diff --git a/chromium/ppapi/c/dev/ppb_graphics_2d_dev.h b/chromium/ppapi/c/dev/ppb_graphics_2d_dev.h index a4661215a11..245ae588ff7 100644 --- a/chromium/ppapi/c/dev/ppb_graphics_2d_dev.h +++ b/chromium/ppapi/c/dev/ppb_graphics_2d_dev.h @@ -3,18 +3,20 @@ * found in the LICENSE file. */ -/* From dev/ppb_graphics_2d_dev.idl modified Tue Jun 19 14:11:08 2012. */ +/* From dev/ppb_graphics_2d_dev.idl modified Tue Nov 12 11:22:26 2013. */ #ifndef PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_ #define PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" #define PPB_GRAPHICS2D_DEV_INTERFACE_0_1 "PPB_Graphics2D(Dev);0.1" -#define PPB_GRAPHICS2D_DEV_INTERFACE PPB_GRAPHICS2D_DEV_INTERFACE_0_1 +#define PPB_GRAPHICS2D_DEV_INTERFACE_0_2 "PPB_Graphics2D(Dev);0.2" +#define PPB_GRAPHICS2D_DEV_INTERFACE PPB_GRAPHICS2D_DEV_INTERFACE_0_2 /** * @file @@ -22,11 +24,38 @@ /** + * @addtogroup Enums + * @{ + */ +/** + * These options affect how the existing graphics context is displayed when a + * plugin is resized. + */ +typedef enum { + /** + * In this mode, the context does not change size or offset. If the backing + * store is the same size as the plugin element, this will result in the + * pixels on the right side of the plugin element being unavailable, revealing + * the contents underneath it. + */ + PP_GRAPHICS2D_DEV_RESIZEMODE_DEFAULT, + /** + * In this mode, the context and its offset are scaled relative to how much + * the plugin element has been resized. + */ + PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH +} PP_Graphics2D_Dev_ResizeMode; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Graphics2D_Dev_ResizeMode, 4); +/** + * @} + */ + +/** * @addtogroup Interfaces * @{ */ /* PPB_Graphics2D_Dev interface */ -struct PPB_Graphics2D_Dev_0_1 { +struct PPB_Graphics2D_Dev_0_2 { /** * SetScale() sets the scale factor that will be applied when painting the * graphics context onto the output device. Typically, if rendering at device @@ -55,9 +84,36 @@ struct PPB_Graphics2D_Dev_0_1 { * is not a valid <code>Graphics2D</code> context, this will return 0.0. */ float (*GetScale)(PP_Resource resource); + /*** + * Sets the offset into the plugin element at which the graphics context is + * painted. This allows a portion of the plugin element to be painted to. + * The new offset will only be applied after Flush() has been called. + * + * @param[in] resource A <code>Graphics2D</code> context resource. + * @param[in] offset The offset at which the context should be painted. + */ + void (*SetOffset)(PP_Resource resource, const struct PP_Point* offset); + /*** + * Sets the resize mode for the graphics context. When a plugin element is + * resized in the DOM, it takes time for the plugin to update the graphics + * context in the renderer. These options affect how the existing context is + * displayed until the backing store is updated by the plugin. + * + * @param[in] resource A <code>Graphics2D</code> context resource. + * @param[in] resize_mode The resize mode to change this context to. + */ + void (*SetResizeMode)(PP_Resource resource, + PP_Graphics2D_Dev_ResizeMode resize_mode); }; -typedef struct PPB_Graphics2D_Dev_0_1 PPB_Graphics2D_Dev; +typedef struct PPB_Graphics2D_Dev_0_2 PPB_Graphics2D_Dev; + +struct PPB_Graphics2D_Dev_0_1 { + PP_Bool (*SetScale)(PP_Resource resource, float scale); + float (*GetScale)(PP_Resource resource); + void (*SetResizeMode)(PP_Resource resource, + PP_Graphics2D_Dev_ResizeMode resize_mode); +}; /** * @} */ diff --git a/chromium/ppapi/c/dev/ppb_truetype_font_dev.h b/chromium/ppapi/c/dev/ppb_truetype_font_dev.h index 5172caee73b..1511ca4af31 100644 --- a/chromium/ppapi/c/dev/ppb_truetype_font_dev.h +++ b/chromium/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 Wed Apr 17 15:38:46 2013. */ +/* From dev/ppb_truetype_font_dev.idl modified Tue Oct 15 05:52:52 2013. */ #ifndef PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_ #define PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_ @@ -266,7 +266,8 @@ struct PPB_TrueTypeFont_Dev_0_1 { * @param[in] table A 4 byte value indicating which table to copy. * For example, 'glyf' will cause the outline table to be copied into the * output array. A zero tag value will cause the entire font to be copied. - * @param[in] offset The offset into the font table. + * @param[in] offset The offset into the font table. Passing an offset + * greater than or equal to the table size will succeed with 0 bytes copied. * @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. diff --git a/chromium/ppapi/c/dev/ppb_var_resource_dev.h b/chromium/ppapi/c/dev/ppb_var_resource_dev.h new file mode 100644 index 00000000000..463f10a17c7 --- /dev/null +++ b/chromium/ppapi/c/dev/ppb_var_resource_dev.h @@ -0,0 +1,60 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_var_resource_dev.idl modified Fri Oct 11 10:31:47 2013. */ + +#ifndef PPAPI_C_DEV_PPB_VAR_RESOURCE_DEV_H_ +#define PPAPI_C_DEV_PPB_VAR_RESOURCE_DEV_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_VAR_RESOURCE_DEV_INTERFACE_0_1 "PPB_VarResource(Dev);0.1" +#define PPB_VAR_RESOURCE_DEV_INTERFACE PPB_VAR_RESOURCE_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_VarResource</code> struct providing + * a way to interact with resource vars. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_VarResource_Dev_0_1 { + /** + * Converts a resource-type var to a <code>PP_Resource</code>. + * + * @param[in] var A <code>PP_Var</code> struct containing a resource-type var. + * + * @return A <code>PP_Resource</code> retrieved from the var, or 0 if the var + * is not a resource. The reference count of the resource is incremented on + * behalf of the caller. + */ + PP_Resource (*VarToResource)(struct PP_Var var); + /** + * Creates a new <code>PP_Var</code> from a given resource. + * + * @param[in] resource A <code>PP_Resource</code> to be wrapped in a var. + * + * @return A <code>PP_Var</code> created for this resource, with type + * <code>PP_VARTYPE_RESOURCE</code>. The reference count of the var is set to + * 1 on behalf of the caller. + */ + struct PP_Var (*VarFromResource)(PP_Resource resource); +}; + +typedef struct PPB_VarResource_Dev_0_1 PPB_VarResource_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_VAR_RESOURCE_DEV_H_ */ + diff --git a/chromium/ppapi/c/dev/ppb_video_decoder_dev.h b/chromium/ppapi/c/dev/ppb_video_decoder_dev.h index fa57fd42ec0..8b15fb07d17 100644 --- a/chromium/ppapi/c/dev/ppb_video_decoder_dev.h +++ b/chromium/ppapi/c/dev/ppb_video_decoder_dev.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From dev/ppb_video_decoder_dev.idl modified Wed Dec 14 18:08:00 2011. */ +/* From dev/ppb_video_decoder_dev.idl modified Tue Oct 29 00:32:59 2013. */ #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ @@ -78,7 +78,8 @@ struct PPB_VideoDecoder_Dev_0_16 { * * Parameters: * |video_decoder| is the previously created handle to the decoder resource. - * |bitstream_buffer| is the bitstream buffer that contains the input data. + * |bitstream_buffer| is the bitstream buffer that contains at most one + * input frame. * |callback| will be called when |bitstream_buffer| has been processed by * the decoder. * diff --git a/chromium/ppapi/c/dev/ppp_video_decoder_dev.h b/chromium/ppapi/c/dev/ppp_video_decoder_dev.h index 20c4e8c275e..d98161f8c18 100644 --- a/chromium/ppapi/c/dev/ppp_video_decoder_dev.h +++ b/chromium/ppapi/c/dev/ppp_video_decoder_dev.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From dev/ppp_video_decoder_dev.idl modified Tue May 29 10:59:23 2012. */ +/* From dev/ppp_video_decoder_dev.idl modified Fri Dec 13 15:21:30 2013. */ #ifndef PPAPI_C_DEV_PPP_VIDEO_DECODER_DEV_H_ #define PPAPI_C_DEV_PPP_VIDEO_DECODER_DEV_H_ @@ -15,8 +15,6 @@ #include "ppapi/c/pp_size.h" #include "ppapi/c/pp_stdint.h" -#define PPP_VIDEODECODER_DEV_INTERFACE_0_9 "PPP_VideoDecoder(Dev);0.9" -#define PPP_VIDEODECODER_DEV_INTERFACE_0_10 "PPP_VideoDecoder(Dev);0.10" #define PPP_VIDEODECODER_DEV_INTERFACE_0_11 "PPP_VideoDecoder(Dev);0.11" #define PPP_VIDEODECODER_DEV_INTERFACE PPP_VIDEODECODER_DEV_INTERFACE_0_11 @@ -51,7 +49,8 @@ struct PPP_VideoDecoder_Dev_0_11 { * |decoder| the PPB_VideoDecoder_Dev resource. * |req_num_of_bufs| tells how many buffers are needed by the decoder. * |dimensions| tells the dimensions of the buffer to allocate. - * |texture_target| the type of texture used. + * |texture_target| the type of texture used. Sample targets in use are + * TEXTURE_2D (most platforms) and TEXTURE_EXTERNAL_OES (on ARM). */ void (*ProvidePictureBuffers)(PP_Instance instance, PP_Resource decoder, @@ -98,39 +97,6 @@ struct PPP_VideoDecoder_Dev_0_11 { }; typedef struct PPP_VideoDecoder_Dev_0_11 PPP_VideoDecoder_Dev; - -struct PPP_VideoDecoder_Dev_0_9 { - void (*ProvidePictureBuffers)(PP_Instance instance, - PP_Resource decoder, - uint32_t req_num_of_bufs, - const struct PP_Size* dimensions); - void (*DismissPictureBuffer)(PP_Instance instance, - PP_Resource decoder, - int32_t picture_buffer_id); - void (*PictureReady)(PP_Instance instance, - PP_Resource decoder, - const struct PP_Picture_Dev* picture); - void (*EndOfStream)(PP_Instance instance, PP_Resource decoder); - void (*NotifyError)(PP_Instance instance, - PP_Resource decoder, - PP_VideoDecodeError_Dev error); -}; - -struct PPP_VideoDecoder_Dev_0_10 { - void (*ProvidePictureBuffers)(PP_Instance instance, - PP_Resource decoder, - uint32_t req_num_of_bufs, - const struct PP_Size* dimensions); - void (*DismissPictureBuffer)(PP_Instance instance, - PP_Resource decoder, - int32_t picture_buffer_id); - void (*PictureReady)(PP_Instance instance, - PP_Resource decoder, - const struct PP_Picture_Dev* picture); - void (*NotifyError)(PP_Instance instance, - PP_Resource decoder, - PP_VideoDecodeError_Dev error); -}; /** * @} */ diff --git a/chromium/ppapi/c/extensions/dev/ppb_ext_alarms_dev.h b/chromium/ppapi/c/extensions/dev/ppb_ext_alarms_dev.h deleted file mode 100644 index e73de60e237..00000000000 --- a/chromium/ppapi/c/extensions/dev/ppb_ext_alarms_dev.h +++ /dev/null @@ -1,204 +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. - */ - -/* From extensions/dev/ppb_ext_alarms_dev.idl, - * modified Wed Mar 20 13:50:11 2013. - */ - -#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" -#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_ALARMS_DEV_INTERFACE_0_1 "PPB_Ext_Alarms(Dev);0.1" -#define PPB_EXT_ALARMS_DEV_INTERFACE PPB_EXT_ALARMS_DEV_INTERFACE_0_1 - -/** - * @file - * This file defines the Pepper equivalent of the <code>chrome.alarms</code> - * extension API. - */ - - -#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h" - -/** - * @addtogroup Typedefs - * @{ - */ -/** - * A dictionary <code>PP_Var</code> which contains: - * - "name" : string <code>PP_Var</code> - * Name of this alarm. - * - * - "scheduledTime" : double <code>PP_Var</code> - * Time at which this alarm was scheduled to fire, in milliseconds past the - * epoch (e.g. <code>Date.now() + n</code>). For performance reasons, the - * alarm may have been delayed an arbitrary amount beyond this. - * - * - "periodInMinutes" : double or undefined <code>PP_Var</code> - * If not undefined, the alarm is a repeating alarm and will fire again in - * <var>periodInMinutes</var> minutes. - */ -typedef struct PP_Var PP_Ext_Alarms_Alarm_Dev; - -/** - * A dictionary <code>PP_Var</code> which contains - * - "when" : double or undefined <code>PP_Var</code> - * Time at which the alarm should fire, in milliseconds past the epoch - * (e.g. <code>Date.now() + n</code>). - * - * - "delayInMinutes" : double or undefined <code>PP_Var</code> - * Length of time in minutes after which the - * <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire. - * - * - "periodInMinutes" : double or undefined <code>PP_Var</code> - * If set, the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire every - * <var>periodInMinutes</var> minutes after the initial event specified by - * <var>when</var> or <var>delayInMinutes</var>. If not set, the alarm will - * only fire once. - */ -typedef struct PP_Var PP_Ext_Alarms_AlarmCreateInfo_Dev; - -/** - * An array <code>PP_Var</code> which contains elements of - * <code>PP_Ext_Alarms_Alarm_Dev</code>. - */ -typedef struct PP_Var PP_Ext_Alarms_Alarm_Dev_Array; -/** - * @} - */ - -/** - * @addtogroup Interfaces - * @{ - */ -struct PPB_Ext_Alarms_Dev_0_1 { - /** - * Creates an alarm. Near the time(s) specified by <var>alarm_info</var>, - * the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event is fired. If there is - * another alarm with the same name (or no name if none is specified), it will - * be cancelled and replaced by this alarm. - * - * In order to reduce the load on the user's machine, Chrome limits alarms - * to at most once every 1 minute but may delay them an arbitrary amount - * more. That is, setting - * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.delayInMinutes - * delayInMinutes]</code> or - * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.periodInMinutes - * periodInMinutes]</code> to less than <code>1</code> will not be honored - * and will cause a warning. - * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.when when]</code> can be set - * to less than 1 minute after "now" without warning but won't actually cause - * the alarm to fire for at least 1 minute. - * - * To help you debug your app or extension, when you've loaded it unpacked, - * there's no limit to how often the alarm can fire. - * - * @param[in] instance A <code>PP_Instance</code>. - * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to - * identify this alarm. Defaults to the empty string. - * @param[in] alarm_info A <code>PP_Var</code> whose contents conform to the - * description of <code>PP_Ext_Alarms_AlarmCreateInfo_Dev</code>. Describes - * when the alarm should fire. The initial time must be specified by either - * <var>when</var> or <var>delayInMinutes</var> (but not both). If - * <var>periodInMinutes</var> is set, the alarm will repeat every - * <var>periodInMinutes</var> minutes after the initial event. If neither - * <var>when</var> or <var>delayInMinutes</var> is set for a repeating alarm, - * <var>periodInMinutes</var> is used as the default for - * <var>delayInMinutes</var>. - */ - void (*Create)(PP_Instance instance, - struct PP_Var name, - PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info); - /** - * Retrieves details about the specified alarm. - * - * @param[in] instance A <code>PP_Instance</code>. - * @param[in] name A string or undefined <code>PP_Var</code>. The name of the - * alarm to get. Defaults to the empty string. - * @param[out] alarm A <code>PP_Var</code> whose contents conform to the - * description of <code>PP_Ext_Alarms_Alarm_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 (*Get)(PP_Instance instance, - struct PP_Var name, - PP_Ext_Alarms_Alarm_Dev* alarm, - struct PP_CompletionCallback callback); - /** - * Gets an array of all the alarms. - * - * @param[in] instance A <code>PP_Instance</code>. - * @param[out] alarms A <code>PP_Var</code> whose contents conform to the - * description of <code>PP_Ext_Alarms_Alarm_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 (*GetAll)(PP_Instance instance, - PP_Ext_Alarms_Alarm_Dev_Array* alarms, - struct PP_CompletionCallback callback); - /** - * Clears the alarm with the given name. - * - * @param[in] instance A <code>PP_Instance</code>. - * @param[in] name A string or undefined <code>PP_Var</code>. The name of the - * alarm to clear. Defaults to the empty string. - */ - void (*Clear)(PP_Instance instance, struct PP_Var name); - /** - * Clears all alarms. - * - * @param[in] instance A <code>PP_Instance</code>. - */ - void (*ClearAll)(PP_Instance instance); -}; - -typedef struct PPB_Ext_Alarms_Dev_0_1 PPB_Ext_Alarms_Dev; -/** - * @} - */ - -/** - * @addtogroup Typedefs - * @{ - */ -/** - * Fired when an alarm has elapsed. Useful for event pages. - * - * @param[in] listener_id The listener ID. - * @param[inout] user_data The opaque pointer that was used when registering the - * listener. - * @param[in] alarm A <code>PP_Var</code> whose contents conform to the - * description of <code>PP_Ext_Alarms_Alarm_Dev</code>. The alarm that has - * elapsed. - */ -typedef void (*PP_Ext_Alarms_OnAlarm_Func_Dev_0_1)( - uint32_t listener_id, - void* user_data, - PP_Ext_Alarms_Alarm_Dev alarm); -/** - * @} - */ - -PP_INLINE struct PP_Ext_EventListener PP_Ext_Alarms_OnAlarm_Dev_0_1( - PP_Ext_Alarms_OnAlarm_Func_Dev_0_1 func, - void* user_data) { - return PP_Ext_MakeEventListener("alarms.onAlarm;0.1", - (PP_Ext_GenericFuncType)(func), user_data); -} - -#define PP_Ext_Alarms_OnAlarm_Dev PP_Ext_Alarms_OnAlarm_Dev_0_1 -#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EXT_ALARMS_DEV_H_ */ - diff --git a/chromium/ppapi/c/extensions/dev/ppb_ext_events_dev.h b/chromium/ppapi/c/extensions/dev/ppb_ext_events_dev.h deleted file mode 100644 index 0c1c57ae418..00000000000 --- a/chromium/ppapi/c/extensions/dev/ppb_ext_events_dev.h +++ /dev/null @@ -1,120 +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. - */ - -/* From extensions/dev/ppb_ext_events_dev.idl, - * modified Mon Mar 18 17:18:20 2013. - */ - -#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" -#include "ppapi/c/pp_stdint.h" - -#define PPB_EXT_EVENTS_DEV_INTERFACE_0_1 "PPB_Ext_Events(Dev);0.1" -#define PPB_EXT_EVENTS_DEV_INTERFACE PPB_EXT_EVENTS_DEV_INTERFACE_0_1 - -/** - * @file - */ - - -/** - * @addtogroup Typedefs - * @{ - */ -/** - * Used to represent arbitrary C function pointers. Please note that usually - * the function that a <code>PP_Ext_GenericFuncType</code> pointer points to - * has a different signature than <code>void (*)()</code>. - */ -typedef void (*PP_Ext_GenericFuncType)(void); -/** - * @} - */ - -/** - * @addtogroup Structs - * @{ - */ -/** - * An event listener that can be registered with the browser and receive - * notifications via the callback function. - * - * A function is defined for each event type to return a properly-filled - * <code>PP_Ext_EventListener</code> struct, for example, - * <code>PP_Ext_Alarms_OnAlarm_Dev()</code>. - */ -struct PP_Ext_EventListener { - /** - * The name of the event to register to. - */ - const char* event_name; - /** - * A callback function whose signature is determined by - * <code>event_name</code>. All calls will happen on the same thread as the - * one on which <code>AddListener()</code> is called. - */ - PP_Ext_GenericFuncType func; - /** - * An opaque pointer that will be passed to <code>func</code>. - */ - void* user_data; -}; -/** - * @} - */ - -/** - * @addtogroup Interfaces - * @{ - */ -struct PPB_Ext_Events_Dev_0_1 { - /** - * Registers a listener to an event. - * - * @param[in] instance A <code>PP_Instance</code> identifying one instance of - * a module. - * @param[in] listener A <code>PP_Ext_EventListener</code> struct. - * - * @return An listener ID, or 0 if failed. - */ - uint32_t (*AddListener)(PP_Instance instance, - struct PP_Ext_EventListener listener); - /** - * Deregisters a listener. - * - * @param[in] instance A <code>PP_Instance</code> identifying one instance of - * a module. - * @param[in] listener_id The ID returned by <code>AddListener()</code>. - */ - void (*RemoveListener)(PP_Instance instance, uint32_t listener_id); -}; - -typedef struct PPB_Ext_Events_Dev_0_1 PPB_Ext_Events_Dev; -/** - * @} - */ - -/** - * Creates a <code>PP_Ext_EventListener</code> struct. - * - * Usually you should not call it directly. Instead you should call those - * functions that return a <code>PP_Ext_EventListener</code> struct for a - * specific event type, for example, <code>PP_Ext_Alarms_OnAlarm_Dev()</code>. - */ -PP_INLINE struct PP_Ext_EventListener PP_Ext_MakeEventListener( - const char* event_name, - PP_Ext_GenericFuncType func, - void* user_data) { - struct PP_Ext_EventListener listener; - listener.event_name = event_name; - listener.func = func; - listener.user_data = user_data; - return listener; -} -#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EXT_EVENTS_DEV_H_ */ - diff --git a/chromium/ppapi/c/pp_array_output.h b/chromium/ppapi/c/pp_array_output.h index add873cf8d1..2272a8f26ea 100644 --- a/chromium/ppapi/c/pp_array_output.h +++ b/chromium/ppapi/c/pp_array_output.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From pp_array_output.idl modified Thu Mar 28 11:07:53 2013. */ +/* From pp_array_output.idl modified Tue Oct 22 15:09:25 2013. */ #ifndef PPAPI_C_PP_ARRAY_OUTPUT_H_ #define PPAPI_C_PP_ARRAY_OUTPUT_H_ @@ -43,7 +43,10 @@ * @param element_size The size of each element in bytes. * * @return Returns a pointer to the allocated memory. On failure, returns null. - * You can also return null if the element_count is 0. + * You can also return null if the element_count is 0. When a non-null value is + * returned, the buffer must remain valid until after the callback runs. If used + * with a blocking callback, the buffer must remain valid until after the + * function returns. The plugin can then free any memory that it allocated. */ @@ -99,7 +102,7 @@ typedef void* (*PP_ArrayOutput_GetDataBuffer)(void* user_data, */ struct PP_ArrayOutput { /** - * A pointer to the allocation function that the browser implements. + * A pointer to the allocation function that the browser will call. */ PP_ArrayOutput_GetDataBuffer GetDataBuffer; /** diff --git a/chromium/ppapi/c/pp_macros.h b/chromium/ppapi/c/pp_macros.h index a552885ea1d..e143b2290e9 100644 --- a/chromium/ppapi/c/pp_macros.h +++ b/chromium/ppapi/c/pp_macros.h @@ -3,13 +3,13 @@ * found in the LICENSE file. */ -/* From pp_macros.idl modified Wed Apr 10 11:57:14 2013. */ +/* From pp_macros.idl modified Wed Mar 6 13:04:56 2013. */ #ifndef PPAPI_C_PP_MACROS_H_ #define PPAPI_C_PP_MACROS_H_ -#define PPAPI_RELEASE 31 +#define PPAPI_RELEASE 33 /** * @file diff --git a/chromium/ppapi/c/ppb_file_io.h b/chromium/ppapi/c/ppb_file_io.h index fe0e1bd4bba..8f272bf5a0d 100644 --- a/chromium/ppapi/c/ppb_file_io.h +++ b/chromium/ppapi/c/ppb_file_io.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_file_io.idl modified Tue Jun 11 15:21:38 2013. */ +/* From ppb_file_io.idl modified Tue Oct 22 15:09:47 2013. */ #ifndef PPAPI_C_PPB_FILE_IO_H_ #define PPAPI_C_PPB_FILE_IO_H_ @@ -135,7 +135,9 @@ struct PPB_FileIO_1_1 { * @param[out] info The <code>PP_FileInfo</code> structure representing all * information about the file. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Query(). + * completion of Query(). <code>info</code> must remain valid until after the + * callback runs. If you pass a blocking callback, <code>info</code> must + * remain valid until after Query() returns. * * @return An int32_t containing an error code from <code>pp_errors.h</code>. * PP_ERROR_FAILED will be returned if the file isn't opened, and @@ -170,6 +172,7 @@ struct PPB_FileIO_1_1 { * large enough to hold the specified number of bytes to read. This function * might perform a partial read, meaning all the requested bytes * might not be returned, even if the end of the file has not been reached. + * The FileIO object must have been opened with read access. * * ReadToArray() is preferred to Read() when doing asynchronous operations. * @@ -180,7 +183,9 @@ struct PPB_FileIO_1_1 { * @param[in] bytes_to_read The number of bytes to read from * <code>offset</code>. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Read(). + * completion of Read(). <code>buffer</code> must remain valid until after + * the callback runs. If you pass a blocking callback, <code>buffer</code> + * must remain valid until after Read() returns. * * @return The number of bytes read or an error code from * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was @@ -267,7 +272,8 @@ struct PPB_FileIO_1_1 { /** * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be * provided so that output will be stored in its allocated buffer. This - * function might perform a partial read. + * function might perform a partial read. The FileIO object must have been + * opened with read access. * * @param[in] file_io A <code>PP_Resource</code> corresponding to a file * FileIO. diff --git a/chromium/ppapi/c/private/pp_content_decryptor.h b/chromium/ppapi/c/private/pp_content_decryptor.h index 43ea559f128..a282abbf3a5 100644 --- a/chromium/ppapi/c/private/pp_content_decryptor.h +++ b/chromium/ppapi/c/private/pp_content_decryptor.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/pp_content_decryptor.idl modified Tue Dec 4 16:42:46 2012. */ +/* From private/pp_content_decryptor.idl modified Mon Oct 21 18:38:44 2013. */ #ifndef PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ #define PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ @@ -153,6 +153,20 @@ typedef enum { PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedFrameFormat, 4); /** + * <code>PP_DecryptedSampleFormat</code> contains audio sample formats. + */ +typedef enum { + PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDSAMPLEFORMAT_U8 = 1, + PP_DECRYPTEDSAMPLEFORMAT_S16 = 2, + PP_DECRYPTEDSAMPLEFORMAT_S32 = 3, + PP_DECRYPTEDSAMPLEFORMAT_F32 = 4, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16 = 5, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32 = 6 +} PP_DecryptedSampleFormat; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedSampleFormat, 4); + +/** * The <code>PP_DecryptResult</code> enum contains decryption and decoding * result constants. */ @@ -259,6 +273,36 @@ struct PP_DecryptedFrameInfo { struct PP_DecryptTrackingInfo tracking_info; }; PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedFrameInfo, 56); + +/** + * <code>PP_DecryptedSampleInfo</code> contains the result of the + * decrypt and decode operation on the associated samples, information required + * to access the sample data in buffer, and tracking info. + */ +struct PP_DecryptedSampleInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + /** + * Format of the decrypted samples. + */ + PP_DecryptedSampleFormat format; + /** + * Size in bytes of decrypted samples. + */ + uint32_t data_size; + /** + * 4-byte padding to make the size of <code>PP_DecryptedSampleInfo</code> + * a multiple of 8 bytes. The value of this field should not be used. + */ + uint32_t padding; + /** + * Information needed by the client to track the decrypted samples. + */ + struct PP_DecryptTrackingInfo tracking_info; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedSampleInfo, 32); /** * @} */ diff --git a/chromium/ppapi/c/private/ppb_content_decryptor_private.h b/chromium/ppapi/c/private/ppb_content_decryptor_private.h index 86f239aab10..58492a00a4c 100644 --- a/chromium/ppapi/c/private/ppb_content_decryptor_private.h +++ b/chromium/ppapi/c/private/ppb_content_decryptor_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_content_decryptor_private.idl, - * modified Tue Sep 17 11:31:05 2013. + * modified Fri Dec 6 12:16:22 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ @@ -18,10 +18,10 @@ #include "ppapi/c/pp_var.h" #include "ppapi/c/private/pp_content_decryptor.h" -#define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7 \ - "PPB_ContentDecryptor_Private;0.7" +#define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_9 \ + "PPB_ContentDecryptor_Private;0.9" #define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ - PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7 + PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_9 /** * @file @@ -39,82 +39,91 @@ * <code>PPB_ContentDecryptor_Private</code> structure contains the function * pointers the browser must implement to support plugins implementing the * <code>PPP_ContentDecryptor_Private</code> interface. This interface provides - * browser side support for the Content Decryption Module (CDM) for v0.1 of the - * proposed Encrypted Media Extensions: http://goo.gl/rbdnR + * browser side support for the Content Decryption Module (CDM) for Encrypted + * Media Extensions: http://www.w3.org/TR/encrypted-media/ */ -struct PPB_ContentDecryptor_Private_0_7 { +struct PPB_ContentDecryptor_Private_0_9 { /** - * A key has been added as the result of a call to the <code>AddKey()</code> - * method on the <code>PPP_ContentDecryptor_Private</code> interface. + * A session has been created by the CDM. * - * Note: The above describes the most simple case. Depending on the key - * system, a series of <code>KeyMessage()</code> calls from the CDM will be - * sent to the browser, and then on to the web application. The web - * application must then provide more data to the CDM by directing the browser - * to pass the data to the CDM via calls to <code>AddKey()</code> on the - * <code>PPP_ContentDecryptor_Private</code> interface. - * The CDM must call <code>KeyAdded()</code> when the sequence is completed, - * and, in response, the browser must notify the web application. + * @param[in] session_id Identifies the session for which the CDM + * created a session. * - * @param[in] key_system A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the name of the key system. + * @param[in] web_session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the string for the + * MediaKeySession's sessionId attribute. * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. */ - void (*KeyAdded)(PP_Instance instance, - struct PP_Var key_system, - struct PP_Var session_id); + void (*SessionCreated)(PP_Instance instance, + uint32_t session_id, + struct PP_Var web_session_id); /** * A message or request has been generated for key_system in the CDM, and * must be sent to the web application. * - * For example, when the browser invokes <code>GenerateKeyRequest()</code> + * For example, when the browser invokes <code>CreateSession()</code> * on the <code>PPP_ContentDecryptor_Private</code> interface, the plugin - * must send a key message containing the key request. + * must send a message containing the license request. * - * Note that <code>KeyMessage()</code> can be used for purposes other than - * responses to <code>GenerateKeyRequest()</code> calls. See also the text - * in the comment for <code>KeyAdded()</code>, which describes a sequence of - * <code>AddKey()</code> and <code>KeyMessage()</code> calls required to - * prepare for decryption. + * Note that <code>SessionMessage()</code> can be used for purposes other than + * responses to <code>CreateSession()</code> calls. See also the text + * in the comment for <code>SessionReady()</code>, which describes a sequence + * of <code>UpdateSession()</code> and <code>SessionMessage()</code> calls + * required to prepare for decryption. * - * @param[in] key_system A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the name of the key system. - * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. + * @param[in] session_id Identifies the session for which the message + * is intended. * * @param[in] message A <code>PP_Var</code> of type * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the message. * - * @param[in] default_url A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the default URL for the message. + * @param[in] destination_url A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the destination URL for the + * message. + */ + void (*SessionMessage)(PP_Instance instance, + uint32_t session_id, + struct PP_Var message, + struct PP_Var destination_url); + /** + * The session is now ready to decrypt the media stream. + * + * Note: The above describes the most simple case. Depending on the key + * system, a series of <code>SessionMessage()</code> calls from the CDM will + * be sent to the browser, and then on to the web application. The web + * application must then provide more data to the CDM by directing the browser + * to pass the data to the CDM via calls to <code>UpdateSession()</code> on + * the <code>PPP_ContentDecryptor_Private</code> interface. + * The CDM must call <code>SessionReady()</code> when the sequence is + * completed, and, in response, the browser must notify the web application. + * + * @param[in] session_id Identifies the session that is ready. + */ + void (*SessionReady)(PP_Instance instance, uint32_t session_id); + /** + * The session has been closed as the result of a call to the + * <code>ReleaseSession()</code> method on the + * <code>PPP_ContentDecryptor_Private</code> interface, or due to other + * factors as determined by the CDM. + * + * @param[in] session_id Identifies the session that is closed. */ - void (*KeyMessage)(PP_Instance instance, - struct PP_Var key_system, - struct PP_Var session_id, - struct PP_Var message, - struct PP_Var default_url); + void (*SessionClosed)(PP_Instance instance, uint32_t session_id); /** * An error occurred in a <code>PPP_ContentDecryptor_Private</code> method, * or within the plugin implementing the interface. * - * @param[in] key_system A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the name of the key system. - * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. + * @param[in] session_id Identifies the session for which the error + * is intended. * * @param[in] media_error A MediaKeyError. * * @param[in] system_error A system error code. */ - void (*KeyError)(PP_Instance instance, - struct PP_Var key_system, - struct PP_Var session_id, - int32_t media_error, - int32_t system_code); + void (*SessionError)(PP_Instance instance, + uint32_t session_id, + int32_t media_error, + int32_t system_code); /** * Called after the <code>Decrypt()</code> method on the * <code>PPP_ContentDecryptor_Private</code> interface completes to @@ -234,17 +243,17 @@ struct PPB_ContentDecryptor_Private_0_7 { * <code>PPB_Buffer_Dev</code> resource that contains a decrypted buffer * of decoded audio samples. * - * @param[in] decrypted_block_info A <code>PP_DecryptedBlockInfo</code> that - * contains the tracking info and result code associated with the - * <code>decrypted_block</code>. + * @param[in] decrypted_sample_info A <code>PP_DecryptedSampleInfo</code> that + * contains the tracking info and result code associated with the decrypted + * samples. */ void (*DeliverSamples)( PP_Instance instance, PP_Resource audio_frames, - const struct PP_DecryptedBlockInfo* decrypted_block_info); + const struct PP_DecryptedSampleInfo* decrypted_sample_info); }; -typedef struct PPB_ContentDecryptor_Private_0_7 PPB_ContentDecryptor_Private; +typedef struct PPB_ContentDecryptor_Private_0_9 PPB_ContentDecryptor_Private; /** * @} */ diff --git a/chromium/ppapi/c/private/ppb_ext_crx_file_system_private.h b/chromium/ppapi/c/private/ppb_ext_crx_file_system_private.h index 114a016faa6..be774115b86 100644 --- a/chromium/ppapi/c/private/ppb_ext_crx_file_system_private.h +++ b/chromium/ppapi/c/private/ppb_ext_crx_file_system_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_ext_crx_file_system_private.idl, - * modified Fri May 3 09:55:27 2013. + * modified Fri Nov 1 12:23:59 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_EXT_CRX_FILE_SYSTEM_PRIVATE_H_ @@ -23,6 +23,7 @@ /** * @file + * This file contains the <code>PPB_Ext_CrxFileSystem_Private</code> interface. */ diff --git a/chromium/ppapi/c/private/ppb_flash_drm.h b/chromium/ppapi/c/private/ppb_flash_drm.h index 85033a40851..88d0f765b59 100644 --- a/chromium/ppapi/c/private/ppb_flash_drm.h +++ b/chromium/ppapi/c/private/ppb_flash_drm.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_flash_drm.idl modified Sat Jun 8 16:45:26 2013. */ +/* From private/ppb_flash_drm.idl modified Mon Nov 11 14:49:53 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_FLASH_DRM_H_ #define PPAPI_C_PRIVATE_PPB_FLASH_DRM_H_ @@ -17,7 +17,8 @@ #include "ppapi/c/pp_var.h" #define PPB_FLASH_DRM_INTERFACE_1_0 "PPB_Flash_DRM;1.0" -#define PPB_FLASH_DRM_INTERFACE PPB_FLASH_DRM_INTERFACE_1_0 +#define PPB_FLASH_DRM_INTERFACE_1_1 "PPB_Flash_DRM;1.1" +#define PPB_FLASH_DRM_INTERFACE PPB_FLASH_DRM_INTERFACE_1_1 /** * @file @@ -32,7 +33,7 @@ /** * A resource for performing Flash DRM-related operations. */ -struct PPB_Flash_DRM_1_0 { +struct PPB_Flash_DRM_1_1 { /** * Creates a PPB_Flash_DRM resource for performing DRM-related operations in * Flash. @@ -60,9 +61,28 @@ struct PPB_Flash_DRM_1_0 { int32_t (*GetVoucherFile)(PP_Resource drm, PP_Resource* file_ref, struct PP_CompletionCallback callback); + /** + * Asynchronously returns a value indicating whether the monitor on which the + * plugin instance is displayed is external. |callback| will be called upon + * completion. + */ + int32_t (*MonitorIsExternal)(PP_Resource drm, + PP_Bool* is_external, + struct PP_CompletionCallback callback); }; -typedef struct PPB_Flash_DRM_1_0 PPB_Flash_DRM; +typedef struct PPB_Flash_DRM_1_1 PPB_Flash_DRM; + +struct PPB_Flash_DRM_1_0 { + PP_Resource (*Create)(PP_Instance instance); + int32_t (*GetDeviceID)(PP_Resource drm, + struct PP_Var* id, + struct PP_CompletionCallback callback); + PP_Bool (*GetHmonitor)(PP_Resource drm, int64_t* hmonitor); + int32_t (*GetVoucherFile)(PP_Resource drm, + PP_Resource* file_ref, + struct PP_CompletionCallback callback); +}; /** * @} */ diff --git a/chromium/ppapi/c/private/ppb_isolated_file_system_private.h b/chromium/ppapi/c/private/ppb_isolated_file_system_private.h new file mode 100644 index 00000000000..410108b8cb9 --- /dev/null +++ b/chromium/ppapi/c/private/ppb_isolated_file_system_private.h @@ -0,0 +1,86 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_isolated_file_system_private.idl, + * modified Fri Nov 8 02:21:15 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_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" + +#define PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2 \ + "PPB_IsolatedFileSystem_Private;0.2" +#define PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE \ + PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2 + +/** + * @file + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The <code>PP_IsolatedFileSystemType_Private</code> values indicate the type + * of isolated file systems. + */ +typedef enum { + /** Type for invalid file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID = 0, + /** Type for CRX file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX = 1, + /** Type for PluginPrivate file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE = 2 +} PP_IsolatedFileSystemType_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_IsolatedFileSystemType_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/* <code>PPB_IsolatedFileSystem_Private</code> interface */ +struct PPB_IsolatedFileSystem_Private_0_2 { + /** + * Open() opens a file system corresponding the given file system type. + * + * When opening the CRX file system, this should be called from an extension + * context, otherwise it will fail. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the file system. + * @param[in] type A file system type as defined by + * <code>PP_IsolatedFileSystemType_Private</code> enum. + * @param[out] file_system An output <code>PP_Resource</code> corresponding + * to a PPB_FileSystem. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Open)(PP_Instance instance, + PP_IsolatedFileSystemType_Private type, + PP_Resource* file_system, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_IsolatedFileSystem_Private_0_2 + PPB_IsolatedFileSystem_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_H_ */ + diff --git a/chromium/ppapi/c/private/ppb_nacl_private.h b/chromium/ppapi/c/private/ppb_nacl_private.h index 6441efd59be..44bbb9fde9b 100644 --- a/chromium/ppapi/c/private/ppb_nacl_private.h +++ b/chromium/ppapi/c/private/ppb_nacl_private.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_nacl_private.idl modified Thu Aug 29 17:42:12 2013. */ +/* From private/ppb_nacl_private.idl modified Fri Nov 29 09:11:40 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ @@ -40,6 +40,17 @@ typedef enum { */ PP_NACL_MANIFEST_MISSING_ARCH = 0 } PP_NaClError; + +/** Event types that NaCl may use when reporting load progress or errors. */ +typedef enum { + PP_NACL_EVENT_LOADSTART, + PP_NACL_EVENT_PROGRESS, + PP_NACL_EVENT_ERROR, + PP_NACL_EVENT_ABORT, + PP_NACL_EVENT_LOAD, + PP_NACL_EVENT_LOADEND, + PP_NACL_EVENT_CRASH +} PP_NaClEventType; /** * @} */ @@ -106,13 +117,6 @@ struct PPB_NaCl_Private_1_0 { PP_FileHandle* target_handle, uint32_t desired_access, uint32_t options); - /* Check if PNaCl is installed and attempt to install if necessary. - * Callback is called when the check is done and PNaCl is already installed, - * or after an on-demand install is attempted. Called back with PP_OK if - * PNaCl is available. Called back with an error otherwise. - */ - int32_t (*EnsurePnaclInstalled)(PP_Instance instance, - struct PP_CompletionCallback callback); /* Returns a read-only file descriptor of a file rooted in the Pnacl * component directory, or an invalid handle on failure. */ @@ -156,12 +160,6 @@ struct PPB_NaCl_Private_1_0 { * the plugin.) */ void (*ReportTranslationFinished)(PP_Instance instance, PP_Bool success); - /* Return true if we are off the record. - */ - PP_Bool (*IsOffTheRecord)(void); - /* Return true if PNaCl is turned on. - */ - PP_Bool (*IsPnaclEnabled)(void); /* Display a UI message to the user. */ PP_ExternalPluginResult (*ReportNaClError)(PP_Instance instance, PP_NaClError message_id); @@ -173,6 +171,21 @@ struct PPB_NaCl_Private_1_0 { const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi); + /* Dispatch a progress event on the DOM element where the given instance is + * embedded. + */ + void (*DispatchEvent)(PP_Instance instance, + PP_NaClEventType event_type, + struct PP_Var resource_url, + PP_Bool length_is_computable, + uint64_t loaded_bytes, + uint64_t total_bytes); + /* Sets a read-only property on the <embed> DOM element that corresponds to + * the given instance. + */ + void (*SetReadOnlyProperty)(PP_Instance instance, + struct PP_Var key, + struct PP_Var value); }; typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private; diff --git a/chromium/ppapi/c/private/ppb_output_protection_private.h b/chromium/ppapi/c/private/ppb_output_protection_private.h index d0438be8f32..d489c009e3d 100644 --- a/chromium/ppapi/c/private/ppb_output_protection_private.h +++ b/chromium/ppapi/c/private/ppb_output_protection_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_output_protection_private.idl, - * modified Sat Aug 31 03:18:39 2013. + * modified Tue Oct 8 13:22:13 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ @@ -52,7 +52,8 @@ typedef enum { PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA = 1 << 2, PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI = 1 << 3, PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI = 1 << 4, - PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5 + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK = 1 << 6 } PP_OutputProtectionLinkType_Private; PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionLinkType_Private, 4); /** @@ -148,9 +149,12 @@ struct PPB_OutputProtection_Private_0_1 { * @param[in] desired_protection_mask The desired protection methods, which * is a bit-mask of the <code>PP_OutputProtectionMethod_Private</code> * values. - * @param[in] callback A <code>PP_CompletionCallback</code> to be called when - * the protection request has been made. This may be before the protection - * have actually been applied. Call QueryStatus to get protection status. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called with + * <code>PP_OK</code> when the protection request has been made. This may be + * before the protection have actually been applied. Call QueryStatus to get + * protection status. If it failed to make the protection request, the + * callback is called with <code>PP_ERROR_FAILED</code> and there is no need + * to call QueryStatus(). * * @return An int32_t containing an error code from <code>pp_errors.h</code>. */ diff --git a/chromium/ppapi/c/private/ppb_pdf.h b/chromium/ppapi/c/private/ppb_pdf.h index fdc5748640c..9053802b897 100644 --- a/chromium/ppapi/c/private/ppb_pdf.h +++ b/chromium/ppapi/c/private/ppb_pdf.h @@ -160,6 +160,9 @@ struct PPB_PDF { // Invoke password dialog for plugin. struct PP_Var (*ModalPromptForPassword)(PP_Instance instance, struct PP_Var message); + + // Returns PP_TRUE if the plugin is out of process. + PP_Bool(*IsOutOfProcess)(PP_Instance instance); }; #endif // PPAPI_C_PRIVATE_PPB_PDF_H_ diff --git a/chromium/ppapi/c/private/ppb_platform_verification_private.h b/chromium/ppapi/c/private/ppb_platform_verification_private.h index b16d074cfae..17ff1e82927 100644 --- a/chromium/ppapi/c/private/ppb_platform_verification_private.h +++ b/chromium/ppapi/c/private/ppb_platform_verification_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_platform_verification_private.idl, - * modified Thu Sep 12 11:48:28 2013. + * modified Fri Oct 18 15:02:09 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_PLATFORM_VERIFICATION_PRIVATE_H_ @@ -18,10 +18,10 @@ #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" -#define PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_1 \ - "PPB_PlatformVerification_Private;0.1" +#define PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2 \ + "PPB_PlatformVerification_Private;0.2" #define PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE \ - PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_1 + PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2 /** * @file @@ -39,7 +39,7 @@ * services to verify that the underlying platform is trusted. An example of a * trusted platform is a Chrome OS device in verified boot mode. */ -struct PPB_PlatformVerification_Private_0_1 { +struct PPB_PlatformVerification_Private_0_2 { /** * Create() creates a <code>PPB_PlatformVerification_Private</code> object. * @@ -65,24 +65,6 @@ struct PPB_PlatformVerification_Private_0_1 { */ PP_Bool (*IsPlatformVerification)(PP_Resource resource); /** - * Check if the underlying host platform can be challenged; i.e., verified as - * a trusted platform. Useful for avoiding unnecessary work on platforms - * which will always fail; i.e. dev mode Chrome OS. - * - * @param[out] can_challenge_platform A <code>PP_Bool</code> which is set to - * <code>PP_TRUE</code> if a platform challenge might pass and - * <code>PP_FALSE</code> if it definitely won't. - * - * @param[in] callback A <code>PP_CompletionCallback</code> to be called after - * the method has been completed. This callback will only run if the return - * code is <code>PP_OK_COMPLETIONPENDING</code>. - * - * @return An int32_t containing an error code from <code>pp_errors.h</code>. - */ - int32_t (*CanChallengePlatform)(PP_Resource instance, - PP_Bool* can_challenge_platform, - struct PP_CompletionCallback callback); - /** * Requests a platform challenge for a given service id. * * @param[in] service_id A <code>PP_Var</code> of type @@ -118,7 +100,7 @@ struct PPB_PlatformVerification_Private_0_1 { struct PP_CompletionCallback callback); }; -typedef struct PPB_PlatformVerification_Private_0_1 +typedef struct PPB_PlatformVerification_Private_0_2 PPB_PlatformVerification_Private; /** * @} diff --git a/chromium/ppapi/c/dev/ppb_testing_dev.h b/chromium/ppapi/c/private/ppb_testing_private.h index e5078e2fd35..889807dfc9c 100644 --- a/chromium/ppapi/c/dev/ppb_testing_dev.h +++ b/chromium/ppapi/c/private/ppb_testing_private.h @@ -1,12 +1,12 @@ -/* Copyright (c) 2012 The Chromium Authors. All rights reserved. +/* Copyright 2013 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -/* From dev/ppb_testing_dev.idl modified Thu Apr 18 13:22:09 2013. */ +/* From private/ppb_testing_private.idl modified Mon Nov 18 14:42:33 2013. */ -#ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_ -#define PPAPI_C_DEV_PPB_TESTING_DEV_H_ +#ifndef PPAPI_C_PRIVATE_PPB_TESTING_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_TESTING_PRIVATE_H_ #include "ppapi/c/dev/ppb_url_util_dev.h" #include "ppapi/c/pp_bool.h" @@ -17,12 +17,8 @@ #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" -#define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7" -#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_0_92 "PPB_Testing(Dev);0.92" -#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_92 +#define PPB_TESTING_PRIVATE_INTERFACE_1_0 "PPB_Testing_Private;1.0" +#define PPB_TESTING_PRIVATE_INTERFACE PPB_TESTING_PRIVATE_INTERFACE_1_0 /** * @file @@ -36,7 +32,7 @@ * @addtogroup Interfaces * @{ */ -struct PPB_Testing_Dev_0_92 { +struct PPB_Testing_Private_1_0 { /** * Reads the bitmap data out of the backing store for the given * DeviceContext2D and into the given image. If the data was successfully @@ -146,58 +142,10 @@ struct PPB_Testing_Dev_0_92 { uint32_t threshold); }; -typedef struct PPB_Testing_Dev_0_92 PPB_Testing_Dev; - -struct PPB_Testing_Dev_0_7 { - 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); -}; - -struct PPB_Testing_Dev_0_8 { - 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 PPB_Testing_Dev_0_9 { - 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); -}; - -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); -}; +typedef struct PPB_Testing_Private_1_0 PPB_Testing_Private; /** * @} */ -#endif /* PPAPI_C_DEV_PPB_TESTING_DEV_H_ */ +#endif /* PPAPI_C_PRIVATE_PPB_TESTING_PRIVATE_H_ */ diff --git a/chromium/ppapi/c/private/ppp_content_decryptor_private.h b/chromium/ppapi/c/private/ppp_content_decryptor_private.h index 69763df251e..27d172d7e73 100644 --- a/chromium/ppapi/c/private/ppp_content_decryptor_private.h +++ b/chromium/ppapi/c/private/ppp_content_decryptor_private.h @@ -4,7 +4,7 @@ */ /* From private/ppp_content_decryptor_private.idl, - * modified Wed Sep 18 16:14:30 2013. + * modified Tue Dec 3 17:05:10 2013. */ #ifndef PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ @@ -18,10 +18,10 @@ #include "ppapi/c/pp_var.h" #include "ppapi/c/private/pp_content_decryptor.h" -#define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7 \ - "PPP_ContentDecryptor_Private;0.7" +#define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_9 \ + "PPP_ContentDecryptor_Private;0.9" #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ - PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7 + PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_9 /** * @file @@ -39,33 +39,30 @@ * <code>PPP_ContentDecryptor_Private</code> structure contains the function * pointers the decryption plugin must implement to provide services needed by * the browser. This interface provides the plugin side support for the Content - * Decryption Module (CDM) for v0.1 of the proposed Encrypted Media Extensions: - * http://goo.gl/rbdnR + * Decryption Module (CDM) for Encrypted Media Extensions: + * http://www.w3.org/TR/encrypted-media/ */ -struct PPP_ContentDecryptor_Private_0_7 { +struct PPP_ContentDecryptor_Private_0_9 { /** * Initialize for the specified key system. * * @param[in] key_system A <code>PP_Var</code> of type * <code>PP_VARTYPE_STRING</code> containing the name of the key system. - * - * @param[in] can_challenge_platform A <code>PP_Bool</code> that - * indicates if the underlying host platform can be challenged; - * i.e., verified as a trusted platform. */ - void (*Initialize)(PP_Instance instance, - struct PP_Var key_system, - PP_Bool can_challenge_platform); + void (*Initialize)(PP_Instance instance, struct PP_Var key_system); /** - * Generates a key request. key_system specifies the key or licensing system - * to use. type contains the MIME type of init_data. init_data is a data - * buffer containing data for use in generating the request. + * Creates a session. <code>type</code> contains the MIME type of + * <code>init_data</code>. <code>init_data</code> is a data buffer + * containing data for use in generating the request. * - * Note: <code>GenerateKeyRequest()</code> must create the session ID used in + * Note: <code>CreateSession()</code> must create the session ID used in * other methods on this interface. The session ID must be provided to the - * browser by the CDM via <code>KeyMessage()</code> on the + * browser by the CDM via <code>SessionCreated()</code> on the * <code>PPB_ContentDecryptor_Private</code> interface. * + * @param[in] session_id A reference for the session for which a session + * should be generated. + * * @param[in] type A <code>PP_Var</code> of type * <code>PP_VARTYPE_STRING</code> containing the MIME type for init_data. * @@ -73,42 +70,38 @@ struct PPP_ContentDecryptor_Private_0_7 { * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific * initialization data. */ - void (*GenerateKeyRequest)(PP_Instance instance, - struct PP_Var type, - struct PP_Var init_data); + void (*CreateSession)(PP_Instance instance, + uint32_t session_id, + struct PP_Var type, + struct PP_Var init_data); /** - * Provides a key or license to the decryptor for decrypting media data. + * Provides a license or other message to the decryptor. * - * When the CDM needs more information to complete addition of the key it - * will call <code>KeyMessage()</code> on the - * <code>PPB_ContentDecryptor_Private</code> interface, which the browser - * passes to the application. When the key is ready to use, the CDM - * must call call <code>KeyAdded()</code> on the + * When the CDM needs more information, it must call + * <code>SessionMessage()</code> on the + * <code>PPB_ContentDecryptor_Private</code> interface, and the browser + * must notify the web application. When the CDM has finished processing + * <code>response</code> and needs no more information, it must call + * <code>SessionReady()</code> on the * <code>PPB_ContentDecryptor_Private</code> interface, and the browser * must notify the web application. * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. - * - * @param[in] key A <code>PP_Var</code> of type - * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the decryption key, license, - * or other message for the given session ID. + * @param[in] session_id A reference for the session to update. * - * @param[in] init_data A <code>PP_Var</code> of type - * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific - * initialization data. + * @param[in] response A <code>PP_Var</code> of type + * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other + * message for the given session ID. */ - void (*AddKey)(PP_Instance instance, - struct PP_Var session_id, - struct PP_Var key, - struct PP_Var init_data); + void (*UpdateSession)(PP_Instance instance, + uint32_t session_id, + struct PP_Var response); /** - * Cancels a pending key request for the specified session ID. + * Release the specified session and related resources. * - * @param[in] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. + * @param[in] session_id A reference for the session that should be + * released. */ - void (*CancelKeyRequest)(PP_Instance instance, struct PP_Var session_id); + void (*ReleaseSession)(PP_Instance instance, uint32_t session_id); /** * Decrypts the block and returns the unencrypted block via * <code>DeliverBlock()</code> on the @@ -235,7 +228,7 @@ struct PPP_ContentDecryptor_Private_0_7 { const struct PP_EncryptedBlockInfo* encrypted_block_info); }; -typedef struct PPP_ContentDecryptor_Private_0_7 PPP_ContentDecryptor_Private; +typedef struct PPP_ContentDecryptor_Private_0_9 PPP_ContentDecryptor_Private; /** * @} */ diff --git a/chromium/ppapi/c/trusted/ppb_file_io_trusted.h b/chromium/ppapi/c/trusted/ppb_file_io_trusted.h deleted file mode 100644 index 8e05589eeb6..00000000000 --- a/chromium/ppapi/c/trusted/ppb_file_io_trusted.h +++ /dev/null @@ -1,73 +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 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_ - -#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_FILEIOTRUSTED_INTERFACE_0_4 "PPB_FileIOTrusted;0.4" -#define PPB_FILEIOTRUSTED_INTERFACE PPB_FILEIOTRUSTED_INTERFACE_0_4 - -/** - * @file - * - * This file defines the trusted file IO interface - */ - - -/** - * @addtogroup Interfaces - * @{ - */ -/* Available only to trusted implementations. */ -struct PPB_FileIOTrusted_0_4 { - /** - * Returns a file descriptor corresponding to the given FileIO object. On - * Windows, returns a HANDLE; on all other platforms, returns a POSIX file - * 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); - /** - * Notifies the browser that underlying file will be modified. This gives - * the browser the opportunity to apply quota restrictions and possibly - * return an error to indicate that the write is not allowed. - */ - int32_t (*WillWrite)(PP_Resource file_io, - int64_t offset, - int32_t bytes_to_write, - struct PP_CompletionCallback callback); - /** - * Notifies the browser that underlying file will be modified. This gives - * the browser the opportunity to apply quota restrictions and possibly - * return an error to indicate that the write is not allowed. - * - * TODO(darin): Maybe unify the above into a single WillChangeFileSize - * method? The above methods have the advantage of mapping to PPB_FileIO - * Write and SetLength calls. WillChangeFileSize would require the caller to - * compute the file size resulting from a Write call, which may be - * undesirable. - */ - int32_t (*WillSetLength)(PP_Resource file_io, - int64_t length, - struct PP_CompletionCallback callback); -}; - -typedef struct PPB_FileIOTrusted_0_4 PPB_FileIOTrusted; -/** - * @} - */ - -#endif /* PPAPI_C_TRUSTED_PPB_FILE_IO_TRUSTED_H_ */ - diff --git a/chromium/ppapi/cpp/dev/graphics_2d_dev.cc b/chromium/ppapi/cpp/dev/graphics_2d_dev.cc index e141bb6b705..3fd000cc2d6 100644 --- a/chromium/ppapi/cpp/dev/graphics_2d_dev.cc +++ b/chromium/ppapi/cpp/dev/graphics_2d_dev.cc @@ -4,35 +4,61 @@ #include "ppapi/cpp/dev/graphics_2d_dev.h" -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" #include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/point.h" namespace pp { namespace { -template <> const char* interface_name<PPB_Graphics2D_Dev>() { - return PPB_GRAPHICS2D_DEV_INTERFACE; +template <> const char* interface_name<PPB_Graphics2D_Dev_0_1>() { + return PPB_GRAPHICS2D_DEV_INTERFACE_0_1; +} + +template <> const char* interface_name<PPB_Graphics2D_Dev_0_2>() { + return PPB_GRAPHICS2D_DEV_INTERFACE_0_2; } } // namespace // static bool Graphics2D_Dev::SupportsScale() { - return has_interface<PPB_Graphics2D_Dev>(); + return has_interface<PPB_Graphics2D_Dev_0_1>() || + has_interface<PPB_Graphics2D_Dev_0_2>(); } bool Graphics2D_Dev::SetScale(float scale) { - if (!has_interface<PPB_Graphics2D_Dev>()) - return false; - return PP_ToBool(get_interface<PPB_Graphics2D_Dev>()->SetScale(pp_resource(), - scale)); + if (has_interface<PPB_Graphics2D_Dev_0_2>()) { + return PP_ToBool(get_interface<PPB_Graphics2D_Dev_0_2>()->SetScale( + pp_resource(), scale)); + } + if (has_interface<PPB_Graphics2D_Dev_0_1>()) { + return PP_ToBool(get_interface<PPB_Graphics2D_Dev_0_1>()->SetScale( + pp_resource(), scale)); + } + return false; } float Graphics2D_Dev::GetScale() { - if (!has_interface<PPB_Graphics2D_Dev>()) - return 1.0f; - return get_interface<PPB_Graphics2D_Dev>()->GetScale(pp_resource()); + if (has_interface<PPB_Graphics2D_Dev_0_2>()) + return get_interface<PPB_Graphics2D_Dev_0_2>()->GetScale(pp_resource()); + if (has_interface<PPB_Graphics2D_Dev_0_1>()) + return get_interface<PPB_Graphics2D_Dev_0_1>()->GetScale(pp_resource()); + return 1.0f; +} + +void Graphics2D_Dev::SetOffset(const pp::Point& offset) { + if (!has_interface<PPB_Graphics2D_Dev_0_2>()) + return; + get_interface<PPB_Graphics2D_Dev_0_2>()->SetOffset(pp_resource(), + &offset.pp_point()); +} + +void Graphics2D_Dev::SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) { + if (!has_interface<PPB_Graphics2D_Dev_0_2>()) + return; + get_interface<PPB_Graphics2D_Dev_0_2>()->SetResizeMode(pp_resource(), + resize_mode); } } // namespace pp diff --git a/chromium/ppapi/cpp/dev/graphics_2d_dev.h b/chromium/ppapi/cpp/dev/graphics_2d_dev.h index 3dc8c7190ae..52c2e666d9e 100644 --- a/chromium/ppapi/cpp/dev/graphics_2d_dev.h +++ b/chromium/ppapi/cpp/dev/graphics_2d_dev.h @@ -7,8 +7,12 @@ #include "ppapi/cpp/graphics_2d.h" +#include "ppapi/c/dev/ppb_graphics_2d_dev.h" + namespace pp { +class Point; + // Graphics2DDev is a version of Graphics2D that exposes under-development APIs // for HiDPI class Graphics2D_Dev : public Graphics2D { @@ -48,6 +52,23 @@ class Graphics2D_Dev : public Graphics2D { /// @return Returns the scale factor for the graphics context. If the resource /// is invalid, 0.0 will be returned. float GetScale(); + + /// Set the offset into the plugin element at which the graphics context is + /// painted. This allows a portion of the plugin element to be painted to. + /// The new offset will only be applied after Flush() has been called. + /// + /// @param[in] resource A <code>Graphics2D</code> context resource. + /// @param[in] offset The offset at which the context should be painted. + void SetOffset(const pp::Point& offset); + + /// Sets the resize mode for the graphics context. When a plugin element is + /// resized in the DOM, it takes time for the plugin to update the graphics + /// context in the renderer. These options affect how the existing context is + /// displayed until the backing store is updated by the plugin. + /// + ///@param[in] resource A <code>Graphics2D</code> context resource. + ///@param[in] resize_mode The resize mode to change this context to. + void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode); }; } // namespace pp diff --git a/chromium/ppapi/cpp/dev/url_util_dev.cc b/chromium/ppapi/cpp/dev/url_util_dev.cc index 5029a4576c2..b0eece6e21e 100644 --- a/chromium/ppapi/cpp/dev/url_util_dev.cc +++ b/chromium/ppapi/cpp/dev/url_util_dev.cc @@ -5,88 +5,191 @@ #include "ppapi/cpp/dev/url_util_dev.h" #include "ppapi/cpp/instance_handle.h" -#include "ppapi/cpp/module.h" +#include "ppapi/cpp/module_impl.h" namespace pp { +namespace { + +template <> const char* interface_name<PPB_URLUtil_Dev_0_6>() { + return PPB_URLUTIL_DEV_INTERFACE_0_6; +} + +template <> const char* interface_name<PPB_URLUtil_Dev_0_7>() { + return PPB_URLUTIL_DEV_INTERFACE_0_7; +} + +} // namespace + // static const URLUtil_Dev* URLUtil_Dev::Get() { - static bool tried_to_init = false; static URLUtil_Dev util; + static bool tried_to_init = false; + static bool interface_available = false; if (!tried_to_init) { tried_to_init = true; - util.interface_ = static_cast<const PPB_URLUtil_Dev*>( - Module::Get()->GetBrowserInterface(PPB_URLUTIL_DEV_INTERFACE)); + if (has_interface<PPB_URLUtil_Dev_0_7>() || + has_interface<PPB_URLUtil_Dev_0_6>()) + interface_available = true; } - if (!util.interface_) + if (!interface_available) return NULL; return &util; } Var URLUtil_Dev::Canonicalize(const Var& url, PP_URLComponents_Dev* components) const { - return Var(PASS_REF, interface_->Canonicalize(url.pp_var(), components)); + if (has_interface<PPB_URLUtil_Dev_0_7>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_7>()->Canonicalize(url.pp_var(), + components)); + } + if (has_interface<PPB_URLUtil_Dev_0_6>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_6>()->Canonicalize(url.pp_var(), + components)); + } + return Var(); } Var URLUtil_Dev::ResolveRelativeToURL(const Var& base_url, const Var& relative_string, PP_URLComponents_Dev* components) const { - return Var(PASS_REF, - interface_->ResolveRelativeToURL(base_url.pp_var(), - relative_string.pp_var(), - components)); + if (has_interface<PPB_URLUtil_Dev_0_7>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_7>()->ResolveRelativeToURL( + base_url.pp_var(), + relative_string.pp_var(), + components)); + } + if (has_interface<PPB_URLUtil_Dev_0_6>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_6>()->ResolveRelativeToURL( + base_url.pp_var(), + relative_string.pp_var(), + components)); + } + return Var(); } Var URLUtil_Dev::ResolveRelativeToDocument( const InstanceHandle& instance, const Var& relative_string, PP_URLComponents_Dev* components) const { - return Var(PASS_REF, - interface_->ResolveRelativeToDocument(instance.pp_instance(), - relative_string.pp_var(), - components)); + if (has_interface<PPB_URLUtil_Dev_0_7>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_7>()->ResolveRelativeToDocument( + instance.pp_instance(), + relative_string.pp_var(), + components)); + } + if (has_interface<PPB_URLUtil_Dev_0_6>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_6>()->ResolveRelativeToDocument( + instance.pp_instance(), + relative_string.pp_var(), + components)); + } + return Var(); } bool URLUtil_Dev::IsSameSecurityOrigin(const Var& url_a, const Var& url_b) const { - return PP_ToBool(interface_->IsSameSecurityOrigin(url_a.pp_var(), - url_b.pp_var())); + if (has_interface<PPB_URLUtil_Dev_0_7>()) { + return PP_ToBool( + get_interface<PPB_URLUtil_Dev_0_7>()->IsSameSecurityOrigin( + url_a.pp_var(), + url_b.pp_var())); + } + if (has_interface<PPB_URLUtil_Dev_0_6>()) { + return PP_ToBool( + get_interface<PPB_URLUtil_Dev_0_6>()->IsSameSecurityOrigin( + url_a.pp_var(), + url_b.pp_var())); + } + return false; } bool URLUtil_Dev::DocumentCanRequest(const InstanceHandle& instance, const Var& url) const { - return PP_ToBool(interface_->DocumentCanRequest(instance.pp_instance(), - url.pp_var())); + if (has_interface<PPB_URLUtil_Dev_0_7>()) { + return PP_ToBool( + get_interface<PPB_URLUtil_Dev_0_7>()->DocumentCanRequest( + instance.pp_instance(), + url.pp_var())); + } + if (has_interface<PPB_URLUtil_Dev_0_6>()) { + return PP_ToBool( + get_interface<PPB_URLUtil_Dev_0_6>()->DocumentCanRequest( + instance.pp_instance(), + url.pp_var())); + } + return false; } bool URLUtil_Dev::DocumentCanAccessDocument( const InstanceHandle& active, const InstanceHandle& target) const { - return PP_ToBool( - interface_->DocumentCanAccessDocument(active.pp_instance(), - target.pp_instance())); + if (has_interface<PPB_URLUtil_Dev_0_7>()) { + return PP_ToBool( + get_interface<PPB_URLUtil_Dev_0_7>()->DocumentCanAccessDocument( + active.pp_instance(), + target.pp_instance())); + } + if (has_interface<PPB_URLUtil_Dev_0_6>()) { + return PP_ToBool( + get_interface<PPB_URLUtil_Dev_0_6>()->DocumentCanAccessDocument( + active.pp_instance(), + target.pp_instance())); + } + return false; } Var URLUtil_Dev::GetDocumentURL(const InstanceHandle& instance, PP_URLComponents_Dev* components) const { - return Var(PASS_REF, - interface_->GetDocumentURL(instance.pp_instance(), components)); + if (has_interface<PPB_URLUtil_Dev_0_7>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_7>()->GetDocumentURL( + instance.pp_instance(), + components)); + } + if (has_interface<PPB_URLUtil_Dev_0_6>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_6>()->GetDocumentURL( + instance.pp_instance(), + components)); + } + return Var(); } Var URLUtil_Dev::GetPluginInstanceURL(const InstanceHandle& instance, PP_URLComponents_Dev* components) const { - return Var(PASS_REF, - interface_->GetPluginInstanceURL(instance.pp_instance(), - components)); + if (has_interface<PPB_URLUtil_Dev_0_7>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_7>()->GetPluginInstanceURL( + instance.pp_instance(), + components)); + } + if (has_interface<PPB_URLUtil_Dev_0_6>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_6>()->GetPluginInstanceURL( + instance.pp_instance(), + components)); + } + return Var(); } Var URLUtil_Dev::GetPluginReferrerURL(const InstanceHandle& instance, PP_URLComponents_Dev* components) const { - return Var(PASS_REF, - interface_->GetPluginReferrerURL(instance.pp_instance(), - components)); + if (has_interface<PPB_URLUtil_Dev_0_7>()) { + return Var(PASS_REF, + get_interface<PPB_URLUtil_Dev_0_7>()->GetPluginReferrerURL( + instance.pp_instance(), + components)); + } + return Var(); } } // namespace pp diff --git a/chromium/ppapi/cpp/dev/url_util_dev.h b/chromium/ppapi/cpp/dev/url_util_dev.h index 9399752514a..db63e7a3a01 100644 --- a/chromium/ppapi/cpp/dev/url_util_dev.h +++ b/chromium/ppapi/cpp/dev/url_util_dev.h @@ -16,10 +16,9 @@ class InstanceHandle; class URLUtil_Dev { public: // This class is just a collection of random functions that aren't - // particularly attached to anything. So this getter returns a cached - // instance of this interface. This may return NULL if the browser doesn't - // support the URLUtil interface. Since this is a singleton, don't delete the - // pointer. + // particularly attached to anything. This may return NULL if the + // browser doesn't support the URLUtil interface. Since this is a + // singleton, don't delete the pointer. static const URLUtil_Dev* Get(); Var Canonicalize(const Var& url, @@ -45,13 +44,11 @@ class URLUtil_Dev { PP_URLComponents_Dev* components = NULL) const; private: - URLUtil_Dev() : interface_(NULL) {} + URLUtil_Dev() {} // Copy and assignment are disallowed. URLUtil_Dev(const URLUtil_Dev& other); URLUtil_Dev& operator=(const URLUtil_Dev& other); - - const PPB_URLUtil_Dev* interface_; }; } // namespace pp diff --git a/chromium/ppapi/cpp/dev/var_resource_dev.cc b/chromium/ppapi/cpp/dev/var_resource_dev.cc new file mode 100644 index 00000000000..69fb15b0898 --- /dev/null +++ b/chromium/ppapi/cpp/dev/var_resource_dev.cc @@ -0,0 +1,70 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/cpp/dev/var_resource_dev.h" + +#include "ppapi/c/dev/ppb_var_resource_dev.h" +#include "ppapi/cpp/logging.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_VarResource_Dev_0_1>() { + return PPB_VAR_RESOURCE_DEV_INTERFACE_0_1; +} + +} // namespace + +VarResource_Dev::VarResource_Dev(const pp::Resource& resource) : Var(Null()) { + if (!has_interface<PPB_VarResource_Dev_0_1>()) { + PP_NOTREACHED(); + return; + } + + // Note: Var(Null()) sets is_managed_ to true, so |var_| will be properly + // released upon destruction. + var_ = get_interface<PPB_VarResource_Dev_0_1>()->VarFromResource( + resource.pp_resource()); +} + +VarResource_Dev::VarResource_Dev(const Var& var) : Var(var) { + if (!var.is_resource()) { + PP_NOTREACHED(); + + // This takes care of releasing the reference that this object holds. + Var::operator=(Var(Null())); + } +} + +VarResource_Dev::VarResource_Dev(const VarResource_Dev& other) : Var(other) {} + +VarResource_Dev::~VarResource_Dev() {} + +VarResource_Dev& VarResource_Dev::operator=(const VarResource_Dev& other) { + Var::operator=(other); + return *this; +} + +Var& VarResource_Dev::operator=(const Var& other) { + if (other.is_resource()) { + Var::operator=(other); + } else { + PP_NOTREACHED(); + Var::operator=(Var(Null())); + } + return *this; +} + +pp::Resource VarResource_Dev::AsResource() { + if (!has_interface<PPB_VarResource_Dev_0_1>()) + return pp::Resource(); + + return pp::Resource( + pp::PASS_REF, + get_interface<PPB_VarResource_Dev_0_1>()->VarToResource(var_)); +} + +} // namespace pp diff --git a/chromium/ppapi/cpp/dev/var_resource_dev.h b/chromium/ppapi/cpp/dev/var_resource_dev.h new file mode 100644 index 00000000000..ab879a55635 --- /dev/null +++ b/chromium/ppapi/cpp/dev/var_resource_dev.h @@ -0,0 +1,53 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_CPP_VAR_RESOURCE_DEV_H_ +#define PPAPI_CPP_VAR_RESOURCE_DEV_H_ + +#include "ppapi/cpp/resource.h" +#include "ppapi/cpp/var.h" + +/// @file +/// This file defines the API for interacting with resource vars. + +namespace pp { + +class VarResource_Dev : public Var { + public: + /// Constructs a <code>VarResource_Dev</code> given a resource. + explicit VarResource_Dev(const pp::Resource& resource); + + /// Constructs a <code>VarResource_Dev</code> given a var for which + /// is_resource() is true. This will refer to the same resource var, but allow + /// you to access methods specific to resources. + /// + /// @param[in] var A resource var. + explicit VarResource_Dev(const Var& var); + + /// Copy constructor. + VarResource_Dev(const VarResource_Dev& other); + + virtual ~VarResource_Dev(); + + /// Assignment operator. + VarResource_Dev& operator=(const VarResource_Dev& other); + + /// The <code>Var</code> assignment operator is overridden here so that we can + /// check for assigning a non-resource var to a <code>VarResource_Dev</code>. + /// + /// @param[in] other The resource var to be assigned. + /// + /// @return The resulting <code>VarResource_Dev</code> (as a + /// <code>Var</code>&). + virtual Var& operator=(const Var& other); + + /// Gets the resource contained in the var. + /// + /// @return The <code>pp::Resource</code> that is contained in the var. + pp::Resource AsResource(); +}; + +} // namespace pp + +#endif // PPAPI_CPP_VAR_RESOURCE_DEV_H_ diff --git a/chromium/ppapi/cpp/extensions/dev/alarms_dev.cc b/chromium/ppapi/cpp/extensions/dev/alarms_dev.cc deleted file mode 100644 index 1cf84646350..00000000000 --- a/chromium/ppapi/cpp/extensions/dev/alarms_dev.cc +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/extensions/dev/alarms_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" -#include "ppapi/cpp/var_dictionary.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_Ext_Alarms_Dev_0_1>() { - return PPB_EXT_ALARMS_DEV_INTERFACE_0_1; -} - -} // namespace - -namespace ext { -namespace alarms { - -const char* const Alarm_Dev::kName = "name"; -const char* const Alarm_Dev::kScheduledTime = "scheduledTime"; -const char* const Alarm_Dev::kPeriodInMinutes = "periodInMinutes"; - -Alarm_Dev::Alarm_Dev() - : name(kName), - scheduled_time(kScheduledTime), - period_in_minutes(kPeriodInMinutes) { -} - -Alarm_Dev::~Alarm_Dev() { -} - -bool Alarm_Dev::Populate(const PP_Ext_Alarms_Alarm_Dev& value) { - if (value.type != PP_VARTYPE_DICTIONARY) - return false; - - VarDictionary dict(value); - bool result = name.Populate(dict); - result = scheduled_time.Populate(dict) && result; - result = period_in_minutes.Populate(dict) && result; - - return result; -} - -Var Alarm_Dev::CreateVar() const { - VarDictionary dict; - - bool result = name.AddTo(&dict); - result = scheduled_time.AddTo(&dict) && result; - result = period_in_minutes.MayAddTo(&dict) && result; - PP_DCHECK(result); - - return dict; -} - -const char* const AlarmCreateInfo_Dev::kWhen = "when"; -const char* const AlarmCreateInfo_Dev::kDelayInMinutes = "delayInMinutes"; -const char* const AlarmCreateInfo_Dev::kPeriodInMinutes = "periodInMinutes"; - -AlarmCreateInfo_Dev::AlarmCreateInfo_Dev() - : when(kWhen), - delay_in_minutes(kDelayInMinutes), - period_in_minutes(kPeriodInMinutes) { -} - -AlarmCreateInfo_Dev::~AlarmCreateInfo_Dev() { -} - -bool AlarmCreateInfo_Dev::Populate( - const PP_Ext_Alarms_AlarmCreateInfo_Dev& value) { - if (value.type != PP_VARTYPE_DICTIONARY) - return false; - - VarDictionary dict(value); - bool result = when.Populate(dict); - result = delay_in_minutes.Populate(dict) && result; - result = period_in_minutes.Populate(dict) && result; - - return result; -} - -Var AlarmCreateInfo_Dev::CreateVar() const { - VarDictionary dict; - - bool result = when.MayAddTo(&dict); - result = delay_in_minutes.MayAddTo(&dict) && result; - result = period_in_minutes.MayAddTo(&dict) && result; - PP_DCHECK(result); - - return dict; -} - -Alarms_Dev::Alarms_Dev(const InstanceHandle& instance) : instance_(instance) { -} - -Alarms_Dev::~Alarms_Dev() { -} - -void Alarms_Dev::Create(const Optional<std::string>& name, - const AlarmCreateInfo_Dev& alarm_info) { - if (!has_interface<PPB_Ext_Alarms_Dev_0_1>()) - return; - - internal::ToVarConverter<Optional<std::string> > name_var(name); - internal::ToVarConverter<AlarmCreateInfo_Dev> alarm_info_var(alarm_info); - - return get_interface<PPB_Ext_Alarms_Dev_0_1>()->Create( - instance_.pp_instance(), - name_var.pp_var(), - alarm_info_var.pp_var()); -} - -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); - - internal::ToVarConverter<Optional<std::string> > name_var(name); - - return get_interface<PPB_Ext_Alarms_Dev_0_1>()->Get( - instance_.pp_instance(), - name_var.pp_var(), - callback.output(), - callback.pp_completion_callback()); -} - -int32_t Alarms_Dev::GetAll(const GetAllCallback& callback) { - if (!has_interface<PPB_Ext_Alarms_Dev_0_1>()) - return callback.MayForce(PP_ERROR_NOINTERFACE); - - return get_interface<PPB_Ext_Alarms_Dev_0_1>()->GetAll( - instance_.pp_instance(), - callback.output(), - callback.pp_completion_callback()); -} - -void Alarms_Dev::Clear(const Optional<std::string>& name) { - if (!has_interface<PPB_Ext_Alarms_Dev_0_1>()) - return; - - internal::ToVarConverter<Optional<std::string> > name_var(name); - - return get_interface<PPB_Ext_Alarms_Dev_0_1>()->Clear( - instance_.pp_instance(), - name_var.pp_var()); -} - -void Alarms_Dev::ClearAll() { - if (!has_interface<PPB_Ext_Alarms_Dev_0_1>()) - return; - - return get_interface<PPB_Ext_Alarms_Dev_0_1>()->ClearAll( - instance_.pp_instance()); -} - -OnAlarmEvent_Dev::OnAlarmEvent_Dev( - const InstanceHandle& instance, - Listener* listener) - : internal::EventBase1<PP_Ext_Alarms_OnAlarm_Dev, Alarm_Dev>(instance), - listener_(listener) { -} - -OnAlarmEvent_Dev::~OnAlarmEvent_Dev() { -} - -void OnAlarmEvent_Dev::Callback(Alarm_Dev& alarm) { - listener_->OnAlarm(alarm); -} - -} // namespace alarms -} // namespace ext -} // namespace pp diff --git a/chromium/ppapi/cpp/extensions/dev/alarms_dev.h b/chromium/ppapi/cpp/extensions/dev/alarms_dev.h deleted file mode 100644 index 57d82d0bf8f..00000000000 --- a/chromium/ppapi/cpp/extensions/dev/alarms_dev.h +++ /dev/null @@ -1,117 +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_CPP_EXTENSIONS_DEV_ALARMS_DEV_H_ -#define PPAPI_CPP_EXTENSIONS_DEV_ALARMS_DEV_H_ - -#include <string> -#include <vector> - -#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" -#include "ppapi/cpp/instance_handle.h" -#include "ppapi/cpp/var.h" - -namespace pp { -namespace ext { - -template <class T> -class ExtCompletionCallbackWithOutput; - -template <class T> -class Optional; - -namespace alarms { - -// Data types ------------------------------------------------------------------ -class Alarm_Dev { - public: - Alarm_Dev(); - ~Alarm_Dev(); - - bool Populate(const PP_Ext_Alarms_Alarm_Dev& value); - - Var CreateVar() const; - - static const char* const kName; - static const char* const kScheduledTime; - static const char* const kPeriodInMinutes; - - DictField<std::string> name; - DictField<double> scheduled_time; - OptionalDictField<double> period_in_minutes; -}; - -class AlarmCreateInfo_Dev { - public: - AlarmCreateInfo_Dev(); - ~AlarmCreateInfo_Dev(); - - bool Populate(const PP_Ext_Alarms_AlarmCreateInfo_Dev& value); - - Var CreateVar() const; - - static const char* const kWhen; - static const char* const kDelayInMinutes; - static const char* const kPeriodInMinutes; - - OptionalDictField<double> when; - OptionalDictField<double> delay_in_minutes; - OptionalDictField<double> period_in_minutes; -}; - -// Functions ------------------------------------------------------------------- -class Alarms_Dev { - public: - explicit Alarms_Dev(const InstanceHandle& instance); - ~Alarms_Dev(); - - void Create(const Optional<std::string>& name, - const AlarmCreateInfo_Dev& alarm_info); - - 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: - InstanceHandle instance_; -}; - -// Events ---------------------------------------------------------------------- -// Please see ppapi/cpp/extensions/event_base.h for how to use an event class. - -class OnAlarmEvent_Dev - : public internal::EventBase1<PP_Ext_Alarms_OnAlarm_Dev, Alarm_Dev> { - public: - class Listener { - public: - virtual ~Listener() {} - - virtual void OnAlarm(Alarm_Dev& alarm) = 0; - }; - - // |listener| is not owned by this instance and must outlive it. - OnAlarmEvent_Dev(const InstanceHandle& instance, Listener* listener); - virtual ~OnAlarmEvent_Dev(); - - private: - virtual void Callback(Alarm_Dev& alarm); - - Listener* listener_; -}; - -} // namespace alarms -} // namespace ext -} // namespace pp - -#endif // PPAPI_CPP_EXTENSIONS_DEV_ALARMS_DEV_H_ diff --git a/chromium/ppapi/cpp/extensions/dev/events_dev.cc b/chromium/ppapi/cpp/extensions/dev/events_dev.cc deleted file mode 100644 index d80008f2dc5..00000000000 --- a/chromium/ppapi/cpp/extensions/dev/events_dev.cc +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/extensions/dev/events_dev.h" - -#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_Ext_Events_Dev_0_1>() { - return PPB_EXT_EVENTS_DEV_INTERFACE_0_1; -} - -} // namespace - -namespace ext { -namespace events { - -// static -uint32_t Events_Dev::AddListener(PP_Instance instance, - const PP_Ext_EventListener& listener) { - if (!has_interface<PPB_Ext_Events_Dev_0_1>()) - return 0; - return get_interface<PPB_Ext_Events_Dev_0_1>()->AddListener(instance, - listener); -} - -// static -void Events_Dev::RemoveListener(PP_Instance instance, - uint32_t listener_id) { - if (has_interface<PPB_Ext_Events_Dev_0_1>()) { - get_interface<PPB_Ext_Events_Dev_0_1>()->RemoveListener(instance, - listener_id); - } -} - -} // namespace events -} // namespace ext -} // namespace pp diff --git a/chromium/ppapi/cpp/extensions/dev/events_dev.h b/chromium/ppapi/cpp/extensions/dev/events_dev.h deleted file mode 100644 index e816ca5fb8a..00000000000 --- a/chromium/ppapi/cpp/extensions/dev/events_dev.h +++ /dev/null @@ -1,34 +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_CPP_EXTENSIONS_DEV_EVENTS_DEV_H_ -#define PPAPI_CPP_EXTENSIONS_DEV_EVENTS_DEV_H_ - -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_stdint.h" - -struct PP_Ext_EventListener; - -namespace pp { -namespace ext { -namespace events { - -// This is a simple wrapper of the PPB_Ext_Events_Dev interface. -// -// Usually you don't have to directly use this interface. Instead, you could -// use those more object-oriented event classes. Please see -// ppapi/cpp/extensions/event_base.h for more details. -class Events_Dev { - public: - static uint32_t AddListener(PP_Instance instance, - const PP_Ext_EventListener& listener); - - static void RemoveListener(PP_Instance instance, uint32_t listener_id); -}; - -} // namespace events -} // namespace ext -} // namespace pp - -#endif // PPAPI_CPP_EXTENSIONS_DEV_EVENTS_DEV_H_ diff --git a/chromium/ppapi/cpp/extensions/event_base.cc b/chromium/ppapi/cpp/extensions/event_base.cc deleted file mode 100644 index 210b213d0e3..00000000000 --- a/chromium/ppapi/cpp/extensions/event_base.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/extensions/event_base.h" - -#include "ppapi/cpp/extensions/dev/events_dev.h" - -namespace pp { -namespace ext { -namespace internal { - -GenericEventBase::GenericEventBase( - const InstanceHandle& instance, - const PP_Ext_EventListener& pp_listener) - : instance_(instance), - listener_id_(0), - pp_listener_(pp_listener) { -} - -GenericEventBase::~GenericEventBase() { - StopListening(); -} - -bool GenericEventBase::StartListening() { - if (IsListening()) - return true; - - listener_id_ = events::Events_Dev::AddListener(instance_.pp_instance(), - pp_listener_); - return IsListening(); -} - -void GenericEventBase::StopListening() { - if (!IsListening()) - return; - - events::Events_Dev::RemoveListener(instance_.pp_instance(), listener_id_); - listener_id_ = 0; -} - -} // namespace internal -} // namespace ext -} // namespace pp diff --git a/chromium/ppapi/cpp/extensions/event_base.h b/chromium/ppapi/cpp/extensions/event_base.h deleted file mode 100644 index 75144c0d8b1..00000000000 --- a/chromium/ppapi/cpp/extensions/event_base.h +++ /dev/null @@ -1,232 +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_CPP_EXTENSIONS_EVENT_BASE_H_ -#define PPAPI_CPP_EXTENSIONS_EVENT_BASE_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" -#include "ppapi/cpp/extensions/from_var_converter.h" -#include "ppapi/cpp/instance_handle.h" -#include "ppapi/cpp/logging.h" - -namespace pp { -namespace ext { -namespace internal { - -// This file contains base classes for events. Usually you don't need to use -// them directly. -// -// For each event type, there is a corresponding event class derived from -// EventBase[0-3]. The event class defines a Listener interface and exposes the -// public methods of GenericEventBase. -// -// Take pp::ext::alarms::OnAlarmEvent_Dev as example, your code to listen to the -// event would look like this: -// -// class MyListener : public pp::ext::alarms::OnAlarmEvent_Dev { -// ... -// // The parameter is a non-const reference so you could directly modify it -// // if necessary. -// virtual void OnAlarm(Alarm_Dev& alarm) { -// ...handle the event... -// } -// }; -// -// MyListener on_alarm_listener; -// // The listener is not owned by the event and must outlive it. -// pp::ext::alarms::OnAlarmEvent_Dev on_alarm(instance, &on_alarm_listener); -// on_alarm.StartListening(); -// ... -// // It is guaranteed that |on_alarm_listener| won't get called after -// // |on_alarm| goes away. So this step is optional. -// on_alarm.StopListening(); - -class GenericEventBase { - public: - bool StartListening(); - void StopListening(); - - bool IsListening() const { return listener_id_ != 0; } - uint32_t listener_id() const { return listener_id_; } - - protected: - GenericEventBase(const InstanceHandle& instance, - const PP_Ext_EventListener& pp_listener); - ~GenericEventBase(); - - InstanceHandle instance_; - uint32_t listener_id_; - const PP_Ext_EventListener pp_listener_; - - private: - // Disallow copying and assignment. - GenericEventBase(const GenericEventBase&); - GenericEventBase& operator=(const GenericEventBase&); -}; - -// EventBase[0-3] are event base classes which can be instantiated with a -// pointer to a PP_Ext_EventListener creation function and the input parameter -// types of the listener callback. -// -// For example, EvenBase1<PP_Ext_Alarms_OnAlarm_Dev, Alarm_Dev> deals with -// the event type defined by the PP_Ext_Alarms_OnAlarm_Dev function pointer. And -// it defines a pure virtual method as the listener callback: -// virtual void Callback(Alarm_Dev&) = 0; - -typedef PP_Ext_EventListener (*CreatePPEventListener0)( - void (*)(uint32_t, void*), void*); -template <const CreatePPEventListener0 kCreatePPEventListener0> -class EventBase0 : public GenericEventBase { - public: - explicit EventBase0(const InstanceHandle& instance) - : PP_ALLOW_THIS_IN_INITIALIZER_LIST( - GenericEventBase(instance, - kCreatePPEventListener0(&CallbackThunk, this))) { - } - - virtual ~EventBase0() {} - - private: - virtual void Callback() = 0; - - static void CallbackThunk(uint32_t listener_id, void* user_data) { - EventBase0<kCreatePPEventListener0>* event_base = - static_cast<EventBase0<kCreatePPEventListener0>*>(user_data); - PP_DCHECK(listener_id == event_base->listener_id_); - // Suppress unused variable warnings. - static_cast<void>(listener_id); - - event_base->Callback(); - } - - // Disallow copying and assignment. - EventBase0(const EventBase0<kCreatePPEventListener0>&); - EventBase0<kCreatePPEventListener0>& operator=( - const EventBase0<kCreatePPEventListener0>&); -}; - -typedef PP_Ext_EventListener (*CreatePPEventListener1)( - void (*)(uint32_t, void*, PP_Var), void*); -template <const CreatePPEventListener1 kCreatePPEventListener1, class A> -class EventBase1 : public GenericEventBase { - public: - explicit EventBase1(const InstanceHandle& instance) - : PP_ALLOW_THIS_IN_INITIALIZER_LIST( - GenericEventBase(instance, - kCreatePPEventListener1(&CallbackThunk, this))) { - } - - virtual ~EventBase1() {} - - private: - virtual void Callback(A&) = 0; - - static void CallbackThunk(uint32_t listener_id, - void* user_data, - PP_Var var_a) { - EventBase1<kCreatePPEventListener1, A>* event_base = - static_cast<EventBase1<kCreatePPEventListener1, A>*>(user_data); - PP_DCHECK(listener_id == event_base->listener_id_); - // Suppress unused variable warnings. - static_cast<void>(listener_id); - - FromVarConverter<A> a(var_a); - event_base->Callback(a.value()); - } - - // Disallow copying and assignment. - EventBase1(const EventBase1<kCreatePPEventListener1, A>&); - EventBase1<kCreatePPEventListener1, A>& operator=( - const EventBase1<kCreatePPEventListener1, A>&); -}; - -typedef PP_Ext_EventListener (*CreatePPEventListener2)( - void (*)(uint32_t, void*, PP_Var, PP_Var), void*); -template <const CreatePPEventListener2 kCreatePPEventListener2, - class A, - class B> -class EventBase2 : public GenericEventBase { - public: - explicit EventBase2(const InstanceHandle& instance) - : PP_ALLOW_THIS_IN_INITIALIZER_LIST( - GenericEventBase(instance, - kCreatePPEventListener2(&CallbackThunk, this))) { - } - - virtual ~EventBase2() {} - - private: - virtual void Callback(A&, B&) = 0; - - static void CallbackThunk(uint32_t listener_id, - void* user_data, - PP_Var var_a, - PP_Var var_b) { - EventBase2<kCreatePPEventListener2, A, B>* event_base = - static_cast<EventBase2<kCreatePPEventListener2, A, B>*>(user_data); - PP_DCHECK(listener_id == event_base->listener_id_); - // Suppress unused variable warnings. - static_cast<void>(listener_id); - - FromVarConverter<A> a(var_a); - FromVarConverter<B> b(var_b); - event_base->Callback(a.value(), b.value()); - } - - // Disallow copying and assignment. - EventBase2(const EventBase2<kCreatePPEventListener2, A, B>&); - EventBase2<kCreatePPEventListener2, A, B>& operator=( - const EventBase2<kCreatePPEventListener2, A, B>&); -}; - -typedef PP_Ext_EventListener (*CreatePPEventListener3)( - void (*)(uint32_t, void*, PP_Var, PP_Var, PP_Var), void*); -template <const CreatePPEventListener3 kCreatePPEventListener3, - class A, - class B, - class C> -class EventBase3 : public GenericEventBase { - public: - explicit EventBase3(const InstanceHandle& instance) - : PP_ALLOW_THIS_IN_INITIALIZER_LIST( - GenericEventBase(instance, - kCreatePPEventListener3(&CallbackThunk, this))) { - } - - virtual ~EventBase3() {} - - private: - virtual void Callback(A&, B&, C&) = 0; - - static void CallbackThunk(uint32_t listener_id, - void* user_data, - PP_Var var_a, - PP_Var var_b, - PP_Var var_c) { - EventBase3<kCreatePPEventListener3, A, B, C>* event_base = - static_cast<EventBase3<kCreatePPEventListener3, A, B, C>*>(user_data); - PP_DCHECK(listener_id == event_base->listener_id_); - // Suppress unused variable warnings. - static_cast<void>(listener_id); - - FromVarConverter<A> a(var_a); - FromVarConverter<B> b(var_b); - FromVarConverter<C> c(var_c); - event_base->Callback(a.value(), b.value(), c.value()); - } - - // Disallow copying and assignment. - EventBase3(const EventBase3<kCreatePPEventListener3, A, B, C>&); - EventBase3<kCreatePPEventListener3, A, B, C>& operator=( - const EventBase3<kCreatePPEventListener3, A, B, C>&); -}; - -} // namespace internal -} // namespace ext -} // namespace pp - -#endif // PPAPI_CPP_EXTENSIONS_EVENT_BASE_H_ diff --git a/chromium/ppapi/cpp/file_io.h b/chromium/ppapi/cpp/file_io.h index 99d8ce74d90..bbd6b57b9ec 100644 --- a/chromium/ppapi/cpp/file_io.h +++ b/chromium/ppapi/cpp/file_io.h @@ -71,7 +71,9 @@ class FileIO : public Resource { /// @param[in] result_buf The <code>PP_FileInfo</code> structure representing /// all information about the file. /// @param[in] cc A <code>CompletionCallback</code> to be called upon - /// completion of Query(). + /// completion of Query(). <code>result_buf</code> must remain valid until + /// after the callback runs. If you pass a blocking callback, + /// <code>result_buf</code> must remain valid until after Query() returns. /// /// @return An int32_t containing an error code from /// <code>pp_errors.h</code>. @@ -138,7 +140,9 @@ class FileIO : public Resource { /// @param[in] bytes_to_read The number of bytes to read from /// <code>offset</code>. /// @param[in] cc A <code>CompletionCallback</code> to be called upon - /// completion of Read(). + /// completion of Read(). <code>buffer</code> must remain valid until after + /// the callback runs. If you pass a blocking callback, <code>buffer</code> + /// must remain valid until after Read() returns. /// /// @return An The number of bytes read an error code from /// <code>pp_errors.h</code>. If the return value is 0, then end-of-file was diff --git a/chromium/ppapi/cpp/file_ref.h b/chromium/ppapi/cpp/file_ref.h index 56828f7e642..452d2a61321 100644 --- a/chromium/ppapi/cpp/file_ref.h +++ b/chromium/ppapi/cpp/file_ref.h @@ -46,6 +46,9 @@ class FileRef : public Resource { /// A constructor that creates a weak pointer to a file in the given file /// system. File paths are POSIX style. /// + /// If the <code>path</code> is malformed, the resulting <code>FileRef</code> + /// will have a null <code>PP_Resource</code>. + /// /// @param[in] file_system A <code>FileSystem</code> corresponding to a file /// system type. /// @param[in] path A path to the file. Must begin with a '/' character. diff --git a/chromium/ppapi/cpp/file_system.cc b/chromium/ppapi/cpp/file_system.cc index f993fdaa892..8bd86d0eefd 100644 --- a/chromium/ppapi/cpp/file_system.cc +++ b/chromium/ppapi/cpp/file_system.cc @@ -9,6 +9,7 @@ #include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/file_ref.h" #include "ppapi/cpp/instance_handle.h" +#include "ppapi/cpp/logging.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/module_impl.h" @@ -28,6 +29,15 @@ FileSystem::FileSystem() { FileSystem::FileSystem(const FileSystem& other) : Resource(other) { } +FileSystem::FileSystem(const Resource& resource) : Resource(resource) { + if (!IsFileSystem(resource)) { + PP_NOTREACHED(); + + // On release builds, set this to null. + Clear(); + } +} + FileSystem::FileSystem(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) { } @@ -48,4 +58,12 @@ int32_t FileSystem::Open(int64_t expected_size, pp_resource(), expected_size, cc.pp_completion_callback()); } +// static +bool FileSystem::IsFileSystem(const Resource& resource) { + if (!has_interface<PPB_FileSystem_1_0>()) + return false; + return get_interface<PPB_FileSystem_1_0>()->IsFileSystem( + resource.pp_resource()) == PP_TRUE; +} + } // namespace pp diff --git a/chromium/ppapi/cpp/file_system.h b/chromium/ppapi/cpp/file_system.h index 9baa78e31bf..96e88c1a324 100644 --- a/chromium/ppapi/cpp/file_system.h +++ b/chromium/ppapi/cpp/file_system.h @@ -33,6 +33,11 @@ class FileSystem : public Resource { /// @param[in] other A reference to a <code>FileSystem</code>. FileSystem(const FileSystem& other); + /// Constructs a <code>FileSystem</code> from a <code>Resource</code>. + /// + /// @param[in] resource A <code>Resource</code> containing a file system. + explicit FileSystem(const Resource& resource); + /// A constructor used when you have received a PP_Resource as a return /// value that has already been reference counted. /// @@ -63,6 +68,14 @@ class FileSystem : public Resource { /// /// @return An int32_t containing an error code from <code>pp_errors.h</code>. int32_t Open(int64_t expected_size, const CompletionCallback& cc); + + /// Checks whether a <code>Resource</code> is a file system, to test whether + /// it is appropriate for use with the <code>FileSystem</code> constructor. + /// + /// @param[in] resource A <code>Resource</code> to test. + /// + /// @return True if <code>resource</code> is a file system. + static bool IsFileSystem(const Resource& resource); }; } // namespace pp diff --git a/chromium/ppapi/cpp/private/content_decryptor_private.cc b/chromium/ppapi/cpp/private/content_decryptor_private.cc index 23417c3e155..776393a2e20 100644 --- a/chromium/ppapi/cpp/private/content_decryptor_private.cc +++ b/chromium/ppapi/cpp/private/content_decryptor_private.cc @@ -24,8 +24,7 @@ static const char kPPPContentDecryptorInterface[] = PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE; void Initialize(PP_Instance instance, - PP_Var key_system_arg, - PP_Bool can_challenge_platform) { + PP_Var key_system_arg) { void* object = Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); if (!object) @@ -36,13 +35,13 @@ void Initialize(PP_Instance instance, return; static_cast<ContentDecryptor_Private*>(object)->Initialize( - key_system_var.AsString(), - PP_ToBool(can_challenge_platform)); + key_system_var.AsString()); } -void GenerateKeyRequest(PP_Instance instance, - PP_Var type_arg, - PP_Var init_data_arg) { +void CreateSession(PP_Instance instance, + uint32_t session_id, + PP_Var type_arg, + PP_Var init_data_arg) { void* object = Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); if (!object) @@ -57,53 +56,34 @@ void GenerateKeyRequest(PP_Instance instance, return; pp::VarArrayBuffer init_data_array_buffer(init_data_var); - static_cast<ContentDecryptor_Private*>(object)->GenerateKeyRequest( - type_var.AsString(), - init_data_array_buffer); + static_cast<ContentDecryptor_Private*>(object) + ->CreateSession(session_id, type_var.AsString(), init_data_array_buffer); } -void AddKey(PP_Instance instance, - PP_Var session_id_arg, - PP_Var key_arg, - PP_Var init_data_arg) { +void UpdateSession(PP_Instance instance, + uint32_t session_id, + PP_Var response_arg) { void* object = Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); if (!object) return; - pp::Var session_id_var(pp::PASS_REF, session_id_arg); - if (!session_id_var.is_string()) + pp::Var response_var(pp::PASS_REF, response_arg); + if (!response_var.is_array_buffer()) return; + pp::VarArrayBuffer response(response_var); - pp::Var key_var(pp::PASS_REF, key_arg); - if (!key_var.is_array_buffer()) - return; - pp::VarArrayBuffer key(key_var); - - pp::Var init_data_var(pp::PASS_REF, init_data_arg); - if (!init_data_var.is_array_buffer()) - return; - pp::VarArrayBuffer init_data(init_data_var); - - - static_cast<ContentDecryptor_Private*>(object)->AddKey( - session_id_var.AsString(), - key, - init_data); + static_cast<ContentDecryptor_Private*>(object) + ->UpdateSession(session_id, response); } -void CancelKeyRequest(PP_Instance instance, PP_Var session_id_arg) { +void ReleaseSession(PP_Instance instance, uint32_t session_id) { void* object = Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); if (!object) return; - pp::Var session_id_var(pp::PASS_REF, session_id_arg); - if (!session_id_var.is_string()) - return; - - static_cast<ContentDecryptor_Private*>(object)->CancelKeyRequest( - session_id_var.AsString()); + static_cast<ContentDecryptor_Private*>(object)->ReleaseSession(session_id); } @@ -196,9 +176,9 @@ void DecryptAndDecode(PP_Instance instance, const PPP_ContentDecryptor_Private ppp_content_decryptor = { &Initialize, - &GenerateKeyRequest, - &AddKey, - &CancelKeyRequest, + &CreateSession, + &UpdateSession, + &ReleaseSession, &Decrypt, &InitializeAudioDecoder, &InitializeVideoDecoder, @@ -226,46 +206,52 @@ ContentDecryptor_Private::~ContentDecryptor_Private() { this); } -void ContentDecryptor_Private::KeyAdded(const std::string& key_system, - const std::string& session_id) { +void ContentDecryptor_Private::SessionCreated( + uint32_t session_id, + const std::string& web_session_id) { if (has_interface<PPB_ContentDecryptor_Private>()) { - pp::Var key_system_var(key_system); - pp::Var session_id_var(session_id); - get_interface<PPB_ContentDecryptor_Private>()->KeyAdded( + pp::Var web_session_id_var(web_session_id); + get_interface<PPB_ContentDecryptor_Private>()->SessionCreated( associated_instance_.pp_instance(), - key_system_var.pp_var(), - session_id_var.pp_var()); + session_id, + web_session_id_var.pp_var()); } } -void ContentDecryptor_Private::KeyMessage(const std::string& key_system, - const std::string& session_id, - pp::VarArrayBuffer message, - const std::string& default_url) { +void ContentDecryptor_Private::SessionMessage(uint32_t session_id, + pp::VarArrayBuffer message, + const std::string& default_url) { if (has_interface<PPB_ContentDecryptor_Private>()) { - pp::Var key_system_var(key_system); - pp::Var session_id_var(session_id); pp::Var default_url_var(default_url); - get_interface<PPB_ContentDecryptor_Private>()->KeyMessage( + get_interface<PPB_ContentDecryptor_Private>()->SessionMessage( associated_instance_.pp_instance(), - key_system_var.pp_var(), - session_id_var.pp_var(), + session_id, message.pp_var(), default_url_var.pp_var()); } } -void ContentDecryptor_Private::KeyError(const std::string& key_system, - const std::string& session_id, - int32_t media_error, - int32_t system_code) { +void ContentDecryptor_Private::SessionReady(uint32_t session_id) { if (has_interface<PPB_ContentDecryptor_Private>()) { - pp::Var key_system_var(key_system); - pp::Var session_id_var(session_id); - get_interface<PPB_ContentDecryptor_Private>()->KeyError( + get_interface<PPB_ContentDecryptor_Private>()->SessionReady( + associated_instance_.pp_instance(), session_id); + } +} + +void ContentDecryptor_Private::SessionClosed(uint32_t session_id) { + if (has_interface<PPB_ContentDecryptor_Private>()) { + get_interface<PPB_ContentDecryptor_Private>()->SessionClosed( + associated_instance_.pp_instance(), session_id); + } +} + +void ContentDecryptor_Private::SessionError(uint32_t session_id, + int32_t media_error, + int32_t system_code) { + if (has_interface<PPB_ContentDecryptor_Private>()) { + get_interface<PPB_ContentDecryptor_Private>()->SessionError( associated_instance_.pp_instance(), - key_system_var.pp_var(), - session_id_var.pp_var(), + session_id, media_error, system_code); } @@ -330,12 +316,12 @@ void ContentDecryptor_Private::DeliverFrame( void ContentDecryptor_Private::DeliverSamples( pp::Buffer_Dev audio_frames, - const PP_DecryptedBlockInfo& decrypted_block_info) { + const PP_DecryptedSampleInfo& decrypted_sample_info) { if (has_interface<PPB_ContentDecryptor_Private>()) { get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( associated_instance_.pp_instance(), audio_frames.pp_resource(), - &decrypted_block_info); + &decrypted_sample_info); } } diff --git a/chromium/ppapi/cpp/private/content_decryptor_private.h b/chromium/ppapi/cpp/private/content_decryptor_private.h index a43a74cfb83..d2c17c1869a 100644 --- a/chromium/ppapi/cpp/private/content_decryptor_private.h +++ b/chromium/ppapi/cpp/private/content_decryptor_private.h @@ -31,14 +31,13 @@ class ContentDecryptor_Private { // TODO(tomfinegan): This could be optimized to pass pp::Var instead of // strings. The change would allow the CDM wrapper to reuse vars when // replying to the browser. - virtual void Initialize(const std::string& key_system, - bool can_challenge_platform) = 0; - virtual void GenerateKeyRequest(const std::string& type, - pp::VarArrayBuffer init_data) = 0; - virtual void AddKey(const std::string& session_id, - pp::VarArrayBuffer key, - pp::VarArrayBuffer init_data) = 0; - virtual void CancelKeyRequest(const std::string& session_id) = 0; + virtual void Initialize(const std::string& key_system) = 0; + virtual void CreateSession(uint32_t session_id, + const std::string& type, + pp::VarArrayBuffer init_data) = 0; + virtual void UpdateSession(uint32_t session_id, + pp::VarArrayBuffer response) = 0; + virtual void ReleaseSession(uint32_t session_id) = 0; virtual void Decrypt(pp::Buffer_Dev encrypted_buffer, const PP_EncryptedBlockInfo& encrypted_block_info) = 0; virtual void InitializeAudioDecoder( @@ -59,16 +58,15 @@ class ContentDecryptor_Private { // PPB_ContentDecryptor_Private methods for passing data from the decryptor // to the browser. - void KeyAdded(const std::string& key_system, - const std::string& session_id); - void KeyMessage(const std::string& key_system, - const std::string& session_id, - pp::VarArrayBuffer message, - const std::string& default_url); - void KeyError(const std::string& key_system, - const std::string& session_id, - int32_t media_error, - int32_t system_code); + void SessionCreated(uint32_t session_id, const std::string& web_session_id); + void SessionMessage(uint32_t session_id, + pp::VarArrayBuffer message, + const std::string& default_url); + void SessionReady(uint32_t session_id); + void SessionClosed(uint32_t session_id); + void SessionError(uint32_t session_id, + int32_t media_error, + int32_t system_code); // The plugin must not hold a reference to the encrypted buffer resource // provided to Decrypt() when it calls this method. The browser will reuse @@ -94,7 +92,7 @@ class ContentDecryptor_Private { // provided to DecryptAndDecode() when it calls this method. The browser will // reuse the buffer in a subsequent DecryptAndDecode() call. void DeliverSamples(pp::Buffer_Dev audio_frames, - const PP_DecryptedBlockInfo& decrypted_block_info); + const PP_DecryptedSampleInfo& decrypted_sample_info); private: InstanceHandle associated_instance_; diff --git a/chromium/ppapi/cpp/private/flash_drm.cc b/chromium/ppapi/cpp/private/flash_drm.cc index 44887abc207..c425c9f5b47 100644 --- a/chromium/ppapi/cpp/private/flash_drm.cc +++ b/chromium/ppapi/cpp/private/flash_drm.cc @@ -17,6 +17,10 @@ template <> const char* interface_name<PPB_Flash_DRM_1_0>() { return PPB_FLASH_DRM_INTERFACE_1_0; } +template <> const char* interface_name<PPB_Flash_DRM_1_1>() { + return PPB_FLASH_DRM_INTERFACE_1_1; +} + template <> const char* interface_name<PPB_Flash_DeviceID_1_0>() { return PPB_FLASH_DEVICEID_INTERFACE_1_0; } @@ -29,7 +33,10 @@ DRM::DRM() { } DRM::DRM(const InstanceHandle& instance) : Resource() { - if (has_interface<PPB_Flash_DRM_1_0>()) { + if (has_interface<PPB_Flash_DRM_1_1>()) { + PassRefFromConstructor(get_interface<PPB_Flash_DRM_1_1>()->Create( + instance.pp_instance())); + } else if (has_interface<PPB_Flash_DRM_1_0>()) { PassRefFromConstructor(get_interface<PPB_Flash_DRM_1_0>()->Create( instance.pp_instance())); } else if (has_interface<PPB_Flash_DeviceID_1_0>()) { @@ -39,6 +46,12 @@ DRM::DRM(const InstanceHandle& instance) : Resource() { } int32_t DRM::GetDeviceID(const CompletionCallbackWithOutput<Var>& callback) { + if (has_interface<PPB_Flash_DRM_1_1>()) { + return get_interface<PPB_Flash_DRM_1_1>()->GetDeviceID( + pp_resource(), + callback.output(), + callback.pp_completion_callback()); + } if (has_interface<PPB_Flash_DRM_1_0>()) { return get_interface<PPB_Flash_DRM_1_0>()->GetDeviceID( pp_resource(), @@ -55,6 +68,11 @@ int32_t DRM::GetDeviceID(const CompletionCallbackWithOutput<Var>& callback) { } bool DRM::GetHmonitor(int64_t* hmonitor) { + if (has_interface<PPB_Flash_DRM_1_1>()) { + return PP_ToBool(get_interface<PPB_Flash_DRM_1_1>()->GetHmonitor( + pp_resource(), + hmonitor)); + } if (has_interface<PPB_Flash_DRM_1_0>()) { return PP_ToBool(get_interface<PPB_Flash_DRM_1_0>()->GetHmonitor( pp_resource(), @@ -65,13 +83,30 @@ bool DRM::GetHmonitor(int64_t* hmonitor) { int32_t DRM::GetVoucherFile( const CompletionCallbackWithOutput<FileRef>& callback) { + if (has_interface<PPB_Flash_DRM_1_1>()) { + return get_interface<PPB_Flash_DRM_1_1>()->GetVoucherFile( + pp_resource(), + callback.output(), + callback.pp_completion_callback()); + } if (has_interface<PPB_Flash_DRM_1_0>()) { return get_interface<PPB_Flash_DRM_1_0>()->GetVoucherFile( pp_resource(), callback.output(), callback.pp_completion_callback()); } - return PP_ERROR_FAILED; + return PP_ERROR_NOINTERFACE; +} + +int32_t DRM::MonitorIsExternal( + const CompletionCallbackWithOutput<PP_Bool>& callback) { + if (has_interface<PPB_Flash_DRM_1_1>()) { + return get_interface<PPB_Flash_DRM_1_1>()->MonitorIsExternal( + pp_resource(), + callback.output(), + callback.pp_completion_callback()); + } + return PP_ERROR_NOINTERFACE; } } // namespace flash diff --git a/chromium/ppapi/cpp/private/flash_drm.h b/chromium/ppapi/cpp/private/flash_drm.h index 45ecde8b9a4..2edddac1d52 100644 --- a/chromium/ppapi/cpp/private/flash_drm.h +++ b/chromium/ppapi/cpp/private/flash_drm.h @@ -27,6 +27,10 @@ class DRM : public Resource { bool GetHmonitor(int64_t* hmonitor); // Returns the voucher file as a FileRef or an invalid resource on failure. int32_t GetVoucherFile(const CompletionCallbackWithOutput<FileRef>& callback); + // On success, returns a value indicating if the monitor associated with the + // current plugin instance is external. + int32_t MonitorIsExternal( + const CompletionCallbackWithOutput<PP_Bool>& callback); }; } // namespace flash diff --git a/chromium/ppapi/cpp/private/isolated_file_system_private.cc b/chromium/ppapi/cpp/private/isolated_file_system_private.cc new file mode 100644 index 00000000000..f0a20ca60f5 --- /dev/null +++ b/chromium/ppapi/cpp/private/isolated_file_system_private.cc @@ -0,0 +1,40 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/cpp/private/isolated_file_system_private.h" + +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_IsolatedFileSystem_Private_0_2>() { + return PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2; +} + +} // namespace + +IsolatedFileSystemPrivate::IsolatedFileSystemPrivate() + : instance_(0), type_(PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID) { +} + +IsolatedFileSystemPrivate::IsolatedFileSystemPrivate( + const InstanceHandle& instance, + PP_IsolatedFileSystemType_Private type) + : instance_(instance.pp_instance()), type_(type) { +} + +IsolatedFileSystemPrivate::~IsolatedFileSystemPrivate() { +} + +int32_t IsolatedFileSystemPrivate::Open( + const CompletionCallbackWithOutput<pp::FileSystem>& cc) { + if (!has_interface<PPB_IsolatedFileSystem_Private_0_2>()) + return cc.MayForce(PP_ERROR_NOINTERFACE); + return get_interface<PPB_IsolatedFileSystem_Private_0_2>()-> + Open(instance_, type_, cc.output(), cc.pp_completion_callback()); +} + +} // namespace pp diff --git a/chromium/ppapi/cpp/private/isolated_file_system_private.h b/chromium/ppapi/cpp/private/isolated_file_system_private.h new file mode 100644 index 00000000000..88213d6cf16 --- /dev/null +++ b/chromium/ppapi/cpp/private/isolated_file_system_private.h @@ -0,0 +1,34 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_CPP_PRIVATE_ISOLATED_FILE_SYSTEM_PRIVATE_H_ +#define PPAPI_CPP_PRIVATE_ISOLATED_FILE_SYSTEM_PRIVATE_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/private/ppb_isolated_file_system_private.h" +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/file_system.h" +#include "ppapi/cpp/instance_handle.h" + +namespace pp { + +class CompletionCallback; + +class IsolatedFileSystemPrivate { + public: + IsolatedFileSystemPrivate(); + IsolatedFileSystemPrivate(const InstanceHandle& instance, + PP_IsolatedFileSystemType_Private type); + virtual ~IsolatedFileSystemPrivate(); + + int32_t Open(const CompletionCallbackWithOutput<pp::FileSystem>& cc); + + private: + PP_Instance instance_; + PP_IsolatedFileSystemType_Private type_; +}; + +} // namespace pp + +#endif // PPAPI_CPP_PRIVATE_ISOLATED_FILE_SYSTEM_PRIVATE_H_ diff --git a/chromium/ppapi/cpp/private/output_protection_private.cc b/chromium/ppapi/cpp/private/output_protection_private.cc new file mode 100644 index 00000000000..9b244fef34b --- /dev/null +++ b/chromium/ppapi/cpp/private/output_protection_private.cc @@ -0,0 +1,59 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/cpp/private/output_protection_private.h" + +#include <stdio.h> +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/private/ppb_output_protection_private.h" +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/instance_handle.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_OutputProtection_Private_0_1>() { + return PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1; +} + +} // namespace + +OutputProtection_Private::OutputProtection_Private( + const InstanceHandle& instance) { + if (has_interface<PPB_OutputProtection_Private_0_1>()) { + PassRefFromConstructor( + get_interface<PPB_OutputProtection_Private_0_1>()->Create( + instance.pp_instance())); + } +} + +OutputProtection_Private::~OutputProtection_Private() { +} + +int32_t OutputProtection_Private::QueryStatus( + uint32_t* link_mask, + uint32_t* protection_mask, + const CompletionCallback& callback) { + if (has_interface<PPB_OutputProtection_Private_0_1>()) { + return get_interface<PPB_OutputProtection_Private_0_1>()->QueryStatus( + pp_resource(), link_mask, protection_mask, + callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +int32_t OutputProtection_Private::EnableProtection( + uint32_t desired_method_mask, + const CompletionCallback& callback) { + if (has_interface<PPB_OutputProtection_Private_0_1>()) { + return get_interface<PPB_OutputProtection_Private_0_1>()->EnableProtection( + pp_resource(), desired_method_mask, + callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +} // namespace pp diff --git a/chromium/ppapi/cpp/private/output_protection_private.h b/chromium/ppapi/cpp/private/output_protection_private.h new file mode 100644 index 00000000000..6b543ea222f --- /dev/null +++ b/chromium/ppapi/cpp/private/output_protection_private.h @@ -0,0 +1,28 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_CPP_PRIVATE_OUTPUT_PROTECTION_PRIVATE_H_ +#define PPAPI_CPP_PRIVATE_OUTPUT_PROTECTION_PRIVATE_H_ + +#include "ppapi/c/private/ppb_output_protection_private.h" +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/resource.h" + +namespace pp { + +class OutputProtection_Private : public Resource { + public: + explicit OutputProtection_Private(const InstanceHandle& instance); + virtual ~OutputProtection_Private(); + + // PPB_OutputProtection_Private implementation. + int32_t QueryStatus(uint32_t* link_mask, uint32_t* protection_mask, + const CompletionCallback& callback); + int32_t EnableProtection(uint32_t desired_method_mask, + const CompletionCallback& callback); +}; + +} // namespace pp + +#endif // PPAPI_CPP_PRIVATE_OUTPUT_PROTECTION_PRIVATE_H_ diff --git a/chromium/ppapi/cpp/private/pdf.cc b/chromium/ppapi/cpp/private/pdf.cc index 9d6bd898251..77fb0b29432 100644 --- a/chromium/ppapi/cpp/private/pdf.cc +++ b/chromium/ppapi/cpp/private/pdf.cc @@ -184,6 +184,7 @@ ImageData PDF::GetResourceImageForScale(const InstanceHandle& instance, return ImageData(); } +// static Var PDF::ModalPromptForPassword(const InstanceHandle& instance, Var message) { if (has_interface<PPB_PDF>()) { @@ -194,4 +195,14 @@ Var PDF::ModalPromptForPassword(const InstanceHandle& instance, } return Var(); } + +// static +bool PDF::IsOutOfProcess(const InstanceHandle& instance) { + if (has_interface<PPB_PDF>()) { + return PP_ToBool(get_interface<PPB_PDF>()->IsOutOfProcess( + instance.pp_instance())); + } + return false; +} + } // namespace pp diff --git a/chromium/ppapi/cpp/private/pdf.h b/chromium/ppapi/cpp/private/pdf.h index 1e89dd0c7ed..4634430b1d7 100644 --- a/chromium/ppapi/cpp/private/pdf.h +++ b/chromium/ppapi/cpp/private/pdf.h @@ -64,6 +64,7 @@ class PDF { float scale); static Var ModalPromptForPassword(const InstanceHandle& instance, Var message); + static bool IsOutOfProcess(const InstanceHandle& instance); }; } // namespace pp diff --git a/chromium/ppapi/cpp/private/platform_verification.cc b/chromium/ppapi/cpp/private/platform_verification.cc index f9085700696..e199a7199d1 100644 --- a/chromium/ppapi/cpp/private/platform_verification.cc +++ b/chromium/ppapi/cpp/private/platform_verification.cc @@ -15,16 +15,16 @@ namespace pp { namespace { -template <> const char* interface_name<PPB_PlatformVerification_Private_0_1>() { - return PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_1; +template <> const char* interface_name<PPB_PlatformVerification_Private_0_2>() { + return PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2; } inline bool HasInterface() { - return has_interface<PPB_PlatformVerification_Private_0_1>(); + return has_interface<PPB_PlatformVerification_Private_0_2>(); } -inline const PPB_PlatformVerification_Private_0_1* GetInterface() { - return get_interface<PPB_PlatformVerification_Private_0_1>(); +inline const PPB_PlatformVerification_Private_0_2* GetInterface() { + return get_interface<PPB_PlatformVerification_Private_0_2>(); } } // namespace @@ -36,15 +36,6 @@ PlatformVerification::PlatformVerification(const InstanceHandle& instance) { PlatformVerification::~PlatformVerification() {} -int32_t PlatformVerification::CanChallengePlatform( - const CompletionCallbackWithOutput<bool>& callback) { - if (!HasInterface()) - return callback.MayForce(PP_ERROR_NOINTERFACE); - - return GetInterface()->CanChallengePlatform( - pp_resource(), callback.output(), callback.pp_completion_callback()); -} - int32_t PlatformVerification::ChallengePlatform( const Var& service_id, const Var& challenge, diff --git a/chromium/ppapi/cpp/private/platform_verification.h b/chromium/ppapi/cpp/private/platform_verification.h index 7f0f8a197ff..166077a8289 100644 --- a/chromium/ppapi/cpp/private/platform_verification.h +++ b/chromium/ppapi/cpp/private/platform_verification.h @@ -18,8 +18,6 @@ class PlatformVerification : public Resource { explicit PlatformVerification(const InstanceHandle& instance); virtual ~PlatformVerification(); - int32_t CanChallengePlatform( - const CompletionCallbackWithOutput<bool>& callback); int32_t ChallengePlatform(const Var& service_id, const Var& challenge, Var* signed_data, diff --git a/chromium/ppapi/cpp/resource.cc b/chromium/ppapi/cpp/resource.cc index 3ccc198b3b1..804d34d2c30 100644 --- a/chromium/ppapi/cpp/resource.cc +++ b/chromium/ppapi/cpp/resource.cc @@ -52,4 +52,11 @@ void Resource::PassRefFromConstructor(PP_Resource resource) { pp_resource_ = resource; } +void Resource::Clear() { + if (is_null()) + return; + Module::Get()->core()->ReleaseResource(pp_resource_); + pp_resource_ = 0; +} + } // namespace pp diff --git a/chromium/ppapi/cpp/resource.h b/chromium/ppapi/cpp/resource.h index 8f5a92d2e12..311db6a1caf 100644 --- a/chromium/ppapi/cpp/resource.h +++ b/chromium/ppapi/cpp/resource.h @@ -14,6 +14,8 @@ /// with the module. namespace pp { +class VarResource_Dev; + /// A reference counted module resource. class Resource { public: @@ -81,7 +83,12 @@ class Resource { /// resource. void PassRefFromConstructor(PP_Resource resource); + /// Sets this resource to null. This releases ownership of the resource. + void Clear(); + private: + friend class VarResource_Dev; + PP_Resource pp_resource_; }; diff --git a/chromium/ppapi/cpp/trusted/file_io_trusted.cc b/chromium/ppapi/cpp/trusted/file_io_trusted.cc deleted file mode 100644 index a3123cac188..00000000000 --- a/chromium/ppapi/cpp/trusted/file_io_trusted.cc +++ /dev/null @@ -1,54 +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/trusted/file_io_trusted.h" - -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/trusted/ppb_file_io_trusted.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/file_io.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_FileIOTrusted>() { - return PPB_FILEIOTRUSTED_INTERFACE_0_4; -} - -} // namespace - -FileIO_Trusted::FileIO_Trusted() { -} - -int32_t FileIO_Trusted::GetOSFileDescriptor(const FileIO& file_io) { - const int32_t kInvalidOSFileDescriptor = -1; - if (!has_interface<PPB_FileIOTrusted>()) - return kInvalidOSFileDescriptor; - return get_interface<PPB_FileIOTrusted>()->GetOSFileDescriptor( - file_io.pp_resource()); -} - -int32_t FileIO_Trusted::WillWrite(const FileIO& file_io, - int64_t offset, - int32_t bytes_to_write, - const CompletionCallback& callback) { - if (!has_interface<PPB_FileIOTrusted>()) - return callback.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileIOTrusted>()->WillWrite( - file_io.pp_resource(), offset, bytes_to_write, - callback.pp_completion_callback()); -} - -int32_t FileIO_Trusted::WillSetLength(const FileIO& file_io, - int64_t length, - const CompletionCallback& callback) { - if (!has_interface<PPB_FileIOTrusted>()) - return callback.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileIOTrusted>()->WillSetLength( - file_io.pp_resource(), length, callback.pp_completion_callback()); -} - -} // namespace pp diff --git a/chromium/ppapi/cpp/trusted/file_io_trusted.h b/chromium/ppapi/cpp/trusted/file_io_trusted.h deleted file mode 100644 index 3ba2140832b..00000000000 --- a/chromium/ppapi/cpp/trusted/file_io_trusted.h +++ /dev/null @@ -1,36 +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_TRUSTED_FILE_IO_TRUSTED_H_ -#define PPAPI_CPP_TRUSTED_FILE_IO_TRUSTED_H_ - -#include <string> - -#include "ppapi/c/pp_stdint.h" - -namespace pp { - -class FileIO; -class CompletionCallback; - -class FileIO_Trusted { - public: - /// Creates a FileIO_Trusted object. - FileIO_Trusted(); - - int32_t GetOSFileDescriptor(const FileIO& file_io); - - int32_t WillWrite(const FileIO& file_io, - int64_t offset, - int32_t bytes_to_write, - const CompletionCallback& callback); - - int32_t WillSetLength(const FileIO& file_io, - int64_t length, - const CompletionCallback& callback); -}; - -} // namespace pp - -#endif // PPAPI_CPP_TRUSTED_FILE_IO_TRUSTED_H_ diff --git a/chromium/ppapi/cpp/var.h b/chromium/ppapi/cpp/var.h index fe30e10614b..5cb26d9ee83 100644 --- a/chromium/ppapi/cpp/var.h +++ b/chromium/ppapi/cpp/var.h @@ -135,6 +135,11 @@ class Var { /// @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 a resource. + /// + /// @return true if this <code>Var</code> is a resource, otherwise false. + bool is_resource() const { return var_.type == PP_VARTYPE_RESOURCE; } + /// This function determines if this <code>Var</code> is an integer value. /// The <code>is_int</code> function returns the internal representation. /// The JavaScript runtime may convert between the two as needed, so the diff --git a/chromium/ppapi/cpp/websocket.cc b/chromium/ppapi/cpp/websocket.cc index f0ae5fa0c30..afd1310f072 100644 --- a/chromium/ppapi/cpp/websocket.cc +++ b/chromium/ppapi/cpp/websocket.cc @@ -39,11 +39,8 @@ int32_t WebSocket::Connect(const Var& url, const Var protocols[], // Convert protocols to C interface. PP_Var *c_protocols = NULL; - if (protocol_count) { + if (protocol_count) c_protocols = new PP_Var[protocol_count]; - if (!c_protocols) - return PP_ERROR_NOMEMORY; - } for (uint32_t i = 0; i < protocol_count; ++i) c_protocols[i] = protocols[i].pp_var(); diff --git a/chromium/ppapi/examples/2d/paint_manager_example.cc b/chromium/ppapi/examples/2d/paint_manager_example.cc index 86bdbe79ed8..c8d6a798ecd 100644 --- a/chromium/ppapi/examples/2d/paint_manager_example.cc +++ b/chromium/ppapi/examples/2d/paint_manager_example.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <algorithm> + #include "ppapi/c/pp_input_event.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/image_data.h" diff --git a/chromium/ppapi/examples/2d/scroll.cc b/chromium/ppapi/examples/2d/scroll.cc index 5dffa5749b7..506129c4929 100644 --- a/chromium/ppapi/examples/2d/scroll.cc +++ b/chromium/ppapi/examples/2d/scroll.cc @@ -4,6 +4,8 @@ #include <math.h> +#include <algorithm> + #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/image_data.h" #include "ppapi/cpp/instance.h" diff --git a/chromium/ppapi/examples/crxfs/crxfs.cc b/chromium/ppapi/examples/crxfs/crxfs.cc index 5e4b422cd30..86a212b9823 100644 --- a/chromium/ppapi/examples/crxfs/crxfs.cc +++ b/chromium/ppapi/examples/crxfs/crxfs.cc @@ -9,7 +9,7 @@ #include "ppapi/cpp/file_ref.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/module.h" -#include "ppapi/cpp/private/ext_crx_file_system_private.h" +#include "ppapi/cpp/private/isolated_file_system_private.h" #include "ppapi/utility/completion_callback_factory.h" // When compiling natively on Windows, PostMessage can be #define-d to @@ -48,7 +48,7 @@ class MyInstance : public pp::Instance { pp::CompletionCallbackFactory<MyInstance> factory_; pp::InstanceHandle handle_; - pp::ExtCrxFileSystemPrivate crxfs_; + pp::IsolatedFileSystemPrivate crxfs_; pp::FileRef file_ref_; pp::FileIO file_io_; std::string filename_; @@ -70,7 +70,8 @@ void MyInstance::OpenCrxFsAndReadFile(const std::string& filename) { pp::CompletionCallbackWithOutput<pp::FileSystem> callback = factory_.NewCallbackWithOutput(&MyInstance::CrxFileSystemCallback); - crxfs_ = pp::ExtCrxFileSystemPrivate(this); + crxfs_ = pp::IsolatedFileSystemPrivate( + this, PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX); int32_t rv = crxfs_.Open(callback); if (rv != PP_OK_COMPLETIONPENDING) ReportResponse("ExtCrxFileSystemPrivate::Open", rv); diff --git a/chromium/ppapi/examples/gamepad/gamepad.cc b/chromium/ppapi/examples/gamepad/gamepad.cc index e4a9f9fbcf4..a94ccd43c1b 100644 --- a/chromium/ppapi/examples/gamepad/gamepad.cc +++ b/chromium/ppapi/examples/gamepad/gamepad.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 <algorithm> #include <cmath> #include <stdarg.h> #include <stdio.h> diff --git a/chromium/ppapi/examples/ime/ime.cc b/chromium/ppapi/examples/ime/ime.cc index 0f3e41edcf2..26c2f4225a9 100644 --- a/chromium/ppapi/examples/ime/ime.cc +++ b/chromium/ppapi/examples/ime/ime.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 <algorithm> #include <string> #include <utility> #include <vector> diff --git a/chromium/ppapi/examples/input/pointer_event_input.cc b/chromium/ppapi/examples/input/pointer_event_input.cc index 57c3d313046..3cd76b38a41 100644 --- a/chromium/ppapi/examples/input/pointer_event_input.cc +++ b/chromium/ppapi/examples/input/pointer_event_input.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <algorithm> + #include "ppapi/c/pp_input_event.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/image_data.h" diff --git a/chromium/ppapi/examples/mouse_cursor/mouse_cursor.cc b/chromium/ppapi/examples/mouse_cursor/mouse_cursor.cc index 8a70b158a9c..e922fa0b3aa 100644 --- a/chromium/ppapi/examples/mouse_cursor/mouse_cursor.cc +++ b/chromium/ppapi/examples/mouse_cursor/mouse_cursor.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <algorithm> + #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/image_data.h" #include "ppapi/cpp/input_event.h" diff --git a/chromium/ppapi/examples/url_loader/url_loader.html b/chromium/ppapi/examples/url_loader/url_loader.html index 39f44949734..808b369479b 100644 --- a/chromium/ppapi/examples/url_loader/url_loader.html +++ b/chromium/ppapi/examples/url_loader/url_loader.html @@ -39,7 +39,7 @@ <script> function HandleMessage(message_event) { - document.getElementById("log_result").innerHTML = message_event.data; + document.getElementById("log_result").textContent = message_event.data; } // Attach a listener for the message event. This must happen after the plugin diff --git a/chromium/ppapi/generators/idl_ast.py b/chromium/ppapi/generators/idl_ast.py index 27658921006..74dce942a8e 100644 --- a/chromium/ppapi/generators/idl_ast.py +++ b/chromium/ppapi/generators/idl_ast.py @@ -5,18 +5,10 @@ """Nodes for PPAPI IDL AST.""" from idl_namespace import IDLNamespace -from idl_node import IDLAttribute, IDLFile, IDLNode +from idl_node import IDLNode from idl_option import GetOption from idl_visitor import IDLVisitor -from idl_release import IDLReleaseList, IDLReleaseMap - -# -# IDL Predefined types -# -BuiltIn = set(['int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint8_t', - 'uint16_t', 'uint32_t', 'uint64_t', 'double_t', 'float_t', - 'handle_t', 'interface_t', 'char', 'mem_t', 'str_t', 'void']) - +from idl_release import IDLReleaseMap # # IDLLabelResolver @@ -26,16 +18,6 @@ BuiltIn = set(['int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint8_t', # The mapping is applied to the File nodes within the AST. # class IDLLabelResolver(IDLVisitor): - def Arrive(self, node, ignore): - # If we are entering a File, clear the visitor local mapping - if node.IsA('File'): - self.release_map = None - self.filenode = node - # For any non AST node, the filenode is the last known file - if not node.IsA('AST'): - node.filenode = self.filenode - return ignore - def Depart(self, node, ignore, childdata): # Build list of Release=Version if node.IsA('LabelItem'): @@ -45,14 +27,13 @@ class IDLLabelResolver(IDLVisitor): # name of the label matches the generation label. if node.IsA('Label') and node.GetName() == GetOption('label'): try: - self.release_map = IDLReleaseMap(childdata) - node.parent.release_map = self.release_map + node.parent.release_map = IDLReleaseMap(childdata) except Exception as err: node.Error('Unable to build release map: %s' % str(err)) # For File objects, set the minimum version if node.IsA('File'): - file_min, file_max = node.release_map.GetReleaseRange() + file_min, _ = node.release_map.GetReleaseRange() node.SetMin(file_min) return None @@ -79,7 +60,7 @@ class IDLNamespaceVersionResolver(IDLVisitor): # Set the min version on any non Label within the File if not node.IsA('AST', 'File', 'Label', 'LabelItem'): - my_min, my_max = node.GetMinMax() + my_min, _ = node.GetMinMax() if not my_min: node.SetMin(self.rmin) @@ -88,7 +69,7 @@ class IDLNamespaceVersionResolver(IDLVisitor): node.namespace = parent_namespace else: # otherwise create one. - node.namespace = IDLNamespace(parent_namespace, node.GetName()) + node.namespace = IDLNamespace(parent_namespace) # If this node is named, place it in its parent's namespace if parent_namespace and node.cls in IDLNode.NamedSet: @@ -128,13 +109,13 @@ class IDLFileTypeResolver(IDLVisitor): filenode = node if not node.IsA('AST'): - file_min, file_max = filenode.release_map.GetReleaseRange() + file_min, _ = filenode.release_map.GetReleaseRange() if not file_min: print 'Resetting min on %s to %s' % (node, file_min) node.SetMinRange(file_min) # If this node has a TYPEREF, resolve it to a version list - typeref = node.property_node.GetPropertyLocal('TYPEREF') + typeref = node.GetPropertyLocal('TYPEREF') if typeref: node.typelist = node.parent.namespace.FindList(typeref) if not node.typelist: @@ -174,7 +155,7 @@ class IDLAst(IDLNode): IDLLabelResolver().Visit(self, None) # Generate the Namesapce Tree - self.namespace = IDLNamespace(None, 'AST') + self.namespace = IDLNamespace(None) IDLNamespaceVersionResolver().Visit(self, self.namespace) # Using the namespace, resolve type references @@ -189,6 +170,8 @@ class IDLAst(IDLNode): IDLReleaseResolver().Visit(self, sorted(releases)) for filenode in self.GetListOf('File'): - self.errors += int(filenode.GetProperty('ERRORS', 0)) + errors = filenode.GetProperty('ERRORS') + if errors: + self.errors += errors diff --git a/chromium/ppapi/generators/idl_c_header.py b/chromium/ppapi/generators/idl_c_header.py index a3b868874da..d3a1b32a3e4 100755 --- a/chromium/ppapi/generators/idl_c_header.py +++ b/chromium/ppapi/generators/idl_c_header.py @@ -145,12 +145,7 @@ def CheckTypedefs(filenode, releases): 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: @@ -162,7 +157,7 @@ def CheckTypedefs(filenode, releases): t = param.GetType(build_list[0]) while t.IsA('Typedef'): t = t.GetType(build_list[0]) - if t.IsA('Struct'): + if t.IsA('Struct') and t.GetProperty('passByValue'): raise Exception('%s is a struct in callback %s. ' 'See http://crbug.com/233439' % (t.GetName(), node.GetName())) diff --git a/chromium/ppapi/generators/idl_c_proto.py b/chromium/ppapi/generators/idl_c_proto.py index 0e0797ac42c..34d5361a82c 100755 --- a/chromium/ppapi/generators/idl_c_proto.py +++ b/chromium/ppapi/generators/idl_c_proto.py @@ -125,6 +125,13 @@ class CGen(object): 'return': '%s', 'store': '%s' }, + 'mem_ptr_t': { + 'in': 'const %s', + 'inout': '%s', + 'out': '%s', + 'return': '%s', + 'store': '%s' + }, 'str_t': { 'in': 'const %s', 'inout': '%s', @@ -161,6 +168,7 @@ class CGen(object): 'double_t': 'double', 'handle_t': 'int', 'mem_t': 'void*', + 'mem_ptr_t': 'void**', 'str_t': 'char*', 'cstr_t': 'const char*', 'interface_t' : 'const void*' @@ -560,28 +568,22 @@ class CGen(object): if len(build_list) != 1: node.Error('Can not support multiple versions of node.') assert len(build_list) == 1 - + out = self.DefineStructInternals(node, build_list[-1], + include_version=False, comment=True) if node.IsA('Interface'): # Build the most recent one versioned, with comments out = self.DefineStructInternals(node, build_list[-1], include_version=True, comment=True) - # Define an unversioned typedef for the most recent version out += '\ntypedef struct %s %s;\n' % ( self.GetStructName(node, build_list[-1], include_version=True), self.GetStructName(node, build_list[-1], include_version=False)) - else: - # Build the most recent one versioned, with comments - out = self.DefineStructInternals(node, build_list[-1], - include_version=False, comment=True) - - - # Build the rest without comments and with the version number appended - for rel in build_list[0:-1]: - out += '\n' + self.DefineStructInternals(node, rel, - include_version=True, - comment=False) + # Build the rest without comments and with the version number appended + for rel in build_list[0:-1]: + out += '\n' + self.DefineStructInternals(node, rel, + include_version=True, + comment=False) self.LogExit('Exit DefineStruct') return out @@ -744,7 +746,7 @@ def main(args): print 'Skipping %s' % f.GetName() continue for node in f.GetChildren()[2:]: - print cgen.Define(node, comment=True, prefix='tst_') + print cgen.Define(node, ast.releases, comment=True, prefix='tst_') if __name__ == '__main__': diff --git a/chromium/ppapi/generators/idl_log.py b/chromium/ppapi/generators/idl_log.py index b7f2151a4d9..f5b103e751c 100644 --- a/chromium/ppapi/generators/idl_log.py +++ b/chromium/ppapi/generators/idl_log.py @@ -4,54 +4,49 @@ """ Error and information logging for IDL """ -# -# IDL Log -# -# And IDLLog object provides a mechanism for capturing logging output -# and/or sending out via a file handle (usually stdout or stderr). -# import sys class IDLLog(object): + """Captures and routes logging output. + + Caputres logging output and/or sends out via a file handle, typically + stdout or stderr. + """ def __init__(self, name, out): if name: - self.name = '%s : ' % name + self._name = '%s : ' % name else: - self.name = '' + self._name = '' - self.out = out - self.capture = False - self.console = True - self.log = [] + self._out = out + self._capture = False + self._console = True + self._log = [] def Log(self, msg): - line = "%s\n" % (msg) - if self.console: self.out.write(line) - if self.capture: - self.log.append(msg) - - def LogTag(self, msg): - line = "%s%s\n" % (self.name, msg) - if self.console: self.out.write(line) - if self.capture: - self.log.append(msg) + if self._console: + line = "%s\n" % (msg) + self._out.write(line) + if self._capture: + self._log.append(msg) def LogLine(self, filename, lineno, pos, msg): - line = "%s(%d) : %s%s\n" % (filename, lineno, self.name, msg) - if self.console: self.out.write(line) - if self.capture: self.log.append(msg) + if self._console: + line = "%s(%d) : %s%s\n" % (filename, lineno, self._name, msg) + self._out.write(line) + if self._capture: + self._log.append(msg) - def SetConsole(self, enable, out = None): - self.console = enable - if out: self.out = out + def SetConsole(self, enable): + self._console = enable def SetCapture(self, enable): - self.capture = enable + self._capture = enable def DrainLog(self): - out = self.log - self.log = [] + out = self._log + self._log = [] return out ErrOut = IDLLog('Error', sys.stderr) diff --git a/chromium/ppapi/generators/idl_namespace.py b/chromium/ppapi/generators/idl_namespace.py index 0d74b547ca0..b81411e68dd 100755 --- a/chromium/ppapi/generators/idl_namespace.py +++ b/chromium/ppapi/generators/idl_namespace.py @@ -28,10 +28,9 @@ Option('namespace_debug', 'Use the specified release') # one or more IDLNodes based on a release or range of releases. # class IDLNamespace(object): - def __init__(self, parent, name): + def __init__(self, parent): self._name_to_releases = {} self._parent = parent - self._name = name def Dump(self): for name in self._name_to_releases: @@ -73,7 +72,6 @@ class IDLNamespace(object): return verlist.AddNode(node) - # # Testing Code # diff --git a/chromium/ppapi/generators/idl_node.py b/chromium/ppapi/generators/idl_node.py index a6b1c88c4f3..3c9470709c1 100755 --- a/chromium/ppapi/generators/idl_node.py +++ b/chromium/ppapi/generators/idl_node.py @@ -16,12 +16,10 @@ # as the source data by the various generators. # -import hashlib import sys from idl_log import ErrOut, InfoOut, WarnOut from idl_propertynode import IDLPropertyNode -from idl_namespace import IDLNamespace from idl_release import IDLRelease, IDLReleaseMap @@ -53,7 +51,6 @@ class IDLNode(IDLRelease): NamedSet = set(['Enum', 'EnumItem', 'File', 'Function', 'Interface', 'Member', 'Param', 'Struct', 'Type', 'Typedef']) - show_versions = False def __init__(self, cls, filename, lineno, pos, children=None): # Initialize with no starting or ending Version IDLRelease.__init__(self, None, None) @@ -61,16 +58,14 @@ class IDLNode(IDLRelease): self.cls = cls self.lineno = lineno self.pos = pos - self.filename = filename - self.filenode = None - self.hashes = {} - self.deps = {} + self._filename = filename + self._deps = {} self.errors = 0 self.namespace = None self.typelist = None self.parent = None - self.property_node = IDLPropertyNode() - self.unique_releases = None + self._property_node = IDLPropertyNode() + self._unique_releases = None # A list of unique releases for this node self.releases = None @@ -78,66 +73,58 @@ class IDLNode(IDLRelease): # A map from any release, to the first unique release self.first_release = None - # self.children is a list of children ordered as defined - self.children = [] + # self._children is a list of children ordered as defined + self._children = [] # Process the passed in list of children, placing ExtAttributes into the # property dictionary, and nodes into the local child list in order. In # addition, add nodes to the namespace if the class is in the NamedSet. - if not children: children = [] - for child in children: - if child.cls == 'ExtAttribute': - self.SetProperty(child.name, child.value) - else: - self.AddChild(child) - -# -# String related functions -# -# + if children: + for child in children: + if child.cls == 'ExtAttribute': + self.SetProperty(child.name, child.value) + else: + self.AddChild(child) - # Return a string representation of this node def __str__(self): name = self.GetName() - ver = IDLRelease.__str__(self) - if name is None: name = '' - if not IDLNode.show_versions: ver = '' - return '%s(%s%s)' % (self.cls, name, ver) + if name is None: + name = '' + return '%s(%s)' % (self.cls, name) - # Return file and line number for where node was defined def Location(self): - return '%s(%d)' % (self.filename, self.lineno) + """Return a file and line number for where this node was defined.""" + return '%s(%d)' % (self._filename, self.lineno) - # Log an error for this object def Error(self, msg): + """Log an error for this object.""" self.errors += 1 - ErrOut.LogLine(self.filename, self.lineno, 0, ' %s %s' % + ErrOut.LogLine(self._filename, self.lineno, 0, ' %s %s' % (str(self), msg)) - if self.filenode: - errcnt = self.filenode.GetProperty('ERRORS', 0) - self.filenode.SetProperty('ERRORS', errcnt + 1) + filenode = self.GetProperty('FILE') + if filenode: + errcnt = filenode.GetProperty('ERRORS') + if not errcnt: + errcnt = 0 + filenode.SetProperty('ERRORS', errcnt + 1) - # Log a warning for this object def Warning(self, msg): - WarnOut.LogLine(self.filename, self.lineno, 0, ' %s %s' % + """Log a warning for this object.""" + WarnOut.LogLine(self._filename, self.lineno, 0, ' %s %s' % (str(self), msg)) def GetName(self): return self.GetProperty('NAME') - def GetNameVersion(self): - name = self.GetProperty('NAME', default='') - ver = IDLRelease.__str__(self) - return '%s%s' % (name, ver) - - # Dump this object and its children def Dump(self, depth=0, comments=False, out=sys.stdout): + """Dump this object and its children""" if self.cls in ['Comment', 'Copyright']: is_comment = True else: is_comment = False # Skip this node if it's a comment, and we are not printing comments - if not comments and is_comment: return + if not comments and is_comment: + return tab = ''.rjust(depth * 2) if is_comment: @@ -153,7 +140,7 @@ class IDLNode(IDLRelease): out.write('%s%s%s%s\n' % (tab, self, ver, release_list)) if self.typelist: out.write('%s Typelist: %s\n' % (tab, self.typelist.GetReleases()[0])) - properties = self.property_node.GetPropertyList() + properties = self._property_node.GetPropertyList() if properties: out.write('%s Properties\n' % tab) for p in properties: @@ -161,90 +148,45 @@ class IDLNode(IDLRelease): # Skip printing the name for comments, since we printed above already continue out.write('%s %s : %s\n' % (tab, p, self.GetProperty(p))) - for child in self.children: + for child in self._children: child.Dump(depth+1, comments=comments, out=out) -# -# Search related functions -# - # Check if node is of a given type def IsA(self, *typelist): - if self.cls in typelist: return True - return False + """Check if node is of a given type.""" + return self.cls in typelist - # Get a list of objects for this key def GetListOf(self, *keys): + """Get a list of objects for the given key(s).""" out = [] - for child in self.children: - if child.cls in keys: out.append(child) + for child in self._children: + if child.cls in keys: + out.append(child) return out def GetOneOf(self, *keys): + """Get an object for the given key(s).""" out = self.GetListOf(*keys) - if out: return out[0] + if out: + return out[0] return None def SetParent(self, parent): - self.property_node.AddParent(parent) + self._property_node.AddParent(parent) self.parent = parent def AddChild(self, node): node.SetParent(self) - self.children.append(node) + self._children.append(node) # Get a list of all children def GetChildren(self): - return self.children - - # Get a list of all children of a given version - def GetChildrenVersion(self, version): - out = [] - for child in self.children: - if child.IsVersion(version): out.append(child) - return out - - # Get a list of all children in a given range - def GetChildrenRange(self, vmin, vmax): - out = [] - for child in self.children: - if child.IsRange(vmin, vmax): out.append(child) - return out - - def FindVersion(self, name, version): - node = self.namespace.FindNode(name, version) - if not node and self.parent: - node = self.parent.FindVersion(name, version) - return node - - def FindRange(self, name, vmin, vmax): - nodes = self.namespace.FindNodes(name, vmin, vmax) - if not nodes and self.parent: - nodes = self.parent.FindVersion(name, vmin, vmax) - return nodes + return self._children def GetType(self, release): - if not self.typelist: return None + if not self.typelist: + return None return self.typelist.FindRelease(release) - def GetHash(self, release): - hashval = self.hashes.get(release, None) - if hashval is None: - hashval = hashlib.sha1() - hashval.update(self.cls) - for key in self.property_node.GetPropertyList(): - val = self.GetProperty(key) - hashval.update('%s=%s' % (key, str(val))) - typeref = self.GetType(release) - if typeref: - hashval.update(typeref.GetHash(release)) - for child in self.GetChildren(): - if child.IsA('Copyright', 'Comment', 'Label'): continue - if not child.IsRelease(release): - continue - hashval.update( child.GetHash(release) ) - self.hashes[release] = hashval - return hashval.hexdigest() - def GetDeps(self, release, visited=None): visited = visited or set() @@ -253,7 +195,7 @@ class IDLNode(IDLRelease): return set([]) # If we have cached the info for this release, return the cached value - deps = self.deps.get(release, None) + deps = self._deps.get(release, None) if deps is not None: return deps @@ -275,7 +217,7 @@ class IDLNode(IDLRelease): if typeref: deps |= typeref.GetDeps(release, visited) - self.deps[release] = deps + self._deps[release] = deps return deps def GetVersion(self, release): @@ -296,17 +238,18 @@ class IDLNode(IDLRelease): out = set() for rel in releases: remapped = self.first_release[rel] - if not remapped: continue + if not remapped: + continue out |= set([remapped]) # Cache the most recent set of unique_releases - self.unique_releases = sorted(out) - return self.unique_releases + self._unique_releases = sorted(out) + return self._unique_releases def LastRelease(self, release): # Get the most recent release from the most recently generated set of # cached unique releases. - if self.unique_releases and self.unique_releases[-1] > release: + if self._unique_releases and self._unique_releases[-1] > release: return False return True @@ -316,21 +259,6 @@ class IDLNode(IDLRelease): return None return filenode.release_map.GetRelease(version) - def _GetReleases(self, releases): - if not self.releases: - my_min, my_max = self.GetMinMax(releases) - my_releases = [my_min] - if my_max != releases[-1]: - my_releases.append(my_max) - my_releases = set(my_releases) - for child in self.GetChildren(): - if child.IsA('Copyright', 'Comment', 'Label'): - continue - my_releases |= child.GetReleases(releases) - self.releases = my_releases - return self.releases - - def _GetReleaseList(self, releases, visited=None): visited = visited or set() if not self.releases: @@ -364,7 +292,7 @@ class IDLNode(IDLRelease): # Exclude sibling results from parent visited set cur_visits = visited - for child in self.children: + for child in self._children: child_releases |= set(child._GetReleaseList(releases, cur_visits)) visited |= set(child_releases) @@ -379,7 +307,7 @@ class IDLNode(IDLRelease): if my_min < type_release_list[0]: type_node = type_list[0] self.Error('requires %s in %s which is undefined at %s.' % ( - type_node, type_node.filename, my_min)) + type_node, type_node._filename, my_min)) for rel in child_releases | type_releases: if rel >= my_min and rel <= my_max: @@ -388,12 +316,9 @@ class IDLNode(IDLRelease): self.releases = sorted(my_releases) return self.releases - def GetReleaseList(self): - return self.releases - def BuildReleaseMap(self, releases): unique_list = self._GetReleaseList(releases) - my_min, my_max = self.GetMinMax(releases) + _, my_max = self.GetMinMax(releases) self.first_release = {} last_rel = None @@ -405,16 +330,13 @@ class IDLNode(IDLRelease): last_rel = None def SetProperty(self, name, val): - self.property_node.SetProperty(name, val) - - def GetProperty(self, name, default=None): - return self.property_node.GetProperty(name, default) + self._property_node.SetProperty(name, val) - def Traverse(self, data, func): - func(self, data) - for child in self.children: - child.Traverse(data, func) + def GetProperty(self, name): + return self._property_node.GetProperty(name) + def GetPropertyLocal(self, name): + return self._property_node.GetPropertyLocal(name) # # IDLFile @@ -425,8 +347,11 @@ class IDLFile(IDLNode): def __init__(self, name, children, errors=0): attrs = [IDLAttribute('NAME', name), IDLAttribute('ERRORS', errors)] - if not children: children = [] + if not children: + children = [] IDLNode.__init__(self, 'File', name, 1, 0, attrs + children) + # TODO(teravest): Why do we set release map like this here? This looks + # suspicious... self.release_map = IDLReleaseMap([('M13', 1.0)]) @@ -448,7 +373,8 @@ def StringTest(): if str(node) != text_str: ErrOut.Log('str() returned >%s< not >%s<' % (str(node), text_str)) errors += 1 - if not errors: InfoOut.Log('Passed StringTest') + if not errors: + InfoOut.Log('Passed StringTest') return errors @@ -482,7 +408,8 @@ def ChildTest(): ErrOut.Log('Failed GetChildren2.') errors += 1 - if not errors: InfoOut.Log('Passed ChildTest') + if not errors: + InfoOut.Log('Passed ChildTest') return errors diff --git a/chromium/ppapi/generators/idl_parser.py b/chromium/ppapi/generators/idl_parser.py index 40751e3f266..df330702a50 100755 --- a/chromium/ppapi/generators/idl_parser.py +++ b/chromium/ppapi/generators/idl_parser.py @@ -35,7 +35,6 @@ from idl_lexer import IDLLexer from idl_node import IDLAttribute, IDLFile, IDLNode from idl_option import GetOption, Option, ParseOptions from idl_lint import Lint -from idl_visitor import IDLVisitor from ply import lex from ply import yacc @@ -311,6 +310,14 @@ class IDLParser(IDLLexer): """dictionary_block : modifiers DICTIONARY SYMBOL '{' struct_list '}' ';'""" p[0] = self.BuildNamed('Dictionary', p, 3, ListFromConcat(p[1], p[5])) + def p_dictionary_errorA(self, p): + """dictionary_block : modifiers DICTIONARY error ';'""" + p[0] = [] + + def p_dictionary_errorB(self, p): + """dictionary_block : modifiers DICTIONARY error '{' struct_list '}' ';'""" + p[0] = [] + # # Callback # @@ -732,10 +739,10 @@ class IDLParser(IDLLexer): if self.parse_debug: DumpReduction('attribute', p) def p_member_function(self, p): - """member_function : modifiers static SYMBOL SYMBOL param_list""" + """member_function : modifiers static SYMBOL arrays SYMBOL param_list""" typeref = self.BuildAttribute('TYPEREF', p[3]) - children = ListFromConcat(p[1], p[2], typeref, p[5]) - p[0] = self.BuildNamed('Member', p, 4, children) + children = ListFromConcat(p[1], p[2], typeref, p[4], p[6]) + p[0] = self.BuildNamed('Member', p, 5, children) if self.parse_debug: DumpReduction('function', p) def p_static(self, p): @@ -977,7 +984,7 @@ class IDLParser(IDLLexer): def FlattenTree(node): add_self = False out = [] - for child in node.children: + for child in node.GetChildren(): if child.IsA('Comment'): add_self = True else: diff --git a/chromium/ppapi/generators/idl_propertynode.py b/chromium/ppapi/generators/idl_propertynode.py index 33837a3cefa..e15354ad0a4 100755 --- a/chromium/ppapi/generators/idl_propertynode.py +++ b/chromium/ppapi/generators/idl_propertynode.py @@ -8,7 +8,6 @@ import re import sys from idl_log import ErrOut, InfoOut, WarnOut -from idl_option import GetOption, Option, ParseOptions # # IDLPropertyNode @@ -22,11 +21,6 @@ class IDLPropertyNode(object): self.parents = [] self.property_map = {} - def Error(self, msg): - name = self.GetProperty('NAME', 'Unknown') - parents = [parent.GetProperty('NAME', '???') for parent in self.parents] - ErrOut.Log('%s [%s] : %s' % (name, ' '.join(parents), msg)) - def AddParent(self, parent): assert parent self.parents.append(parent) @@ -34,56 +28,26 @@ class IDLPropertyNode(object): def SetProperty(self, name, val): self.property_map[name] = val - def _GetProperty_(self, name): + def GetProperty(self, name): # Check locally for the property, and return it if found. prop = self.property_map.get(name, None) - if prop is not None: return prop + if prop is not None: + return prop # If not, seach parents in order for parent in self.parents: prop = parent.GetProperty(name) - if prop is not None: return prop + if prop is not None: + return prop # Otherwise, it can not be found. return None - def GetProperty(self, name, default=None): - prop = self._GetProperty_(name) - if prop is None: - return default - else: - return prop - - def GetPropertyLocal(self, name, default=None): - # Search for the property, but only locally, returning the - # default if not found. - prop = self.property_map.get(name, default) - return prop - - # Regular expression to parse property keys in a string such that a string - # "My string $NAME$" will find the key "NAME". - regex_var = re.compile('(?P<src>[^\\$]+)|(?P<key>\\$\\w+\\$)') + def GetPropertyLocal(self, name): + # Search for the property, but only locally. + return self.property_map.get(name, None) def GetPropertyList(self): return self.property_map.keys() - # Recursively expands text keys in the form of $KEY$ with the value - # of the property of the same name. Since this is done recursively - # one property can be defined in terms of another. - def Replace(self, text): - itr = IDLPropertyNode.regex_var.finditer(text) - out = '' - for m in itr: - (start, stop) = m.span() - if m.lastgroup == 'src': - out += text[start:stop] - if m.lastgroup == 'key': - key = text[start+1:stop-1] - val = self.GetProperty(key, None) - if not val: - self.Error('No property "%s"' % key) - out += self.Replace(str(val)) - return out - - # # Testing functions # @@ -91,16 +55,18 @@ class IDLPropertyNode(object): # Build a property node, setting the properties including a name, and # associate the children with this new node. # -def BuildNode(name, props, children=[], parents=[]): +def BuildNode(name, props, children=None, parents=None): node = IDLPropertyNode() node.SetProperty('NAME', name) for prop in props: toks = prop.split('=') node.SetProperty(toks[0], toks[1]) - for child in children: - child.AddParent(node) - for parent in parents: - node.AddParent(parent) + if children: + for child in children: + child.AddParent(node) + if parents: + for parent in parents: + node.AddParent(parent) return node def ExpectProp(node, name, val): @@ -128,63 +94,14 @@ def PropertyTest(): errors += ExpectProp(right, 'Left', 'Top') errors += ExpectProp(right, 'Right', 'Right') - if not errors: InfoOut.Log('Passed PropertyTest') - return errors - - -def ExpectText(node, text, val): - found = node.Replace(text) - if found != val: - ErrOut.Log('Got replacement %s expecting %s' % (found, val)) - return 1 - return 0 - -# -# Verify text replacement -# -def ReplaceTest(): - errors = 0 - left = BuildNode('Left', ['Left=Left']) - right = BuildNode('Right', ['Right=Right']) - top = BuildNode('Top', ['Left=Top', 'Right=Top'], [left, right]) - - errors += ExpectText(top, '$Left$', 'Top') - errors += ExpectText(top, '$Right$', 'Top') - - errors += ExpectText(left, '$Left$', 'Left') - errors += ExpectText(left, '$Right$', 'Top') - - errors += ExpectText(right, '$Left$', 'Top') - errors += ExpectText(right, '$Right$', 'Right') - - if not errors: InfoOut.Log('Passed ReplaceTest') - return errors - - -def MultiParentTest(): - errors = 0 - - parent1 = BuildNode('parent1', ['PARENT1=parent1', 'TOPMOST=$TOP$']) - parent2 = BuildNode('parent2', ['PARENT1=parent2', 'PARENT2=parent2']) - child = BuildNode('child', ['CHILD=child'], parents=[parent1, parent2]) - BuildNode('top', ['TOP=top'], children=[parent1]) - - errors += ExpectText(child, '$CHILD$', 'child') - errors += ExpectText(child, '$PARENT1$', 'parent1') - errors += ExpectText(child, '$PARENT2$', 'parent2') - - # Verify recursive resolution - errors += ExpectText(child, '$TOPMOST$', 'top') - - if not errors: InfoOut.Log('Passed MultiParentTest') + if not errors: + InfoOut.Log('Passed PropertyTest') return errors def Main(): errors = 0 errors += PropertyTest() - errors += ReplaceTest() - errors += MultiParentTest() if errors: ErrOut.Log('IDLNode failed with %d errors.' % errors) diff --git a/chromium/ppapi/generators/idl_tests.py b/chromium/ppapi/generators/idl_tests.py index cfc9fe8bac1..bf6d8a1570c 100755 --- a/chromium/ppapi/generators/idl_tests.py +++ b/chromium/ppapi/generators/idl_tests.py @@ -30,6 +30,10 @@ def main(args): assert errors == 0 errors += TestIDL('idl_gen_pnacl.py', ['--wnone', '--test']) assert errors == 0 + errors += TestIDL('idl_namespace.py', []) + assert errors == 0 + errors += TestIDL('idl_node.py', []) + assert errors == 0 if errors: print '\nFailed tests.' diff --git a/chromium/ppapi/generators/idl_visitor.py b/chromium/ppapi/generators/idl_visitor.py index 1ea1c9cf25f..7945f613dc9 100644 --- a/chromium/ppapi/generators/idl_visitor.py +++ b/chromium/ppapi/generators/idl_visitor.py @@ -19,30 +19,22 @@ class IDLVisitor(object): def __init__(self): - self.depth = 0 + pass # Return TRUE if the node should be visited def VisitFilter(self, node, data): return True - # Return TRUE if data should be added to the childdata list - def AgrigateFilter(self, data): - return data is not None - def Visit(self, node, data): - self.depth += 1 if not self.VisitFilter(node, data): return None childdata = [] newdata = self.Arrive(node, data) for child in node.GetChildren(): ret = self.Visit(child, newdata) - if self.AgrigateFilter(ret): + if ret is not None: childdata.append(ret) - out = self.Depart(node, newdata, childdata) - - self.depth -= 1 - return out + return self.Depart(node, newdata, childdata) def Arrive(self, node, data): __pychecker__ = 'unusednames=node' @@ -51,31 +43,3 @@ class IDLVisitor(object): def Depart(self, node, data, childdata): __pychecker__ = 'unusednames=node,childdata' return data - - -# -# IDLVersionVisitor -# -# The IDLVersionVisitor will only visit nodes with intervals that include the -# version. It will also optionally filter based on a class list -# -class IDLVersionVisitor(object): - def __init__(self, version, classList): - self.version = version - self.classes = classes - - def Filter(self, node, data): - if self.classList and node.cls not in self.classList: return False - if not node.IsVersion(self.version): return False - return True - -class IDLRangeVisitor(object): - def __init__(self, vmin, vmax, classList): - self.vmin = vmin - self.vmax = vmax - self.classList = classList - - def Filter(self, node, data): - if self.classList and node.cls not in self.classList: return False - if not node.IsVersion(self.version): return False - return True diff --git a/chromium/ppapi/generators/test_lex.in b/chromium/ppapi/generators/test_lex.in deleted file mode 100644 index e0a000ad41a..00000000000 --- a/chromium/ppapi/generators/test_lex.in +++ /dev/null @@ -1,65 +0,0 @@ -INT 1 INT 123 INT 12345 -SYMBOL A123 SYMBOL A_A - -COMMENT /*XXXX*/ -COMMENT //XXXX - -COMMENT /*MULTI LINE*/ - -[ [ -] ] -* * -. . -( ( -) ) -{ { -} } -[ [ -] ] -, , -; ; -: : -= = -+ + -- - -/ / -~ ~ -| | -& & -^ ^ -<< << ->> >> - -FLOAT 1.1 -FLOAT 1e1 -FLOAT -1.1 -FLOAT -1e1 -FLOAT 1e-1 -FLOAT -1e-1 -FLOAT 1.0e1 -FLOAT -1.0e-1 - -HEX 0x1 -HEX 0x0 -HEX 0x10 -HEX 0x112312 -HEX 0x1ABCD0 -HEX 0xA0B0C0 -HEX 0xabcdef -HEX 0x1ab2cd - -OCT 00 -OCT 01 -OCT 0123 - -INLINE #inline C -This is an inline block. - -Contains /* Comments */ -Contains // Comments -Contains /* Multi-line - Comment */ - -#endinl -SYMBOL blah - diff --git a/chromium/ppapi/generators/test_parser/dictionary.idl b/chromium/ppapi/generators/test_parser/dictionary.idl new file mode 100644 index 00000000000..1035cd1c355 --- /dev/null +++ b/chromium/ppapi/generators/test_parser/dictionary.idl @@ -0,0 +1,17 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +dictionary MyDict { + /* OK Member(setString) */ + DOMString setString; + /* OK Member(unsetLong) */ + long unsetLong; +}; + +/* FAIL Unexpected "}" after symbol unsetLong. */ +dictionary MyDict { + DOMString setString; + long unsetLong +}; diff --git a/chromium/ppapi/generators/test_parser/interface.idl b/chromium/ppapi/generators/test_parser/interface.idl index 6b52402db82..712027a88d8 100644 --- a/chromium/ppapi/generators/test_parser/interface.idl +++ b/chromium/ppapi/generators/test_parser/interface.idl @@ -27,6 +27,9 @@ interface Interface1 { [out] PP_Size size, /* OK Param(is_always_opaque) */ [out] PP_Bool is_always_opaque); + + /* OK Member(ReturnArray) */ + PP_Resource[] ReturnArray(); }; diff --git a/chromium/ppapi/host/resource_message_filter.cc b/chromium/ppapi/host/resource_message_filter.cc index ff56cac8c46..1757ad50bbf 100644 --- a/chromium/ppapi/host/resource_message_filter.cc +++ b/chromium/ppapi/host/resource_message_filter.cc @@ -16,14 +16,35 @@ namespace ppapi { namespace host { +namespace internal { + +// static +void ResourceMessageFilterDeleteTraits::Destruct( + const ResourceMessageFilter* filter) { + if (!filter->deletion_message_loop_proxy_->BelongsToCurrentThread()) { + // During shutdown the object may not be deleted, but it should be okay to + // leak in that case. + filter->deletion_message_loop_proxy_->DeleteSoon(FROM_HERE, filter); + } else { + delete filter; + } +} + +} // namespace internal + ResourceMessageFilter::ResourceMessageFilter() - : reply_thread_message_loop_proxy_( + : deletion_message_loop_proxy_( base::MessageLoop::current()->message_loop_proxy()), - resource_host_(NULL) {} + reply_thread_message_loop_proxy_( + base::MessageLoop::current()->message_loop_proxy()), + resource_host_(NULL) { +} ResourceMessageFilter::ResourceMessageFilter( scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy) - : reply_thread_message_loop_proxy_(reply_thread_message_loop_proxy), + : deletion_message_loop_proxy_( + base::MessageLoop::current()->message_loop_proxy()), + reply_thread_message_loop_proxy_(reply_thread_message_loop_proxy), resource_host_(NULL) { } diff --git a/chromium/ppapi/host/resource_message_filter.h b/chromium/ppapi/host/resource_message_filter.h index ef00cf7ae22..b72a7df7db2 100644 --- a/chromium/ppapi/host/resource_message_filter.h +++ b/chromium/ppapi/host/resource_message_filter.h @@ -24,6 +24,15 @@ namespace ppapi { namespace host { class ResourceHost; +class ResourceMessageFilter; + +namespace internal { + +struct PPAPI_HOST_EXPORT ResourceMessageFilterDeleteTraits { + static void Destruct(const ResourceMessageFilter* filter); +}; + +} // namespace internal // This is the base class of resource message filters that can handle resource // messages on another thread. ResourceHosts can handle most messages @@ -65,13 +74,15 @@ class ResourceHost; // AddFilter(make_scoped_refptr(new MyMessageFilter)); class PPAPI_HOST_EXPORT ResourceMessageFilter : public ResourceMessageHandler, - public base::RefCountedThreadSafe<ResourceMessageFilter> { + public base::RefCountedThreadSafe< + ResourceMessageFilter, internal::ResourceMessageFilterDeleteTraits> { public: // This object must be constructed on the same thread that a reply message // should be sent, i.e. the IO thread when constructed in the browser process // or the main thread when constructed in the renderer process. Since // ResourceMessageFilters are usually constructed in the constructor of the // owning ResourceHost, this will almost always be the case anyway. + // The object will be deleted on the creation thread. ResourceMessageFilter(); // Test constructor. Allows you to specify the message loop which will be used // to dispatch replies on. @@ -93,7 +104,6 @@ class PPAPI_HOST_EXPORT ResourceMessageFilter const IPC::Message& msg) OVERRIDE; protected: - friend class base::RefCountedThreadSafe<ResourceMessageFilter>; virtual ~ResourceMessageFilter(); // If you want the message to be handled on another thread, return a non-null @@ -102,10 +112,17 @@ class PPAPI_HOST_EXPORT ResourceMessageFilter const IPC::Message& message); private: + friend class base::DeleteHelper<ResourceMessageFilter>; + friend class base::RefCountedThreadSafe< + ResourceMessageFilter, internal::ResourceMessageFilterDeleteTraits>; + friend struct internal::ResourceMessageFilterDeleteTraits; + // This method is posted to the target thread and runs the message handler. void DispatchMessage(const IPC::Message& msg, HostMessageContext context); + scoped_refptr<base::MessageLoopProxy> deletion_message_loop_proxy_; + // Message loop to send resource message replies on. This will be the message // loop proxy of the IO thread for the browser process or the main thread for // the renderer process. diff --git a/chromium/ppapi/host/resource_message_filter_unittest.cc b/chromium/ppapi/host/resource_message_filter_unittest.cc index 78fc23cf6b4..e26d164c2f9 100644 --- a/chromium/ppapi/host/resource_message_filter_unittest.cc +++ b/chromium/ppapi/host/resource_message_filter_unittest.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_proxy.h" +#include "base/run_loop.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" #include "ipc/ipc_message.h" @@ -15,9 +18,6 @@ namespace ppapi { namespace host { - -typedef testing::Test ResourceMessageFilterTest; - namespace { base::WaitableEvent g_handler_completion(true, false); @@ -141,61 +141,83 @@ class MyResourceFilter : public ResourceMessageFilter { } // namespace +class ResourceMessageFilterTest : public testing::Test { + public: + void TestHandleMessageImpl() { + base::Thread io_thread("test_io_thread"); + ASSERT_TRUE(io_thread.Start()); + + base::Thread bg_thread1("test_background_thread1"); + ASSERT_TRUE(bg_thread1.Start()); + scoped_refptr<MyResourceFilter> filter1 = + new MyResourceFilter(io_thread, bg_thread1, MSG1_TYPE, REPLY_MSG1_TYPE); + + base::Thread bg_thread2("test_background_thread2"); + ASSERT_TRUE(bg_thread2.Start()); + scoped_refptr<MyResourceFilter> filter2 = + new MyResourceFilter(io_thread, bg_thread2, MSG2_TYPE, REPLY_MSG2_TYPE); + + PP_Instance instance = 12345; + PP_Resource resource = 67890; + MyResourceHost host(NULL, instance, resource, MSG3_TYPE, REPLY_MSG3_TYPE); + host.AddMessageFilter(filter1); + host.AddMessageFilter(filter2); + + proxy::ResourceMessageCallParams params(resource, 1); + params.set_has_callback(); + HostMessageContext context(params); + IPC::Message message1(0, MSG1_TYPE, IPC::Message::PRIORITY_NORMAL); + IPC::Message message2(0, MSG2_TYPE, IPC::Message::PRIORITY_NORMAL); + IPC::Message message3(0, MSG3_TYPE, IPC::Message::PRIORITY_NORMAL); + + // Message 1 handled by the first filter. + host.HandleMessage(message1, &context); + g_handler_completion.Wait(); + EXPECT_EQ(filter1->last_handled_msg().type(), message1.type()); + EXPECT_EQ(filter1->last_message_loop(), bg_thread1.message_loop()); + EXPECT_EQ(host.last_reply_msg().type(), + static_cast<uint32>(REPLY_MSG1_TYPE)); + EXPECT_EQ(host.last_reply_message_loop(), io_thread.message_loop()); + g_handler_completion.Reset(); + + // Message 2 handled by the second filter. + host.HandleMessage(message2, &context); + g_handler_completion.Wait(); + EXPECT_EQ(filter2->last_handled_msg().type(), message2.type()); + EXPECT_EQ(filter2->last_message_loop(), bg_thread2.message_loop()); + EXPECT_EQ(host.last_reply_msg().type(), + static_cast<uint32>(REPLY_MSG2_TYPE)); + EXPECT_EQ(host.last_reply_message_loop(), io_thread.message_loop()); + g_handler_completion.Reset(); + + // Message 3 handled by the resource host. + host.HandleMessage(message3, &context); + EXPECT_EQ(host.last_handled_msg().type(), message3.type()); + EXPECT_EQ(host.last_reply_msg().type(), + static_cast<uint32>(REPLY_MSG3_TYPE)); + + io_thread.Stop(); + bg_thread1.Stop(); + bg_thread2.Stop(); + } +}; + // Test that messages are filtered correctly and handlers are run on the correct // threads. TEST_F(ResourceMessageFilterTest, TestHandleMessage) { - base::Thread io_thread("test_io_thread"); - ASSERT_TRUE(io_thread.Start()); - - base::Thread bg_thread1("test_background_thread1"); - ASSERT_TRUE(bg_thread1.Start()); - scoped_refptr<MyResourceFilter> filter1 = - new MyResourceFilter(io_thread, bg_thread1, MSG1_TYPE, REPLY_MSG1_TYPE); - - base::Thread bg_thread2("test_background_thread2"); - ASSERT_TRUE(bg_thread2.Start()); - scoped_refptr<MyResourceFilter> filter2 = - new MyResourceFilter(io_thread, bg_thread2, MSG2_TYPE, REPLY_MSG2_TYPE); - - PP_Instance instance = 12345; - PP_Resource resource = 67890; - MyResourceHost host(NULL, instance, resource, MSG3_TYPE, REPLY_MSG3_TYPE); - host.AddMessageFilter(filter1); - host.AddMessageFilter(filter2); - - proxy::ResourceMessageCallParams params(resource, 1); - params.set_has_callback(); - HostMessageContext context(params); - IPC::Message message1(0, MSG1_TYPE, IPC::Message::PRIORITY_NORMAL); - IPC::Message message2(0, MSG2_TYPE, IPC::Message::PRIORITY_NORMAL); - IPC::Message message3(0, MSG3_TYPE, IPC::Message::PRIORITY_NORMAL); - - // Message 1 handled by the first filter. - host.HandleMessage(message1, &context); - g_handler_completion.Wait(); - EXPECT_EQ(filter1->last_handled_msg().type(), message1.type()); - EXPECT_EQ(filter1->last_message_loop(), bg_thread1.message_loop()); - EXPECT_EQ(host.last_reply_msg().type(), static_cast<uint32>(REPLY_MSG1_TYPE)); - EXPECT_EQ(host.last_reply_message_loop(), io_thread.message_loop()); - g_handler_completion.Reset(); - - // Message 2 handled by the second filter. - host.HandleMessage(message2, &context); - g_handler_completion.Wait(); - EXPECT_EQ(filter2->last_handled_msg().type(), message2.type()); - EXPECT_EQ(filter2->last_message_loop(), bg_thread2.message_loop()); - EXPECT_EQ(host.last_reply_msg().type(), static_cast<uint32>(REPLY_MSG2_TYPE)); - EXPECT_EQ(host.last_reply_message_loop(), io_thread.message_loop()); - g_handler_completion.Reset(); - - // Message 3 handled by the resource host. - host.HandleMessage(message3, &context); - EXPECT_EQ(host.last_handled_msg().type(), message3.type()); - EXPECT_EQ(host.last_reply_msg().type(), static_cast<uint32>(REPLY_MSG3_TYPE)); - - io_thread.Stop(); - bg_thread1.Stop(); - bg_thread2.Stop(); + // ResourceMessageFilter instances need to be created on a thread with message + // loop. Therefore, we create a message loop and run the testing logic as a + // task on it. + base::MessageLoop main_message_loop; + + // It should be safe to use base::Unretained() because the object won't be + // destroyed before the task is run. + main_message_loop.PostTask( + FROM_HERE, + base::Bind(&ResourceMessageFilterTest::TestHandleMessageImpl, + base::Unretained(this))); + + base::RunLoop().RunUntilIdle(); } } // namespace proxy diff --git a/chromium/ppapi/native_client/chrome_main.scons b/chromium/ppapi/native_client/chrome_main.scons index 8f41ab02743..e8593a4dabe 100644 --- a/chromium/ppapi/native_client/chrome_main.scons +++ b/chromium/ppapi/native_client/chrome_main.scons @@ -39,13 +39,9 @@ ppapi_scons_files['nonvariant_test_scons_files'] = [ 'tests/nacl_browser/browser_dynamic_library/nacl.scons', 'tests/nacl_browser/manifest_file/nacl.scons', 'tests/nacl_browser/nameservice/nacl.scons', - 'tests/nacl_browser/postmessage_redir/nacl.scons', 'tests/ppapi_browser/bad/nacl.scons', - 'tests/ppapi_browser/crash/nacl.scons', 'tests/ppapi_browser/extension_mime_handler/nacl.scons', 'tests/ppapi_browser/manifest/nacl.scons', - 'tests/ppapi_browser/ppb_instance/nacl.scons', - 'tests/ppapi_browser/ppp_instance/nacl.scons', 'tests/ppapi_test_lib/nacl.scons', ] diff --git a/chromium/ppapi/native_client/src/trusted/plugin/arch_x86/sandbox_isa.cc b/chromium/ppapi/native_client/src/trusted/plugin/arch_x86/sandbox_isa.cc index 3f5ab0db243..99e033925f9 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/arch_x86/sandbox_isa.cc +++ b/chromium/ppapi/native_client/src/trusted/plugin/arch_x86/sandbox_isa.cc @@ -5,13 +5,14 @@ #include "native_client/src/trusted/platform_qualify/nacl_os_qualify.h" #include "ppapi/native_client/src/trusted/plugin/nexe_arch.h" -namespace { // The list of supported ISA strings for x86. See issue: // http://code.google.com/p/nativeclient/issues/detail?id=1040 for more // information. Note that these string are to be case-insensitive compared. -const char* const kNexeArchX86_32 = "x86-32"; -const char* const kNexeArchX86_64 = "x86-64"; -} // namespace +const char kNexeArchX86_64[] = "x86-64"; +#if !((NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 && NACL_BUILD_SUBARCH == 64) && \ + (defined(NACL_LINUX) || defined(NACL_OSX))) +const char kNexeArchX86_32[] = "x86-32"; +#endif namespace plugin { const char* GetSandboxISA() { diff --git a/chromium/ppapi/native_client/src/trusted/plugin/file_downloader.cc b/chromium/ppapi/native_client/src/trusted/plugin/file_downloader.cc index 5da04c686b9..f8d3a4c4572 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/file_downloader.cc +++ b/chromium/ppapi/native_client/src/trusted/plugin/file_downloader.cc @@ -33,8 +33,28 @@ struct NaClFileInfo NoFileInfo() { return info; } +// Converts a PP_FileHandle to a POSIX file descriptor. +int32_t ConvertFileDescriptor(PP_FileHandle handle) { + PLUGIN_PRINTF(("ConvertFileDescriptor, handle=%d\n", handle)); +#if NACL_WINDOWS + int32_t file_desc = NACL_NO_FILE_DESC; + // On Windows, valid handles are 32 bit unsigned integers so this is safe. + file_desc = reinterpret_cast<uintptr_t>(handle); + // Convert the Windows HANDLE from Pepper to a POSIX file descriptor. + int32_t posix_desc = _open_osfhandle(file_desc, _O_RDWR | _O_BINARY); + if (posix_desc == -1) { + // Close the Windows HANDLE if it can't be converted. + CloseHandle(reinterpret_cast<HANDLE>(file_desc)); + return -1; + } + return posix_desc; +#else + return handle; +#endif } +} // namespace + namespace plugin { void FileDownloader::Initialize(Plugin* instance) { @@ -44,11 +64,12 @@ void FileDownloader::Initialize(Plugin* instance) { CHECK(instance_ == NULL); // Can only initialize once. instance_ = instance; callback_factory_.Initialize(this); - file_io_trusted_interface_ = static_cast<const PPB_FileIOTrusted*>( - pp::Module::Get()->GetBrowserInterface(PPB_FILEIOTRUSTED_INTERFACE)); + file_io_private_interface_ = static_cast<const PPB_FileIO_Private*>( + pp::Module::Get()->GetBrowserInterface(PPB_FILEIO_PRIVATE_INTERFACE)); url_loader_trusted_interface_ = static_cast<const PPB_URLLoaderTrusted*>( pp::Module::Get()->GetBrowserInterface(PPB_URLLOADERTRUSTED_INTERFACE)); temp_buffer_.resize(kTempBufferSize); + cached_file_info_ = NoFileInfo(); } bool FileDownloader::OpenStream( @@ -69,7 +90,7 @@ bool FileDownloader::Open( PLUGIN_PRINTF(("FileDownloader::Open (url=%s)\n", url.c_str())); if (callback.pp_completion_callback().func == NULL || instance_ == NULL || - file_io_trusted_interface_ == NULL) + file_io_private_interface_ == NULL) return false; CHECK(instance_ != NULL); @@ -80,6 +101,7 @@ bool FileDownloader::Open( file_open_notify_callback_ = callback; mode_ = mode; buffer_.clear(); + cached_file_info_ = NoFileInfo(); pp::URLRequestInfo url_request(instance_); // Allow CORS. @@ -90,6 +112,9 @@ bool FileDownloader::Open( if (!instance_->DocumentCanRequest(url)) url_request.SetAllowCrossOriginRequests(true); + if (!extra_request_headers_.empty()) + url_request.SetHeaders(extra_request_headers_); + do { // Reset the url loader and file reader. // Note that we have the only reference to the underlying objects, so @@ -137,18 +162,12 @@ bool FileDownloader::Open( } } while (0); - void (FileDownloader::*start_notify)(int32_t); - if (streaming_to_file()) - start_notify = &FileDownloader::URLLoadStartNotify; - else - start_notify = &FileDownloader::URLBufferStartNotify; - // Request asynchronous download of the url providing an on-load callback. // As long as this step is guaranteed to be asynchronous, we can call // synchronously all other internal callbacks that eventually result in the // invocation of the user callback. The user code will not be reentered. pp::CompletionCallback onload_callback = - callback_factory_.NewCallback(start_notify); + callback_factory_.NewCallback(&FileDownloader::URLLoadStartNotify); int32_t pp_error = url_loader_.Open(url_request, onload_callback); PLUGIN_PRINTF(("FileDownloader::Open (pp_error=%" NACL_PRId32 ")\n", pp_error)); @@ -160,6 +179,8 @@ void FileDownloader::OpenFast(const nacl::string& url, PP_FileHandle file_handle, uint64_t file_token_lo, uint64_t file_token_hi) { PLUGIN_PRINTF(("FileDownloader::OpenFast (url=%s)\n", url.c_str())); + + cached_file_info_ = NoFileInfo(); CHECK(instance_ != NULL); open_time_ = NaClGetTimeOfDayMicroseconds(); status_code_ = NACL_HTTP_STATUS_OK; @@ -172,41 +193,16 @@ void FileDownloader::OpenFast(const nacl::string& url, } struct NaClFileInfo FileDownloader::GetFileInfo() { - struct NaClFileInfo info = NoFileInfo(); - 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 - info.file_token = file_token_; - } else { - if (!streaming_to_file()) { - return NoFileInfo(); - } - // Use the trusted interface to get the file descriptor. - if (file_io_trusted_interface_ == NULL) { - return NoFileInfo(); - } - 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. - int32_t posix_desc = _open_osfhandle(file_desc, _O_RDWR | _O_BINARY); - if (posix_desc == -1) { - // Close the Windows HANDLE if it can't be converted. - CloseHandle(reinterpret_cast<HANDLE>(file_desc)); - return NoFileInfo(); + PLUGIN_PRINTF(("FileDownloader::GetFileInfo\n")); + if (cached_file_info_.desc != -1) { + return cached_file_info_; + } else if (not_streaming() && file_handle_ != PP_kInvalidFileHandle) { + cached_file_info_.desc = ConvertFileDescriptor(file_handle_); + if (cached_file_info_.desc != -1) + cached_file_info_.file_token = file_token_; + return cached_file_info_; } - file_desc = posix_desc; -#endif - - info.desc = file_desc; - return info; + return NoFileInfo(); } int64_t FileDownloader::TimeSinceOpenMilliseconds() const { @@ -218,18 +214,12 @@ int64_t FileDownloader::TimeSinceOpenMilliseconds() const { return (now - open_time_) / NACL_MICROS_PER_MILLI; } -bool FileDownloader::InitialResponseIsValid(int32_t pp_error) { - if (pp_error != PP_OK) { // Url loading failed. - file_open_notify_callback_.RunAndClear(pp_error); - return false; - } - +bool FileDownloader::InitialResponseIsValid() { // Process the response, validating the headers to confirm successful loading. url_response_ = url_loader_.GetResponseInfo(); if (url_response_.is_null()) { PLUGIN_PRINTF(( "FileDownloader::InitialResponseIsValid (url_response_=NULL)\n")); - file_open_notify_callback_.RunAndClear(PP_ERROR_FAILED); return false; } @@ -237,7 +227,6 @@ bool FileDownloader::InitialResponseIsValid(int32_t pp_error) { if (!full_url.is_string()) { PLUGIN_PRINTF(( "FileDownloader::InitialResponseIsValid (url is not a string)\n")); - file_open_notify_callback_.RunAndClear(PP_ERROR_FAILED); return false; } url_ = full_url.AsString(); @@ -265,43 +254,28 @@ bool FileDownloader::InitialResponseIsValid(int32_t pp_error) { status_ok = (status_code_ == NACL_HTTP_STATUS_OK); break; } - - if (!status_ok) { - file_open_notify_callback_.RunAndClear(PP_ERROR_FAILED); - return false; - } - - return true; + return status_ok; } void FileDownloader::URLLoadStartNotify(int32_t pp_error) { PLUGIN_PRINTF(("FileDownloader::URLLoadStartNotify (pp_error=%" NACL_PRId32")\n", pp_error)); - - if (!InitialResponseIsValid(pp_error)) { - // InitialResponseIsValid() calls file_open_notify_callback_ on errors. + if (pp_error != PP_OK) { + file_open_notify_callback_.RunAndClear(pp_error); return; } - if (open_and_stream_) - return FinishStreaming(file_open_notify_callback_); - - file_open_notify_callback_.RunAndClear(pp_error); -} - -void FileDownloader::URLBufferStartNotify(int32_t pp_error) { - PLUGIN_PRINTF(("FileDownloader::URLBufferStartNotify (pp_error=%" - NACL_PRId32")\n", pp_error)); - - if (!InitialResponseIsValid(pp_error)) { - // InitialResponseIsValid() calls file_open_notify_callback_ on errors. + if (!InitialResponseIsValid()) { + file_open_notify_callback_.RunAndClear(PP_ERROR_FAILED); return; } - if (open_and_stream_) - return FinishStreaming(file_open_notify_callback_); + if (open_and_stream_) { + FinishStreaming(file_open_notify_callback_); + return; + } - file_open_notify_callback_.RunAndClear(pp_error); + file_open_notify_callback_.RunAndClear(PP_OK); } void FileDownloader::FinishStreaming( @@ -442,7 +416,19 @@ void FileDownloader::StreamFinishNotify(int32_t pp_error) { PLUGIN_PRINTF(( "FileDownloader::StreamFinishNotify (pp_error=%" NACL_PRId32 ")\n", pp_error)); - stream_finish_callback_.RunAndClear(pp_error); + + // Run the callback if we have an error, or if we don't have a file_reader_ + // to get a file handle for. + if (pp_error != PP_OK || file_reader_.pp_resource() == 0) { + stream_finish_callback_.RunAndClear(pp_error); + return; + } + + pp::CompletionCallbackWithOutput<PP_FileHandle> cb = + callback_factory_.NewCallbackWithOutput( + &FileDownloader::GotFileHandleNotify); + file_io_private_interface_->RequestOSFileHandle( + file_reader_.pp_resource(), cb.output(), cb.pp_completion_callback()); } bool FileDownloader::streaming_to_file() const { @@ -461,4 +447,15 @@ bool FileDownloader::not_streaming() const { return mode_ == DOWNLOAD_NONE; } +void FileDownloader::GotFileHandleNotify(int32_t pp_error, + PP_FileHandle handle) { + PLUGIN_PRINTF(( + "FileDownloader::GotFileHandleNotify (pp_error=%" NACL_PRId32 ")\n", + pp_error)); + if (pp_error == PP_OK) + cached_file_info_.desc = ConvertFileDescriptor(handle); + + stream_finish_callback_.RunAndClear(pp_error); +} + } // namespace plugin diff --git a/chromium/ppapi/native_client/src/trusted/plugin/file_downloader.h b/chromium/ppapi/native_client/src/trusted/plugin/file_downloader.h index e84e6368682..4fd7997cc92 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/file_downloader.h +++ b/chromium/ppapi/native_client/src/trusted/plugin/file_downloader.h @@ -11,7 +11,7 @@ #include "native_client/src/include/nacl_string.h" #include "native_client/src/trusted/validator/nacl_file_info.h" #include "ppapi/c/private/pp_file_handle.h" -#include "ppapi/c/trusted/ppb_file_io_trusted.h" +#include "ppapi/c/private/ppb_file_io_private.h" #include "ppapi/c/trusted/ppb_url_loader_trusted.h" #include "ppapi/cpp/file_io.h" #include "ppapi/cpp/instance.h" @@ -52,7 +52,7 @@ class FileDownloader { file_open_notify_callback_(pp::BlockUntilComplete()), stream_finish_callback_(pp::BlockUntilComplete()), file_handle_(PP_kInvalidFileHandle), - file_io_trusted_interface_(NULL), + file_io_private_interface_(NULL), url_loader_trusted_interface_(NULL), open_time_(-1), mode_(DOWNLOAD_NONE), @@ -149,6 +149,11 @@ class FileDownloader { int status_code() const { return status_code_; } nacl::string GetResponseHeaders() const; + void set_request_headers(const nacl::string& extra_request_headers) { + extra_request_headers_ = extra_request_headers; + } + + private: NACL_DISALLOW_COPY_AND_ASSIGN(FileDownloader); // This class loads and opens the file in three steps for DOWNLOAD_TO_FILE: @@ -165,23 +170,24 @@ class FileDownloader { // data is passed directly to the user instead of saved in a buffer. // The public Open*() functions start step 1), and the public FinishStreaming // function proceeds to step 2) and 3). - bool InitialResponseIsValid(int32_t pp_error); + bool InitialResponseIsValid(); void URLLoadStartNotify(int32_t pp_error); void URLLoadFinishNotify(int32_t pp_error); - void URLBufferStartNotify(int32_t pp_error); void URLReadBodyNotify(int32_t pp_error); void StreamFinishNotify(int32_t pp_error); + void GotFileHandleNotify(int32_t pp_error, PP_FileHandle handle); Plugin* instance_; nacl::string url_to_open_; nacl::string url_; + nacl::string extra_request_headers_; pp::URLResponseInfo url_response_; pp::CompletionCallback file_open_notify_callback_; pp::CompletionCallback stream_finish_callback_; pp::FileIO file_reader_; PP_FileHandle file_handle_; struct NaClFileToken file_token_; - const PPB_FileIOTrusted* file_io_trusted_interface_; + const PPB_FileIO_Private* file_io_private_interface_; const PPB_URLLoaderTrusted* url_loader_trusted_interface_; pp::URLLoader url_loader_; pp::CompletionCallbackFactory<FileDownloader> callback_factory_; @@ -194,6 +200,7 @@ class FileDownloader { std::deque<char> buffer_; UrlSchemeType url_scheme_; StreamCallbackSource* data_stream_callback_source_; + NaClFileInfo cached_file_info_; }; } // namespace plugin; #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_FILE_DOWNLOADER_H_ diff --git a/chromium/ppapi/native_client/src/trusted/plugin/json_manifest.cc b/chromium/ppapi/native_client/src/trusted/plugin/json_manifest.cc index 0928c05f2ce..4a3640f5042 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/json_manifest.cc +++ b/chromium/ppapi/native_client/src/trusted/plugin/json_manifest.cc @@ -42,8 +42,6 @@ const char* const kUrlKey = "url"; // PNaCl keys const char* const kOptLevelKey = "optlevel"; -// DEPRECATED! TODO(jvoung): remove the error message after launch. -const char* const kOptLevelKeyDeprecated = "-O"; // Sample NaCl manifest file: // { @@ -212,14 +210,6 @@ bool IsValidUrlSpec(const Json::Value& url_spec, *error_string = error_stream.str(); return false; } - if (url_spec.isMember(kOptLevelKeyDeprecated)) { - nacl::stringstream error_stream; - error_stream << parent_key << " property '" << container_key << - "' has deprecated key '" << kOptLevelKeyDeprecated << - "' please use '" << kOptLevelKey << "' instead."; - *error_string = error_stream.str(); - return false; - } return true; } diff --git a/chromium/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc b/chromium/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc index 16fa18fba23..ca358781dda 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc +++ b/chromium/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc @@ -56,7 +56,7 @@ void NaClHttpResponseHeaders::Parse(const std::string& headers_str) { std::string key = tokens[0]; // Also ignore keys that start with white-space (they are invalid). // See: HttpResponseHeadersTest.NormalizeHeadersLeadingWhitespace. - if (key[0] == ' ' || key[0] == '\t') + if (key.length() == 0 || key[0] == ' ' || key[0] == '\t') continue; // TODO(jvoung): replace some of this with TrimWhitespaceASCII when // we move code to chromium. diff --git a/chromium/ppapi/native_client/src/trusted/plugin/plugin.cc b/chromium/ppapi/native_client/src/trusted/plugin/plugin.cc index 2aa90bedb4e..2bf3021efac 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/chromium/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -29,28 +29,14 @@ #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" #include "native_client/src/trusted/service_runtime/nacl_error_code.h" -#include "ppapi/c/dev/ppp_find_dev.h" -#include "ppapi/c/dev/ppp_printing_dev.h" -#include "ppapi/c/dev/ppp_selection_dev.h" -#include "ppapi/c/dev/ppp_zoom_dev.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_console.h" #include "ppapi/c/ppb_var.h" -#include "ppapi/c/ppp_input_event.h" #include "ppapi/c/ppp_instance.h" -#include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/ppb_nacl_private.h" #include "ppapi/c/private/ppb_uma_private.h" -#include "ppapi/cpp/dev/find_dev.h" -#include "ppapi/cpp/dev/printing_dev.h" -#include "ppapi/cpp/dev/selection_dev.h" #include "ppapi/cpp/dev/url_util_dev.h" -#include "ppapi/cpp/dev/zoom_dev.h" -#include "ppapi/cpp/image_data.h" -#include "ppapi/cpp/input_event.h" #include "ppapi/cpp/module.h" -#include "ppapi/cpp/mouse_lock.h" -#include "ppapi/cpp/rect.h" #include "ppapi/cpp/text_input_controller.h" #include "ppapi/native_client/src/trusted/plugin/file_utils.h" @@ -92,9 +78,6 @@ const char* const kDevAttribute = "@dev"; const char* const kChromeExtensionUriScheme = "chrome-extension"; const char* const kDataUriScheme = "data"; -// The key used to find the dictionary nexe URLs in the manifest file. -const char* const kNexesKey = "nexes"; - // Up to 20 seconds const int64_t kTimeSmallMin = 1; // in ms const int64_t kTimeSmallMax = 20000; // in ms @@ -263,53 +246,9 @@ void HistogramHTTPStatusCode(const std::string& name, int status) { } // namespace -static int const kAbiHeaderBuffer = 256; // must be at least EI_ABIVERSION + 1 - -void Plugin::AddPropertyGet(const nacl::string& prop_name, - Plugin::PropertyGetter getter) { - PLUGIN_PRINTF(("Plugin::AddPropertyGet (prop_name='%s')\n", - prop_name.c_str())); - property_getters_[nacl::string(prop_name)] = getter; -} - -bool Plugin::HasProperty(const nacl::string& prop_name) { - PLUGIN_PRINTF(("Plugin::HasProperty (prop_name=%s)\n", - prop_name.c_str())); - return property_getters_.find(prop_name) != property_getters_.end(); -} - -bool Plugin::GetProperty(const nacl::string& prop_name, - NaClSrpcArg* prop_value) { - PLUGIN_PRINTF(("Plugin::GetProperty (prop_name=%s)\n", prop_name.c_str())); - - if (property_getters_.find(prop_name) == property_getters_.end()) { - return false; - } - PropertyGetter getter = property_getters_[prop_name]; - (this->*getter)(prop_value); - return true; -} - -void Plugin::GetExitStatus(NaClSrpcArg* prop_value) { - PLUGIN_PRINTF(("GetExitStatus (this=%p)\n", reinterpret_cast<void*>(this))); - prop_value->tag = NACL_SRPC_ARG_TYPE_INT; - prop_value->u.ival = exit_status(); -} - -void Plugin::GetLastError(NaClSrpcArg* prop_value) { - PLUGIN_PRINTF(("GetLastError (this=%p)\n", reinterpret_cast<void*>(this))); - prop_value->tag = NACL_SRPC_ARG_TYPE_STRING; - prop_value->arrays.str = strdup(last_error_string().c_str()); -} - -void Plugin::GetReadyStateProperty(NaClSrpcArg* prop_value) { - PLUGIN_PRINTF(("GetReadyState (this=%p)\n", reinterpret_cast<void*>(this))); - prop_value->tag = NACL_SRPC_ARG_TYPE_INT; - prop_value->u.ival = nacl_ready_state(); -} - -bool Plugin::Init(int argc, char* argn[], char* argv[]) { - PLUGIN_PRINTF(("Plugin::Init (instance=%p)\n", static_cast<void*>(this))); +bool Plugin::EarlyInit(int argc, const char* argn[], const char* argv[]) { + PLUGIN_PRINTF(("Plugin::EarlyInit (instance=%p)\n", + static_cast<void*>(this))); #ifdef NACL_OSX // TODO(kochi): For crbug.com/102808, this is a stopgap solution for Lion @@ -348,13 +287,6 @@ bool Plugin::Init(int argc, char* argn[], char* argv[]) { PLUGIN_PRINTF(("Plugin::Init (wrapper_factory=%p)\n", static_cast<void*>(wrapper_factory_))); - // Export a property to allow us to get the exit status of a nexe. - AddPropertyGet("exitStatus", &Plugin::GetExitStatus); - // Export a property to allow us to get the last error description. - AddPropertyGet("lastError", &Plugin::GetLastError); - // Export a property to allow us to get the ready state of a nexe during load. - AddPropertyGet("readyState", &Plugin::GetReadyStateProperty); - PLUGIN_PRINTF(("Plugin::Init (return 1)\n")); // Return success. return true; @@ -568,29 +500,18 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(nacl::DescWrapper* wrapper, } char* Plugin::LookupArgument(const char* key) { - char** keys = argn(); - for (int ii = 0, len = argc(); ii < len; ++ii) { + char** keys = argn_; + for (int ii = 0, len = argc_; ii < len; ++ii) { if (!strcmp(keys[ii], key)) { - return argv()[ii]; + return argv_[ii]; } } return NULL; } -// Suggested names for progress event types, per -// http://www.w3.org/TR/progress-events/ -const char* const Plugin::kProgressEventLoadStart = "loadstart"; -const char* const Plugin::kProgressEventProgress = "progress"; -const char* const Plugin::kProgressEventError = "error"; -const char* const Plugin::kProgressEventAbort = "abort"; -const char* const Plugin::kProgressEventLoad = "load"; -const char* const Plugin::kProgressEventLoadEnd = "loadend"; -// Define a NaCl specific event type for .nexe crashes. -const char* const Plugin::kProgressEventCrash = "crash"; - class ProgressEvent { public: - ProgressEvent(const char* event_type, + ProgressEvent(PP_NaClEventType event_type, const nacl::string& url, Plugin::LengthComputable length_computable, uint64_t loaded_bytes, @@ -600,7 +521,7 @@ class ProgressEvent { length_computable_(length_computable), loaded_bytes_(loaded_bytes), total_bytes_(total_bytes) { } - const char* event_type() const { return event_type_; } + PP_NaClEventType event_type() const { return event_type_; } const char* url() const { return url_.c_str(); } Plugin::LengthComputable length_computable() const { return length_computable_; @@ -609,10 +530,7 @@ class ProgressEvent { uint64_t total_bytes() const { return total_bytes_; } private: - // event_type_ is always passed from a string literal, so ownership is - // not taken. Hence it does not need to be deleted when ProgressEvent is - // destroyed. - const char* event_type_; + PP_NaClEventType event_type_; nacl::string url_; Plugin::LengthComputable length_computable_; uint64_t loaded_bytes_; @@ -637,9 +555,6 @@ Plugin* Plugin::New(PP_Instance pp_instance) { PLUGIN_PRINTF(("Plugin::New (pp_instance=%" NACL_PRId32 ")\n", pp_instance)); Plugin* plugin = new Plugin(pp_instance); PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin))); - if (plugin == NULL) { - return NULL; - } return plugin; } @@ -666,12 +581,7 @@ bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) { PLUGIN_PRINTF(("Plugin::Init (url_util_=%p)\n", static_cast<const void*>(url_util_))); - bool status = Plugin::Init( - static_cast<int>(argc), - // TODO(polina): Can we change the args on our end to be const to - // avoid these ugly casts? - const_cast<char**>(argn), - const_cast<char**>(argv)); + bool status = EarlyInit(static_cast<int>(argc), argn, argv); if (status) { // Look for the developer attribute; if it's present, enable 'dev' // interfaces. @@ -732,7 +642,6 @@ Plugin::Plugin(PP_Instance pp_instance) argn_(NULL), argv_(NULL), main_subprocess_("main subprocess", NULL, NULL), - nacl_ready_state_(UNSENT), nexe_error_reported_(false), wrapper_factory_(NULL), enable_dev_interfaces_(false), @@ -741,6 +650,7 @@ Plugin::Plugin(PP_Instance pp_instance) ready_time_(0), nexe_size_(0), time_of_last_progress_event_(0), + exit_status_(-1), nacl_interface_(NULL) { PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" NACL_PRId32 ")\n", static_cast<void*>(this), pp_instance)); @@ -748,6 +658,11 @@ Plugin::Plugin(PP_Instance pp_instance) nexe_downloader_.Initialize(this); nacl_interface_ = GetNaClInterface(); CHECK(nacl_interface_ != NULL); + set_nacl_ready_state(UNSENT); + set_last_error_string(""); + // We call set_exit_status() here to ensure that the 'exitStatus' property is + // set. This can only be called when nacl_interface_ is not NULL. + set_exit_status(-1); } @@ -895,7 +810,7 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) { static_cast<float>(nexe_downloader_.TimeSinceOpenMilliseconds())); // Inform JavaScript that we successfully downloaded the nacl module. - EnqueueProgressEvent(kProgressEventProgress, + EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, nexe_downloader_.url_to_open(), LENGTH_IS_COMPUTABLE, nexe_bytes_read, @@ -976,14 +891,13 @@ void Plugin::NexeDidCrash(int32_t pp_error) { " non-PP_OK arg -- SHOULD NOT HAPPEN\n")); } PLUGIN_PRINTF(("Plugin::NexeDidCrash: crash event!\n")); - int exit_status = main_subprocess_.service_runtime()->exit_status(); - if (-1 != exit_status) { + if (-1 != exit_status()) { // The NaCl module voluntarily exited. However, this is still a // crash from the point of view of Pepper, since PPAPI plugins are // event handlers and should never exit. PLUGIN_PRINTF((("Plugin::NexeDidCrash: nexe exited with status %d" " so this is a \"controlled crash\".\n"), - exit_status)); + exit_status())); } // If the crash occurs during load, we just want to report an error // that fits into our load progress event grammar. If the crash @@ -993,7 +907,7 @@ void Plugin::NexeDidCrash(int32_t pp_error) { PLUGIN_PRINTF(("Plugin::NexeDidCrash: error already reported;" " suppressing\n")); } else { - if (nacl_ready_state() == DONE) { + if (nacl_ready_state_ == DONE) { ReportDeadNexe(); } else { ErrorInfo error_info; @@ -1060,7 +974,7 @@ void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) { void Plugin::ReportDeadNexe() { PLUGIN_PRINTF(("Plugin::ReportDeadNexe\n")); - if (nacl_ready_state() == DONE && !nexe_error_reported()) { // After loadEnd. + if (nacl_ready_state_ == DONE && !nexe_error_reported()) { // After loadEnd. int64_t crash_time = NaClGetTimeOfDayMicroseconds(); // Crashes will be more likely near startup, so use a medium histogram // instead of a large one. @@ -1072,7 +986,7 @@ void Plugin::ReportDeadNexe() { set_last_error_string(message); AddToConsole(message); - EnqueueProgressEvent(kProgressEventCrash); + EnqueueProgressEvent(PP_NACL_EVENT_CRASH); set_nexe_error_reported(true); } // else ReportLoadError() and ReportAbortError() will be used by loading code @@ -1206,9 +1120,8 @@ void Plugin::ProcessNaClManifest(const nacl::string& manifest_json) { is_installed_ = GetUrlScheme(program_url) == SCHEME_CHROME_EXTENSION; set_nacl_ready_state(LOADING); // Inform JavaScript that we found a nexe URL to load. - EnqueueProgressEvent(kProgressEventProgress); + EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS); if (pnacl_options.translate()) { - CHECK(nacl_interface()->IsPnaclEnabled()); pp::CompletionCallback translate_callback = callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate); // Will always call the callback on success or failure. @@ -1265,7 +1178,7 @@ void Plugin::RequestNaClManifest(const nacl::string& url) { set_manifest_url(url); // Inform JavaScript that a load is starting. set_nacl_ready_state(OPENED); - EnqueueProgressEvent(kProgressEventLoadStart); + EnqueueProgressEvent(PP_NACL_EVENT_LOADSTART); bool is_data_uri = GetUrlScheme(nmf_resolved_url.AsString()) == SCHEME_DATA; HistogramEnumerateManifestIsDataURI(static_cast<int>(is_data_uri)); if (is_data_uri) { @@ -1387,9 +1300,9 @@ void Plugin::ReportLoadSuccess(LengthComputable length_computable, // Inform JavaScript that loading was successful and is complete. const nacl::string& url = nexe_downloader_.url_to_open(); EnqueueProgressEvent( - kProgressEventLoad, url, length_computable, loaded_bytes, total_bytes); + PP_NACL_EVENT_LOAD, url, length_computable, loaded_bytes, total_bytes); EnqueueProgressEvent( - kProgressEventLoadEnd, url, length_computable, loaded_bytes, total_bytes); + PP_NACL_EVENT_LOADEND, url, length_computable, loaded_bytes, total_bytes); // UMA HistogramEnumerateLoadStatus(ERROR_LOAD_SUCCESS, is_installed_); @@ -1419,8 +1332,8 @@ void Plugin::ReportLoadError(const ErrorInfo& error_info) { AddToConsole(nacl::string("NaCl module load failed: ") + error_info.console_message()); // Inform JavaScript that loading encountered an error and is complete. - EnqueueProgressEvent(kProgressEventError); - EnqueueProgressEvent(kProgressEventLoadEnd); + EnqueueProgressEvent(PP_NACL_EVENT_ERROR); + EnqueueProgressEvent(PP_NACL_EVENT_LOADEND); // UMA HistogramEnumerateLoadStatus(error_info.error_code(), is_installed_); @@ -1437,8 +1350,8 @@ void Plugin::ReportLoadAbort() { set_last_error_string(error_string); AddToConsole(error_string); // Inform JavaScript that loading was aborted and is complete. - EnqueueProgressEvent(kProgressEventAbort); - EnqueueProgressEvent(kProgressEventLoadEnd); + EnqueueProgressEvent(PP_NACL_EVENT_ABORT); + EnqueueProgressEvent(PP_NACL_EVENT_LOADEND); // UMA HistogramEnumerateLoadStatus(ERROR_LOAD_ABORTED, is_installed_); @@ -1471,7 +1384,7 @@ void Plugin::UpdateDownloadProgress( LengthComputable length_computable = (total_bytes_to_be_received >= 0) ? LENGTH_IS_COMPUTABLE : LENGTH_IS_NOT_COMPUTABLE; - plugin->EnqueueProgressEvent(kProgressEventProgress, + plugin->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, url, length_computable, bytes_received, @@ -1498,7 +1411,7 @@ const FileDownloader* Plugin::FindFileDownloader( return file_downloader; } -void Plugin::EnqueueProgressEvent(const char* event_type) { +void Plugin::EnqueueProgressEvent(PP_NaClEventType event_type) { EnqueueProgressEvent(event_type, NACL_NO_URL, Plugin::LENGTH_IS_NOT_COMPUTABLE, @@ -1506,15 +1419,15 @@ void Plugin::EnqueueProgressEvent(const char* event_type) { Plugin::kUnknownBytes); } -void Plugin::EnqueueProgressEvent(const char* event_type, +void Plugin::EnqueueProgressEvent(PP_NaClEventType event_type, const nacl::string& url, LengthComputable length_computable, uint64_t loaded_bytes, uint64_t total_bytes) { PLUGIN_PRINTF(("Plugin::EnqueueProgressEvent (" - "event_type='%s', url='%s', length_computable=%d, " + "event_type='%d', url='%s', length_computable=%d, " "loaded=%" NACL_PRIu64 ", total=%" NACL_PRIu64 ")\n", - event_type, + static_cast<int>(event_type), url.c_str(), static_cast<int>(length_computable), loaded_bytes, @@ -1552,63 +1465,21 @@ void Plugin::DispatchProgressEvent(int32_t result) { nacl::scoped_ptr<ProgressEvent> event(progress_events_.front()); progress_events_.pop(); PLUGIN_PRINTF(("Plugin::DispatchProgressEvent (" - "event_type='%s', url='%s', length_computable=%d, " + "event_type='%d', url='%s', length_computable=%d, " "loaded=%" NACL_PRIu64 ", total=%" NACL_PRIu64 ")\n", - event->event_type(), + static_cast<int>(event->event_type()), event->url(), static_cast<int>(event->length_computable()), event->loaded_bytes(), event->total_bytes())); - static const char* kEventClosureJS = - "(function(target, type, url," - " lengthComputable, loadedBytes, totalBytes) {" - " var progress_event = new ProgressEvent(type, {" - " bubbles: false," - " cancelable: true," - " lengthComputable: lengthComputable," - " loaded: loadedBytes," - " total: totalBytes" - " });" - " progress_event.url = url;" - " target.dispatchEvent(progress_event);" - "})"; - - // Create a function object by evaluating the JavaScript text. - // TODO(sehr, polina): We should probably cache the created function object to - // avoid JavaScript reparsing. - pp::VarPrivate exception; - pp::VarPrivate function_object = ExecuteScript(kEventClosureJS, &exception); - if (!exception.is_undefined() || !function_object.is_object()) { - PLUGIN_PRINTF(("Plugin::DispatchProgressEvent:" - " Function object creation failed.\n")); - return; - } - // Get the target of the event to be dispatched. - pp::Var owner_element_object = GetOwnerElementObject(); - if (!owner_element_object.is_object()) { - PLUGIN_PRINTF(("Plugin::DispatchProgressEvent:" - " Couldn't get owner element object.\n")); - NACL_NOTREACHED(); - return; - } - - pp::Var argv[6]; - static const uint32_t argc = NACL_ARRAY_SIZE(argv); - argv[0] = owner_element_object; - argv[1] = pp::Var(event->event_type()); - argv[2] = pp::Var(event->url()); - argv[3] = pp::Var(event->length_computable() == LENGTH_IS_COMPUTABLE); - argv[4] = pp::Var(static_cast<double>(event->loaded_bytes())); - argv[5] = pp::Var(static_cast<double>(event->total_bytes())); - - // Dispatch the event. - const pp::Var default_method; - function_object.Call(default_method, argc, argv, &exception); - if (!exception.is_undefined()) { - PLUGIN_PRINTF(("Plugin::DispatchProgressEvent:" - " event dispatch failed.\n")); - } + nacl_interface_->DispatchEvent( + pp_instance(), + event->event_type(), + pp::Var(event->url()).pp_var(), + event->length_computable() == LENGTH_IS_COMPUTABLE ? PP_TRUE : PP_FALSE, + event->loaded_bytes(), + event->total_bytes()); } bool Plugin::OpenURLFast(const nacl::string& url, @@ -1688,4 +1559,42 @@ void Plugin::AddToConsole(const nacl::string& text) { var_interface->Release(str); } +void Plugin::set_last_error_string(const nacl::string& error) { + DCHECK(nacl_interface_); + nacl_interface_->SetReadOnlyProperty(pp_instance(), + pp::Var("lastError").pp_var(), + pp::Var(error).pp_var()); +} + +void Plugin::set_nacl_ready_state(ReadyState state) { + nacl_ready_state_ = state; + DCHECK(nacl_interface_); + nacl_interface_->SetReadOnlyProperty(pp_instance(), + pp::Var("readyState").pp_var(), + pp::Var(state).pp_var()); +} + +void Plugin::set_exit_status(int exit_status) { + pp::Core* core = pp::Module::Get()->core(); + if (core->IsMainThread()) { + SetExitStatusOnMainThread(PP_OK, exit_status); + } else { + pp::CompletionCallback callback = + callback_factory_.NewCallback(&Plugin::SetExitStatusOnMainThread, + exit_status); + core->CallOnMainThread(0, callback, 0); + } +} + +void Plugin::SetExitStatusOnMainThread(int32_t pp_error, + int exit_status) { + DCHECK(pp::Module::Get()->core()->IsMainThread()); + DCHECK(nacl_interface_); + exit_status_ = exit_status; + nacl_interface_->SetReadOnlyProperty(pp_instance(), + pp::Var("exitStatus").pp_var(), + pp::Var(exit_status_).pp_var()); +} + + } // namespace plugin diff --git a/chromium/ppapi/native_client/src/trusted/plugin/plugin.h b/chromium/ppapi/native_client/src/trusted/plugin/plugin.h index 416ab5bf71a..ca8348968d2 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/chromium/ppapi/native_client/src/trusted/plugin/plugin.h @@ -22,10 +22,7 @@ #include "native_client/src/trusted/validator/nacl_file_info.h" #include "ppapi/c/private/ppb_nacl_private.h" -#include "ppapi/cpp/private/var_private.h" -// for pp::VarPrivate #include "ppapi/cpp/private/instance_private.h" -#include "ppapi/cpp/rect.h" #include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/var.h" #include "ppapi/cpp/view.h" @@ -36,21 +33,14 @@ #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" #include "ppapi/native_client/src/trusted/plugin/utility.h" -struct NaClSrpcChannel; - namespace nacl { class DescWrapper; class DescWrapperFactory; } // namespace nacl namespace pp { -class Find_Dev; -class MouseLock; -class Printing_Dev; -class Selection_Dev; class URLLoader; class URLUtil_Dev; -class Zoom_Dev; } namespace ppapi_proxy { @@ -156,35 +146,19 @@ class Plugin : public pp::InstancePrivate { // event (loadstart, progress, error, abort, load, loadend). Events are // enqueued on the JavaScript event loop, which then calls back through // DispatchProgressEvent. - void EnqueueProgressEvent(const char* event_type); - void EnqueueProgressEvent(const char* event_type, + void EnqueueProgressEvent(PP_NaClEventType event_type); + void EnqueueProgressEvent(PP_NaClEventType event_type, const nacl::string& url, LengthComputable length_computable, uint64_t loaded_bytes, uint64_t total_bytes); - // Progress event types. - static const char* const kProgressEventLoadStart; - static const char* const kProgressEventProgress; - static const char* const kProgressEventError; - static const char* const kProgressEventAbort; - static const char* const kProgressEventLoad; - static const char* const kProgressEventLoadEnd; - static const char* const kProgressEventCrash; - // Report the error code that sel_ldr produces when starting a nexe. void ReportSelLdrLoadStatus(int status); // Report nexe death after load to JS and shut down the proxy. void ReportDeadNexe(); - // The embed/object tag argument list. - int argc() const { return argc_; } - char** argn() const { return argn_; } - char** argv() const { return argv_; } - - Plugin* plugin() const { return const_cast<Plugin*>(this); } - // URL resolution support. // plugin_base_url is the URL used for resolving relative URLs used in // src="...". @@ -218,10 +192,6 @@ class Plugin : public pp::InstancePrivate { // interaction with the page. DONE = 4 }; - ReadyState nacl_ready_state() const { return nacl_ready_state_; } - void set_nacl_ready_state(ReadyState nacl_ready_state) { - nacl_ready_state_ = nacl_ready_state; - } bool nexe_error_reported() const { return nexe_error_reported_; } void set_nexe_error_reported(bool val) { nexe_error_reported_ = val; @@ -232,16 +202,6 @@ class Plugin : public pp::InstancePrivate { // Requests a NaCl manifest download from a |url| relative to the page origin. void RequestNaClManifest(const nacl::string& url); - // Support for property getting. - typedef void (Plugin::* PropertyGetter)(NaClSrpcArg* prop_value); - void AddPropertyGet(const nacl::string& prop_name, PropertyGetter getter); - bool HasProperty(const nacl::string& prop_name); - bool GetProperty(const nacl::string& prop_name, NaClSrpcArg* prop_value); - // The supported property getters. - void GetExitStatus(NaClSrpcArg* prop_value); - void GetLastError(NaClSrpcArg* prop_value); - void GetReadyStateProperty(NaClSrpcArg* prop_value); - // The size returned when a file download operation is unable to determine // the size of the file to load. W3C ProgressEvents specify that unknown // sizes return 0. @@ -271,11 +231,7 @@ class Plugin : public pp::InstancePrivate { // document to request the URL using CORS even if this function returns false. bool DocumentCanRequest(const std::string& url); - // Get the text description of the last error reported by the plugin. - const nacl::string& last_error_string() const { return last_error_string_; } - void set_last_error_string(const nacl::string& error) { - last_error_string_ = error; - } + void set_last_error_string(const nacl::string& error); // The MIME type used to instantiate this instance of the NaCl plugin. // Typically, the MIME type will be application/x-nacl. However, if the NEXE @@ -292,13 +248,9 @@ class Plugin : public pp::InstancePrivate { Manifest const* manifest() const { return manifest_.get(); } const pp::URLUtil_Dev* url_util() const { return url_util_; } - // Extracts the exit status from the (main) service runtime. - int exit_status() const { - if (NULL == main_service_runtime()) { - return -1; - } - return main_service_runtime()->exit_status(); - } + int exit_status() const { return exit_status_; } + // set_exit_status may be called off the main thread. + void set_exit_status(int exit_status); const PPB_NaCl_Private* nacl_interface() const { return nacl_interface_; } @@ -311,7 +263,7 @@ class Plugin : public pp::InstancePrivate { // pointer to this object, not from base's Delete(). ~Plugin(); - bool Init(int argc, char* argn[], char* argv[]); + bool EarlyInit(int argc, const char* argn[], const char* argv[]); // Shuts down socket connection, service runtime, and receive thread, // in this order, for the main nacl subprocess. void ShutDownSubprocesses(); @@ -416,6 +368,10 @@ class Plugin : public pp::InstancePrivate { // request so it won't slow down non-installed file downloads. bool OpenURLFast(const nacl::string& url, FileDownloader* downloader); + void set_nacl_ready_state(ReadyState state); + + void SetExitStatusOnMainThread(int32_t pp_error, int exit_status); + ScriptablePlugin* scriptable_plugin_; int argc_; @@ -433,8 +389,6 @@ class Plugin : public pp::InstancePrivate { nacl::DescWrapperFactory* wrapper_factory_; - std::map<nacl::string, PropertyGetter> property_getters_; - // File download support. |nexe_downloader_| can be opened with a specific // callback to run when the file has been downloaded and is opened for // reading. We use one downloader for all URL downloads to prevent issuing @@ -451,10 +405,6 @@ class Plugin : public pp::InstancePrivate { // URL processing interface for use in looking up resources in manifests. const pp::URLUtil_Dev* url_util_; - // A string containing the text description of the last error - // produced by this plugin. - nacl::string last_error_string_; - // PPAPI Dev interfaces are disabled by default. bool enable_dev_interfaces_; @@ -512,6 +462,7 @@ class Plugin : public pp::InstancePrivate { const FileDownloader* FindFileDownloader(PP_Resource url_loader) const; int64_t time_of_last_progress_event_; + int exit_status_; const PPB_NaCl_Private* nacl_interface_; }; diff --git a/chromium/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/chromium/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc index 26268bf7eba..f892059ad79 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc +++ b/chromium/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc @@ -226,20 +226,14 @@ PnaclCoordinator* PnaclCoordinator::BitcodeToNative( pnacl_options, translate_notify_callback); coordinator->pnacl_init_time_ = NaClGetTimeOfDayMicroseconds(); - coordinator->off_the_record_ = - plugin->nacl_interface()->IsOffTheRecord(); - PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (manifest=%p, " - "off_the_record=%d)\n", - reinterpret_cast<const void*>(coordinator->manifest_.get()), - coordinator->off_the_record_)); - - // First check that PNaCl is installed. - pp::CompletionCallback pnacl_installed_cb = - coordinator->callback_factory_.NewCallback( - &PnaclCoordinator::DidCheckPnaclInstalled); - plugin->nacl_interface()->EnsurePnaclInstalled( - plugin->pp_instance(), - pnacl_installed_cb.pp_completion_callback()); + PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (manifest=%p, ", + reinterpret_cast<const void*>(coordinator->manifest_.get()))); + + // First start a network request for the pexe, to tickle the component + // updater's On-Demand resource throttler, and to get Last-Modified/ETag + // cache information. We can cancel the request later if there's + // a bitcode->nexe cache hit. + coordinator->OpenBitcodeStream(); return coordinator; } @@ -257,7 +251,6 @@ PnaclCoordinator::PnaclCoordinator( pnacl_options_(pnacl_options), is_cache_hit_(PP_FALSE), error_already_reported_(false), - off_the_record_(false), pnacl_init_time_(0), pexe_size_(0), pexe_bytes_compiled_(0), @@ -346,7 +339,7 @@ void PnaclCoordinator::TranslateFinished(int32_t pp_error) { // that were delayed (see the delay inserted in BitcodeGotCompiled). if (ExpectedProgressKnown()) { pexe_bytes_compiled_ = expected_pexe_size_; - plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress, + plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, pexe_url_, plugin::Plugin::LENGTH_IS_COMPUTABLE, pexe_bytes_compiled_, @@ -428,55 +421,14 @@ void PnaclCoordinator::NexeReadDidOpen(int32_t pp_error) { translate_notify_callback_.Run(pp_error); } -void PnaclCoordinator::DidCheckPnaclInstalled(int32_t pp_error) { - if (pp_error != PP_OK) { - ReportNonPpapiError( - ERROR_PNACL_RESOURCE_FETCH, - nacl::string("The Portable Native Client (pnacl) component is not " - "installed. Please consult chrome://components for more " - "information.")); - return; - } - - // Loading resources (e.g. llc and ld nexes) is done with PnaclResources. - resources_.reset(new PnaclResources(plugin_, - this, - this->manifest_.get())); - CHECK(resources_ != NULL); - - // The first step of loading resources: read the resource info file. - pp::CompletionCallback resource_info_read_cb = - callback_factory_.NewCallback( - &PnaclCoordinator::ResourceInfoWasRead); - resources_->ReadResourceInfo(PnaclUrls::GetResourceInfoUrl(), - resource_info_read_cb); -} - -void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) { - PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%" - NACL_PRId32 ")\n", pp_error)); - // Second step of loading resources: call StartLoad. - pp::CompletionCallback resources_cb = - callback_factory_.NewCallback(&PnaclCoordinator::ResourcesDidLoad); - resources_->StartLoad(resources_cb); -} - -void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) { - PLUGIN_PRINTF(("PnaclCoordinator::ResourcesDidLoad (pp_error=%" - NACL_PRId32 ")\n", pp_error)); - if (pp_error != PP_OK) { - // Finer-grained error code should have already been reported by - // the PnaclResources class. - return; - } - - OpenBitcodeStream(); -} - void PnaclCoordinator::OpenBitcodeStream() { // Now open the pexe stream. streaming_downloader_.reset(new FileDownloader()); streaming_downloader_->Initialize(plugin_); + // Mark the request as requesting a PNaCl bitcode file, + // so that component updater can detect this user action. + streaming_downloader_->set_request_headers( + "Accept: application/x-pnacl, */*"); // Even though we haven't started downloading, create the translation // thread object immediately. This ensures that any pieces of the file @@ -509,7 +461,42 @@ void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) { return; } - // Get the cache key and try to open an existing entry. + // The component updater's resource throttles + OnDemand update/install + // should block the URL request until the compiler is present. Now we + // can load the resources (e.g. llc and ld nexes). + resources_.reset(new PnaclResources(plugin_, this, this->manifest_.get())); + CHECK(resources_ != NULL); + + // The first step of loading resources: read the resource info file. + pp::CompletionCallback resource_info_read_cb = + callback_factory_.NewCallback(&PnaclCoordinator::ResourceInfoWasRead); + resources_->ReadResourceInfo(PnaclUrls::GetResourceInfoUrl(), + resource_info_read_cb); +} + +void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) { + PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%" + NACL_PRId32 ")\n", pp_error)); + // Second step of loading resources: call StartLoad to load pnacl-llc + // and pnacl-ld, based on the filenames found in the resource info file. + pp::CompletionCallback resources_cb = + callback_factory_.NewCallback(&PnaclCoordinator::ResourcesDidLoad); + resources_->StartLoad(resources_cb); +} + +void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) { + PLUGIN_PRINTF(("PnaclCoordinator::ResourcesDidLoad (pp_error=%" + NACL_PRId32 ")\n", pp_error)); + if (pp_error != PP_OK) { + // Finer-grained error code should have already been reported by + // the PnaclResources class. + return; + } + + // Okay, now that we've started the HTTP request for the pexe + // and we've ensured that the PNaCl compiler + metadata is installed, + // get the cache key from the response headers and from the + // compiler's version metadata. nacl::string headers = streaming_downloader_->GetResponseHeaders(); NaClHttpResponseHeaders parser; parser.Parse(headers); @@ -642,14 +629,14 @@ void PnaclCoordinator::BitcodeGotCompiled(int32_t pp_error, // that bytes were sent to the compiler. if (ExpectedProgressKnown()) { if (!ShouldDelayProgressEvent()) { - plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress, + plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, pexe_url_, plugin::Plugin::LENGTH_IS_COMPUTABLE, pexe_bytes_compiled_, expected_pexe_size_); } } else { - plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress, + plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, pexe_url_, plugin::Plugin::LENGTH_IS_NOT_COMPUTABLE, pexe_bytes_compiled_, diff --git a/chromium/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h b/chromium/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h index 97828646a5d..e38cbc07869 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h +++ b/chromium/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h @@ -54,10 +54,10 @@ class TempFile; // (2) ld links the object code in obj_file_ and produces a nexe in nexe_file_. // // The coordinator proceeds through several states. They are -// LOAD_TRANSLATOR_BINARIES -// Complete when ResourcesDidLoad is invoked. // OPEN_BITCODE_STREAM // Complete when BitcodeStreamDidOpen is invoked +// LOAD_TRANSLATOR_BINARIES +// Complete when ResourcesDidLoad is invoked. // GET_NEXE_FD // Get an FD which contains the cached nexe, or is writeable for // translation output. Complete when NexeFdDidOpen is called. @@ -139,22 +139,17 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> { const PnaclOptions& pnacl_options, const pp::CompletionCallback& translate_notify_callback); - // Callback for when we know PNaCl is installed. - void DidCheckPnaclInstalled(int32_t pp_error); + // Invoke to issue a GET request for bitcode. + void OpenBitcodeStream(); + // Invoked when we've started an URL fetch for the pexe to check for + // caching metadata. + void BitcodeStreamDidOpen(int32_t pp_error); // Callback for when the resource info JSON file has been read. void ResourceInfoWasRead(int32_t pp_error); // Callback for when llc and ld have been downloaded. void ResourcesDidLoad(int32_t pp_error); - - // Callbacks for temporary file related stages. - // They are invoked from ResourcesDidLoad and proceed in declaration order. - // Invoke to issue a GET request for bitcode. - void OpenBitcodeStream(); - // Invoked when we've started an URL fetch for the pexe to check for - // caching metadata. - void BitcodeStreamDidOpen(int32_t pp_error); // Invoked when we've gotten a temp FD for the nexe, either with the nexe // data, or a writeable fd to save to. void NexeFdDidOpen(int32_t pp_error); @@ -224,9 +219,6 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> { // was already run/consumed. bool error_already_reported_; - // True if compilation is off_the_record. - bool off_the_record_; - // State for timing and size information for UMA stats. int64_t pnacl_init_time_; int64_t pexe_size_; // Count as we stream -- will converge to pexe size. diff --git a/chromium/ppapi/native_client/src/trusted/plugin/scriptable_plugin.cc b/chromium/ppapi/native_client/src/trusted/plugin/scriptable_plugin.cc index 5e395675aeb..05c0455d558 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/scriptable_plugin.cc +++ b/chromium/ppapi/native_client/src/trusted/plugin/scriptable_plugin.cc @@ -41,54 +41,6 @@ pp::Var Error(const nacl::string& call_name, const char* caller, return pp::Var(); } -// In JavaScript, foo[1] is equivalent to foo["1"], so map both indexed and -// string names to a string. -nacl::string NameAsString(const pp::Var& name) { - if (name.is_string()) - return name.AsString(); - CHECK(name.is_int()); - nacl::stringstream namestream; - namestream << name.AsInt(); - return namestream.str(); -} - -// Returns a pp::Var corresponding to |arg| or void. Sets |exception| on error. -pp::Var NaClSrpcArgToPPVar(const NaClSrpcArg* arg, pp::Var* exception) { - PLUGIN_PRINTF((" NaClSrpcArgToPPVar (arg->tag='%c')\n", arg->tag)); - pp::Var var; - switch (arg->tag) { - case NACL_SRPC_ARG_TYPE_BOOL: - var = pp::Var(arg->u.bval != 0); - break; - case NACL_SRPC_ARG_TYPE_DOUBLE: - var = pp::Var(arg->u.dval); - break; - case NACL_SRPC_ARG_TYPE_INT: - var = pp::Var(arg->u.ival); - break; - case NACL_SRPC_ARG_TYPE_LONG: - // PPAPI does not have a 64-bit integral type. Downcast. - var = pp::Var(static_cast<int32_t>(arg->u.lval)); - break; - case NACL_SRPC_ARG_TYPE_STRING: - var = pp::Var(arg->arrays.str); - break; - case NACL_SRPC_ARG_TYPE_CHAR_ARRAY: - case NACL_SRPC_ARG_TYPE_DOUBLE_ARRAY: - case NACL_SRPC_ARG_TYPE_INT_ARRAY: - case NACL_SRPC_ARG_TYPE_LONG_ARRAY: - case NACL_SRPC_ARG_TYPE_OBJECT: - case NACL_SRPC_ARG_TYPE_HANDLE: - case NACL_SRPC_ARG_TYPE_VARIANT_ARRAY: - case NACL_SRPC_ARG_TYPE_INVALID: - default: - *exception = "variant array and invalid argument types are not supported"; - } - PLUGIN_PRINTF((" NaClSrpcArgToPPVar (return var=%s, exception=%s)\n", - var.DebugString().c_str(), exception->DebugString().c_str())); - return var; -} - } // namespace ScriptablePlugin::ScriptablePlugin(Plugin* plugin) @@ -131,18 +83,9 @@ bool ScriptablePlugin::HasProperty(const pp::Var& name, pp::Var* exception) { UNREFERENCED_PARAMETER(exception); PLUGIN_PRINTF(("ScriptablePlugin::HasProperty (this=%p, name=%s)\n", static_cast<void*>(this), name.DebugString().c_str())); - if (plugin_ == NULL) { - return false; - } - if (!name.is_string() && !name.is_int()) - return false; - bool has_property = plugin_->HasProperty(name.AsString()); - PLUGIN_PRINTF(("ScriptablePlugin::HasProperty (has_property=%d)\n", - has_property)); - return has_property; + return false; } - bool ScriptablePlugin::HasMethod(const pp::Var& name, pp::Var* exception) { UNREFERENCED_PARAMETER(exception); PLUGIN_PRINTF(("ScriptablePlugin::HasMethod (this=%p, name='%s')\n", @@ -150,33 +93,15 @@ bool ScriptablePlugin::HasMethod(const pp::Var& name, pp::Var* exception) { return false; } - pp::Var ScriptablePlugin::GetProperty(const pp::Var& name, pp::Var* exception) { PLUGIN_PRINTF(("ScriptablePlugin::GetProperty (name=%s)\n", name.DebugString().c_str())); - if (plugin_ == NULL) { - return pp::Var(); - } - // Get the property. - NaClSrpcArg prop_value; - nacl::string prop_name = NameAsString(name); - if (!plugin_->GetProperty(prop_name, &prop_value)) { - return Error(prop_name, "GetProperty", "invocation failed", exception); - } - PLUGIN_PRINTF(("ScriptablePlugin::GetProperty (invocation done)\n")); - // Marshall output parameter. - pp::Var property = NaClSrpcArgToPPVar(&prop_value, exception); - if (!exception->is_undefined()) { - return Error(prop_name, "GetProperty", "output marshalling failed", - exception); - } - PLUGIN_PRINTF(("ScriptablePlugin::GetProperty (property=%s)\n", - property.DebugString().c_str())); - return property; + Error("GetProperty", name.DebugString().c_str(), + "property getting is not supported", exception); + return pp::Var(); } - void ScriptablePlugin::SetProperty(const pp::Var& name, const pp::Var& value, pp::Var* exception) { @@ -191,7 +116,7 @@ void ScriptablePlugin::RemoveProperty(const pp::Var& name, pp::Var* exception) { PLUGIN_PRINTF(("ScriptablePlugin::RemoveProperty (name=%s)\n", name.DebugString().c_str())); - Error(NameAsString(name), "RemoveProperty", + Error("RemoveProperty", name.DebugString().c_str(), "property removal is not supported", exception); } diff --git a/chromium/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/chromium/ppapi/native_client/src/trusted/plugin/service_runtime.cc index 27957862325..8a5a11aac7d 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/service_runtime.cc +++ b/chromium/ppapi/native_client/src/trusted/plugin/service_runtime.cc @@ -50,7 +50,7 @@ #include "ppapi/native_client/src/trusted/plugin/manifest.h" #include "ppapi/native_client/src/trusted/plugin/plugin.h" #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" -#include "ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h" +#include "ppapi/native_client/src/trusted/plugin/pnacl_options.h" #include "ppapi/native_client/src/trusted/plugin/pnacl_resources.h" #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" #include "ppapi/native_client/src/trusted/plugin/srpc_client.h" @@ -313,9 +313,9 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( plugin_, PnaclUrls::PnaclComponentURLToFilename(mapped_url).c_str()); if (fd < 0) { - // We should check earlier if the pnacl component wasn't installed - // yet. At this point, we can't do much anymore, so just continue - // with an invalid fd. + // We checked earlier if the pnacl component wasn't installed + // yet, so this shouldn't happen. At this point, we can't do much + // anymore, so just continue with an invalid fd. NaClLog(4, "OpenManifestEntry_MainThreadContinuation: " "GetReadonlyPnaclFd failed\n"); @@ -333,23 +333,18 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( "OpenManifestEntry_MainThreadContinuation: GetPnaclFd okay\n"); } } else { - // Requires PNaCl translation. + // Requires PNaCl translation, but that's not supported. NaClLog(4, "OpenManifestEntry_MainThreadContinuation: " - "pulling down and translating.\n"); - CHECK(plugin_->nacl_interface()->IsPnaclEnabled()); - pp::CompletionCallback translate_callback = - WeakRefNewCallback( - anchor_, - this, - &PluginReverseInterface::BitcodeTranslate_MainThreadContinuation, - open_cont); - // Will always call the callback on success or failure. - pnacl_coordinator_.reset( - PnaclCoordinator::BitcodeToNative(plugin_, - mapped_url, - pnacl_options, - translate_callback)); + "Requires PNaCl translation -- not supported\n"); + nacl::MutexLocker take(&mu_); + *p->op_complete_ptr = true; // done... + p->file_info->desc = -1; // but failed. + p->error_info->SetReport( + ERROR_MANIFEST_OPEN, + "ServiceRuntime: Translating OpenManifestEntry files not supported"); + NaClXCondVarBroadcast(&cv_); + return; } // p is deleted automatically } @@ -380,38 +375,6 @@ void PluginReverseInterface::StreamAsFile_MainThreadContinuation( NaClXCondVarBroadcast(&cv_); } - -void PluginReverseInterface::BitcodeTranslate_MainThreadContinuation( - OpenManifestEntryResource* p, - int32_t result) { - NaClLog(4, - "Entered BitcodeTranslate_MainThreadContinuation\n"); - - nacl::MutexLocker take(&mu_); - if (result == PP_OK) { - // TODO(jvoung): clean this up. We are assuming that the NaClDesc is - // a host IO desc and doing a downcast. Once the ReverseInterface - // accepts NaClDescs we can avoid this downcast. - NaClDesc* desc = pnacl_coordinator_->ReleaseTranslatedFD()->desc(); - struct NaClDescIoDesc* ndiodp = (struct NaClDescIoDesc*)desc; - p->file_info->desc = ndiodp->hd->d; - pnacl_coordinator_.reset(NULL); - NaClLog(4, - "BitcodeTranslate_MainThreadContinuation: PP_OK, desc %d\n", - p->file_info->desc); - } else { - NaClLog(4, - "BitcodeTranslate_MainThreadContinuation: !PP_OK, " - "setting desc -1\n"); - p->file_info->desc = -1; - // Error should have been reported by pnacl coordinator. - NaClLog(LOG_ERROR, "PluginReverseInterface::BitcodeTranslate error.\n"); - } - *p->op_complete_ptr = true; - NaClXCondVarBroadcast(&cv_); -} - - bool PluginReverseInterface::CloseManifestEntry(int32_t desc) { bool op_complete = false; bool op_result; @@ -509,11 +472,11 @@ void PluginReverseInterface::AddTempQuotaManagedFile( ServiceRuntime::ServiceRuntime(Plugin* plugin, const Manifest* manifest, - bool should_report_uma, + bool main_service_runtime, pp::CompletionCallback init_done_cb, pp::CompletionCallback crash_cb) : plugin_(plugin), - should_report_uma_(should_report_uma), + main_service_runtime_(main_service_runtime), reverse_service_(NULL), anchor_(new nacl::WeakRefAnchor()), rev_interface_(new PluginReverseInterface(anchor_, plugin, @@ -588,7 +551,7 @@ bool ServiceRuntime::InitCommunication(nacl::DescWrapper* nacl_desc, } NaClLog(4, "ServiceRuntime::InitCommunication (load_status=%d)\n", load_status); - if (should_report_uma_) { + if (main_service_runtime_) { plugin_->ReportSelLdrLoadStatus(load_status); } if (LOAD_OK != load_status) { @@ -748,14 +711,10 @@ ServiceRuntime::~ServiceRuntime() { NaClMutexDtor(&mu_); } -int ServiceRuntime::exit_status() { - nacl::MutexLocker take(&mu_); - return exit_status_; -} - void ServiceRuntime::set_exit_status(int exit_status) { nacl::MutexLocker take(&mu_); - exit_status_ = exit_status & 0xff; + if (main_service_runtime_) + plugin_->set_exit_status(exit_status & 0xff); } nacl::string ServiceRuntime::GetCrashLogOutput() { diff --git a/chromium/ppapi/native_client/src/trusted/plugin/service_runtime.h b/chromium/ppapi/native_client/src/trusted/plugin/service_runtime.h index 4241737602b..78c781b1941 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/service_runtime.h +++ b/chromium/ppapi/native_client/src/trusted/plugin/service_runtime.h @@ -23,7 +23,6 @@ #include "native_client/src/trusted/reverse_service/reverse_service.h" #include "native_client/src/trusted/weak_ref/weak_ref.h" -#include "ppapi/c/trusted/ppb_file_io_trusted.h" #include "ppapi/cpp/completion_callback.h" #include "ppapi/native_client/src/trusted/plugin/utility.h" @@ -43,7 +42,6 @@ namespace plugin { class ErrorInfo; class Manifest; class Plugin; -class PnaclCoordinator; class SrpcClient; class ServiceRuntime; @@ -202,10 +200,6 @@ class PluginReverseInterface: public nacl::ReverseInterface { OpenManifestEntryResource* p, int32_t result); - virtual void BitcodeTranslate_MainThreadContinuation( - OpenManifestEntryResource* p, - int32_t result); - virtual void CloseManifestEntry_MainThreadContinuation( CloseManifestEntryResource* cls, int32_t err); @@ -221,8 +215,6 @@ class PluginReverseInterface: public nacl::ReverseInterface { std::set<int64_t> quota_files_; bool shutting_down_; - nacl::scoped_ptr<PnaclCoordinator> pnacl_coordinator_; - pp::CompletionCallback init_done_cb_; pp::CompletionCallback crash_cb_; }; @@ -288,7 +280,7 @@ class ServiceRuntime { NaClSrpcChannel command_channel_; Plugin* plugin_; - bool should_report_uma_; + bool main_service_runtime_; nacl::ReverseService* reverse_service_; nacl::scoped_ptr<nacl::SelLdrLauncherBase> subprocess_; diff --git a/chromium/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/chromium/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 747d753e6ed..ad7260b0e5b 100644 --- a/chromium/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/chromium/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -7,12 +7,14 @@ #include "ppapi/generators/pnacl_shim.h" #include "ppapi/c/ppb.h" +#include "ppapi/c/dev/ppb_alarms_dev.h" #include "ppapi/c/dev/ppb_audio_input_dev.h" #include "ppapi/c/dev/ppb_buffer_dev.h" #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_file_chooser_dev.h" +#include "ppapi/c/dev/ppb_file_io_dev.h" #include "ppapi/c/dev/ppb_find_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_graphics_2d_dev.h" @@ -22,11 +24,11 @@ #include "ppapi/c/dev/ppb_printing_dev.h" #include "ppapi/c/dev/ppb_resource_array_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" -#include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_text_input_dev.h" #include "ppapi/c/dev/ppb_trace_event_dev.h" #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" +#include "ppapi/c/dev/ppb_var_resource_dev.h" #include "ppapi/c/dev/ppb_video_capture_dev.h" #include "ppapi/c/dev/ppb_video_decoder_dev.h" #include "ppapi/c/dev/ppb_view_dev.h" @@ -41,8 +43,6 @@ #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_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" @@ -99,6 +99,7 @@ #include "ppapi/c/private/ppb_flash_print.h" #include "ppapi/c/private/ppb_host_resolver_private.h" #include "ppapi/c/private/ppb_instance_private.h" +#include "ppapi/c/private/ppb_isolated_file_system_private.h" #include "ppapi/c/private/ppb_nacl_private.h" #include "ppapi/c/private/ppb_net_address_private.h" #include "ppapi/c/private/ppb_output_protection_private.h" @@ -106,6 +107,7 @@ #include "ppapi/c/private/ppb_talk_private.h" #include "ppapi/c/private/ppb_tcp_server_socket_private.h" #include "ppapi/c/private/ppb_tcp_socket_private.h" +#include "ppapi/c/private/ppb_testing_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" @@ -118,7 +120,6 @@ #include "ppapi/c/trusted/ppb_browser_font_trusted.h" #include "ppapi/c/trusted/ppb_char_set_trusted.h" #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" -#include "ppapi/c/trusted/ppb_file_io_trusted.h" #include "ppapi/c/trusted/ppb_url_loader_trusted.h" /* Use local strcmp to avoid dependency on libc. */ @@ -173,28 +174,28 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Messaging_1_0; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Font_Dev_0_6; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_7; -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_TrueTypeFont_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_7; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarResource_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Selection_Dev_0_3; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1; @@ -206,15 +207,17 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DRM_1_0; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DRM_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Menu_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_Private_0_1; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NaCl_Private_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_OutputProtection_Private_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_1; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Talk_Private_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Talk_Private_2_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1; @@ -222,6 +225,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Private_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4; @@ -229,10 +233,8 @@ 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_7; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9; 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; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_2; /* END Declarations for all Wrapper Infos. */ @@ -1617,10 +1619,42 @@ static void Pnacl_M14_PPP_Messaging_HandleMessage(PP_Instance instance, struct P /* Not generating wrapper methods for PPB_FileChooserTrusted_0_6 */ -/* Not generating wrapper methods for PPB_FileIOTrusted_0_4 */ - /* Not generating wrapper methods for PPB_URLLoaderTrusted_0_3 */ +/* Begin wrapper methods for PPB_Alarms_Dev_0_1 */ + +static void Pnacl_M33_PPB_Alarms_Dev_Create(PP_Instance instance, struct PP_Var* name, const struct PP_Alarms_AlarmCreateInfo_Dev* alarm_info) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + iface->Create(instance, *name, alarm_info); +} + +static int32_t Pnacl_M33_PPB_Alarms_Dev_Get(PP_Instance instance, struct PP_Var* name, struct PP_Alarms_Alarm_Dev* alarm, struct PP_CompletionCallback* callback) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + return iface->Get(instance, *name, alarm, *callback); +} + +static int32_t Pnacl_M33_PPB_Alarms_Dev_GetAll(PP_Instance instance, struct PP_Alarms_Alarm_Array_Dev* alarms, struct PP_ArrayOutput* array_allocator, struct PP_CompletionCallback* callback) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + return iface->GetAll(instance, alarms, *array_allocator, *callback); +} + +static void Pnacl_M33_PPB_Alarms_Dev_Clear(PP_Instance instance, struct PP_Var* name) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + iface->Clear(instance, *name); +} + +static void Pnacl_M33_PPB_Alarms_Dev_ClearAll(PP_Instance instance) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + iface->ClearAll(instance); +} + +static uint32_t Pnacl_M33_PPB_Alarms_Dev_AddOnAlarmListener(PP_Instance instance, PP_Alarms_OnAlarm_Dev callback, void* user_data) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + return iface->AddOnAlarmListener(instance, callback, user_data); +} + +/* End wrapper methods for PPB_Alarms_Dev_0_1 */ + /* Begin wrapper methods for PPB_AudioInput_Dev_0_2 */ static PP_Resource Pnacl_M19_PPB_AudioInput_Dev_Create(PP_Instance instance) { @@ -1831,6 +1865,25 @@ static int32_t Pnacl_M19_PPB_FileChooser_Dev_Show(PP_Resource chooser, struct PP /* End wrapper methods for PPB_FileChooser_Dev_0_6 */ +/* Begin wrapper methods for PPB_FileIO_Dev_0_1 */ + +static int32_t Pnacl_M31_PPB_FileIO_Dev_Map(PP_Resource file_io, int64_t length, uint32_t map_protection, uint32_t map_flags, int64_t offset, void** address, struct PP_CompletionCallback* callback) { + const struct PPB_FileIO_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_Dev_0_1.real_iface; + return iface->Map(file_io, length, map_protection, map_flags, offset, address, *callback); +} + +static void Pnacl_M31_PPB_FileIO_Dev_Unmap(PP_Resource file_io, void* address, int64_t length) { + const struct PPB_FileIO_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_Dev_0_1.real_iface; + iface->Unmap(file_io, address, length); +} + +static int64_t Pnacl_M31_PPB_FileIO_Dev_GetMapPageSize(PP_Resource file_io) { + const struct PPB_FileIO_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_FileIO_Dev_0_1.real_iface; + return iface->GetMapPageSize(file_io); +} + +/* End wrapper methods for PPB_FileIO_Dev_0_1 */ + /* Not generating wrapper methods for PPB_Find_Dev_0_3 */ /* Begin wrapper methods for PPB_Font_Dev_0_6 */ @@ -1879,6 +1932,8 @@ static int32_t Pnacl_M14_PPB_Font_Dev_PixelOffsetForCharacter(PP_Resource font, /* Not generating wrapper methods for PPB_Graphics2D_Dev_0_1 */ +/* Not generating wrapper methods for PPB_Graphics2D_Dev_0_2 */ + /* Begin wrapper methods for PPB_IMEInputEvent_Dev_0_1 */ static PP_Bool Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent(PP_Resource resource) { @@ -1991,142 +2046,6 @@ static int32_t Pnacl_M23_PPB_Printing_Dev_GetDefaultPrintSettings(PP_Resource re /* Not generating wrapper methods for PPB_Scrollbar_Dev_0_5 */ -/* Not generating wrapper methods for PPB_Testing_Dev_0_7 */ - -/* Not generating wrapper methods for PPB_Testing_Dev_0_8 */ - -/* Begin wrapper methods for PPB_Testing_Dev_0_9 */ - -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 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 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 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 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 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 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; - *_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 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 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 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 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 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 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 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; - *_struct_result = iface->GetDocumentURL(instance, components); -} - -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 */ @@ -2267,6 +2186,20 @@ static void Pnacl_M31_PPB_URLUtil_Dev_GetPluginReferrerURL(struct PP_Var* _struc /* End wrapper methods for PPB_URLUtil_Dev_0_7 */ +/* Begin wrapper methods for PPB_VarResource_Dev_0_1 */ + +static PP_Resource Pnacl_M32_PPB_VarResource_Dev_VarToResource(struct PP_Var* var) { + const struct PPB_VarResource_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarResource_Dev_0_1.real_iface; + return iface->VarToResource(*var); +} + +static void Pnacl_M32_PPB_VarResource_Dev_VarFromResource(struct PP_Var* _struct_result, PP_Resource resource) { + const struct PPB_VarResource_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarResource_Dev_0_1.real_iface; + *_struct_result = iface->VarFromResource(resource); +} + +/* End wrapper methods for PPB_VarResource_Dev_0_1 */ + /* Begin wrapper methods for PPB_VideoCapture_Dev_0_2 */ static PP_Resource Pnacl_M19_PPB_VideoCapture_Dev_Create(PP_Instance instance) { @@ -2437,64 +2370,70 @@ static struct PP_Var Pnacl_M13_PPP_Selection_Dev_GetSelectedText(PP_Instance ins /* Not generating wrapper methods for PPP_VideoCapture_Dev_0_1 */ -/* Not generating wrapper methods for PPP_VideoDecoder_Dev_0_9 */ - -/* Not generating wrapper methods for PPP_VideoDecoder_Dev_0_10 */ - /* Not generating wrapper methods for PPP_VideoDecoder_Dev_0_11 */ /* Not generating wrapper methods for PPP_Widget_Dev_0_2 */ /* Not generating wrapper methods for PPP_Zoom_Dev_0_3 */ -/* Begin wrapper methods for PPB_ContentDecryptor_Private_0_7 */ +/* Begin wrapper methods for PPB_ContentDecryptor_Private_0_9 */ -static void Pnacl_M31_PPB_ContentDecryptor_Private_KeyAdded(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* session_id) { - const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; - iface->KeyAdded(instance, *key_system, *session_id); +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionCreated(PP_Instance instance, uint32_t session_id, struct PP_Var* web_session_id) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; + iface->SessionCreated(instance, session_id, *web_session_id); } -static void Pnacl_M31_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_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; - iface->KeyMessage(instance, *key_system, *session_id, *message, *default_url); +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionMessage(PP_Instance instance, uint32_t session_id, struct PP_Var* message, struct PP_Var* destination_url) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; + iface->SessionMessage(instance, session_id, *message, *destination_url); } -static void Pnacl_M31_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_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; - iface->KeyError(instance, *key_system, *session_id, media_error, system_code); +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionReady(PP_Instance instance, uint32_t session_id) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; + iface->SessionReady(instance, session_id); } -static void Pnacl_M31_PPB_ContentDecryptor_Private_DeliverBlock(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info) { - const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionClosed(PP_Instance instance, uint32_t session_id) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; + iface->SessionClosed(instance, session_id); +} + +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionError(PP_Instance instance, uint32_t session_id, int32_t media_error, int32_t system_code) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; + iface->SessionError(instance, session_id, media_error, system_code); +} + +static void Pnacl_M33_PPB_ContentDecryptor_Private_DeliverBlock(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; iface->DeliverBlock(instance, decrypted_block, decrypted_block_info); } -static void Pnacl_M31_PPB_ContentDecryptor_Private_DecoderInitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success) { - const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPB_ContentDecryptor_Private_DecoderInitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; iface->DecoderInitializeDone(instance, decoder_type, request_id, success); } -static void Pnacl_M31_PPB_ContentDecryptor_Private_DecoderDeinitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPB_ContentDecryptor_Private_DecoderDeinitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; iface->DecoderDeinitializeDone(instance, decoder_type, request_id); } -static void Pnacl_M31_PPB_ContentDecryptor_Private_DecoderResetDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPB_ContentDecryptor_Private_DecoderResetDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; iface->DecoderResetDone(instance, decoder_type, request_id); } -static void Pnacl_M31_PPB_ContentDecryptor_Private_DeliverFrame(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info) { - const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPB_ContentDecryptor_Private_DeliverFrame(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; iface->DeliverFrame(instance, decrypted_frame, decrypted_frame_info); } -static void Pnacl_M31_PPB_ContentDecryptor_Private_DeliverSamples(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info) { - const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; - iface->DeliverSamples(instance, audio_frames, decrypted_block_info); +static void Pnacl_M33_PPB_ContentDecryptor_Private_DeliverSamples(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedSampleInfo* decrypted_sample_info) { + const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; + iface->DeliverSamples(instance, audio_frames, decrypted_sample_info); } -/* End wrapper methods for PPB_ContentDecryptor_Private_0_7 */ +/* End wrapper methods for PPB_ContentDecryptor_Private_0_9 */ /* Begin wrapper methods for PPB_Ext_CrxFileSystem_Private_0_1 */ @@ -2920,6 +2859,35 @@ static int32_t Pnacl_M29_PPB_Flash_DRM_GetVoucherFile(PP_Resource drm, PP_Resour /* End wrapper methods for PPB_Flash_DRM_1_0 */ +/* Begin wrapper methods for PPB_Flash_DRM_1_1 */ + +static PP_Resource Pnacl_M33_PPB_Flash_DRM_Create(PP_Instance instance) { + const struct PPB_Flash_DRM_1_1 *iface = Pnacl_WrapperInfo_PPB_Flash_DRM_1_1.real_iface; + return iface->Create(instance); +} + +static int32_t Pnacl_M33_PPB_Flash_DRM_GetDeviceID(PP_Resource drm, struct PP_Var* id, struct PP_CompletionCallback* callback) { + const struct PPB_Flash_DRM_1_1 *iface = Pnacl_WrapperInfo_PPB_Flash_DRM_1_1.real_iface; + return iface->GetDeviceID(drm, id, *callback); +} + +static PP_Bool Pnacl_M33_PPB_Flash_DRM_GetHmonitor(PP_Resource drm, int64_t* hmonitor) { + const struct PPB_Flash_DRM_1_1 *iface = Pnacl_WrapperInfo_PPB_Flash_DRM_1_1.real_iface; + return iface->GetHmonitor(drm, hmonitor); +} + +static int32_t Pnacl_M33_PPB_Flash_DRM_GetVoucherFile(PP_Resource drm, PP_Resource* file_ref, struct PP_CompletionCallback* callback) { + const struct PPB_Flash_DRM_1_1 *iface = Pnacl_WrapperInfo_PPB_Flash_DRM_1_1.real_iface; + return iface->GetVoucherFile(drm, file_ref, *callback); +} + +static int32_t Pnacl_M33_PPB_Flash_DRM_MonitorIsExternal(PP_Resource drm, PP_Bool* is_external, struct PP_CompletionCallback* callback) { + const struct PPB_Flash_DRM_1_1 *iface = Pnacl_WrapperInfo_PPB_Flash_DRM_1_1.real_iface; + return iface->MonitorIsExternal(drm, is_external, *callback); +} + +/* End wrapper methods for PPB_Flash_DRM_1_1 */ + /* Not generating wrapper methods for PPB_Flash_FontFile_0_1 */ /* Not generating wrapper methods for PPB_FlashFullscreen_0_1 */ @@ -3002,6 +2970,15 @@ static void Pnacl_M13_PPB_Instance_Private_ExecuteScript(struct PP_Var* _struct_ /* End wrapper methods for PPB_Instance_Private_0_1 */ +/* Begin wrapper methods for PPB_IsolatedFileSystem_Private_0_2 */ + +static int32_t Pnacl_M33_PPB_IsolatedFileSystem_Private_Open(PP_Instance instance, PP_IsolatedFileSystemType_Private type, PP_Resource* file_system, struct PP_CompletionCallback* callback) { + const struct PPB_IsolatedFileSystem_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2.real_iface; + return iface->Open(instance, type, file_system, *callback); +} + +/* End wrapper methods for PPB_IsolatedFileSystem_Private_0_2 */ + /* Begin wrapper methods for PPB_NaCl_Private_1_0 */ static PP_ExternalPluginResult Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_Var* error_message) { @@ -3029,11 +3006,6 @@ static int32_t Pnacl_M25_PPB_NaCl_Private_BrokerDuplicateHandle(PP_FileHandle so return iface->BrokerDuplicateHandle(source_handle, process_id, target_handle, desired_access, options); } -static int32_t Pnacl_M25_PPB_NaCl_Private_EnsurePnaclInstalled(PP_Instance instance, struct PP_CompletionCallback* callback) { - const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; - return iface->EnsurePnaclInstalled(instance, *callback); -} - static PP_FileHandle Pnacl_M25_PPB_NaCl_Private_GetReadonlyPnaclFd(const char* filename) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; return iface->GetReadonlyPnaclFd(filename); @@ -3054,24 +3026,24 @@ static void Pnacl_M25_PPB_NaCl_Private_ReportTranslationFinished(PP_Instance ins iface->ReportTranslationFinished(instance, success); } -static PP_Bool Pnacl_M25_PPB_NaCl_Private_IsOffTheRecord(void) { +static PP_ExternalPluginResult Pnacl_M25_PPB_NaCl_Private_ReportNaClError(PP_Instance instance, PP_NaClError message_id) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; - return iface->IsOffTheRecord(); + return iface->ReportNaClError(instance, message_id); } -static PP_Bool Pnacl_M25_PPB_NaCl_Private_IsPnaclEnabled(void) { +static PP_FileHandle Pnacl_M25_PPB_NaCl_Private_OpenNaClExecutable(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; - return iface->IsPnaclEnabled(); + return iface->OpenNaClExecutable(instance, file_url, file_token_lo, file_token_hi); } -static PP_ExternalPluginResult Pnacl_M25_PPB_NaCl_Private_ReportNaClError(PP_Instance instance, PP_NaClError message_id) { +static void Pnacl_M25_PPB_NaCl_Private_DispatchEvent(PP_Instance instance, PP_NaClEventType event_type, struct PP_Var* resource_url, PP_Bool length_is_computable, uint64_t loaded_bytes, uint64_t total_bytes) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; - return iface->ReportNaClError(instance, message_id); + iface->DispatchEvent(instance, event_type, *resource_url, length_is_computable, loaded_bytes, total_bytes); } -static PP_FileHandle Pnacl_M25_PPB_NaCl_Private_OpenNaClExecutable(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi) { +static void Pnacl_M25_PPB_NaCl_Private_SetReadOnlyProperty(PP_Instance instance, struct PP_Var* key, struct PP_Var* value) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; - return iface->OpenNaClExecutable(instance, file_url, file_token_lo, file_token_hi); + iface->SetReadOnlyProperty(instance, *key, *value); } /* End wrapper methods for PPB_NaCl_Private_1_0 */ @@ -3232,29 +3204,24 @@ static int32_t Pnacl_M31_PPB_OutputProtection_Private_EnableProtection(PP_Resour /* End wrapper methods for PPB_OutputProtection_Private_0_1 */ -/* Begin wrapper methods for PPB_PlatformVerification_Private_0_1 */ +/* Begin wrapper methods for PPB_PlatformVerification_Private_0_2 */ -static PP_Resource Pnacl_M31_PPB_PlatformVerification_Private_Create(PP_Instance instance) { - const struct PPB_PlatformVerification_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_1.real_iface; +static PP_Resource Pnacl_M32_PPB_PlatformVerification_Private_Create(PP_Instance instance) { + const struct PPB_PlatformVerification_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2.real_iface; return iface->Create(instance); } -static PP_Bool Pnacl_M31_PPB_PlatformVerification_Private_IsPlatformVerification(PP_Resource resource) { - const struct PPB_PlatformVerification_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_1.real_iface; +static PP_Bool Pnacl_M32_PPB_PlatformVerification_Private_IsPlatformVerification(PP_Resource resource) { + const struct PPB_PlatformVerification_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2.real_iface; return iface->IsPlatformVerification(resource); } -static int32_t Pnacl_M31_PPB_PlatformVerification_Private_CanChallengePlatform(PP_Resource instance, PP_Bool* can_challenge_platform, struct PP_CompletionCallback* callback) { - const struct PPB_PlatformVerification_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_1.real_iface; - return iface->CanChallengePlatform(instance, can_challenge_platform, *callback); -} - -static int32_t Pnacl_M31_PPB_PlatformVerification_Private_ChallengePlatform(PP_Resource instance, struct PP_Var* service_id, struct PP_Var* challenge, struct PP_Var* signed_data, struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback* callback) { - const struct PPB_PlatformVerification_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_1.real_iface; +static int32_t Pnacl_M32_PPB_PlatformVerification_Private_ChallengePlatform(PP_Resource instance, struct PP_Var* service_id, struct PP_Var* challenge, struct PP_Var* signed_data, struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback* callback) { + const struct PPB_PlatformVerification_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2.real_iface; return iface->ChallengePlatform(instance, *service_id, *challenge, signed_data, signed_data_signature, platform_key_certificate, *callback); } -/* End wrapper methods for PPB_PlatformVerification_Private_0_1 */ +/* End wrapper methods for PPB_PlatformVerification_Private_0_2 */ /* Begin wrapper methods for PPB_Talk_Private_1_0 */ @@ -3544,6 +3511,55 @@ static int32_t Pnacl_M27_PPB_TCPSocket_Private_SetOption(PP_Resource tcp_socket, /* End wrapper methods for PPB_TCPSocket_Private_0_5 */ +/* Begin wrapper methods for PPB_Testing_Private_1_0 */ + +static PP_Bool Pnacl_M33_PPB_Testing_Private_ReadImageData(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left) { + const struct PPB_Testing_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Testing_Private_1_0.real_iface; + return iface->ReadImageData(device_context_2d, image, top_left); +} + +static void Pnacl_M33_PPB_Testing_Private_RunMessageLoop(PP_Instance instance) { + const struct PPB_Testing_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Testing_Private_1_0.real_iface; + iface->RunMessageLoop(instance); +} + +static void Pnacl_M33_PPB_Testing_Private_QuitMessageLoop(PP_Instance instance) { + const struct PPB_Testing_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Testing_Private_1_0.real_iface; + iface->QuitMessageLoop(instance); +} + +static uint32_t Pnacl_M33_PPB_Testing_Private_GetLiveObjectsForInstance(PP_Instance instance) { + const struct PPB_Testing_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Testing_Private_1_0.real_iface; + return iface->GetLiveObjectsForInstance(instance); +} + +static PP_Bool Pnacl_M33_PPB_Testing_Private_IsOutOfProcess(void) { + const struct PPB_Testing_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Testing_Private_1_0.real_iface; + return iface->IsOutOfProcess(); +} + +static void Pnacl_M33_PPB_Testing_Private_SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { + const struct PPB_Testing_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Testing_Private_1_0.real_iface; + iface->SimulateInputEvent(instance, input_event); +} + +static void Pnacl_M33_PPB_Testing_Private_GetDocumentURL(struct PP_Var* _struct_result, PP_Instance instance, struct PP_URLComponents_Dev* components) { + const struct PPB_Testing_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Testing_Private_1_0.real_iface; + *_struct_result = iface->GetDocumentURL(instance, components); +} + +static uint32_t Pnacl_M33_PPB_Testing_Private_GetLiveVars(struct PP_Var live_vars[], uint32_t array_size) { + const struct PPB_Testing_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Testing_Private_1_0.real_iface; + return iface->GetLiveVars(live_vars, array_size); +} + +static void Pnacl_M33_PPB_Testing_Private_SetMinimumArrayBufferSizeForShmem(PP_Instance instance, uint32_t threshold) { + const struct PPB_Testing_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_Testing_Private_1_0.real_iface; + iface->SetMinimumArrayBufferSizeForShmem(instance, threshold); +} + +/* End wrapper methods for PPB_Testing_Private_1_0 */ + /* Begin wrapper methods for PPB_UDPSocket_Private_0_2 */ static PP_Resource Pnacl_M17_PPB_UDPSocket_Private_Create(PP_Instance instance_id) { @@ -3777,79 +3793,79 @@ static void Pnacl_M19_PPB_X509Certificate_Private_GetField(struct PP_Var* _struc /* End wrapper methods for PPB_X509Certificate_Private_0_1 */ -/* Begin wrapper methods for PPP_ContentDecryptor_Private_0_7 */ +/* Begin wrapper methods for PPP_ContentDecryptor_Private_0_9 */ -static void Pnacl_M31_PPP_ContentDecryptor_Private_Initialize(PP_Instance instance, struct PP_Var key_system, PP_Bool can_challenge_platform) { - const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; - void (*temp_fp)(PP_Instance instance, struct PP_Var* key_system, PP_Bool can_challenge_platform) = - ((void (*)(PP_Instance instance, struct PP_Var* key_system, PP_Bool can_challenge_platform))iface->Initialize); - temp_fp(instance, &key_system, can_challenge_platform); +static void Pnacl_M33_PPP_ContentDecryptor_Private_Initialize(PP_Instance instance, struct PP_Var key_system) { + const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; + void (*temp_fp)(PP_Instance instance, struct PP_Var* key_system) = + ((void (*)(PP_Instance instance, struct PP_Var* key_system))iface->Initialize); + temp_fp(instance, &key_system); } -static void Pnacl_M31_PPP_ContentDecryptor_Private_GenerateKeyRequest(PP_Instance instance, struct PP_Var type, struct PP_Var init_data) { - const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; - void (*temp_fp)(PP_Instance instance, struct PP_Var* type, struct PP_Var* init_data) = - ((void (*)(PP_Instance instance, struct PP_Var* type, struct PP_Var* init_data))iface->GenerateKeyRequest); - temp_fp(instance, &type, &init_data); +static void Pnacl_M33_PPP_ContentDecryptor_Private_CreateSession(PP_Instance instance, uint32_t session_id, struct PP_Var type, struct PP_Var init_data) { + const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; + void (*temp_fp)(PP_Instance instance, uint32_t session_id, struct PP_Var* type, struct PP_Var* init_data) = + ((void (*)(PP_Instance instance, uint32_t session_id, struct PP_Var* type, struct PP_Var* init_data))iface->CreateSession); + temp_fp(instance, session_id, &type, &init_data); } -static void Pnacl_M31_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_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; - 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_M33_PPP_ContentDecryptor_Private_UpdateSession(PP_Instance instance, uint32_t session_id, struct PP_Var response) { + const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; + void (*temp_fp)(PP_Instance instance, uint32_t session_id, struct PP_Var* response) = + ((void (*)(PP_Instance instance, uint32_t session_id, struct PP_Var* response))iface->UpdateSession); + temp_fp(instance, session_id, &response); } -static void Pnacl_M31_PPP_ContentDecryptor_Private_CancelKeyRequest(PP_Instance instance, struct PP_Var session_id) { - const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; - 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_M33_PPP_ContentDecryptor_Private_ReleaseSession(PP_Instance instance, uint32_t session_id) { + const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; + void (*temp_fp)(PP_Instance instance, uint32_t session_id) = + ((void (*)(PP_Instance instance, uint32_t session_id))iface->ReleaseSession); + temp_fp(instance, session_id); } -static void Pnacl_M31_PPP_ContentDecryptor_Private_Decrypt(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) { - const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPP_ContentDecryptor_Private_Decrypt(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) { + const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; 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_M31_PPP_ContentDecryptor_Private_InitializeAudioDecoder(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data) { - const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPP_ContentDecryptor_Private_InitializeAudioDecoder(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data) { + const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; 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_M31_PPP_ContentDecryptor_Private_InitializeVideoDecoder(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data) { - const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPP_ContentDecryptor_Private_InitializeVideoDecoder(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data) { + const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; 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_M31_PPP_ContentDecryptor_Private_DeinitializeDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPP_ContentDecryptor_Private_DeinitializeDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; 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_M31_PPP_ContentDecryptor_Private_ResetDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_PPP_ContentDecryptor_Private_ResetDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; 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_M31_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_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; +static void Pnacl_M33_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_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; 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); } -/* End wrapper methods for PPP_ContentDecryptor_Private_0_7 */ +/* End wrapper methods for PPP_ContentDecryptor_Private_0_9 */ /* Not generating wrapper methods for PPP_Flash_BrowserOperations_1_0 */ @@ -3870,49 +3886,6 @@ static struct PP_Var Pnacl_M18_PPP_Instance_Private_GetInstanceObject(PP_Instanc /* End wrapper methods for PPP_Instance_Private_0_1 */ -/* Begin wrapper methods for PPB_Ext_Alarms_Dev_0_1 */ - -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); -} - -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); -} - -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); -} - -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); -} - -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); -} - -/* End wrapper methods for PPB_Ext_Alarms_Dev_0_1 */ - -/* Begin wrapper methods for PPB_Ext_Events_Dev_0_1 */ - -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); -} - -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) { @@ -4492,10 +4465,17 @@ struct PPP_Messaging_1_0 Pnacl_Wrappers_PPP_Messaging_1_0 = { /* Not generating wrapper interface for PPB_FileChooserTrusted_0_6 */ -/* Not generating wrapper interface for PPB_FileIOTrusted_0_4 */ - /* Not generating wrapper interface for PPB_URLLoaderTrusted_0_3 */ +struct PPB_Alarms_Dev_0_1 Pnacl_Wrappers_PPB_Alarms_Dev_0_1 = { + .Create = (void (*)(PP_Instance instance, struct PP_Var name, const struct PP_Alarms_AlarmCreateInfo_Dev* alarm_info))&Pnacl_M33_PPB_Alarms_Dev_Create, + .Get = (int32_t (*)(PP_Instance instance, struct PP_Var name, struct PP_Alarms_Alarm_Dev* alarm, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_Alarms_Dev_Get, + .GetAll = (int32_t (*)(PP_Instance instance, struct PP_Alarms_Alarm_Array_Dev* alarms, struct PP_ArrayOutput array_allocator, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_Alarms_Dev_GetAll, + .Clear = (void (*)(PP_Instance instance, struct PP_Var name))&Pnacl_M33_PPB_Alarms_Dev_Clear, + .ClearAll = (void (*)(PP_Instance instance))&Pnacl_M33_PPB_Alarms_Dev_ClearAll, + .AddOnAlarmListener = (uint32_t (*)(PP_Instance instance, PP_Alarms_OnAlarm_Dev callback, void* user_data))&Pnacl_M33_PPB_Alarms_Dev_AddOnAlarmListener +}; + struct PPB_AudioInput_Dev_0_2 Pnacl_Wrappers_PPB_AudioInput_Dev_0_2 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_AudioInput_Dev_Create, .IsAudioInput = (PP_Bool (*)(PP_Resource resource))&Pnacl_M19_PPB_AudioInput_Dev_IsAudioInput, @@ -4556,6 +4536,12 @@ struct PPB_FileChooser_Dev_0_6 Pnacl_Wrappers_PPB_FileChooser_Dev_0_6 = { .Show = (int32_t (*)(PP_Resource chooser, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M19_PPB_FileChooser_Dev_Show }; +struct PPB_FileIO_Dev_0_1 Pnacl_Wrappers_PPB_FileIO_Dev_0_1 = { + .Map = (int32_t (*)(PP_Resource file_io, int64_t length, uint32_t map_protection, uint32_t map_flags, int64_t offset, void** address, struct PP_CompletionCallback callback))&Pnacl_M31_PPB_FileIO_Dev_Map, + .Unmap = (void (*)(PP_Resource file_io, void* address, int64_t length))&Pnacl_M31_PPB_FileIO_Dev_Unmap, + .GetMapPageSize = (int64_t (*)(PP_Resource file_io))&Pnacl_M31_PPB_FileIO_Dev_GetMapPageSize +}; + /* Not generating wrapper interface for PPB_Find_Dev_0_3 */ struct PPB_Font_Dev_0_6 Pnacl_Wrappers_PPB_Font_Dev_0_6 = { @@ -4571,6 +4557,8 @@ struct PPB_Font_Dev_0_6 Pnacl_Wrappers_PPB_Font_Dev_0_6 = { /* Not generating wrapper interface for PPB_Graphics2D_Dev_0_1 */ +/* Not generating wrapper interface for PPB_Graphics2D_Dev_0_2 */ + struct PPB_IMEInputEvent_Dev_0_1 Pnacl_Wrappers_PPB_IMEInputEvent_Dev_0_1 = { .IsIMEInputEvent = (PP_Bool (*)(PP_Resource resource))&Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent, .GetText = (struct PP_Var (*)(PP_Resource ime_event))&Pnacl_M16_PPB_IMEInputEvent_Dev_GetText, @@ -4607,43 +4595,6 @@ struct PPB_Printing_Dev_0_7 Pnacl_Wrappers_PPB_Printing_Dev_0_7 = { /* Not generating wrapper interface for PPB_Scrollbar_Dev_0_5 */ -/* Not generating wrapper interface for PPB_Testing_Dev_0_7 */ - -/* Not generating wrapper interface for PPB_Testing_Dev_0_8 */ - -struct PPB_Testing_Dev_0_9 Pnacl_Wrappers_PPB_Testing_Dev_0_9 = { - .ReadImageData = (PP_Bool (*)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left))&Pnacl_M17_PPB_Testing_Dev_ReadImageData, - .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M17_PPB_Testing_Dev_RunMessageLoop, - .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M17_PPB_Testing_Dev_QuitMessageLoop, - .GetLiveObjectsForInstance = (uint32_t (*)(PP_Instance instance))&Pnacl_M17_PPB_Testing_Dev_GetLiveObjectsForInstance, - .IsOutOfProcess = (PP_Bool (*)(void))&Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess, - .SimulateInputEvent = (void (*)(PP_Instance instance, PP_Resource input_event))&Pnacl_M17_PPB_Testing_Dev_SimulateInputEvent, - .GetDocumentURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_Testing_Dev_GetDocumentURL -}; - -struct PPB_Testing_Dev_0_91 Pnacl_Wrappers_PPB_Testing_Dev_0_91 = { - .ReadImageData = (PP_Bool (*)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left))&Pnacl_M18_PPB_Testing_Dev_ReadImageData, - .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M18_PPB_Testing_Dev_RunMessageLoop, - .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M18_PPB_Testing_Dev_QuitMessageLoop, - .GetLiveObjectsForInstance = (uint32_t (*)(PP_Instance instance))&Pnacl_M18_PPB_Testing_Dev_GetLiveObjectsForInstance, - .IsOutOfProcess = (PP_Bool (*)(void))&Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess, - .SimulateInputEvent = (void (*)(PP_Instance instance, PP_Resource input_event))&Pnacl_M18_PPB_Testing_Dev_SimulateInputEvent, - .GetDocumentURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M18_PPB_Testing_Dev_GetDocumentURL, - .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 */ @@ -4685,6 +4636,11 @@ struct PPB_URLUtil_Dev_0_7 Pnacl_Wrappers_PPB_URLUtil_Dev_0_7 = { .GetPluginReferrerURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M31_PPB_URLUtil_Dev_GetPluginReferrerURL }; +struct PPB_VarResource_Dev_0_1 Pnacl_Wrappers_PPB_VarResource_Dev_0_1 = { + .VarToResource = (PP_Resource (*)(struct PP_Var var))&Pnacl_M32_PPB_VarResource_Dev_VarToResource, + .VarFromResource = (struct PP_Var (*)(PP_Resource resource))&Pnacl_M32_PPB_VarResource_Dev_VarFromResource +}; + struct PPB_VideoCapture_Dev_0_2 Pnacl_Wrappers_PPB_VideoCapture_Dev_0_2 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_VideoCapture_Dev_Create, .IsVideoCapture = (PP_Bool (*)(PP_Resource video_capture))&Pnacl_M19_PPB_VideoCapture_Dev_IsVideoCapture, @@ -4743,26 +4699,24 @@ struct PPP_Selection_Dev_0_3 Pnacl_Wrappers_PPP_Selection_Dev_0_3 = { /* Not generating wrapper interface for PPP_VideoCapture_Dev_0_1 */ -/* Not generating wrapper interface for PPP_VideoDecoder_Dev_0_9 */ - -/* Not generating wrapper interface for PPP_VideoDecoder_Dev_0_10 */ - /* Not generating wrapper interface for PPP_VideoDecoder_Dev_0_11 */ /* Not generating wrapper interface for PPP_Widget_Dev_0_2 */ /* Not generating wrapper interface for PPP_Zoom_Dev_0_3 */ -struct PPB_ContentDecryptor_Private_0_7 Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_7 = { - .KeyAdded = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id))&Pnacl_M31_PPB_ContentDecryptor_Private_KeyAdded, - .KeyMessage = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var message, struct PP_Var default_url))&Pnacl_M31_PPB_ContentDecryptor_Private_KeyMessage, - .KeyError = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, int32_t media_error, int32_t system_code))&Pnacl_M31_PPB_ContentDecryptor_Private_KeyError, - .DeliverBlock = (void (*)(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M31_PPB_ContentDecryptor_Private_DeliverBlock, - .DecoderInitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success))&Pnacl_M31_PPB_ContentDecryptor_Private_DecoderInitializeDone, - .DecoderDeinitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M31_PPB_ContentDecryptor_Private_DecoderDeinitializeDone, - .DecoderResetDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M31_PPB_ContentDecryptor_Private_DecoderResetDone, - .DeliverFrame = (void (*)(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info))&Pnacl_M31_PPB_ContentDecryptor_Private_DeliverFrame, - .DeliverSamples = (void (*)(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M31_PPB_ContentDecryptor_Private_DeliverSamples +struct PPB_ContentDecryptor_Private_0_9 Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_9 = { + .SessionCreated = (void (*)(PP_Instance instance, uint32_t session_id, struct PP_Var web_session_id))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionCreated, + .SessionMessage = (void (*)(PP_Instance instance, uint32_t session_id, struct PP_Var message, struct PP_Var destination_url))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionMessage, + .SessionReady = (void (*)(PP_Instance instance, uint32_t session_id))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionReady, + .SessionClosed = (void (*)(PP_Instance instance, uint32_t session_id))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionClosed, + .SessionError = (void (*)(PP_Instance instance, uint32_t session_id, int32_t media_error, int32_t system_code))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionError, + .DeliverBlock = (void (*)(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M33_PPB_ContentDecryptor_Private_DeliverBlock, + .DecoderInitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success))&Pnacl_M33_PPB_ContentDecryptor_Private_DecoderInitializeDone, + .DecoderDeinitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M33_PPB_ContentDecryptor_Private_DecoderDeinitializeDone, + .DecoderResetDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M33_PPB_ContentDecryptor_Private_DecoderResetDone, + .DeliverFrame = (void (*)(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info))&Pnacl_M33_PPB_ContentDecryptor_Private_DeliverFrame, + .DeliverSamples = (void (*)(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedSampleInfo* decrypted_sample_info))&Pnacl_M33_PPB_ContentDecryptor_Private_DeliverSamples }; struct PPB_Ext_CrxFileSystem_Private_0_1 Pnacl_Wrappers_PPB_Ext_CrxFileSystem_Private_0_1 = { @@ -4874,6 +4828,14 @@ struct PPB_Flash_DRM_1_0 Pnacl_Wrappers_PPB_Flash_DRM_1_0 = { .GetVoucherFile = (int32_t (*)(PP_Resource drm, PP_Resource* file_ref, struct PP_CompletionCallback callback))&Pnacl_M29_PPB_Flash_DRM_GetVoucherFile }; +struct PPB_Flash_DRM_1_1 Pnacl_Wrappers_PPB_Flash_DRM_1_1 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M33_PPB_Flash_DRM_Create, + .GetDeviceID = (int32_t (*)(PP_Resource drm, struct PP_Var* id, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_Flash_DRM_GetDeviceID, + .GetHmonitor = (PP_Bool (*)(PP_Resource drm, int64_t* hmonitor))&Pnacl_M33_PPB_Flash_DRM_GetHmonitor, + .GetVoucherFile = (int32_t (*)(PP_Resource drm, PP_Resource* file_ref, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_Flash_DRM_GetVoucherFile, + .MonitorIsExternal = (int32_t (*)(PP_Resource drm, PP_Bool* is_external, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_Flash_DRM_MonitorIsExternal +}; + /* Not generating wrapper interface for PPB_Flash_FontFile_0_1 */ /* Not generating wrapper interface for PPB_FlashFullscreen_0_1 */ @@ -4905,21 +4867,24 @@ struct PPB_Instance_Private_0_1 Pnacl_Wrappers_PPB_Instance_Private_0_1 = { .ExecuteScript = (struct PP_Var (*)(PP_Instance instance, struct PP_Var script, struct PP_Var* exception))&Pnacl_M13_PPB_Instance_Private_ExecuteScript }; +struct PPB_IsolatedFileSystem_Private_0_2 Pnacl_Wrappers_PPB_IsolatedFileSystem_Private_0_2 = { + .Open = (int32_t (*)(PP_Instance instance, PP_IsolatedFileSystemType_Private type, PP_Resource* file_system, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_IsolatedFileSystem_Private_Open +}; + struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = { .LaunchSelLdr = (PP_ExternalPluginResult (*)(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_Var* error_message))&Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr, .StartPpapiProxy = (PP_ExternalPluginResult (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_StartPpapiProxy, .UrandomFD = (int32_t (*)(void))&Pnacl_M25_PPB_NaCl_Private_UrandomFD, .Are3DInterfacesDisabled = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_Are3DInterfacesDisabled, .BrokerDuplicateHandle = (int32_t (*)(PP_FileHandle source_handle, uint32_t process_id, PP_FileHandle* target_handle, uint32_t desired_access, uint32_t options))&Pnacl_M25_PPB_NaCl_Private_BrokerDuplicateHandle, - .EnsurePnaclInstalled = (int32_t (*)(PP_Instance instance, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_EnsurePnaclInstalled, .GetReadonlyPnaclFd = (PP_FileHandle (*)(const char* filename))&Pnacl_M25_PPB_NaCl_Private_GetReadonlyPnaclFd, .CreateTemporaryFile = (PP_FileHandle (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_CreateTemporaryFile, .GetNexeFd = (int32_t (*)(PP_Instance instance, const char* pexe_url, uint32_t abi_version, uint32_t opt_level, const char* last_modified, const char* etag, PP_Bool has_no_store_header, PP_Bool* is_hit, PP_FileHandle* nexe_handle, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_GetNexeFd, .ReportTranslationFinished = (void (*)(PP_Instance instance, PP_Bool success))&Pnacl_M25_PPB_NaCl_Private_ReportTranslationFinished, - .IsOffTheRecord = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_IsOffTheRecord, - .IsPnaclEnabled = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_IsPnaclEnabled, .ReportNaClError = (PP_ExternalPluginResult (*)(PP_Instance instance, PP_NaClError message_id))&Pnacl_M25_PPB_NaCl_Private_ReportNaClError, - .OpenNaClExecutable = (PP_FileHandle (*)(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi))&Pnacl_M25_PPB_NaCl_Private_OpenNaClExecutable + .OpenNaClExecutable = (PP_FileHandle (*)(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi))&Pnacl_M25_PPB_NaCl_Private_OpenNaClExecutable, + .DispatchEvent = (void (*)(PP_Instance instance, PP_NaClEventType event_type, struct PP_Var resource_url, PP_Bool length_is_computable, uint64_t loaded_bytes, uint64_t total_bytes))&Pnacl_M25_PPB_NaCl_Private_DispatchEvent, + .SetReadOnlyProperty = (void (*)(PP_Instance instance, struct PP_Var key, struct PP_Var value))&Pnacl_M25_PPB_NaCl_Private_SetReadOnlyProperty }; struct PPB_NetAddress_Private_0_1 Pnacl_Wrappers_PPB_NetAddress_Private_0_1 = { @@ -4962,11 +4927,10 @@ struct PPB_OutputProtection_Private_0_1 Pnacl_Wrappers_PPB_OutputProtection_Priv .EnableProtection = (int32_t (*)(PP_Resource resource, uint32_t desired_protection_mask, struct PP_CompletionCallback callback))&Pnacl_M31_PPB_OutputProtection_Private_EnableProtection }; -struct PPB_PlatformVerification_Private_0_1 Pnacl_Wrappers_PPB_PlatformVerification_Private_0_1 = { - .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M31_PPB_PlatformVerification_Private_Create, - .IsPlatformVerification = (PP_Bool (*)(PP_Resource resource))&Pnacl_M31_PPB_PlatformVerification_Private_IsPlatformVerification, - .CanChallengePlatform = (int32_t (*)(PP_Resource instance, PP_Bool* can_challenge_platform, struct PP_CompletionCallback callback))&Pnacl_M31_PPB_PlatformVerification_Private_CanChallengePlatform, - .ChallengePlatform = (int32_t (*)(PP_Resource instance, struct PP_Var service_id, struct PP_Var challenge, struct PP_Var* signed_data, struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback callback))&Pnacl_M31_PPB_PlatformVerification_Private_ChallengePlatform +struct PPB_PlatformVerification_Private_0_2 Pnacl_Wrappers_PPB_PlatformVerification_Private_0_2 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M32_PPB_PlatformVerification_Private_Create, + .IsPlatformVerification = (PP_Bool (*)(PP_Resource resource))&Pnacl_M32_PPB_PlatformVerification_Private_IsPlatformVerification, + .ChallengePlatform = (int32_t (*)(PP_Resource instance, struct PP_Var service_id, struct PP_Var challenge, struct PP_Var* signed_data, struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback callback))&Pnacl_M32_PPB_PlatformVerification_Private_ChallengePlatform }; struct PPB_Talk_Private_1_0 Pnacl_Wrappers_PPB_Talk_Private_1_0 = { @@ -5042,6 +5006,18 @@ struct PPB_TCPSocket_Private_0_5 Pnacl_Wrappers_PPB_TCPSocket_Private_0_5 = { .SetOption = (int32_t (*)(PP_Resource tcp_socket, PP_TCPSocketOption_Private name, struct PP_Var value, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_TCPSocket_Private_SetOption }; +struct PPB_Testing_Private_1_0 Pnacl_Wrappers_PPB_Testing_Private_1_0 = { + .ReadImageData = (PP_Bool (*)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left))&Pnacl_M33_PPB_Testing_Private_ReadImageData, + .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M33_PPB_Testing_Private_RunMessageLoop, + .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M33_PPB_Testing_Private_QuitMessageLoop, + .GetLiveObjectsForInstance = (uint32_t (*)(PP_Instance instance))&Pnacl_M33_PPB_Testing_Private_GetLiveObjectsForInstance, + .IsOutOfProcess = (PP_Bool (*)(void))&Pnacl_M33_PPB_Testing_Private_IsOutOfProcess, + .SimulateInputEvent = (void (*)(PP_Instance instance, PP_Resource input_event))&Pnacl_M33_PPB_Testing_Private_SimulateInputEvent, + .GetDocumentURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M33_PPB_Testing_Private_GetDocumentURL, + .GetLiveVars = (uint32_t (*)(struct PP_Var live_vars[], uint32_t array_size))&Pnacl_M33_PPB_Testing_Private_GetLiveVars, + .SetMinimumArrayBufferSizeForShmem = (void (*)(PP_Instance instance, uint32_t threshold))&Pnacl_M33_PPB_Testing_Private_SetMinimumArrayBufferSizeForShmem +}; + struct PPB_UDPSocket_Private_0_2 Pnacl_Wrappers_PPB_UDPSocket_Private_0_2 = { .Create = (PP_Resource (*)(PP_Instance instance_id))&Pnacl_M17_PPB_UDPSocket_Private_Create, .IsUDPSocket = (PP_Bool (*)(PP_Resource resource_id))&Pnacl_M17_PPB_UDPSocket_Private_IsUDPSocket, @@ -5104,17 +5080,17 @@ struct PPB_X509Certificate_Private_0_1 Pnacl_Wrappers_PPB_X509Certificate_Privat .GetField = (struct PP_Var (*)(PP_Resource resource, PP_X509Certificate_Private_Field field))&Pnacl_M19_PPB_X509Certificate_Private_GetField }; -struct PPP_ContentDecryptor_Private_0_7 Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_7 = { - .Initialize = &Pnacl_M31_PPP_ContentDecryptor_Private_Initialize, - .GenerateKeyRequest = &Pnacl_M31_PPP_ContentDecryptor_Private_GenerateKeyRequest, - .AddKey = &Pnacl_M31_PPP_ContentDecryptor_Private_AddKey, - .CancelKeyRequest = &Pnacl_M31_PPP_ContentDecryptor_Private_CancelKeyRequest, - .Decrypt = &Pnacl_M31_PPP_ContentDecryptor_Private_Decrypt, - .InitializeAudioDecoder = &Pnacl_M31_PPP_ContentDecryptor_Private_InitializeAudioDecoder, - .InitializeVideoDecoder = &Pnacl_M31_PPP_ContentDecryptor_Private_InitializeVideoDecoder, - .DeinitializeDecoder = &Pnacl_M31_PPP_ContentDecryptor_Private_DeinitializeDecoder, - .ResetDecoder = &Pnacl_M31_PPP_ContentDecryptor_Private_ResetDecoder, - .DecryptAndDecode = &Pnacl_M31_PPP_ContentDecryptor_Private_DecryptAndDecode +struct PPP_ContentDecryptor_Private_0_9 Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_9 = { + .Initialize = &Pnacl_M33_PPP_ContentDecryptor_Private_Initialize, + .CreateSession = &Pnacl_M33_PPP_ContentDecryptor_Private_CreateSession, + .UpdateSession = &Pnacl_M33_PPP_ContentDecryptor_Private_UpdateSession, + .ReleaseSession = &Pnacl_M33_PPP_ContentDecryptor_Private_ReleaseSession, + .Decrypt = &Pnacl_M33_PPP_ContentDecryptor_Private_Decrypt, + .InitializeAudioDecoder = &Pnacl_M33_PPP_ContentDecryptor_Private_InitializeAudioDecoder, + .InitializeVideoDecoder = &Pnacl_M33_PPP_ContentDecryptor_Private_InitializeVideoDecoder, + .DeinitializeDecoder = &Pnacl_M33_PPP_ContentDecryptor_Private_DeinitializeDecoder, + .ResetDecoder = &Pnacl_M33_PPP_ContentDecryptor_Private_ResetDecoder, + .DecryptAndDecode = &Pnacl_M33_PPP_ContentDecryptor_Private_DecryptAndDecode }; /* Not generating wrapper interface for PPP_Flash_BrowserOperations_1_0 */ @@ -5127,19 +5103,6 @@ struct PPP_Instance_Private_0_1 Pnacl_Wrappers_PPP_Instance_Private_0_1 = { .GetInstanceObject = &Pnacl_M18_PPP_Instance_Private_GetInstanceObject }; -struct PPB_Ext_Alarms_Dev_0_1 Pnacl_Wrappers_PPB_Ext_Alarms_Dev_0_1 = { - .Create = (void (*)(PP_Instance instance, struct PP_Var name, PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info))&Pnacl_M27_PPB_Ext_Alarms_Dev_Create, - .Get = (int32_t (*)(PP_Instance instance, struct PP_Var name, PP_Ext_Alarms_Alarm_Dev* alarm, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_Ext_Alarms_Dev_Get, - .GetAll = (int32_t (*)(PP_Instance instance, PP_Ext_Alarms_Alarm_Dev_Array* alarms, struct PP_CompletionCallback callback))&Pnacl_M27_PPB_Ext_Alarms_Dev_GetAll, - .Clear = (void (*)(PP_Instance instance, struct PP_Var name))&Pnacl_M27_PPB_Ext_Alarms_Dev_Clear, - .ClearAll = (void (*)(PP_Instance instance))&Pnacl_M27_PPB_Ext_Alarms_Dev_ClearAll -}; - -struct PPB_Ext_Events_Dev_0_1 Pnacl_Wrappers_PPB_Ext_Events_Dev_0_1 = { - .AddListener = (uint32_t (*)(PP_Instance instance, struct PP_Ext_EventListener listener))&Pnacl_M27_PPB_Ext_Events_Dev_AddListener, - .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, @@ -5409,6 +5372,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Messaging_1_0 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1 = { + .iface_macro = PPB_ALARMS_DEV_INTERFACE_0_1, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Alarms_Dev_0_1, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2 = { .iface_macro = PPB_AUDIO_INPUT_DEV_INTERFACE_0_2, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_AudioInput_Dev_0_2, @@ -5445,6 +5414,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_Dev_0_1 = { + .iface_macro = PPB_FILEIO_DEV_INTERFACE_0_1, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileIO_Dev_0_1, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Font_Dev_0_6 = { .iface_macro = PPB_FONT_DEV_INTERFACE_0_6, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Font_Dev_0_6, @@ -5475,24 +5450,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_7 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_9 = { - .iface_macro = PPB_TESTING_DEV_INTERFACE_0_9, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Testing_Dev_0_9, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Dev_0_91 = { - .iface_macro = PPB_TESTING_DEV_INTERFACE_0_91, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Testing_Dev_0_91, - .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_TrueTypeFont_Dev_0_1 = { .iface_macro = PPB_TRUETYPEFONT_DEV_INTERFACE_0_1, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_TrueTypeFont_Dev_0_1, @@ -5511,6 +5468,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_7 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarResource_Dev_0_1 = { + .iface_macro = PPB_VAR_RESOURCE_DEV_INTERFACE_0_1, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarResource_Dev_0_1, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2 = { .iface_macro = PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoCapture_Dev_0_2, @@ -5535,9 +5498,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Selection_Dev_0_3 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7 = { - .iface_macro = PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_7, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9 = { + .iface_macro = PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_9, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_9, .real_iface = NULL }; @@ -5607,6 +5570,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DRM_1_0 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DRM_1_1 = { + .iface_macro = PPB_FLASH_DRM_INTERFACE_1_1, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_DRM_1_1, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Menu_0_2 = { .iface_macro = PPB_FLASH_MENU_INTERFACE_0_2, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Flash_Menu_0_2, @@ -5625,6 +5594,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_Private_0_1 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2 = { + .iface_macro = PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_IsolatedFileSystem_Private_0_2, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NaCl_Private_1_0 = { .iface_macro = PPB_NACL_PRIVATE_INTERFACE_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_NaCl_Private_1_0, @@ -5655,9 +5630,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_OutputProtection_Private_ .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_1 = { - .iface_macro = PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_PlatformVerification_Private_0_1, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2 = { + .iface_macro = PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_PlatformVerification_Private_0_2, .real_iface = NULL }; @@ -5703,6 +5678,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Private_1_0 = { + .iface_macro = PPB_TESTING_PRIVATE_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Testing_Private_1_0, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2 = { .iface_macro = PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_UDPSocket_Private_0_2, @@ -5745,9 +5726,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0 .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7 = { - .iface_macro = PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_7, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9 = { + .iface_macro = PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_9, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_9, .real_iface = NULL }; @@ -5757,18 +5738,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Instance_Private_0_1 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1 = { - .iface_macro = PPB_EXT_ALARMS_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Ext_Alarms_Dev_0_1, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1 = { - .iface_macro = PPB_EXT_EVENTS_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Ext_Events_Dev_0_1, - .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, @@ -5819,27 +5788,27 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0, &Pnacl_WrapperInfo_PPB_VarDictionary_1_0, &Pnacl_WrapperInfo_PPB_WebSocket_1_0, + &Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4, &Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1, &Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5, &Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6, + &Pnacl_WrapperInfo_PPB_FileIO_Dev_0_1, &Pnacl_WrapperInfo_PPB_Font_Dev_0_6, &Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1, &Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2, &Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_2, &Pnacl_WrapperInfo_PPB_Printing_Dev_0_7, - &Pnacl_WrapperInfo_PPB_Testing_Dev_0_9, - &Pnacl_WrapperInfo_PPB_Testing_Dev_0_91, - &Pnacl_WrapperInfo_PPB_Testing_Dev_0_92, &Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1, &Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6, &Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_7, + &Pnacl_WrapperInfo_PPB_VarResource_Dev_0_1, &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2, &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3, &Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16, - &Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7, + &Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9, &Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1, &Pnacl_WrapperInfo_PPB_FileIO_Private_0_1, &Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1, @@ -5851,15 +5820,17 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_Flash_Clipboard_5_0, &Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0, &Pnacl_WrapperInfo_PPB_Flash_DRM_1_0, + &Pnacl_WrapperInfo_PPB_Flash_DRM_1_1, &Pnacl_WrapperInfo_PPB_Flash_Menu_0_2, &Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1, &Pnacl_WrapperInfo_PPB_Instance_Private_0_1, + &Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2, &Pnacl_WrapperInfo_PPB_NaCl_Private_1_0, &Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1, &Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0, &Pnacl_WrapperInfo_PPB_NetAddress_Private_1_1, &Pnacl_WrapperInfo_PPB_OutputProtection_Private_0_1, - &Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_1, + &Pnacl_WrapperInfo_PPB_PlatformVerification_Private_0_2, &Pnacl_WrapperInfo_PPB_Talk_Private_1_0, &Pnacl_WrapperInfo_PPB_Talk_Private_2_0, &Pnacl_WrapperInfo_PPB_TCPServerSocket_Private_0_1, @@ -5867,6 +5838,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_3, &Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_4, &Pnacl_WrapperInfo_PPB_TCPSocket_Private_0_5, + &Pnacl_WrapperInfo_PPB_Testing_Private_1_0, &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2, &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3, &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4, @@ -5874,8 +5846,6 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &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, &Pnacl_WrapperInfo_PPB_Ext_Socket_Dev_0_2, NULL @@ -5884,7 +5854,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { static struct __PnaclWrapperInfo *s_ppp_wrappers[] = { &Pnacl_WrapperInfo_PPP_Messaging_1_0, &Pnacl_WrapperInfo_PPP_Selection_Dev_0_3, - &Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7, + &Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9, &Pnacl_WrapperInfo_PPP_Instance_Private_0_1, NULL }; diff --git a/chromium/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c b/chromium/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c index e73326e0602..70f17b244ca 100644 --- a/chromium/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c +++ b/chromium/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c @@ -9,6 +9,7 @@ #include <string.h> #include "native_client/src/include/nacl_macros.h" #include "native_client/src/untrusted/irt/irt.h" +#include "native_client/src/untrusted/irt/irt_dev.h" #include "native_client/src/untrusted/irt/irt_ppapi.h" #include "ppapi/generators/pnacl_shim.h" #include "ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h" diff --git a/chromium/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp b/chromium/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp index e290eaea071..dfd83496759 100644 --- a/chromium/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp +++ b/chromium/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp @@ -39,7 +39,6 @@ 'outputs': [ '<(PRODUCT_DIR)/pnacl/pnacl_public_pnacl_json', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_crtbegin_o', - '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_crtbeginS_o', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_ld_nexe', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libcrt_platform_a', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libgcc_a', @@ -47,7 +46,6 @@ '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libpnacl_irt_shim_a', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_pnacl_llc_nexe', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_crtbegin_o', - '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_crtbeginS_o', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_ld_nexe', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libcrt_platform_a', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libgcc_a', @@ -74,7 +72,6 @@ 'outputs': [ '<(PRODUCT_DIR)/pnacl/pnacl_public_pnacl_json', '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_crtbegin_o', - '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_crtbeginS_o', '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_ld_nexe', '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_libcrt_platform_a', '<(PRODUCT_DIR)/pnacl/pnacl_public_arm_libgcc_a', @@ -96,7 +93,6 @@ 'outputs': [ '<(PRODUCT_DIR)/pnacl/pnacl_public_pnacl_json', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_crtbegin_o', - '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_crtbeginS_o', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_ld_nexe', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libcrt_platform_a', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_libgcc_a', @@ -118,7 +114,6 @@ 'outputs': [ '<(PRODUCT_DIR)/pnacl/pnacl_public_pnacl_json', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_crtbegin_o', - '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_crtbeginS_o', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_ld_nexe', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libcrt_platform_a', '<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_libgcc_a', diff --git a/chromium/ppapi/native_client/tools/browser_tester/browser_tester.py b/chromium/ppapi/native_client/tools/browser_tester/browser_tester.py index 0fef6ea6713..844956d7b3e 100755 --- a/chromium/ppapi/native_client/tools/browser_tester/browser_tester.py +++ b/chromium/ppapi/native_client/tools/browser_tester/browser_tester.py @@ -14,9 +14,9 @@ import urllib # Allow the import of third party modules script_dir = os.path.dirname(os.path.abspath(__file__)) -sys.path.append(os.path.join(script_dir, '../../../../third_party/')) -sys.path.append(os.path.join(script_dir, '../../../../tools/valgrind/')) -sys.path.append(os.path.join(script_dir, '../../../../testing/')) +sys.path.insert(0, os.path.join(script_dir, '../../../../third_party/')) +sys.path.insert(0, os.path.join(script_dir, '../../../../tools/valgrind/')) +sys.path.insert(0, os.path.join(script_dir, '../../../../testing/')) import browsertester.browserlauncher import browsertester.rpclistener @@ -161,7 +161,7 @@ def ProcessToolLogs(options, logs_dir): analyzer = memcheck_analyze.MemcheckAnalyzer('', use_gdb=True) logs_wildcard = 'xml.*' elif options.tool == 'tsan': - analyzer = tsan_analyze.TsanAnalyzer('', use_gdb=True) + analyzer = tsan_analyze.TsanAnalyzer(use_gdb=True) logs_wildcard = 'log.*' files = glob.glob(os.path.join(logs_dir, logs_wildcard)) retcode = analyzer.Report(files, options.url) @@ -298,6 +298,8 @@ def RunTestsOnce(url, options): else: err += '\nThe test probably did not get a callback that it expected.' listener.ServerError(err) + if not server.received_request: + raise RetryTest('Chrome hung before running the test.') break elif not options.interactive and HardTimeout(options.hard_timeout): listener.ServerError('The test took over %.1f seconds. This is ' @@ -356,6 +358,17 @@ def Run(url, options): while True: try: result = RunTestsOnce(url, options) + if result: + # Currently (2013/11/15) nacl_integration is fairly flaky and there is + # not enough time to look into it. Retry if the test fails for any + # reason. Note that in general this test runner tries to only retry + # when a known flake is encountered. (See the other raise + # RetryTest(..)s in this file.) This blanket retry means that those + # other cases could be removed without changing the behavior of the test + # runner, but it is hoped that this blanket retry will eventually be + # unnecessary and subsequently removed. The more precise retries have + # been left in place to preserve the knowledge. + raise RetryTest('HACK retrying failed test.') break except RetryTest: # Only retry once. diff --git a/chromium/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py b/chromium/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py index 67ea29125e9..36b8c2ab2bc 100755 --- a/chromium/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py +++ b/chromium/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py @@ -265,9 +265,10 @@ class ChromeLauncher(BrowserLauncher): def MakeCmd(self, url, host, port): cmd = [self.binary, - # Note that we do not use "--enable-logging" here because - # it actually turns off logging to the Buildbot logs on - # Windows (see http://crbug.com/169941). + # --enable-logging enables stderr output from Chromium subprocesses + # on Windows (see + # https://code.google.com/p/chromium/issues/detail?id=171836) + '--enable-logging', '--disable-web-resources', '--disable-preconnect', # This is speculative, sync should not occur with a clean profile. @@ -294,6 +295,10 @@ class ChromeLauncher(BrowserLauncher): '--user-data-dir=%s' % self.profile] # Log network requests to assist debugging. cmd.append('--log-net-log=%s' % self.NetLogName()) + if PLATFORM == 'linux': + # Explicitly run with mesa on linux. The test infrastructure doesn't have + # sufficient native GL contextes to run these tests. + cmd.append('--use-gl=osmesa') if self.options.ppapi_plugin is None: cmd.append('--enable-nacl') disable_sandbox = False diff --git a/chromium/ppapi/ppapi_ipc.gypi b/chromium/ppapi/ppapi_ipc.gypi index f8334722f60..132c0f11e92 100644 --- a/chromium/ppapi/ppapi_ipc.gypi +++ b/chromium/ppapi/ppapi_ipc.gypi @@ -12,8 +12,8 @@ # This part is shared between the targets defined below. ['ppapi_ipc_target==1', { 'sources': [ - 'proxy/handle_converter.cc', - 'proxy/handle_converter.h', + 'proxy/nacl_message_scanner.cc', + 'proxy/nacl_message_scanner.h', 'proxy/ppapi_messages.cc', 'proxy/ppapi_messages.h', 'proxy/ppapi_param_traits.cc', diff --git a/chromium/ppapi/ppapi_nacl_test_common.gypi b/chromium/ppapi/ppapi_nacl_test_common.gypi index dd1adb1c824..99599ef141a 100644 --- a/chromium/ppapi/ppapi_nacl_test_common.gypi +++ b/chromium/ppapi/ppapi_nacl_test_common.gypi @@ -89,22 +89,17 @@ 'extra_args': [ '--strip-all', ], + 'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', }, 'target_conditions': [ ['generate_nmf==1 and build_newlib==1', { 'actions': [ { 'action_name': 'Generate NEWLIB NMF', - # Unlike glibc, nexes are not actually inputs - only the names matter. - # We don't have the nexes as inputs because the ARM nexe may not - # exist. However, VS 2010 seems to blackhole this entire target if - # there are no inputs to this action. To work around this we add a - # bogus input. - 'inputs': [], + 'inputs': ['>(create_nmf)'], 'outputs': ['>(nmf_newlib)'], 'action': [ 'python', - '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', '>@(_inputs)', '--output=>(nmf_newlib)', ], @@ -133,14 +128,13 @@ 'actions': [ { 'action_name': 'Generate GLIBC NMF and copy libs', - 'inputs': [], + 'inputs': ['>(create_nmf)'], # NOTE: There is no explicit dependency for the lib32 # and lib64 directories created in the PRODUCT_DIR. # They are created as a side-effect of NMF creation. 'outputs': ['>(nmf_glibc)'], 'action': [ 'python', - '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', '>@(_inputs)', '--objdump=>(nacl_objdump)', '--output=>(nmf_glibc)', @@ -171,11 +165,12 @@ 'actions': [ { 'action_name': 'Generate PNACL NEWLIB NMF', - 'inputs': ['>(out_pnacl_newlib)'], + # NOTE: create_nmf must be first, it is the script python + # executes below. + 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib)'], 'outputs': ['>(nmf_pnacl_newlib)'], 'action': [ 'python', - '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', '>@(_inputs)', '--output=>(nmf_pnacl_newlib)', ], diff --git a/chromium/ppapi/ppapi_proxy.gypi b/chromium/ppapi/ppapi_proxy.gypi index 267402d6f5d..35186c86644 100644 --- a/chromium/ppapi/ppapi_proxy.gypi +++ b/chromium/ppapi/ppapi_proxy.gypi @@ -35,8 +35,6 @@ 'proxy/enter_proxy.h', 'proxy/error_conversion.cc', 'proxy/error_conversion.h', - 'proxy/ext_crx_file_system_private_resource.cc', - 'proxy/ext_crx_file_system_private_resource.h', 'proxy/extensions_common_resource.cc', 'proxy/extensions_common_resource.h', 'proxy/file_chooser_resource.cc', @@ -79,6 +77,8 @@ 'proxy/interface_list.h', 'proxy/interface_proxy.cc', 'proxy/interface_proxy.h', + 'proxy/isolated_file_system_private_resource.cc', + 'proxy/isolated_file_system_private_resource.h', 'proxy/locking_resource_releaser.h', 'proxy/net_address_resource.cc', 'proxy/net_address_resource.h', @@ -88,6 +88,8 @@ 'proxy/network_monitor_resource.h', 'proxy/network_proxy_resource.cc', 'proxy/network_proxy_resource.h', + 'proxy/output_protection_resource.cc', + 'proxy/output_protection_resource.h', 'proxy/pdf_resource.cc', 'proxy/pdf_resource.h', 'proxy/platform_verification_private_resource.cc', @@ -176,6 +178,8 @@ 'proxy/proxy_object_var.h', 'proxy/resource_creation_proxy.cc', 'proxy/resource_creation_proxy.h', + 'proxy/resource_reply_thread_registrar.cc', + 'proxy/resource_reply_thread_registrar.h', 'proxy/talk_resource.cc', 'proxy/talk_resource.h', 'proxy/tcp_server_socket_private_resource.cc', diff --git a/chromium/ppapi/ppapi_shared.gypi b/chromium/ppapi/ppapi_shared.gypi index 7edeb2f2252..3cdec10e40f 100644 --- a/chromium/ppapi/ppapi_shared.gypi +++ b/chromium/ppapi/ppapi_shared.gypi @@ -27,6 +27,8 @@ 'shared_impl/file_ref_create_info.h', 'shared_impl/file_ref_util.cc', 'shared_impl/file_ref_util.h', + 'shared_impl/file_system_util.cc', + 'shared_impl/file_system_util.h', 'shared_impl/file_type_conversion.cc', 'shared_impl/file_type_conversion.h', 'shared_impl/flash_clipboard_format_registry.cc', @@ -129,6 +131,7 @@ 'thunk/enter.cc', 'thunk/enter.h', 'thunk/extensions_common_api.h', + 'thunk/ppb_alarms_dev_thunk.cc', 'thunk/ppb_audio_api.h', 'thunk/ppb_audio_config_api.h', 'thunk/ppb_audio_config_thunk.cc', @@ -147,8 +150,6 @@ 'thunk/ppb_cursor_control_thunk.cc', 'thunk/ppb_device_ref_api.h', 'thunk/ppb_device_ref_dev_thunk.cc', - 'thunk/ppb_ext_alarms_thunk.cc', - 'thunk/ppb_ext_crx_file_system_private_api.h', 'thunk/ppb_ext_crx_file_system_private_thunk.cc', 'thunk/ppb_ext_socket_thunk.cc', 'thunk/ppb_file_chooser_api.h', @@ -157,7 +158,6 @@ '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', 'thunk/ppb_file_ref_thunk.cc', 'thunk/ppb_file_system_api.h', @@ -201,6 +201,8 @@ 'thunk/ppb_instance_api.h', 'thunk/ppb_instance_private_thunk.cc', 'thunk/ppb_instance_thunk.cc', + 'thunk/ppb_isolated_file_system_private_api.h', + 'thunk/ppb_isolated_file_system_private_thunk.cc', 'thunk/ppb_message_loop_api.h', 'thunk/ppb_messaging_thunk.cc', 'thunk/ppb_mouse_cursor_thunk.cc', @@ -213,6 +215,8 @@ 'thunk/ppb_network_monitor_thunk.cc', 'thunk/ppb_network_proxy_api.h', 'thunk/ppb_network_proxy_thunk.cc', + 'thunk/ppb_output_protection_api.h', + 'thunk/ppb_output_protection_private_thunk.cc', 'thunk/ppb_pdf_api.h', 'thunk/ppb_pdf_thunk.cc', 'thunk/ppb_platform_verification_api.h', @@ -249,6 +253,7 @@ 'thunk/ppb_url_util_thunk.cc', 'thunk/ppb_var_array_thunk.cc', 'thunk/ppb_var_dictionary_thunk.cc', + 'thunk/ppb_var_resource_dev_thunk.cc', 'thunk/ppb_video_capture_api.h', 'thunk/ppb_video_capture_thunk.cc', 'thunk/ppb_video_decoder_api.h', @@ -291,7 +296,6 @@ 'thunk/ppb_buffer_thunk.cc', 'thunk/ppb_content_decryptor_private_thunk.cc', 'thunk/ppb_char_set_thunk.cc', - 'thunk/ppb_file_io_trusted_thunk.cc', 'thunk/ppb_flash_clipboard_thunk.cc', 'thunk/ppb_flash_device_id_thunk.cc', 'thunk/ppb_flash_drm_thunk.cc', diff --git a/chromium/ppapi/ppapi_sources.gypi b/chromium/ppapi/ppapi_sources.gypi index 6ec54b7000a..793cbfc2465 100644 --- a/chromium/ppapi/ppapi_sources.gypi +++ b/chromium/ppapi/ppapi_sources.gypi @@ -69,7 +69,9 @@ # Dev interfaces. 'c/dev/pp_cursor_type_dev.h', + 'c/dev/pp_optional_structs_dev.h', 'c/dev/pp_video_dev.h', + 'c/dev/ppb_alarms_dev.h', 'c/dev/ppb_buffer_dev.h', 'c/dev/ppb_char_set_dev.h', 'c/dev/ppb_cursor_control_dev.h', @@ -82,10 +84,10 @@ 'c/dev/ppb_printing_dev.h', 'c/dev/ppb_resource_array_dev.h', 'c/dev/ppb_scrollbar_dev.h', - 'c/dev/ppb_testing_dev.h', 'c/dev/ppb_text_input_dev.h', 'c/dev/ppb_truetype_font_dev.h', 'c/dev/ppb_url_util_dev.h', + 'c/dev/ppb_var_resource_dev.h', 'c/dev/ppb_video_decoder_dev.h', 'c/dev/ppb_widget_dev.h', 'c/dev/ppb_zoom_dev.h', @@ -113,12 +115,14 @@ 'c/private/ppb_flash_message_loop.h', 'c/private/ppb_host_resolver_private.h', 'c/private/ppb_instance_private.h', + 'c/private/ppb_isolated_file_system_private.h', 'c/private/ppb_nacl_private.h', 'c/private/ppb_net_address_private.h', + 'c/private/ppb_output_protection_private.h', 'c/private/ppb_pdf.h', 'c/private/ppb_platform_verification_private.h', 'c/private/ppb_proxy_private.h', - 'c/private/ppp_instance_private.h', + 'c/private/ppb_testing_private.h', 'c/private/ppb_tcp_server_socket_private.h', 'c/private/ppb_tcp_socket_private.h', 'c/private/ppb_udp_socket_private.h', @@ -126,6 +130,7 @@ 'c/private/ppb_video_source_private.h', 'c/private/ppb_x509_certificate_private.h', 'c/private/ppp_content_decryptor_private.h', + 'c/private/ppp_instance_private.h', # Deprecated interfaces. 'c/dev/deprecated_bool.h', @@ -136,13 +141,10 @@ 'c/trusted/ppb_broker_trusted.h', 'c/trusted/ppb_browser_font_trusted.h', 'c/trusted/ppb_file_chooser_trusted.h', - 'c/trusted/ppb_file_io_trusted.h', 'c/trusted/ppb_url_loader_trusted.h', 'c/trusted/ppp_broker.h', # Extensions dev interfaces. - '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': [ @@ -269,6 +271,8 @@ 'cpp/dev/truetype_font_dev.h', 'cpp/dev/url_util_dev.cc', 'cpp/dev/url_util_dev.h', + 'cpp/dev/var_resource_dev.cc', + 'cpp/dev/var_resource_dev.h', 'cpp/dev/video_capture_client_dev.cc', 'cpp/dev/video_capture_client_dev.h', 'cpp/dev/video_capture_dev.cc', @@ -319,8 +323,12 @@ 'cpp/private/host_resolver_private.h', 'cpp/private/instance_private.cc', 'cpp/private/instance_private.h', + 'cpp/private/isolated_file_system_private.cc', + 'cpp/private/isolated_file_system_private.h', 'cpp/private/net_address_private.cc', 'cpp/private/net_address_private.h', + 'cpp/private/output_protection_private.cc', + 'cpp/private/output_protection_private.h', 'cpp/private/pass_file_handle.cc', 'cpp/private/pass_file_handle.h', 'cpp/private/pdf.cc', @@ -349,23 +357,15 @@ 'cpp/trusted/browser_font_trusted.h', 'cpp/trusted/file_chooser_trusted.cc', 'cpp/trusted/file_chooser_trusted.h', - 'cpp/trusted/file_io_trusted.cc', - 'cpp/trusted/file_io_trusted.h', # Extensions interfaces. 'cpp/extensions/dict_field.h', - 'cpp/extensions/event_base.cc', - 'cpp/extensions/event_base.h', 'cpp/extensions/ext_output_traits.h', 'cpp/extensions/from_var_converter.h', 'cpp/extensions/optional.h', 'cpp/extensions/to_var_converter.h', # Extensions dev interfaces. - 'cpp/extensions/dev/alarms_dev.cc', - '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', @@ -450,6 +450,8 @@ 'tests/test_network_monitor.h', 'tests/test_network_proxy.cc', 'tests/test_network_proxy.h', + 'tests/test_output_protection_private.cc', + 'tests/test_output_protection_private.h', 'tests/test_paint_aggregator.cc', 'tests/test_paint_aggregator.h', 'tests/test_post_message.cc', @@ -479,6 +481,8 @@ 'tests/test_utils.cc', 'tests/test_var.cc', 'tests/test_var.h', + 'tests/test_var_resource.cc', + 'tests/test_var_resource.h', 'tests/test_video_destination.cc', 'tests/test_video_destination.h', 'tests/test_video_source.cc', diff --git a/chromium/ppapi/ppapi_untrusted.gyp b/chromium/ppapi/ppapi_untrusted.gyp index 4e11b2cfdff..4c51db6b5d4 100644 --- a/chromium/ppapi/ppapi_untrusted.gyp +++ b/chromium/ppapi/ppapi_untrusted.gyp @@ -134,6 +134,7 @@ 'extra_args': [ '--strip-all', ], + 'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', }, 'conditions': [ ['target_arch!="arm" and disable_glibc==0', { @@ -149,14 +150,15 @@ 'actions': [ { 'action_name': 'Generate GLIBC NMF and copy libs', - 'inputs': ['>(out_glibc64)', '>(out_glibc32)'], + # NOTE: create_nmf must be first, it is the script python executes + # below. + 'inputs': ['>(create_nmf)', '>(out_glibc64)', '>(out_glibc32)'], # NOTE: There is no explicit dependency for the lib32 # and lib64 directories created in the PRODUCT_DIR. # They are created as a side-effect of NMF creation. 'outputs': ['>(nmf_glibc)'], 'action': [ 'python', - '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', '>@(_inputs)', '--objdump=>(nacl_objdump)', '--library-path=>(libdir_glibc64)', @@ -189,12 +191,16 @@ 'actions': [ { 'action_name': 'Generate PNACL NEWLIB NMF', - 'inputs': ['>(out_pnacl_newlib_x86_32_nexe)', - '>(out_pnacl_newlib_x86_64_nexe)'], + # NOTE: create_nmf must be first, it is the script python executes + # below. + 'inputs': [ + '>(create_nmf)', + '>(out_pnacl_newlib_x86_32_nexe)', + '>(out_pnacl_newlib_x86_64_nexe)' + ], 'outputs': ['>(nmf_pnacl)'], 'action': [ 'python', - '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', '>@(_inputs)', '--output=>(nmf_pnacl)', ], @@ -213,11 +219,12 @@ 'actions': [ { 'action_name': 'Generate PNACL NEWLIB NMF', - 'inputs': ['>(out_pnacl_newlib_arm_nexe)'], + # NOTE: create_nmf must be first, it is the script python executes + # below. + 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib_arm_nexe)'], 'outputs': ['>(nmf_pnacl)'], 'action': [ 'python', - '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', '>@(_inputs)', '--output=>(nmf_pnacl)', ], diff --git a/chromium/ppapi/proxy/audio_input_resource.cc b/chromium/ppapi/proxy/audio_input_resource.cc index 4a7afff1a2c..7c29df5b744 100644 --- a/chromium/ppapi/proxy/audio_input_resource.cc +++ b/chromium/ppapi/proxy/audio_input_resource.cc @@ -8,7 +8,6 @@ #include "base/logging.h" #include "ipc/ipc_platform_file.h" #include "media/audio/audio_parameters.h" -#include "media/audio/shared_memory_util.h" #include "ppapi/c/pp_errors.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/resource_message_params.h" @@ -168,15 +167,9 @@ void AudioInputResource::OnPluginMsgOpenReply( params.TakeHandleOfTypeAtIndex(1, SerializedHandle::SHARED_MEMORY); CHECK(serialized_shared_memory_handle.IsHandleValid()); - // See the comment in pepper_audio_input_host.cc about how we must call - // TotalSharedMemorySizeInBytes to get the actual size of the buffer. Here, - // we must call PacketSizeInBytes to get back the size of the audio buffer, - // excluding the bytes that audio uses for book-keeping. - size_t shared_memory_size = media::PacketSizeInBytes( - serialized_shared_memory_handle.size()); - open_state_ = OPENED; - SetStreamInfo(serialized_shared_memory_handle.shmem(), shared_memory_size, + SetStreamInfo(serialized_shared_memory_handle.shmem(), + serialized_shared_memory_handle.size(), socket_handle); } else { capturing_ = false; diff --git a/chromium/ppapi/proxy/connection.h b/chromium/ppapi/proxy/connection.h index 13cbbc6fcf4..cc8255cd7ad 100644 --- a/chromium/ppapi/proxy/connection.h +++ b/chromium/ppapi/proxy/connection.h @@ -40,7 +40,7 @@ struct Connection { bool in_process; // We need to use a routing ID when a plugin is in-process, and messages are // sent back from the browser to the renderer. This is so that messages are - // routed to the proper RenderViewImpl. + // routed to the proper RenderFrameImpl. int browser_sender_routing_id; }; diff --git a/chromium/ppapi/proxy/device_enumeration_resource_helper_unittest.cc b/chromium/ppapi/proxy/device_enumeration_resource_helper_unittest.cc index 56c09d7966c..bbf70527065 100644 --- a/chromium/ppapi/proxy/device_enumeration_resource_helper_unittest.cc +++ b/chromium/ppapi/proxy/device_enumeration_resource_helper_unittest.cc @@ -7,6 +7,7 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/proxy/connection.h" #include "ppapi/proxy/device_enumeration_resource_helper.h" +#include "ppapi/proxy/plugin_message_filter.h" #include "ppapi/proxy/plugin_resource.h" #include "ppapi/proxy/plugin_resource_tracker.h" #include "ppapi/proxy/plugin_var_tracker.h" @@ -258,10 +259,9 @@ TEST_F(DeviceEnumerationResourceHelperTest, EnumerateDevices) { { ProxyAutoUnlock unlock; - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( - PpapiPluginMsg_ResourceReply( - reply_params, - PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply(data)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, + PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply(data)); } EXPECT_TRUE(callback.called()); EXPECT_EQ(PP_OK, callback.result()); @@ -304,11 +304,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) { { ProxyAutoUnlock unlock; // Synthesize a response with no device. - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( - PpapiPluginMsg_ResourceReply( - reply_params, - PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( - callback_id, data)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, + PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( + callback_id, data)); } EXPECT_TRUE(helper.called() && helper.same_as_expected()); @@ -327,11 +326,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) { { ProxyAutoUnlock unlock; // Synthesize a response with some devices. - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( - PpapiPluginMsg_ResourceReply( - reply_params, - PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( - callback_id, data)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, + PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( + callback_id, data)); } EXPECT_TRUE(helper.called() && helper.same_as_expected()); @@ -357,11 +355,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) { { 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)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, + PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( + callback_id2, data)); } EXPECT_TRUE(helper2.called() && helper2.same_as_expected()); EXPECT_FALSE(helper.called()); @@ -372,11 +369,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) { 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)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, + PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( + callback_id, data)); } EXPECT_FALSE(helper2.called()); EXPECT_FALSE(helper.called()); @@ -396,11 +392,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) { { 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)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, + PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( + callback_id2, data)); } EXPECT_FALSE(helper2.called()); } diff --git a/chromium/ppapi/proxy/file_chooser_resource_unittest.cc b/chromium/ppapi/proxy/file_chooser_resource_unittest.cc index 4ba5bd9da88..a97b9c9f4a2 100644 --- a/chromium/ppapi/proxy/file_chooser_resource_unittest.cc +++ b/chromium/ppapi/proxy/file_chooser_resource_unittest.cc @@ -8,6 +8,7 @@ #include "ppapi/c/ppb_file_ref.h" #include "ppapi/proxy/file_chooser_resource.h" #include "ppapi/proxy/locking_resource_releaser.h" +#include "ppapi/proxy/plugin_message_filter.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppapi_proxy_test.h" #include "ppapi/shared_impl/proxy_lock.h" @@ -101,9 +102,8 @@ TEST_F(FileChooserResourceTest, Show) { create_info.browser_pending_host_resource_id = 12; create_info.renderer_pending_host_resource_id = 15; create_info_array.push_back(create_info); - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( - PpapiPluginMsg_ResourceReply(reply_params, - PpapiPluginMsg_FileChooser_ShowReply(create_info_array)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, PpapiPluginMsg_FileChooser_ShowReply(create_info_array)); // Should have populated our vector. ASSERT_EQ(1u, dest.size()); diff --git a/chromium/ppapi/proxy/file_io_resource.cc b/chromium/ppapi/proxy/file_io_resource.cc index fc53fb05243..ad0718709c3 100644 --- a/chromium/ppapi/proxy/file_io_resource.cc +++ b/chromium/ppapi/proxy/file_io_resource.cc @@ -10,23 +10,28 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/shared_impl/array_writer.h" +#include "ppapi/shared_impl/file_ref_create_info.h" +#include "ppapi/shared_impl/file_system_util.h" #include "ppapi/shared_impl/file_type_conversion.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/shared_impl/resource_tracker.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_file_ref_api.h" +#include "ppapi/thunk/ppb_file_system_api.h" using ppapi::thunk::EnterResourceNoLock; using ppapi::thunk::PPB_FileIO_API; using ppapi::thunk::PPB_FileRef_API; +using ppapi::thunk::PPB_FileSystem_API; namespace { // We must allocate a buffer sized according to the request of the plugin. To -// reduce the chance of out-of-memory errors, we cap the read size to 32MB. -// This is OK since the API specifies that it may perform a partial read. -static const int32_t kMaxReadSize = 32 * 1024 * 1024; // 32MB +// reduce the chance of out-of-memory errors, we cap the read and write size to +// 32MB. This is OK since the API specifies that it may perform a partial read +// or write. +static const int32_t kMaxReadWriteSize = 32 * 1024 * 1024; // 32MB // An adapter to let Read() share the same implementation with ReadToArray(). void* DummyGetDataBuffer(void* user_data, uint32_t count, uint32_t size) { @@ -43,24 +48,26 @@ void DoClose(base::PlatformFile file) { namespace ppapi { namespace proxy { -FileIOResource::QueryOp::QueryOp(PP_FileHandle file_handle) +FileIOResource::QueryOp::QueryOp(scoped_refptr<FileHandleHolder> file_handle) : file_handle_(file_handle) { + DCHECK(file_handle_); } FileIOResource::QueryOp::~QueryOp() { } int32_t FileIOResource::QueryOp::DoWork() { - return base::GetPlatformFileInfo(file_handle_, &file_info_) ? + return base::GetPlatformFileInfo(file_handle_->raw_handle(), &file_info_) ? PP_OK : PP_ERROR_FAILED; } -FileIOResource::ReadOp::ReadOp(PP_FileHandle file_handle, +FileIOResource::ReadOp::ReadOp(scoped_refptr<FileHandleHolder> file_handle, int64_t offset, int32_t bytes_to_read) : file_handle_(file_handle), offset_(offset), bytes_to_read_(bytes_to_read) { + DCHECK(file_handle_); } FileIOResource::ReadOp::~ReadOp() { @@ -70,18 +77,18 @@ int32_t FileIOResource::ReadOp::DoWork() { DCHECK(!buffer_.get()); buffer_.reset(new char[bytes_to_read_]); return base::ReadPlatformFile( - file_handle_, offset_, buffer_.get(), bytes_to_read_); + file_handle_->raw_handle(), offset_, buffer_.get(), bytes_to_read_); } FileIOResource::FileIOResource(Connection connection, PP_Instance instance) : PluginResource(connection, instance), - file_handle_(base::kInvalidPlatformFileValue), - file_system_type_(PP_FILESYSTEMTYPE_INVALID) { - SendCreate(RENDERER, PpapiHostMsg_FileIO_Create()); + file_system_type_(PP_FILESYSTEMTYPE_INVALID), + called_close_(false) { + SendCreate(BROWSER, PpapiHostMsg_FileIO_Create()); } FileIOResource::~FileIOResource() { - CloseFileHandle(); + Close(); } PPB_FileIO_API* FileIOResource::AsPPB_FileIO_API() { @@ -91,31 +98,38 @@ PPB_FileIO_API* FileIOResource::AsPPB_FileIO_API() { int32_t FileIOResource::Open(PP_Resource file_ref, int32_t open_flags, scoped_refptr<TrackedCallback> callback) { - EnterResourceNoLock<PPB_FileRef_API> enter(file_ref, true); - if (enter.failed()) + EnterResourceNoLock<PPB_FileRef_API> enter_file_ref(file_ref, true); + if (enter_file_ref.failed()) return PP_ERROR_BADRESOURCE; - PPB_FileRef_API* file_ref_api = enter.object(); - PP_FileSystemType type = file_ref_api->GetFileSystemType(); - if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && - type != PP_FILESYSTEMTYPE_LOCALTEMPORARY && - type != PP_FILESYSTEMTYPE_EXTERNAL && - type != PP_FILESYSTEMTYPE_ISOLATED) { + PPB_FileRef_API* file_ref_api = enter_file_ref.object(); + const FileRefCreateInfo& create_info = file_ref_api->GetCreateInfo(); + if (!FileSystemTypeIsValid(create_info.file_system_type)) { NOTREACHED(); return PP_ERROR_FAILED; } - file_system_type_ = type; - int32_t rv = state_manager_.CheckOperationState( FileIOStateManager::OPERATION_EXCLUSIVE, false); if (rv != PP_OK) return rv; + file_system_type_ = create_info.file_system_type; + + if (create_info.file_system_plugin_resource) { + EnterResourceNoLock<PPB_FileSystem_API> enter_file_system( + create_info.file_system_plugin_resource, true); + if (enter_file_system.failed()) + return PP_ERROR_FAILED; + // Take a reference on the FileSystem resource. The FileIO host uses the + // FileSystem host for running tasks and checking quota. + file_system_resource_ = enter_file_system.resource(); + } + // Take a reference on the FileRef resource while we're opening the file; we // don't want the plugin destroying it during the Open operation. - file_ref_ = enter.resource(); + file_ref_ = enter_file_ref.resource(); - Call<PpapiPluginMsg_FileIO_OpenReply>(RENDERER, + Call<PpapiPluginMsg_FileIO_OpenReply>(BROWSER, PpapiHostMsg_FileIO_Open( file_ref, open_flags), @@ -134,27 +148,39 @@ int32_t FileIOResource::Query(PP_FileInfo* info, return rv; if (!info) return PP_ERROR_BADARGUMENT; - if (file_handle_ == base::kInvalidPlatformFileValue) + if (!FileHandleHolder::IsValid(file_handle_)) return PP_ERROR_FAILED; state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); - scoped_refptr<QueryOp> query_op(new QueryOp(file_handle_)); // If the callback is blocking, perform the task on the calling thread. if (callback->is_blocking()) { - int32_t result; + int32_t result = PP_ERROR_FAILED; + base::PlatformFileInfo file_info; + // The plugin could release its reference to this instance when we release + // the proxy lock below. + scoped_refptr<FileIOResource> protect(this); { // Release the proxy lock while making a potentially slow file call. ProxyAutoUnlock unlock; - result = query_op->DoWork(); + if (base::GetPlatformFileInfo(file_handle_->raw_handle(), &file_info)) + result = PP_OK; } - return OnQueryComplete(query_op, info, result); + if (result == PP_OK) { + // This writes the file info into the plugin's PP_FileInfo struct. + ppapi::PlatformFileInfoToPepperFileInfo(file_info, + file_system_type_, + info); + } + state_manager_.SetOperationFinished(); + return result; } // For the non-blocking case, post a task to the file thread and add a // completion task to write the result. + scoped_refptr<QueryOp> query_op(new QueryOp(file_handle_)); base::PostTaskAndReplyWithResult( - PpapiGlobals::Get()->GetFileTaskRunner(pp_instance()), + PpapiGlobals::Get()->GetFileTaskRunner(), FROM_HERE, Bind(&FileIOResource::QueryOp::DoWork, query_op), RunWhileLocked(Bind(&TrackedCallback::Run, callback))); @@ -172,7 +198,7 @@ int32_t FileIOResource::Touch(PP_Time last_access_time, if (rv != PP_OK) return rv; - Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER, + Call<PpapiPluginMsg_FileIO_GeneralReply>(BROWSER, PpapiHostMsg_FileIO_Touch(last_access_time, last_modified_time), base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this, callback)); @@ -221,7 +247,8 @@ int32_t FileIOResource::Write(int64_t offset, // TODO(brettw) it would be nice to use a shared memory buffer for large // writes rather than having to copy to a string (which will involve a number // of extra copies to serialize over IPC). - Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER, + bytes_to_write = std::min(bytes_to_write, kMaxReadWriteSize); + Call<PpapiPluginMsg_FileIO_GeneralReply>(BROWSER, PpapiHostMsg_FileIO_Write(offset, std::string(buffer, bytes_to_write)), base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this, callback)); @@ -237,7 +264,7 @@ int32_t FileIOResource::SetLength(int64_t length, if (rv != PP_OK) return rv; - Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER, + Call<PpapiPluginMsg_FileIO_GeneralReply>(BROWSER, PpapiHostMsg_FileIO_SetLength(length), base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this, callback)); @@ -252,7 +279,7 @@ int32_t FileIOResource::Flush(scoped_refptr<TrackedCallback> callback) { if (rv != PP_OK) return rv; - Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER, + Call<PpapiPluginMsg_FileIO_GeneralReply>(BROWSER, PpapiHostMsg_FileIO_Flush(), base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this, callback)); @@ -262,16 +289,14 @@ int32_t FileIOResource::Flush(scoped_refptr<TrackedCallback> callback) { } void FileIOResource::Close() { - CloseFileHandle(); - Post(RENDERER, PpapiHostMsg_FileIO_Close()); -} + if (called_close_) + return; + + called_close_ = true; + if (file_handle_) + file_handle_ = NULL; -int32_t FileIOResource::GetOSFileDescriptor() { - int32_t file_descriptor; - // Only available when running in process. - SyncCall<PpapiPluginMsg_FileIO_GetOSFileDescriptorReply>( - RENDERER, PpapiHostMsg_FileIO_GetOSFileDescriptor(), &file_descriptor); - return file_descriptor; + Post(BROWSER, PpapiHostMsg_FileIO_Close()); } int32_t FileIOResource::RequestOSFileHandle( @@ -282,7 +307,7 @@ int32_t FileIOResource::RequestOSFileHandle( if (rv != PP_OK) return rv; - Call<PpapiPluginMsg_FileIO_RequestOSFileHandleReply>(RENDERER, + Call<PpapiPluginMsg_FileIO_RequestOSFileHandleReply>(BROWSER, PpapiHostMsg_FileIO_RequestOSFileHandle(), base::Bind(&FileIOResource::OnPluginMsgRequestOSFileHandleComplete, this, callback, handle)); @@ -291,25 +316,23 @@ int32_t FileIOResource::RequestOSFileHandle( return PP_OK_COMPLETIONPENDING; } -int32_t FileIOResource::WillWrite(int64_t offset, - int32_t bytes_to_write, - scoped_refptr<TrackedCallback> callback) { - Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER, - PpapiHostMsg_FileIO_WillWrite(offset, bytes_to_write), - base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this, callback)); - - state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); - return PP_OK_COMPLETIONPENDING; +FileIOResource::FileHandleHolder::FileHandleHolder(PP_FileHandle file_handle) + : raw_handle_(file_handle) { } -int32_t FileIOResource::WillSetLength(int64_t length, - scoped_refptr<TrackedCallback> callback) { - Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER, - PpapiHostMsg_FileIO_WillSetLength(length), - base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this, callback)); +// static +bool FileIOResource::FileHandleHolder::IsValid( + const scoped_refptr<FileIOResource::FileHandleHolder>& handle) { + return handle && (handle->raw_handle() != base::kInvalidPlatformFileValue); +} - state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); - return PP_OK_COMPLETIONPENDING; +FileIOResource::FileHandleHolder::~FileHandleHolder() { + if (raw_handle_ != base::kInvalidPlatformFileValue) { + base::TaskRunner* file_task_runner = + PpapiGlobals::Get()->GetFileTaskRunner(); + file_task_runner->PostTask(FROM_HERE, + base::Bind(&DoClose, raw_handle_)); + } } int32_t FileIOResource::ReadValidated(int64_t offset, @@ -318,27 +341,36 @@ int32_t FileIOResource::ReadValidated(int64_t offset, scoped_refptr<TrackedCallback> callback) { if (bytes_to_read < 0) return PP_ERROR_FAILED; - if (file_handle_ == base::kInvalidPlatformFileValue) + if (!FileHandleHolder::IsValid(file_handle_)) return PP_ERROR_FAILED; state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_READ); - bytes_to_read = std::min(bytes_to_read, kMaxReadSize); - scoped_refptr<ReadOp> read_op( - new ReadOp(file_handle_, offset, bytes_to_read)); + bytes_to_read = std::min(bytes_to_read, kMaxReadWriteSize); if (callback->is_blocking()) { - int32_t result; - { + char* buffer = static_cast<char*>( + array_output.GetDataBuffer(array_output.user_data, bytes_to_read, 1)); + int32_t result = PP_ERROR_FAILED; + // The plugin could release its reference to this instance when we release + // the proxy lock below. + scoped_refptr<FileIOResource> protect(this); + if (buffer) { // Release the proxy lock while making a potentially slow file call. ProxyAutoUnlock unlock; - result = read_op->DoWork(); + result = base::ReadPlatformFile( + file_handle_->raw_handle(), offset, buffer, bytes_to_read); + if (result < 0) + result = PP_ERROR_FAILED; } - return OnReadComplete(read_op, array_output, result); + state_manager_.SetOperationFinished(); + return result; } // For the non-blocking case, post a task to the file thread. + scoped_refptr<ReadOp> read_op( + new ReadOp(file_handle_, offset, bytes_to_read)); base::PostTaskAndReplyWithResult( - PpapiGlobals::Get()->GetFileTaskRunner(pp_instance()), + PpapiGlobals::Get()->GetFileTaskRunner(), FROM_HERE, Bind(&FileIOResource::ReadOp::DoWork, read_op), RunWhileLocked(Bind(&TrackedCallback::Run, callback))); @@ -348,18 +380,6 @@ int32_t FileIOResource::ReadValidated(int64_t offset, return PP_OK_COMPLETIONPENDING; } -void FileIOResource::CloseFileHandle() { - if (file_handle_ != base::kInvalidPlatformFileValue) { - // Close our local fd on the file thread. - base::TaskRunner* file_task_runner = - PpapiGlobals::Get()->GetFileTaskRunner(pp_instance()); - file_task_runner->PostTask(FROM_HERE, - base::Bind(&DoClose, file_handle_)); - - file_handle_ = base::kInvalidPlatformFileValue; - } -} - int32_t FileIOResource::OnQueryComplete(scoped_refptr<QueryOp> query_op, PP_FileInfo* info, int32_t result) { @@ -422,8 +442,10 @@ void FileIOResource::OnPluginMsgOpenFileComplete( int32_t result = params.result(); IPC::PlatformFileForTransit transit_file; - if ((result == PP_OK) && params.TakeFileHandleAtIndex(0, &transit_file)) - file_handle_ = IPC::PlatformFileForTransitToPlatformFile(transit_file); + if ((result == PP_OK) && params.TakeFileHandleAtIndex(0, &transit_file)) { + file_handle_ = new FileHandleHolder( + IPC::PlatformFileForTransitToPlatformFile(transit_file)); + } // End this operation now, so the user's callback can execute another FileIO // operation, assuming there are no other pending operations. state_manager_.SetOperationFinished(); diff --git a/chromium/ppapi/proxy/file_io_resource.h b/chromium/ppapi/proxy/file_io_resource.h index 26c4abb9488..bfdf24fb602 100644 --- a/chromium/ppapi/proxy/file_io_resource.h +++ b/chromium/ppapi/proxy/file_io_resource.h @@ -7,6 +7,7 @@ #include <string> +#include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "ppapi/c/private/pp_file_handle.h" #include "ppapi/proxy/connection.h" @@ -14,6 +15,7 @@ #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/shared_impl/file_io_state_manager.h" #include "ppapi/shared_impl/resource.h" +#include "ppapi/shared_impl/scoped_pp_resource.h" #include "ppapi/thunk/ppb_file_io_api.h" namespace ppapi { @@ -57,22 +59,48 @@ class PPAPI_PROXY_EXPORT FileIOResource scoped_refptr<TrackedCallback> callback) OVERRIDE; 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; - virtual int32_t WillSetLength( - int64_t length, - scoped_refptr<TrackedCallback> callback) OVERRIDE; private: + // FileHandleHolder is used to guarantee that file operations will have a + // valid FD to operate on, even if they're in a different thread. + // If instead we just passed the raw FD, the FD could be closed before the + // file operation has a chance to run. It could interact with an invalid FD, + // or worse, the FD value could be reused if another file is opened quickly + // (POSIX is required to provide the lowest available value when opening a + // file). This could result in strange problems such as writing data to the + // wrong file. + // + // Operations that run on a background thread should hold one of these to + // ensure they have a valid file descriptor. The file handle is only closed + // when the last reference to the FileHandleHolder is removed, so we are + // guaranteed to operate on the correct file descriptor. It *is* still + // possible that the FileIOResource will be destroyed and "Abort" callbacks + // just before the operation does its task (e.g., Reading). In that case, we + // might for example Read from a file even though the FileIO has been + // destroyed and the plugin's callback got a PP_ERROR_ABORTED result. In the + // case of a write, we could write some data to the file despite the plugin + // receiving a PP_ERROR_ABORTED instead of a successful result. + class FileHandleHolder : public base::RefCountedThreadSafe<FileHandleHolder> { + public: + explicit FileHandleHolder(PP_FileHandle file_handle_); + PP_FileHandle raw_handle() { + return raw_handle_; + } + static bool IsValid( + const scoped_refptr<FileIOResource::FileHandleHolder>& handle); + private: + friend class base::RefCountedThreadSafe<FileHandleHolder>; + ~FileHandleHolder(); + PP_FileHandle raw_handle_; + }; + // Class to perform file query operations across multiple threads. class QueryOp : public base::RefCountedThreadSafe<QueryOp> { public: - explicit QueryOp(PP_FileHandle file_handle); + explicit QueryOp(scoped_refptr<FileHandleHolder> file_handle); // Queries the file. Called on the file thread (non-blocking) or the plugin // thread (blocking). This should not be called when we hold the proxy lock. @@ -84,14 +112,16 @@ class PPAPI_PROXY_EXPORT FileIOResource friend class base::RefCountedThreadSafe<QueryOp>; ~QueryOp(); - PP_FileHandle file_handle_; + scoped_refptr<FileHandleHolder> file_handle_; base::PlatformFileInfo file_info_; }; // Class to perform file read operations across multiple threads. class ReadOp : public base::RefCountedThreadSafe<ReadOp> { public: - ReadOp(PP_FileHandle file_handle, int64_t offset, int32_t bytes_to_read); + ReadOp(scoped_refptr<FileHandleHolder> file_handle, + int64_t offset, + int32_t bytes_to_read); // Reads the file. Called on the file thread (non-blocking) or the plugin // thread (blocking). This should not be called when we hold the proxy lock. @@ -103,7 +133,7 @@ class PPAPI_PROXY_EXPORT FileIOResource friend class base::RefCountedThreadSafe<ReadOp>; ~ReadOp(); - PP_FileHandle file_handle_; + scoped_refptr<FileHandleHolder> file_handle_; int64_t offset_; int32_t bytes_to_read_; scoped_ptr<char[]> buffer_; @@ -114,9 +144,6 @@ class PPAPI_PROXY_EXPORT FileIOResource const PP_ArrayOutput& array_output, scoped_refptr<TrackedCallback> callback); - void CloseFileHandle(); - - // Completion tasks for file operations that are done in the plugin. int32_t OnQueryComplete(scoped_refptr<QueryOp> query_op, PP_FileInfo* info, @@ -135,8 +162,10 @@ class PPAPI_PROXY_EXPORT FileIOResource PP_FileHandle* output_handle, const ResourceMessageReplyParams& params); - PP_FileHandle file_handle_; + scoped_refptr<FileHandleHolder> file_handle_; PP_FileSystemType file_system_type_; + scoped_refptr<Resource> file_system_resource_; + bool called_close_; FileIOStateManager state_manager_; scoped_refptr<Resource> file_ref_; diff --git a/chromium/ppapi/proxy/file_system_resource.cc b/chromium/ppapi/proxy/file_system_resource.cc index bab771929ac..df8c3907751 100644 --- a/chromium/ppapi/proxy/file_system_resource.cc +++ b/chromium/ppapi/proxy/file_system_resource.cc @@ -21,14 +21,28 @@ FileSystemResource::FileSystemResource(Connection connection, : PluginResource(connection, instance), type_(type), called_open_(false), - callback_count_(0) { + callback_count_(0), + callback_result_(PP_OK) { DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID); - // TODO(teravest): Temporarily create hosts in both the browser and renderer - // while we move file related hosts to the browser. SendCreate(RENDERER, PpapiHostMsg_FileSystem_Create(type_)); SendCreate(BROWSER, PpapiHostMsg_FileSystem_Create(type_)); } +FileSystemResource::FileSystemResource(Connection connection, + PP_Instance instance, + int pending_renderer_id, + int pending_browser_id, + PP_FileSystemType type) + : PluginResource(connection, instance), + type_(type), + called_open_(true), + callback_count_(0), + callback_result_(PP_OK) { + DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID); + AttachToPendingHost(RENDERER, pending_renderer_id); + AttachToPendingHost(BROWSER, pending_browser_id); +} + FileSystemResource::~FileSystemResource() { } @@ -62,6 +76,7 @@ PP_FileSystemType FileSystemResource::GetType() { int32_t FileSystemResource::InitIsolatedFileSystem( const std::string& fsid, + PP_IsolatedFileSystemType_Private type, const base::Callback<void(int32_t)>& callback) { // This call is mutually exclusive with Open() above, so we can reuse the // called_open state. @@ -71,12 +86,12 @@ int32_t FileSystemResource::InitIsolatedFileSystem( called_open_ = true; Call<PpapiPluginMsg_FileSystem_InitIsolatedFileSystemReply>(RENDERER, - PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid), + PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid, type), base::Bind(&FileSystemResource::InitIsolatedFileSystemComplete, this, callback)); Call<PpapiPluginMsg_FileSystem_InitIsolatedFileSystemReply>(BROWSER, - PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid), + PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid, type), base::Bind(&FileSystemResource::InitIsolatedFileSystemComplete, this, callback)); @@ -87,18 +102,24 @@ void FileSystemResource::OpenComplete( scoped_refptr<TrackedCallback> callback, const ResourceMessageReplyParams& params) { ++callback_count_; + // Prioritize worse result since only one status can be returned. + if (params.result() != PP_OK) + callback_result_ = params.result(); // Received callback from browser and renderer. if (callback_count_ == 2) - callback->Run(params.result()); + callback->Run(callback_result_); } void FileSystemResource::InitIsolatedFileSystemComplete( const base::Callback<void(int32_t)>& callback, const ResourceMessageReplyParams& params) { ++callback_count_; + // Prioritize worse result since only one status can be returned. + if (params.result() != PP_OK) + callback_result_ = params.result(); // Received callback from browser and renderer. if (callback_count_ == 2) - callback.Run(params.result()); + callback.Run(callback_result_); } } // namespace proxy diff --git a/chromium/ppapi/proxy/file_system_resource.h b/chromium/ppapi/proxy/file_system_resource.h index 74677f724ed..9029583c819 100644 --- a/chromium/ppapi/proxy/file_system_resource.h +++ b/chromium/ppapi/proxy/file_system_resource.h @@ -9,6 +9,7 @@ #include "base/memory/ref_counted.h" #include "ppapi/c/pp_file_info.h" +#include "ppapi/c/private/ppb_isolated_file_system_private.h" #include "ppapi/proxy/connection.h" #include "ppapi/proxy/plugin_resource.h" #include "ppapi/proxy/ppapi_proxy_export.h" @@ -25,9 +26,19 @@ class PPAPI_PROXY_EXPORT FileSystemResource : public PluginResource, public NON_EXPORTED_BASE(thunk::PPB_FileSystem_API) { public: + // Creates a new FileSystemResource. The resource must be subsequently opened + // via Open() before use. FileSystemResource(Connection connection, PP_Instance instance, PP_FileSystemType type); + // Creates a FileSystemResource, attached to an existing pending host + // resource. The |pending_renderer_id| and |pending_browser_id| must be + // already-opened file systems. + FileSystemResource(Connection connection, + PP_Instance instance, + int pending_renderer_id, + int pending_browser_id, + PP_FileSystemType type); virtual ~FileSystemResource(); // Resource overrides. @@ -39,6 +50,7 @@ class PPAPI_PROXY_EXPORT FileSystemResource virtual PP_FileSystemType GetType() OVERRIDE; int32_t InitIsolatedFileSystem(const std::string& fsid, + PP_IsolatedFileSystemType_Private type, const base::Callback<void(int32_t)>& callback); private: // Called when the host has responded to our open request. @@ -53,6 +65,7 @@ class PPAPI_PROXY_EXPORT FileSystemResource PP_FileSystemType type_; bool called_open_; uint32_t callback_count_; + int32_t callback_result_; DISALLOW_COPY_AND_ASSIGN(FileSystemResource); }; diff --git a/chromium/ppapi/proxy/flash_drm_resource.cc b/chromium/ppapi/proxy/flash_drm_resource.cc index 889aa72b457..8c80c5912b1 100644 --- a/chromium/ppapi/proxy/flash_drm_resource.cc +++ b/chromium/ppapi/proxy/flash_drm_resource.cc @@ -71,6 +71,22 @@ int32_t FlashDRMResource::GetVoucherFile( return PP_OK_COMPLETIONPENDING; } +int32_t FlashDRMResource::MonitorIsExternal( + PP_Bool* is_external, + scoped_refptr<TrackedCallback> callback) { + if (!is_external) + return PP_ERROR_BADARGUMENT; + + *is_external = PP_FALSE; + + Call<PpapiPluginMsg_FlashDRM_MonitorIsExternalReply>( + BROWSER, + PpapiHostMsg_FlashDRM_MonitorIsExternal(), + base::Bind(&FlashDRMResource::OnPluginMsgMonitorIsExternalReply, this, + is_external, callback)); + return PP_OK_COMPLETIONPENDING; +} + void FlashDRMResource::OnPluginMsgGetDeviceIDReply( PP_Var* dest, scoped_refptr<TrackedCallback> callback, @@ -99,5 +115,17 @@ void FlashDRMResource::OnPluginMsgGetVoucherFileReply( } } +void FlashDRMResource::OnPluginMsgMonitorIsExternalReply( + PP_Bool* dest, + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params, + PP_Bool is_external) { + if (TrackedCallback::IsPending(callback)) { + if (params.result() == PP_OK) + *dest = is_external; + callback->Run(params.result()); + } +} + } // namespace proxy } // namespace ppapi diff --git a/chromium/ppapi/proxy/flash_drm_resource.h b/chromium/ppapi/proxy/flash_drm_resource.h index 9a4b31c941d..dd2b599c1c2 100644 --- a/chromium/ppapi/proxy/flash_drm_resource.h +++ b/chromium/ppapi/proxy/flash_drm_resource.h @@ -35,6 +35,9 @@ class FlashDRMResource virtual int32_t GetVoucherFile( PP_Resource* file_ref, scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual int32_t MonitorIsExternal( + PP_Bool* is_external, + scoped_refptr<TrackedCallback> callback) OVERRIDE; private: void OnPluginMsgGetDeviceIDReply(PP_Var* dest, @@ -45,6 +48,11 @@ class FlashDRMResource scoped_refptr<TrackedCallback> callback, const ResourceMessageReplyParams& params, const FileRefCreateInfo& file_info); + void OnPluginMsgMonitorIsExternalReply( + PP_Bool* dest, + scoped_refptr<TrackedCallback> callback, + const ResourceMessageReplyParams& params, + PP_Bool is_external); DISALLOW_COPY_AND_ASSIGN(FlashDRMResource); }; diff --git a/chromium/ppapi/proxy/graphics_2d_resource.cc b/chromium/ppapi/proxy/graphics_2d_resource.cc index 3bad2e4e13c..f545364f1e7 100644 --- a/chromium/ppapi/proxy/graphics_2d_resource.cc +++ b/chromium/ppapi/proxy/graphics_2d_resource.cc @@ -11,6 +11,7 @@ #include "ppapi/c/pp_size.h" #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/proxy/dispatch_reply_message.h" +#include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/resource_tracker.h" @@ -111,6 +112,15 @@ float Graphics2DResource::GetScale() { return scale_; } +void Graphics2DResource::SetOffset(const PP_Point* offset) { + Post(RENDERER, PpapiHostMsg_Graphics2D_SetOffset(*offset)); +} + +void Graphics2DResource::SetResizeMode( + PP_Graphics2D_Dev_ResizeMode resize_mode) { + Post(RENDERER, PpapiHostMsg_Graphics2D_SetResizeMode(resize_mode)); +} + 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). @@ -121,9 +131,20 @@ int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. current_flush_callback_ = callback; + // Send the current view data with the Flush() message. This allows the + // renderer to know what the plugin's view of the renderer is at the time + // Flush was called. + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( + pp_instance()); + ppapi::ViewData view_data; + if (dispatcher) { + InstanceData* data = dispatcher->GetInstanceData(pp_instance()); + if (data) + view_data = data->view; + } Call<PpapiPluginMsg_Graphics2D_FlushAck>( RENDERER, - PpapiHostMsg_Graphics2D_Flush(), + PpapiHostMsg_Graphics2D_Flush(view_data), base::Bind(&Graphics2DResource::OnPluginMsgFlushACK, this)); return PP_OK_COMPLETIONPENDING; } diff --git a/chromium/ppapi/proxy/graphics_2d_resource.h b/chromium/ppapi/proxy/graphics_2d_resource.h index b7ec30c710d..93d182b65a5 100644 --- a/chromium/ppapi/proxy/graphics_2d_resource.h +++ b/chromium/ppapi/proxy/graphics_2d_resource.h @@ -40,6 +40,8 @@ class PPAPI_PROXY_EXPORT Graphics2DResource virtual void ReplaceContents(PP_Resource image_data) OVERRIDE; virtual PP_Bool SetScale(float scale) OVERRIDE; virtual float GetScale() OVERRIDE; + virtual void SetOffset(const PP_Point* offset) OVERRIDE; + virtual void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) 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/chromium/ppapi/proxy/handle_converter.cc b/chromium/ppapi/proxy/handle_converter.cc deleted file mode 100644 index 534a8ae5945..00000000000 --- a/chromium/ppapi/proxy/handle_converter.cc +++ /dev/null @@ -1,285 +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/handle_converter.h" - -#include <vector> -#include "base/bind.h" -#include "ipc/ipc_message.h" -#include "ipc/ipc_message_macros.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/resource_message_params.h" -#include "ppapi/proxy/serialized_handle.h" -#include "ppapi/proxy/serialized_var.h" - -class NaClDescImcShm; - -namespace IPC { -class Message; -} - -namespace { - -void WriteHandle(int handle_index, - const ppapi::proxy::SerializedHandle& handle, - IPC::Message* message) { - ppapi::proxy::SerializedHandle::WriteHeader(handle.header(), message); - - // Now write the handle itself in POSIX style. - message->WriteBool(true); // valid == true - message->WriteInt(handle_index); -} - -typedef std::vector<ppapi::proxy::SerializedHandle> Handles; - -// We define overloads for catching SerializedHandles so that we can share -// them correctly to the untrusted side. -// See ConvertHandlesImpl for how these get used. -void ConvertHandlesInParam(const ppapi::proxy::SerializedHandle& handle, - Handles* handles, - IPC::Message* msg, - int* handle_index) { - handles->push_back(handle); - if (msg) - 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) { - std::vector<ppapi::proxy::SerializedHandle*> var_handles = var.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.WriteDataToMessage(msg, base::Bind(&HandleWriter, handle_index)); -} - -// For PpapiMsg_ResourceReply and the reply to PpapiHostMsg_ResourceSyncCall, -// the handles are carried inside the ResourceMessageReplyParams. -// NOTE: We only translate handles from host->NaCl. The only kind of -// ResourceMessageParams that travels this direction is -// ResourceMessageReplyParams, so that's the only one we need to handle. -void ConvertHandlesInParam( - const ppapi::proxy::ResourceMessageReplyParams& params, - Handles* handles, - IPC::Message* msg, - int* handle_index) { - // First, if we need to rewrite the message parameters, write everything - // before the handles (there's nothing after the handles). - if (msg) { - params.WriteReplyHeader(msg); - // IPC writes the vector length as an int before the contents of the - // vector. - msg->WriteInt(static_cast<int>(params.handles().size())); - } - for (Handles::const_iterator iter = params.handles().begin(); - iter != params.handles().end(); - ++iter) { - // ConvertHandle will write each handle to |msg|, if necessary. - ConvertHandlesInParam(*iter, handles, msg, handle_index); - } - // Tell ResourceMessageReplyParams that we have taken the handles, so it - // shouldn't close them. The NaCl runtime will take ownership of them. - params.ConsumeHandles(); -} - -// This overload is to catch all types other than SerializedHandle or -// ResourceMessageReplyParams. On Windows, |msg| will be a valid pointer, and we -// must write |param| to it. -template <class T> -void ConvertHandlesInParam(const T& param, - Handles* /* handles */, - IPC::Message* msg, - int* /* handle_index */) { - // It's not a handle, so just write to the output message, if necessary. - if (msg) - IPC::WriteParam(msg, param); -} - -// These just break apart the given tuple and run ConvertHandle over each param. -// The idea is to extract any handles in the tuple, while writing all data to -// msg (if msg is valid). The msg will only be valid on Windows, where we need -// to re-write all of the message parameters, writing the handles in POSIX style -// for NaCl. -template <class A> -void ConvertHandlesImpl(const Tuple1<A>& t1, Handles* handles, - IPC::Message* msg) { - int handle_index = 0; - ConvertHandlesInParam(t1.a, handles, msg, &handle_index); -} -template <class A, class B> -void ConvertHandlesImpl(const Tuple2<A, B>& t1, Handles* handles, - IPC::Message* msg) { - int handle_index = 0; - ConvertHandlesInParam(t1.a, handles, msg, &handle_index); - ConvertHandlesInParam(t1.b, handles, msg, &handle_index); -} -template <class A, class B, class C> -void ConvertHandlesImpl(const Tuple3<A, B, C>& t1, Handles* handles, - IPC::Message* msg) { - int handle_index = 0; - ConvertHandlesInParam(t1.a, handles, msg, &handle_index); - ConvertHandlesInParam(t1.b, handles, msg, &handle_index); - ConvertHandlesInParam(t1.c, handles, msg, &handle_index); -} -template <class A, class B, class C, class D> -void ConvertHandlesImpl(const Tuple4<A, B, C, D>& t1, Handles* handles, - IPC::Message* msg) { - int handle_index = 0; - ConvertHandlesInParam(t1.a, handles, msg, &handle_index); - ConvertHandlesInParam(t1.b, handles, msg, &handle_index); - ConvertHandlesInParam(t1.c, handles, msg, &handle_index); - ConvertHandlesInParam(t1.d, handles, msg, &handle_index); -} - -template <class MessageType> -class HandleConverterImpl { - public: - explicit HandleConverterImpl(const IPC::Message* msg) - : msg_(static_cast<const MessageType*>(msg)) { - } - bool ConvertMessage(Handles* handles, IPC::Message* out_msg) { - typename TupleTypes<typename MessageType::Schema::Param>::ValueTuple params; - if (!MessageType::Read(msg_, ¶ms)) - return false; - ConvertHandlesImpl(params, handles, out_msg); - return true; - } - - bool ConvertReply(Handles* handles, IPC::SyncMessage* out_msg) { - typename TupleTypes<typename MessageType::Schema::ReplyParam>::ValueTuple - params; - if (!MessageType::ReadReplyParam(msg_, ¶ms)) - return false; - // If we need to rewrite the message (i.e., on Windows), we need to make - // sure we write the message id first. - if (out_msg) { - out_msg->set_reply(); - int id = IPC::SyncMessage::GetMessageId(*msg_); - out_msg->WriteInt(id); - } - ConvertHandlesImpl(params, handles, out_msg); - return true; - } - // TODO(dmichael): Add ConvertSyncMessage for outgoing sync messages, if we - // ever pass handles in one of those. - - private: - const MessageType* msg_; -}; - -} // namespace - -#define CASE_FOR_MESSAGE(MESSAGE_TYPE) \ - case MESSAGE_TYPE::ID: { \ - HandleConverterImpl<MESSAGE_TYPE> extractor(&msg); \ - if (!extractor.ConvertMessage(handles, new_msg_ptr->get())) \ - return false; \ - break; \ - } -#define CASE_FOR_REPLY(MESSAGE_TYPE) \ - case MESSAGE_TYPE::ID: { \ - HandleConverterImpl<MESSAGE_TYPE> extractor(&msg); \ - if (!extractor.ConvertReply( \ - handles, \ - static_cast<IPC::SyncMessage*>(new_msg_ptr->get()))) \ - return false; \ - break; \ - } - -namespace ppapi { -namespace proxy { - -class SerializedHandle; - -HandleConverter::HandleConverter() { -} - -bool HandleConverter::ConvertNativeHandlesToPosix( - const IPC::Message& msg, - std::vector<SerializedHandle>* handles, - scoped_ptr<IPC::Message>* new_msg_ptr) { - DCHECK(handles); - DCHECK(new_msg_ptr); - DCHECK(!new_msg_ptr->get()); - - // In Windows, we need to re-write the contents of the message. This is - // because in Windows IPC code, native HANDLE values are serialized in the - // body of the message. - // - // In POSIX, we only serialize an index in to a FileDescriptorSet, and the - // actual file descriptors are sent out-of-band. So on Windows, to make a - // message that's compatible with Windows, we need to write a new message that - // has simple indices in the message body instead of the HANDLEs. - // - // NOTE: This means on Windows, new_msg_ptr's serialized contents are not - // compatible with Windows IPC deserialization code; it is intended to be - // passed to NaCl. -#if defined(OS_WIN) - new_msg_ptr->reset( - new IPC::Message(msg.routing_id(), msg.type(), msg.priority())); -#else - // Even on POSIX, we have to rewrite messages to create channels, because - // these contain a handle with an invalid (place holder) descriptor. The - // message sending code sees this and doesn't pass the descriptor over - // correctly. - if (msg.type() == PpapiMsg_CreateNaClChannel::ID) { - new_msg_ptr->reset( - new IPC::Message(msg.routing_id(), msg.type(), msg.priority())); - } -#endif - - switch (msg.type()) { - CASE_FOR_MESSAGE(PpapiMsg_CreateNaClChannel) - CASE_FOR_MESSAGE(PpapiMsg_PPBAudio_NotifyAudioStreamCreated) - CASE_FOR_MESSAGE(PpapiMsg_PPPMessaging_HandleMessage) - CASE_FOR_MESSAGE(PpapiPluginMsg_ResourceReply) - case IPC_REPLY_ID: { - int id = IPC::SyncMessage::GetMessageId(msg); - PendingSyncMsgMap::iterator iter(pending_sync_msgs_.find(id)); - if (iter == pending_sync_msgs_.end()) { - NOTREACHED(); - return false; - } - uint32_t type = iter->second; - pending_sync_msgs_.erase(iter); - switch (type) { - CASE_FOR_REPLY(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer) - CASE_FOR_REPLY(PpapiHostMsg_PPBImageData_CreateSimple) - CASE_FOR_REPLY(PpapiHostMsg_ResourceSyncCall) - CASE_FOR_REPLY(PpapiHostMsg_SharedMemory_CreateSharedMemory) - default: - // Do nothing for messages we don't know. - break; - } - break; - } - default: - // Do nothing for messages we don't know. - break; - } - return true; -} - -void HandleConverter::RegisterSyncMessageForReply(const IPC::Message& msg) { - DCHECK(msg.is_sync()); - - int msg_id = IPC::SyncMessage::GetMessageId(msg); - DCHECK(pending_sync_msgs_.find(msg_id) == pending_sync_msgs_.end()); - - pending_sync_msgs_[msg_id] = msg.type(); -} - -} // namespace proxy -} // namespace ppapi diff --git a/chromium/ppapi/proxy/handle_converter.h b/chromium/ppapi/proxy/handle_converter.h deleted file mode 100644 index 456ee8db71c..00000000000 --- a/chromium/ppapi/proxy/handle_converter.h +++ /dev/null @@ -1,62 +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_HANDLE_CONVERTER_H_ -#define PPAPI_PROXY_HANDLE_CONVERTER_H_ - -#include <map> -#include <vector> - -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "ppapi/proxy/ppapi_proxy_export.h" - -namespace IPC { -class Message; -} - -namespace ppapi { -namespace proxy { - -class SerializedHandle; - -class PPAPI_PROXY_EXPORT HandleConverter { - public: - HandleConverter(); - - // Convert the native handles in |msg| to NaCl style. - // In some cases (e.g., Windows), we need to re-write the contents of the - // message; in those cases, |new_msg_ptr| will be set to the new message. - // If |msg| is already in a good form for NaCl, |new_msg_ptr| is left NULL. - // See the explanation in the body of the method. - // - // In either case, all the handles in |msg| are extracted into |handles| so - // that they can be converted to NaClDesc handles. - // See chrome/nacl/nacl_ipc_adapter.cc for where this gets used. - bool ConvertNativeHandlesToPosix(const IPC::Message& msg, - std::vector<SerializedHandle>* handles, - scoped_ptr<IPC::Message>* new_msg_ptr); - - // This method informs HandleConverter that a sync message is being sent so - // that it can associate reply messages with their type. - // - // Users of HandleConverter must call this when they send a synchronous - // message, otherwise HandleConverter won't be able to convert handles in - // replies. - void RegisterSyncMessageForReply(const IPC::Message& msg); - - private: - // When we send a synchronous message (from untrusted to trusted), we store - // its type here, so that later we can associate the reply with its type - // and potentially translate handles in the message. - typedef std::map<int, uint32> PendingSyncMsgMap; - PendingSyncMsgMap pending_sync_msgs_; - - DISALLOW_COPY_AND_ASSIGN(HandleConverter); -}; - -} // namespace proxy -} // namespace ppapi - -#endif // PPAPI_PROXY_HANDLE_CONVERTER_H_ diff --git a/chromium/ppapi/proxy/interface_list.cc b/chromium/ppapi/proxy/interface_list.cc index 9c810a350ce..8b05f7ace99 100644 --- a/chromium/ppapi/proxy/interface_list.cc +++ b/chromium/ppapi/proxy/interface_list.cc @@ -6,6 +6,7 @@ #include "base/lazy_instance.h" #include "base/memory/singleton.h" +#include "ppapi/c/dev/ppb_alarms_dev.h" #include "ppapi/c/dev/ppb_audio_input_dev.h" #include "ppapi/c/dev/ppb_buffer_dev.h" #include "ppapi/c/dev/ppb_char_set_dev.h" @@ -21,15 +22,14 @@ #include "ppapi/c/dev/ppb_opengles2ext_dev.h" #include "ppapi/c/dev/ppb_printing_dev.h" #include "ppapi/c/dev/ppb_resource_array_dev.h" -#include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_text_input_dev.h" #include "ppapi/c/dev/ppb_trace_event_dev.h" #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" +#include "ppapi/c/dev/ppb_var_resource_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" @@ -80,12 +80,15 @@ #include "ppapi/c/private/ppb_flash_message_loop.h" #include "ppapi/c/private/ppb_flash_print.h" #include "ppapi/c/private/ppb_host_resolver_private.h" +#include "ppapi/c/private/ppb_isolated_file_system_private.h" #include "ppapi/c/private/ppb_net_address_private.h" +#include "ppapi/c/private/ppb_output_protection_private.h" #include "ppapi/c/private/ppb_pdf.h" #include "ppapi/c/private/ppb_platform_verification_private.h" #include "ppapi/c/private/ppb_talk_private.h" #include "ppapi/c/private/ppb_tcp_server_socket_private.h" #include "ppapi/c/private/ppb_tcp_socket_private.h" +#include "ppapi/c/private/ppb_testing_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" @@ -95,7 +98,6 @@ #include "ppapi/c/trusted/ppb_browser_font_trusted.h" #include "ppapi/c/trusted/ppb_char_set_trusted.h" #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" -#include "ppapi/c/trusted/ppb_file_io_trusted.h" #include "ppapi/c/trusted/ppb_url_loader_trusted.h" #include "ppapi/proxy/interface_proxy.h" #include "ppapi/proxy/ppb_audio_proxy.h" @@ -163,6 +165,7 @@ InterfaceProxy* ProxyFactory(Dispatcher* dispatcher) { } base::LazyInstance<PpapiPermissions> g_process_global_permissions; +base::LazyInstance<bool> g_supports_dev_channel; } // namespace @@ -187,7 +190,6 @@ InterfaceList::InterfaceList() { #include "ppapi/thunk/interfaces_ppb_private_no_permissions.h" #include "ppapi/thunk/interfaces_ppb_public_stable.h" } - { Permission current_required_permission = PERMISSION_DEV; #include "ppapi/thunk/interfaces_ppb_public_dev.h" @@ -203,6 +205,8 @@ InterfaceList::InterfaceList() { #endif // !defined(OS_NACL) } + // TODO(teravest): Add dev channel interfaces here. + #undef PROXIED_API #undef PROXIED_IFACE @@ -246,8 +250,14 @@ InterfaceList::InterfaceList() { // PPB (browser) interfaces. // Do not add more stuff here, they should be added to interface_list*.h // TODO(brettw) remove these. - AddPPB(PPB_Instance_Proxy::GetInfoPrivate(), PERMISSION_PRIVATE); - AddPPB(PPB_Var_Deprecated_Proxy::GetInfo(), PERMISSION_DEV); + AddProxy(API_ID_PPB_INSTANCE_PRIVATE, &ProxyFactory<PPB_Instance_Proxy>); + AddPPB(PPB_INSTANCE_PRIVATE_INTERFACE_0_1, API_ID_PPB_INSTANCE_PRIVATE, + thunk::GetPPB_Instance_Private_0_1_Thunk(), + PERMISSION_PRIVATE); + + AddProxy(API_ID_PPB_VAR_DEPRECATED, &ProxyFactory<PPB_Var_Deprecated_Proxy>); + AddPPB(PPB_VAR_DEPRECATED_INTERFACE, API_ID_PPB_VAR_DEPRECATED, + PPB_Var_Deprecated_Proxy::GetProxyInterface(), PERMISSION_DEV); // TODO(tomfinegan): Figure out where to put these once we refactor things // to load the PPP interface struct from the PPB interface. @@ -257,7 +267,9 @@ InterfaceList::InterfaceList() { API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, PPP_ContentDecryptor_Private_Proxy::GetProxyInterface()); #endif - AddPPB(PPB_Testing_Proxy::GetInfo(), PERMISSION_TESTING); + AddProxy(API_ID_PPB_TESTING, &ProxyFactory<PPB_Testing_Proxy>); + AddPPB(PPB_TESTING_PRIVATE_INTERFACE, API_ID_PPB_TESTING, + PPB_Testing_Proxy::GetProxyInterface(), PERMISSION_TESTING); // PPP (plugin) interfaces. // TODO(brettw) move these to interface_list*.h @@ -300,6 +312,12 @@ void InterfaceList::SetProcessGlobalPermissions( g_process_global_permissions.Get() = permissions; } +// static +void InterfaceList::SetSupportsDevChannel( + bool supports_dev_channel) { + g_supports_dev_channel.Get() = supports_dev_channel; +} + ApiID InterfaceList::GetIDForPPBInterface(const std::string& name) const { NameToInterfaceInfoMap::const_iterator found = name_to_browser_info_.find(name); @@ -330,6 +348,8 @@ const void* InterfaceList::GetInterfaceForPPB(const std::string& name) const { if (found == name_to_browser_info_.end()) return NULL; + // Dev channel checking goes here. + if (g_process_global_permissions.Get().HasPermission( found->second.required_permission)) return found->second.iface; @@ -375,11 +395,6 @@ void InterfaceList::AddPPP(const char* name, name_to_plugin_info_[name] = InterfaceInfo(id, iface, PERMISSION_NONE); } -void InterfaceList::AddPPB(const InterfaceProxy::Info* info, Permission perm) { - AddProxy(info->id, info->create_proxy); - AddPPB(info->name, info->id, info->interface_ptr, perm); -} - void InterfaceList::AddPPP(const InterfaceProxy::Info* info) { AddProxy(info->id, info->create_proxy); AddPPP(info->name, info->id, info->interface_ptr); diff --git a/chromium/ppapi/proxy/interface_list.h b/chromium/ppapi/proxy/interface_list.h index 9ef91dcc1f9..78064170d1c 100644 --- a/chromium/ppapi/proxy/interface_list.h +++ b/chromium/ppapi/proxy/interface_list.h @@ -35,6 +35,8 @@ class InterfaceList { // using to keep honest plugins honest. static PPAPI_PROXY_EXPORT void SetProcessGlobalPermissions( const PpapiPermissions& permissions); + static PPAPI_PROXY_EXPORT void SetSupportsDevChannel( + bool supports_dev_channel); // Looks up the ID for the given interface name. Returns API_ID_NONE if // the interface string is not found. @@ -85,7 +87,6 @@ class InterfaceList { // Old-style add functions. These should be removed when the rest of the // proxies are converted over to using the new system. - void AddPPB(const InterfaceProxy::Info* info, Permission perm); void AddPPP(const InterfaceProxy::Info* info); PpapiPermissions permissions_; diff --git a/chromium/ppapi/proxy/ext_crx_file_system_private_resource.cc b/chromium/ppapi/proxy/isolated_file_system_private_resource.cc index be4c3f7bbd5..756bdb7bd6c 100644 --- a/chromium/ppapi/proxy/ext_crx_file_system_private_resource.cc +++ b/chromium/ppapi/proxy/isolated_file_system_private_resource.cc @@ -1,10 +1,11 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/proxy/ext_crx_file_system_private_resource.h" +#include "ppapi/proxy/isolated_file_system_private_resource.h" #include "base/bind.h" +#include "base/logging.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_file_info.h" #include "ppapi/proxy/file_system_resource.h" @@ -24,40 +25,37 @@ void RunTrackedCallback(scoped_refptr<TrackedCallback> callback, } } // namespace -ExtCrxFileSystemPrivateResource::ExtCrxFileSystemPrivateResource( +IsolatedFileSystemPrivateResource::IsolatedFileSystemPrivateResource( Connection connection, PP_Instance instance) - : PluginResource(connection, instance), called_open_(false) { - SendCreate(BROWSER, PpapiHostMsg_Ext_CrxFileSystem_Create()); + : PluginResource(connection, instance) { + SendCreate(BROWSER, PpapiHostMsg_IsolatedFileSystem_Create()); } -ExtCrxFileSystemPrivateResource::~ExtCrxFileSystemPrivateResource() { +IsolatedFileSystemPrivateResource::~IsolatedFileSystemPrivateResource() { } -thunk::PPB_Ext_CrxFileSystem_Private_API* -ExtCrxFileSystemPrivateResource::AsPPB_Ext_CrxFileSystem_Private_API() { +thunk::PPB_IsolatedFileSystem_Private_API* +IsolatedFileSystemPrivateResource::AsPPB_IsolatedFileSystem_Private_API() { return this; } -int32_t ExtCrxFileSystemPrivateResource::Open( +int32_t IsolatedFileSystemPrivateResource::Open( PP_Instance /* unused */, + PP_IsolatedFileSystemType_Private type, PP_Resource* file_system_resource, scoped_refptr<TrackedCallback> callback) { - if (called_open_) - return PP_ERROR_FAILED; - called_open_ = true; - if (!file_system_resource) return PP_ERROR_BADARGUMENT; - Call<PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply>(BROWSER, - PpapiHostMsg_Ext_CrxFileSystem_BrowserOpen(), - base::Bind(&ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete, this, - file_system_resource, - callback)); + Call<PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply>(BROWSER, + PpapiHostMsg_IsolatedFileSystem_BrowserOpen(type), + base::Bind(&IsolatedFileSystemPrivateResource::OnBrowserOpenComplete, + this, type, file_system_resource, callback)); return PP_OK_COMPLETIONPENDING; } -void ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete( +void IsolatedFileSystemPrivateResource::OnBrowserOpenComplete( + PP_IsolatedFileSystemType_Private type, PP_Resource* file_system_resource, scoped_refptr<TrackedCallback> callback, const ResourceMessageReplyParams& params, @@ -75,7 +73,8 @@ void ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete( *file_system_resource = fs->GetReference(); if (*file_system_resource == 0) callback->Run(PP_ERROR_FAILED); - fs->InitIsolatedFileSystem(fsid, base::Bind(&RunTrackedCallback, callback)); + fs->InitIsolatedFileSystem( + fsid, type, base::Bind(&RunTrackedCallback, callback)); } } // namespace proxy diff --git a/chromium/ppapi/proxy/ext_crx_file_system_private_resource.h b/chromium/ppapi/proxy/isolated_file_system_private_resource.h index 5f2887a7181..6f3f5e6a5d8 100644 --- a/chromium/ppapi/proxy/ext_crx_file_system_private_resource.h +++ b/chromium/ppapi/proxy/isolated_file_system_private_resource.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -16,8 +16,8 @@ // Once the plugin receives the fsid, it creates a PPB_FileSystem and forwards // the fsid to PepperFileSystemHost in order to construct root url. -#ifndef PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_ -#define PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_ +#ifndef PPAPI_PROXY_ISOLATED_FILE_SYSTEM_PRIVATE_RESOURCE_H_ +#define PPAPI_PROXY_ISOLATED_FILE_SYSTEM_PRIVATE_RESOURCE_H_ #include <string> @@ -25,7 +25,7 @@ #include "ppapi/proxy/connection.h" #include "ppapi/proxy/plugin_resource.h" #include "ppapi/proxy/ppapi_proxy_export.h" -#include "ppapi/thunk/ppb_ext_crx_file_system_private_api.h" +#include "ppapi/thunk/ppb_isolated_file_system_private_api.h" namespace ppapi { @@ -35,34 +35,35 @@ namespace proxy { class ResourceMessageReplyParams; -class PPAPI_PROXY_EXPORT ExtCrxFileSystemPrivateResource +class PPAPI_PROXY_EXPORT IsolatedFileSystemPrivateResource : public PluginResource, - public thunk::PPB_Ext_CrxFileSystem_Private_API { + public thunk::PPB_IsolatedFileSystem_Private_API { public: - ExtCrxFileSystemPrivateResource(Connection connection, PP_Instance instance); - virtual ~ExtCrxFileSystemPrivateResource(); + IsolatedFileSystemPrivateResource( + Connection connection, PP_Instance instance); + virtual ~IsolatedFileSystemPrivateResource(); // Resource overrides. - virtual thunk::PPB_Ext_CrxFileSystem_Private_API* - AsPPB_Ext_CrxFileSystem_Private_API() OVERRIDE; + virtual thunk::PPB_IsolatedFileSystem_Private_API* + AsPPB_IsolatedFileSystem_Private_API() OVERRIDE; - // PPB_Ext_CrxFileSystem_Private_API implementation. + // PPB_IsolatedFileSystem_Private_API implementation. virtual int32_t Open(PP_Instance instance, + PP_IsolatedFileSystemType_Private type, PP_Resource* file_system_resource, scoped_refptr<TrackedCallback> callback) OVERRIDE; private: - void OnBrowserOpenComplete(PP_Resource* file_system_resource, + void OnBrowserOpenComplete(PP_IsolatedFileSystemType_Private type, + PP_Resource* file_system_resource, scoped_refptr<TrackedCallback> callback, const ResourceMessageReplyParams& params, const std::string& fsid); - bool called_open_; - - DISALLOW_COPY_AND_ASSIGN(ExtCrxFileSystemPrivateResource); + DISALLOW_COPY_AND_ASSIGN(IsolatedFileSystemPrivateResource); }; } // namespace proxy } // namespace ppapi -#endif // PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_ +#endif // PPAPI_PROXY_ISOLATED_FILE_SYSTEM_PRIVATE_RESOURCE_H_ diff --git a/chromium/ppapi/proxy/nacl_message_scanner.cc b/chromium/ppapi/proxy/nacl_message_scanner.cc new file mode 100644 index 00000000000..027975eb66c --- /dev/null +++ b/chromium/ppapi/proxy/nacl_message_scanner.cc @@ -0,0 +1,298 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/proxy/nacl_message_scanner.h" + +#include <vector> +#include "base/bind.h" +#include "ipc/ipc_message.h" +#include "ipc/ipc_message_macros.h" +#include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/proxy/resource_message_params.h" +#include "ppapi/proxy/serialized_handle.h" +#include "ppapi/proxy/serialized_var.h" + +class NaClDescImcShm; + +namespace IPC { +class Message; +} + +namespace { + +typedef std::vector<ppapi::proxy::SerializedHandle> Handles; + +struct ScanningResults { + ScanningResults() : handle_index(0) {} + + // Vector to hold handles found in the message. + Handles handles; + // Current handle index in the rewritten message. During the scan, it will be + // be less than or equal to handles.size(). After the scan it should be equal. + int handle_index; + // The rewritten message. This may be NULL, so all ScanParam overloads should + // check for NULL before writing to it. In some cases, a ScanParam overload + // may set this to NULL when it can determine that there are no parameters + // that need conversion. (See the ResourceMessageReplyParams overload.) + scoped_ptr<IPC::Message> new_msg; +}; + +void WriteHandle(int handle_index, + const ppapi::proxy::SerializedHandle& handle, + IPC::Message* msg) { + ppapi::proxy::SerializedHandle::WriteHeader(handle.header(), msg); + + // Now write the handle itself in POSIX style. + msg->WriteBool(true); // valid == true + msg->WriteInt(handle_index); +} + +// Define overloads for each kind of message parameter that requires special +// handling. See ScanTuple for how these get used. + +// Overload to match SerializedHandle. +void ScanParam(const ppapi::proxy::SerializedHandle& handle, + ScanningResults* results) { + results->handles.push_back(handle); + if (results->new_msg) + WriteHandle(results->handle_index++, handle, results->new_msg.get()); +} + +void HandleWriter(int* handle_index, + IPC::Message* m, + const ppapi::proxy::SerializedHandle& handle) { + WriteHandle((*handle_index)++, handle, m); +} + +// Overload to match SerializedVar, which can contain handles. +void ScanParam(const ppapi::proxy::SerializedVar& var, + ScanningResults* results) { + std::vector<ppapi::proxy::SerializedHandle*> var_handles = var.GetHandles(); + // Copy any handles and then rewrite the message. + for (size_t i = 0; i < var_handles.size(); ++i) + results->handles.push_back(*var_handles[i]); + if (results->new_msg) + var.WriteDataToMessage(results->new_msg.get(), + base::Bind(&HandleWriter, &results->handle_index)); +} + +// For PpapiMsg_ResourceReply and the reply to PpapiHostMsg_ResourceSyncCall, +// the handles are carried inside the ResourceMessageReplyParams. +// NOTE: We only intercept handles from host->NaCl. The only kind of +// ResourceMessageParams that travels this direction is +// ResourceMessageReplyParams, so that's the only one we need to handle. +void ScanParam(const ppapi::proxy::ResourceMessageReplyParams& params, + ScanningResults* results) { + // If the resource reply params don't contain handles, NULL the new message + // pointer to cancel further rewriting. + // NOTE: This works because only handles currently need rewriting, and we + // know at this point that this message has none. + if (params.handles().empty()) { + results->new_msg.reset(NULL); + return; + } + + // If we need to rewrite the message, write everything before the handles + // (there's nothing after the handles). + if (results->new_msg) { + params.WriteReplyHeader(results->new_msg.get()); + // IPC writes the vector length as an int before the contents of the + // vector. + results->new_msg->WriteInt(static_cast<int>(params.handles().size())); + } + for (Handles::const_iterator iter = params.handles().begin(); + iter != params.handles().end(); + ++iter) { + // ScanParam will write each handle to the new message, if necessary. + ScanParam(*iter, results); + } + // Tell ResourceMessageReplyParams that we have taken the handles, so it + // shouldn't close them. The NaCl runtime will take ownership of them. + params.ConsumeHandles(); +} + +// Overload to match all other types. If we need to rewrite the message, +// write the parameter. +template <class T> +void ScanParam(const T& param, ScanningResults* results) { + if (results->new_msg) + IPC::WriteParam(results->new_msg.get(), param); +} + +// These just break apart the given tuple and run ScanParam over each param. +// The idea is to scan elements in the tuple which require special handling, +// and write them into the |results| struct. +template <class A> +void ScanTuple(const Tuple1<A>& t1, ScanningResults* results) { + ScanParam(t1.a, results); +} +template <class A, class B> +void ScanTuple(const Tuple2<A, B>& t1, ScanningResults* results) { + ScanParam(t1.a, results); + ScanParam(t1.b, results); +} +template <class A, class B, class C> +void ScanTuple(const Tuple3<A, B, C>& t1, ScanningResults* results) { + ScanParam(t1.a, results); + ScanParam(t1.b, results); + ScanParam(t1.c, results); +} +template <class A, class B, class C, class D> +void ScanTuple(const Tuple4<A, B, C, D>& t1, ScanningResults* results) { + ScanParam(t1.a, results); + ScanParam(t1.b, results); + ScanParam(t1.c, results); + ScanParam(t1.d, results); +} + +template <class MessageType> +class MessageScannerImpl { + public: + explicit MessageScannerImpl(const IPC::Message* msg) + : msg_(static_cast<const MessageType*>(msg)) { + } + bool ScanMessage(ScanningResults* results) { + typename TupleTypes<typename MessageType::Schema::Param>::ValueTuple params; + if (!MessageType::Read(msg_, ¶ms)) + return false; + ScanTuple(params, results); + return true; + } + + bool ScanReply(ScanningResults* results) { + typename TupleTypes<typename MessageType::Schema::ReplyParam>::ValueTuple + params; + if (!MessageType::ReadReplyParam(msg_, ¶ms)) + return false; + // If we need to rewrite the message, write the message id first. + if (results->new_msg) { + results->new_msg->set_reply(); + int id = IPC::SyncMessage::GetMessageId(*msg_); + results->new_msg->WriteInt(id); + } + ScanTuple(params, results); + return true; + } + // TODO(dmichael): Add ScanSyncMessage for outgoing sync messages, if we ever + // need to scan those. + + private: + const MessageType* msg_; +}; + +} // namespace + +#define CASE_FOR_MESSAGE(MESSAGE_TYPE) \ + case MESSAGE_TYPE::ID: { \ + MessageScannerImpl<MESSAGE_TYPE> scanner(&msg); \ + if (rewrite_msg) \ + results.new_msg.reset( \ + new IPC::Message(msg.routing_id(), msg.type(), \ + IPC::Message::PRIORITY_NORMAL)); \ + if (!scanner.ScanMessage(&results)) \ + return false; \ + break; \ + } +#define CASE_FOR_REPLY(MESSAGE_TYPE) \ + case MESSAGE_TYPE::ID: { \ + MessageScannerImpl<MESSAGE_TYPE> scanner(&msg); \ + if (rewrite_msg) \ + results.new_msg.reset( \ + new IPC::Message(msg.routing_id(), msg.type(), \ + IPC::Message::PRIORITY_NORMAL)); \ + if (!scanner.ScanReply(&results)) \ + return false; \ + break; \ + } + +namespace ppapi { +namespace proxy { + +class SerializedHandle; + +NaClMessageScanner::NaClMessageScanner() { +} + +// Windows IPC differs from POSIX in that native handles are serialized in the +// message body, rather than passed in a separate FileDescriptorSet. Therefore, +// on Windows, any message containing handles must be rewritten in the POSIX +// format before we can send it to the NaCl plugin. +// +// On POSIX and Windows we have to rewrite PpapiMsg_CreateNaClChannel messages. +// These contain a handle with an invalid (place holder) descriptor. We need to +// locate this handle so it can be replaced with a valid one when the channel is +// created. +bool NaClMessageScanner::ScanMessage( + const IPC::Message& msg, + std::vector<SerializedHandle>* handles, + scoped_ptr<IPC::Message>* new_msg_ptr) { + DCHECK(handles); + DCHECK(handles->empty()); + DCHECK(new_msg_ptr); + DCHECK(!new_msg_ptr->get()); + + bool rewrite_msg = +#if defined(OS_WIN) + true; +#else + (msg.type() == PpapiMsg_CreateNaClChannel::ID); +#endif + + + // We can't always tell from the message ID if rewriting is needed. Therefore, + // scan any message types that might contain a handle. If we later determine + // that there are no handles, we can cancel the rewriting by clearing the + // results.new_msg pointer. + ScanningResults results; + switch (msg.type()) { + CASE_FOR_MESSAGE(PpapiMsg_CreateNaClChannel) + CASE_FOR_MESSAGE(PpapiMsg_PPBAudio_NotifyAudioStreamCreated) + CASE_FOR_MESSAGE(PpapiMsg_PPPMessaging_HandleMessage) + CASE_FOR_MESSAGE(PpapiPluginMsg_ResourceReply) + case IPC_REPLY_ID: { + int id = IPC::SyncMessage::GetMessageId(msg); + PendingSyncMsgMap::iterator iter(pending_sync_msgs_.find(id)); + if (iter == pending_sync_msgs_.end()) { + NOTREACHED(); + return false; + } + uint32_t type = iter->second; + pending_sync_msgs_.erase(iter); + switch (type) { + CASE_FOR_REPLY(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer) + CASE_FOR_REPLY(PpapiHostMsg_PPBImageData_CreateSimple) + CASE_FOR_REPLY(PpapiHostMsg_ResourceSyncCall) + CASE_FOR_REPLY(PpapiHostMsg_SharedMemory_CreateSharedMemory) + default: + // Do nothing for messages we don't know. + break; + } + break; + } + default: + // Do nothing for messages we don't know. + break; + } + + // Only messages containing handles need to be rewritten. If no handles are + // found, don't return the rewritten message either. This must be changed if + // we ever add new param types that also require rewriting. + if (!results.handles.empty()) { + handles->swap(results.handles); + *new_msg_ptr = results.new_msg.Pass(); + } + return true; +} + +void NaClMessageScanner::RegisterSyncMessageForReply(const IPC::Message& msg) { + DCHECK(msg.is_sync()); + + int msg_id = IPC::SyncMessage::GetMessageId(msg); + DCHECK(pending_sync_msgs_.find(msg_id) == pending_sync_msgs_.end()); + + pending_sync_msgs_[msg_id] = msg.type(); +} + +} // namespace proxy +} // namespace ppapi diff --git a/chromium/ppapi/proxy/nacl_message_scanner.h b/chromium/ppapi/proxy/nacl_message_scanner.h new file mode 100644 index 00000000000..cce821b7f0c --- /dev/null +++ b/chromium/ppapi/proxy/nacl_message_scanner.h @@ -0,0 +1,62 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_ +#define PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_ + +#include <map> +#include <vector> + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "ppapi/proxy/ppapi_proxy_export.h" + +namespace IPC { +class Message; +} + +namespace ppapi { +namespace proxy { + +class SerializedHandle; + +class PPAPI_PROXY_EXPORT NaClMessageScanner { + public: + NaClMessageScanner(); + + // Scans the message for items that require special handling. Copies any + // SerializedHandles in the message into |handles| and if the message must be + // rewritten for NaCl, sets |new_msg_ptr| to the new message. If no handles + // are found, |handles| is left unchanged. If no rewriting is needed, + // |new_msg_ptr| is left unchanged. + // + // See more explanation in the method definition. + // + // See chrome/nacl/nacl_ipc_adapter.cc for where this is used to help convert + // native handles to NaClDescs. + bool ScanMessage(const IPC::Message& msg, + std::vector<SerializedHandle>* handles, + scoped_ptr<IPC::Message>* new_msg_ptr); + + // This method informs NaClMessageScanner that a sync message is being sent + // so that it can associate reply messages with their type. + // + // Users of NaClMessageScanner must call this when they send a synchronous + // message, otherwise NaClMessageScanner won't scan replies. + void RegisterSyncMessageForReply(const IPC::Message& msg); + + private: + // When we send a synchronous message (from untrusted to trusted), we store + // its type here, so that later we can associate the reply with its type + // for scanning. + typedef std::map<int, uint32> PendingSyncMsgMap; + PendingSyncMsgMap pending_sync_msgs_; + + DISALLOW_COPY_AND_ASSIGN(NaClMessageScanner); +}; + +} // namespace proxy +} // namespace ppapi + +#endif // PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_ diff --git a/chromium/ppapi/proxy/output_protection_resource.cc b/chromium/ppapi/proxy/output_protection_resource.cc new file mode 100644 index 00000000000..8f601de453a --- /dev/null +++ b/chromium/ppapi/proxy/output_protection_resource.cc @@ -0,0 +1,105 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/proxy/output_protection_resource.h" + +#include "base/logging.h" +#include "ppapi/proxy/plugin_globals.h" +#include "ppapi/proxy/plugin_resource_tracker.h" +#include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/shared_impl/proxy_lock.h" +#include "ppapi/shared_impl/resource_tracker.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_output_protection_api.h" + +namespace ppapi { +namespace proxy { + +OutputProtectionResource::OutputProtectionResource( + Connection connection, + PP_Instance instance) + : PluginResource(connection, instance) { + SendCreate(BROWSER, PpapiHostMsg_OutputProtection_Create()); +} + +OutputProtectionResource::~OutputProtectionResource() { + if (TrackedCallback::IsPending(query_status_callback_)) + query_status_callback_->PostAbort(); + if (TrackedCallback::IsPending(enable_protection_callback_)) + enable_protection_callback_->PostAbort(); +} + +thunk::PPB_OutputProtection_API* + OutputProtectionResource::AsPPB_OutputProtection_API() { + return this; +} + +int32_t OutputProtectionResource::QueryStatus( + uint32_t* link_mask, + uint32_t* protection_mask, + const scoped_refptr<TrackedCallback>& callback) { + if (!link_mask || !protection_mask) + return PP_ERROR_BADARGUMENT; + if (TrackedCallback::IsPending(query_status_callback_)) + return PP_ERROR_INPROGRESS; + + query_status_callback_ = callback; + + Call<PpapiPluginMsg_OutputProtection_QueryStatusReply>( + BROWSER, + PpapiHostMsg_OutputProtection_QueryStatus(), + base::Bind(&OutputProtectionResource::OnPluginMsgQueryStatusReply, + base::Unretained(this), + link_mask, + protection_mask)); + return PP_OK_COMPLETIONPENDING; +} + +void OutputProtectionResource::OnPluginMsgQueryStatusReply( + uint32_t* out_link_mask, + uint32_t* out_protection_mask, + const ResourceMessageReplyParams& params, + uint32_t link_mask, + uint32_t protection_mask) { + // The callback may have been aborted. + if (!TrackedCallback::IsPending(query_status_callback_)) + return; + + int32_t result = params.result(); + + if (result == PP_OK) { + DCHECK(out_link_mask); + DCHECK(out_protection_mask); + *out_link_mask = link_mask; + *out_protection_mask = protection_mask; + } + query_status_callback_->Run(result); +} + +int32_t OutputProtectionResource::EnableProtection( + uint32_t desired_method_mask, + const scoped_refptr<TrackedCallback>& callback) { + if (TrackedCallback::IsPending(enable_protection_callback_)) + return PP_ERROR_INPROGRESS; + + enable_protection_callback_ = callback; + + Call<PpapiPluginMsg_OutputProtection_EnableProtectionReply>( + BROWSER, + PpapiHostMsg_OutputProtection_EnableProtection(desired_method_mask), + base::Bind(&OutputProtectionResource::OnPluginMsgEnableProtectionReply, + base::Unretained(this))); + return PP_OK_COMPLETIONPENDING; +} + +void OutputProtectionResource::OnPluginMsgEnableProtectionReply( + const ResourceMessageReplyParams& params) { + // The callback may have been aborted. + if (TrackedCallback::IsPending(enable_protection_callback_)) + enable_protection_callback_->Run(params.result()); +} + +} // namespace proxy +} // namespace ppapi diff --git a/chromium/ppapi/proxy/output_protection_resource.h b/chromium/ppapi/proxy/output_protection_resource.h new file mode 100644 index 00000000000..b56a33d7b22 --- /dev/null +++ b/chromium/ppapi/proxy/output_protection_resource.h @@ -0,0 +1,58 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_PROXY_OUTPUT_PROTECTION_RESOURCE_H_ +#define PPAPI_PROXY_OUTPUT_PROTECTION_RESOURCE_H_ + +#include "base/compiler_specific.h" +#include "ppapi/c/private/ppb_output_protection_private.h" +#include "ppapi/proxy/device_enumeration_resource_helper.h" +#include "ppapi/proxy/plugin_resource.h" +#include "ppapi/thunk/ppb_output_protection_api.h" + +namespace ppapi { +namespace proxy { + +class OutputProtectionResource + : public PluginResource, + public ::ppapi::thunk::PPB_OutputProtection_API { + public: + OutputProtectionResource(Connection connection, + PP_Instance instance); + + private: + virtual ~OutputProtectionResource(); + + // PluginResource overrides. + virtual thunk::PPB_OutputProtection_API* AsPPB_OutputProtection_API() + OVERRIDE; + + // PPB_OutputProtection_API implementation. + virtual int32_t QueryStatus( + uint32_t* link_mask, + uint32_t* protection_mask, + const scoped_refptr<TrackedCallback>& callback) OVERRIDE; + virtual int32_t EnableProtection( + uint32_t desired_method_mask, + const scoped_refptr<TrackedCallback>& callback) OVERRIDE; + + void OnPluginMsgQueryStatusReply( + uint32_t* out_link_mask, + uint32_t* out_protection_mask, + const ResourceMessageReplyParams& params, + uint32_t link_mask, + uint32_t protection_mask); + void OnPluginMsgEnableProtectionReply( + const ResourceMessageReplyParams& params); + + scoped_refptr<TrackedCallback> query_status_callback_; + scoped_refptr<TrackedCallback> enable_protection_callback_; + + DISALLOW_COPY_AND_ASSIGN(OutputProtectionResource); +}; + +} // namespace proxy +} // namespace ppapi + +#endif // PPAPI_PROXY_OUTPUT_PROTECTION_RESOURCE_H_ diff --git a/chromium/ppapi/proxy/pdf_resource.cc b/chromium/ppapi/proxy/pdf_resource.cc index 8e0a2e0bbf1..80c4237a5e5 100644 --- a/chromium/ppapi/proxy/pdf_resource.cc +++ b/chromium/ppapi/proxy/pdf_resource.cc @@ -188,5 +188,9 @@ PP_Resource PDFResource::GetResourceImage(PP_ResourceImage image_id) { return GetResourceImageForScale(image_id, 1.0f); } +PP_Bool PDFResource::IsOutOfProcess() { + return PP_TRUE; +} + } // namespace proxy } // namespace ppapi diff --git a/chromium/ppapi/proxy/pdf_resource.h b/chromium/ppapi/proxy/pdf_resource.h index 704e1d4a44e..4ab30ba1ca7 100644 --- a/chromium/ppapi/proxy/pdf_resource.h +++ b/chromium/ppapi/proxy/pdf_resource.h @@ -54,6 +54,7 @@ class PPAPI_PROXY_EXPORT PDFResource virtual PP_Resource GetResourceImageForScale(PP_ResourceImage image_id, float scale) OVERRIDE; virtual PP_Resource GetResourceImage(PP_ResourceImage image_id) OVERRIDE; + virtual PP_Bool IsOutOfProcess() OVERRIDE; private: std::string locale_; diff --git a/chromium/ppapi/proxy/platform_verification_private_resource.cc b/chromium/ppapi/proxy/platform_verification_private_resource.cc index 4da3ca0f34e..d361f4f8279 100644 --- a/chromium/ppapi/proxy/platform_verification_private_resource.cc +++ b/chromium/ppapi/proxy/platform_verification_private_resource.cc @@ -30,35 +30,6 @@ PlatformVerificationPrivateResource::AsPPB_PlatformVerification_API() { return this; } -int32_t PlatformVerificationPrivateResource::CanChallengePlatform( - PP_Bool* can_challenge_platform, - const scoped_refptr<TrackedCallback>& callback) { - if (!can_challenge_platform) - return PP_ERROR_BADARGUMENT; - - Call<PpapiHostMsg_PlatformVerification_CanChallengePlatformReply>( - BROWSER, PpapiHostMsg_PlatformVerification_CanChallengePlatform(), - base::Bind( - &PlatformVerificationPrivateResource::OnCanChallengePlatformReply, - base::Unretained(this), can_challenge_platform, callback)); - - return PP_OK_COMPLETIONPENDING; -} - -void PlatformVerificationPrivateResource::OnCanChallengePlatformReply( - PP_Bool* can_challenge_platform, - const scoped_refptr<TrackedCallback>& callback, - const ResourceMessageReplyParams& params, - bool can_challenge_platform_response) { - if (!TrackedCallback::IsPending(callback) || - TrackedCallback::IsScheduledToRun(callback)) { - return; - } - - *can_challenge_platform = PP_FromBool(can_challenge_platform_response); - callback->Run(params.result()); -} - int32_t PlatformVerificationPrivateResource::ChallengePlatform( const PP_Var& service_id, const PP_Var& challenge, diff --git a/chromium/ppapi/proxy/platform_verification_private_resource.h b/chromium/ppapi/proxy/platform_verification_private_resource.h index ba7d3b14014..a12a137aacb 100644 --- a/chromium/ppapi/proxy/platform_verification_private_resource.h +++ b/chromium/ppapi/proxy/platform_verification_private_resource.h @@ -34,9 +34,6 @@ class PPAPI_PROXY_EXPORT PlatformVerificationPrivateResource AsPPB_PlatformVerification_API() OVERRIDE; // PPB_PlatformVerification_API implementation. - virtual int32_t CanChallengePlatform( - PP_Bool* can_challenge_platform, - const scoped_refptr<TrackedCallback>& callback) OVERRIDE; virtual int32_t ChallengePlatform( const PP_Var& service_id, const PP_Var& challenge, @@ -44,12 +41,6 @@ class PPAPI_PROXY_EXPORT PlatformVerificationPrivateResource PP_Var* signed_data_signature, PP_Var* platform_key_certificate, const scoped_refptr<TrackedCallback>& callback) OVERRIDE; - - void OnCanChallengePlatformReply( - PP_Bool* can_challenge_platform, - const scoped_refptr<TrackedCallback>& callback, - const ResourceMessageReplyParams& params, - bool can_challenge_platform_response); void OnChallengePlatformReply( ChallengePlatformParams output_params, const ResourceMessageReplyParams& params, diff --git a/chromium/ppapi/proxy/plugin_dispatcher.cc b/chromium/ppapi/proxy/plugin_dispatcher.cc index d6d0d909765..6cd0ab4151d 100644 --- a/chromium/ppapi/proxy/plugin_dispatcher.cc +++ b/chromium/ppapi/proxy/plugin_dispatcher.cc @@ -29,13 +29,12 @@ #include "ppapi/proxy/ppb_instance_proxy.h" #include "ppapi/proxy/ppp_class_proxy.h" #include "ppapi/proxy/resource_creation_proxy.h" -#include "ppapi/proxy/resource_message_params.h" +#include "ppapi/proxy/resource_reply_thread_registrar.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/shared_impl/resource.h" #if defined(OS_POSIX) && !defined(OS_NACL) -#include "base/posix/eintr_wrapper.h" #include "ipc/ipc_channel_posix.h" #endif @@ -174,7 +173,9 @@ bool PluginDispatcher::InitPluginWithChannel( // The message filter will intercept and process certain messages directly // on the I/O thread. channel()->AddFilter( - new PluginMessageFilter(delegate->GetGloballySeenInstanceIDSet())); + new PluginMessageFilter( + delegate->GetGloballySeenInstanceIDSet(), + PluginGlobals::Get()->resource_reply_thread_registrar())); return true; } @@ -227,7 +228,6 @@ bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { // Handle some plugin-specific control messages. bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) - IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply) IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface) IPC_MESSAGE_HANDLER(PpapiMsg_SetPreferences, OnMsgSetPreferences) IPC_MESSAGE_UNHANDLED(handled = false); @@ -288,16 +288,6 @@ thunk::ResourceCreationAPI* PluginDispatcher::GetResourceCreationAPI() { GetInterfaceProxy(API_ID_RESOURCE_CREATION)); } -// static -void PluginDispatcher::DispatchResourceReply( - const ppapi::proxy::ResourceMessageReplyParams& reply_params, - const IPC::Message& nested_msg) { - // We need to grab the proxy lock to ensure that we don't collide with the - // plugin making pepper calls on a different thread. - ProxyAutoLock lock; - LockedDispatchResourceReply(reply_params, nested_msg); -} - void PluginDispatcher::ForceFreeAllInstances() { if (!g_instance_to_dispatcher) return; @@ -316,12 +306,6 @@ void PluginDispatcher::ForceFreeAllInstances() { } } -void PluginDispatcher::OnMsgResourceReply( - const ppapi::proxy::ResourceMessageReplyParams& reply_params, - const IPC::Message& nested_msg) { - LockedDispatchResourceReply(reply_params, nested_msg); -} - void PluginDispatcher::OnMsgSupportsInterface( const std::string& interface_name, bool* result) { @@ -350,20 +334,5 @@ void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) { } } -// static -void PluginDispatcher::LockedDispatchResourceReply( - const ppapi::proxy::ResourceMessageReplyParams& reply_params, - const IPC::Message& nested_msg) { - Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource( - reply_params.pp_resource()); - if (!resource) { - DLOG_IF(INFO, reply_params.sequence() != 0) - << "Pepper resource reply message received but the resource doesn't " - "exist (probably has been destroyed)."; - return; - } - resource->OnReplyReceived(reply_params, nested_msg); -} - } // namespace proxy } // namespace ppapi diff --git a/chromium/ppapi/proxy/plugin_dispatcher.h b/chromium/ppapi/proxy/plugin_dispatcher.h index 3a9e7330865..5176eba7c74 100644 --- a/chromium/ppapi/proxy/plugin_dispatcher.h +++ b/chromium/ppapi/proxy/plugin_dispatcher.h @@ -40,8 +40,6 @@ class ResourceCreationAPI; namespace proxy { -class ResourceMessageReplyParams; - // Used to keep track of per-instance data. struct InstanceData { InstanceData(); @@ -163,13 +161,6 @@ class PPAPI_PROXY_EXPORT PluginDispatcher uint32 plugin_dispatcher_id() const { return plugin_dispatcher_id_; } bool incognito() const { return incognito_; } - // Dispatches the given resource message to the appropriate resource in the - // plugin process. This should be wired to the various channels that messages - // come in from various other processes. - static void DispatchResourceReply( - const ppapi::proxy::ResourceMessageReplyParams& reply_params, - const IPC::Message& nested_msg); - private: friend class PluginDispatcherTest; @@ -178,17 +169,9 @@ class PPAPI_PROXY_EXPORT PluginDispatcher void ForceFreeAllInstances(); // IPC message handlers. - void OnMsgResourceReply( - const ppapi::proxy::ResourceMessageReplyParams& reply_params, - const IPC::Message& nested_msg); void OnMsgSupportsInterface(const std::string& interface_name, bool* result); void OnMsgSetPreferences(const Preferences& prefs); - // Internal backed for DispatchResourceReply. - static void LockedDispatchResourceReply( - const ppapi::proxy::ResourceMessageReplyParams& reply_params, - const IPC::Message& nested_msg); - virtual bool SendMessage(IPC::Message* msg); PluginDelegate* plugin_delegate_; diff --git a/chromium/ppapi/proxy/plugin_globals.cc b/chromium/ppapi/proxy/plugin_globals.cc index 83217f0d96b..59b51919e1a 100644 --- a/chromium/ppapi/proxy/plugin_globals.cc +++ b/chromium/ppapi/proxy/plugin_globals.cc @@ -11,6 +11,7 @@ #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/plugin_proxy_delegate.h" #include "ppapi/proxy/ppb_message_loop_proxy.h" +#include "ppapi/proxy/resource_reply_thread_registrar.h" #include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/thunk/enter.h" @@ -51,7 +52,9 @@ PluginGlobals* PluginGlobals::plugin_globals_ = NULL; PluginGlobals::PluginGlobals() : ppapi::PpapiGlobals(), plugin_proxy_delegate_(NULL), - callback_tracker_(new CallbackTracker) { + callback_tracker_(new CallbackTracker), + resource_reply_thread_registrar_( + new ResourceReplyThreadRegistrar(GetMainThreadMessageLoop())) { DCHECK(!plugin_globals_); plugin_globals_ = this; @@ -66,7 +69,9 @@ PluginGlobals::PluginGlobals() PluginGlobals::PluginGlobals(PerThreadForTest per_thread_for_test) : ppapi::PpapiGlobals(per_thread_for_test), plugin_proxy_delegate_(NULL), - callback_tracker_(new CallbackTracker) { + callback_tracker_(new CallbackTracker), + resource_reply_thread_registrar_( + new ResourceReplyThreadRegistrar(GetMainThreadMessageLoop())) { DCHECK(!plugin_globals_); } @@ -150,7 +155,7 @@ MessageLoopShared* PluginGlobals::GetCurrentMessageLoop() { return MessageLoopResource::GetCurrent(); } -base::TaskRunner* PluginGlobals::GetFileTaskRunner(PP_Instance instance) { +base::TaskRunner* PluginGlobals::GetFileTaskRunner() { if (!file_thread_.get()) { file_thread_.reset(new base::Thread("Plugin::File")); base::Thread::Options options; diff --git a/chromium/ppapi/proxy/plugin_globals.h b/chromium/ppapi/proxy/plugin_globals.h index 31adef55841..029e2d2e28e 100644 --- a/chromium/ppapi/proxy/plugin_globals.h +++ b/chromium/ppapi/proxy/plugin_globals.h @@ -34,6 +34,7 @@ namespace proxy { class MessageLoopResource; class PluginProxyDelegate; +class ResourceReplyThreadRegistrar; class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { public: @@ -72,7 +73,7 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { const std::string& source, const std::string& value) OVERRIDE; virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; - base::TaskRunner* GetFileTaskRunner(PP_Instance instance) OVERRIDE; + base::TaskRunner* GetFileTaskRunner() OVERRIDE; // Returns the channel for sending to the browser. IPC::Sender* GetBrowserSender(); @@ -128,6 +129,10 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { // The embedder should call this function when the command line is known. void set_command_line(const std::string& c) { command_line_ = c; } + ResourceReplyThreadRegistrar* resource_reply_thread_registrar() { + return resource_reply_thread_registrar_.get(); + } + private: class BrowserSender; @@ -160,6 +165,8 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { // lazily, since it might not be needed. scoped_ptr<base::Thread> file_thread_; + scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; + DISALLOW_COPY_AND_ASSIGN(PluginGlobals); }; diff --git a/chromium/ppapi/proxy/plugin_main_nacl.cc b/chromium/ppapi/proxy/plugin_main_nacl.cc index 5978233a537..985deb7bd12 100644 --- a/chromium/ppapi/proxy/plugin_main_nacl.cc +++ b/chromium/ppapi/proxy/plugin_main_nacl.cc @@ -26,7 +26,9 @@ #include "ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/plugin_globals.h" +#include "ppapi/proxy/plugin_message_filter.h" #include "ppapi/proxy/plugin_proxy_delegate.h" +#include "ppapi/proxy/resource_reply_thread_registrar.h" #include "ppapi/shared_impl/ppb_audio_shared.h" #if defined(IPC_MESSAGE_LOG_ENABLED) @@ -91,9 +93,6 @@ class PpapiDispatcher : public ProxyChannel, void OnMsgCreateNaClChannel(int renderer_id, const ppapi::PpapiNaClChannelArgs& args, SerializedHandle handle); - void OnMsgResourceReply( - const ppapi::proxy::ResourceMessageReplyParams& reply_params, - const IPC::Message& nested_msg); void OnPluginDispatcherMessageReceived(const IPC::Message& msg); std::set<PP_Instance> instances_; @@ -113,6 +112,8 @@ PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop) // NaCl sandbox. InitWithChannel(this, base::kNullProcessId, channel_handle, false); // Channel is server. + channel()->AddFilter(new ppapi::proxy::PluginMessageFilter( + NULL, PluginGlobals::Get()->resource_reply_thread_registrar())); channel()->AddFilter( new tracing::ChildTraceMessageFilter(message_loop_.get())); } @@ -186,7 +187,6 @@ PP_Resource PpapiDispatcher::CreateBrowserFont( bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(PpapiDispatcher, msg) IPC_MESSAGE_HANDLER(PpapiMsg_CreateNaClChannel, OnMsgCreateNaClChannel) - IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply) // All other messages are simply forwarded to a PluginDispatcher. IPC_MESSAGE_UNHANDLED(OnPluginDispatcherMessageReceived(msg)) IPC_END_MESSAGE_MAP() @@ -214,6 +214,14 @@ void PpapiDispatcher::OnMsgCreateNaClChannel( // plugin. ppapi::proxy::InterfaceList::SetProcessGlobalPermissions( args.permissions); + ppapi::proxy::InterfaceList::SetSupportsDevChannel( + args.supports_dev_channel); + + int32_t error = ::PPP_InitializeModule( + 0 /* module */, + &ppapi::proxy::PluginDispatcher::GetBrowserInterface); + if (error) + ::exit(error); PluginDispatcher* dispatcher = new PluginDispatcher(::PPP_GetInterface, args.permissions, @@ -229,13 +237,6 @@ void PpapiDispatcher::OnMsgCreateNaClChannel( // lifetime of the attached channel. } -void PpapiDispatcher::OnMsgResourceReply( - const ppapi::proxy::ResourceMessageReplyParams& reply_params, - const IPC::Message& nested_msg) { - ppapi::proxy::PluginDispatcher::DispatchResourceReply(reply_params, - nested_msg); -} - void PpapiDispatcher::OnPluginDispatcherMessageReceived( const IPC::Message& msg) { // The first parameter should be a plugin dispatcher ID. @@ -280,13 +281,6 @@ int PpapiPluginMain() { return 1; } - int32_t error = ::PPP_InitializeModule( - 0 /* module */, - &ppapi::proxy::PluginDispatcher::GetBrowserInterface); - // TODO(dmichael): Handle other error conditions, like failure to connect? - if (error) - return error; - PpapiDispatcher ppapi_dispatcher(io_thread.message_loop_proxy()); plugin_globals.set_plugin_proxy_delegate(&ppapi_dispatcher); diff --git a/chromium/ppapi/proxy/plugin_message_filter.cc b/chromium/ppapi/proxy/plugin_message_filter.cc index 9f178f15acc..1a62d21454b 100644 --- a/chromium/ppapi/proxy/plugin_message_filter.cc +++ b/chromium/ppapi/proxy/plugin_message_filter.cc @@ -4,14 +4,24 @@ #include "ppapi/proxy/plugin_message_filter.h" +#include "base/bind.h" +#include "base/logging.h" #include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/proxy/resource_message_params.h" +#include "ppapi/proxy/resource_reply_thread_registrar.h" +#include "ppapi/shared_impl/ppapi_globals.h" +#include "ppapi/shared_impl/proxy_lock.h" +#include "ppapi/shared_impl/resource.h" +#include "ppapi/shared_impl/resource_tracker.h" namespace ppapi { namespace proxy { PluginMessageFilter::PluginMessageFilter( - std::set<PP_Instance>* seen_instance_ids) + std::set<PP_Instance>* seen_instance_ids, + scoped_refptr<ResourceReplyThreadRegistrar> registrar) : seen_instance_ids_(seen_instance_ids), + resource_reply_thread_registrar_(registrar), channel_(NULL) { } @@ -30,6 +40,7 @@ bool PluginMessageFilter::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginMessageFilter, message) IPC_MESSAGE_HANDLER(PpapiMsg_ReserveInstanceId, OnMsgReserveInstanceId) + IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -42,8 +53,18 @@ bool PluginMessageFilter::Send(IPC::Message* msg) { return false; } +// static +void PluginMessageFilter::DispatchResourceReplyForTest( + const ResourceMessageReplyParams& reply_params, + const IPC::Message& nested_msg) { + DispatchResourceReply(reply_params, nested_msg); +} + void PluginMessageFilter::OnMsgReserveInstanceId(PP_Instance instance, bool* usable) { + // If |seen_instance_ids_| is set to NULL, we are not supposed to see this + // message. + CHECK(seen_instance_ids_); // See the message definition for how this works. if (seen_instance_ids_->find(instance) != seen_instance_ids_->end()) { // Instance ID already seen, reject it. @@ -57,5 +78,33 @@ void PluginMessageFilter::OnMsgReserveInstanceId(PP_Instance instance, *usable = true; } +void PluginMessageFilter::OnMsgResourceReply( + const ResourceMessageReplyParams& reply_params, + const IPC::Message& nested_msg) { + scoped_refptr<base::MessageLoopProxy> target = + resource_reply_thread_registrar_->GetTargetThreadAndUnregister( + reply_params.pp_resource(), reply_params.sequence()); + + target->PostTask( + FROM_HERE, + base::Bind(&DispatchResourceReply, reply_params, nested_msg)); +} + +// static +void PluginMessageFilter::DispatchResourceReply( + const ResourceMessageReplyParams& reply_params, + const IPC::Message& nested_msg) { + ProxyAutoLock lock; + Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource( + reply_params.pp_resource()); + if (!resource) { + DVLOG_IF(1, reply_params.sequence() != 0) + << "Pepper resource reply message received but the resource doesn't " + "exist (probably has been destroyed)."; + return; + } + resource->OnReplyReceived(reply_params, nested_msg); +} + } // namespace proxy } // namespace ppapi diff --git a/chromium/ppapi/proxy/plugin_message_filter.h b/chromium/ppapi/proxy/plugin_message_filter.h index 5701a96a09a..646900724a2 100644 --- a/chromium/ppapi/proxy/plugin_message_filter.h +++ b/chromium/ppapi/proxy/plugin_message_filter.h @@ -8,26 +8,37 @@ #include <set> #include "base/compiler_specific.h" +#include "base/memory/ref_counted.h" #include "ipc/ipc_channel_proxy.h" #include "ipc/ipc_sender.h" #include "ppapi/c/pp_instance.h" +#include "ppapi/proxy/ppapi_proxy_export.h" namespace ppapi { namespace proxy { +class ResourceMessageReplyParams; +class ResourceReplyThreadRegistrar; + // Listens for messages on the I/O thread of the plugin and handles some of // them to avoid needing to block on the plugin. // // There is one instance of this class for each renderer channel (same as for // the PluginDispatchers). -class PluginMessageFilter : public IPC::ChannelProxy::MessageFilter, - public IPC::Sender { +class PPAPI_PROXY_EXPORT PluginMessageFilter + : public IPC::ChannelProxy::MessageFilter, + public IPC::Sender { public: - // The input is a pointer to a set that will be used to uniquify PP_Instances - // across all renderer channels. The same pointer should be passed to each - // MessageFilter to ensure uniqueness, and the value should outlive this - // class. - PluginMessageFilter(std::set<PP_Instance>* seen_instance_ids); + // |seen_instance_ids| is a pointer to a set that will be used to uniquify + // PP_Instances across all renderer channels. The same pointer should be + // passed to each MessageFilter to ensure uniqueness, and the value should + // outlive this class. It could be NULL if this filter is for a browser + // channel. + // |thread_registrar| is used to look up handling threads for resource + // reply messages. It shouldn't be NULL. + PluginMessageFilter( + std::set<PP_Instance>* seen_instance_ids, + scoped_refptr<ResourceReplyThreadRegistrar> thread_registrar); virtual ~PluginMessageFilter(); // MessageFilter implementation. @@ -38,14 +49,30 @@ class PluginMessageFilter : public IPC::ChannelProxy::MessageFilter, // IPC::Sender implementation. virtual bool Send(IPC::Message* msg) OVERRIDE; + // Simulates an incoming resource reply that is handled on the calling thread. + // For testing only. + static void DispatchResourceReplyForTest( + const ResourceMessageReplyParams& reply_params, + const IPC::Message& nested_msg); + private: void OnMsgReserveInstanceId(PP_Instance instance, bool* usable); + void OnMsgResourceReply(const ResourceMessageReplyParams& reply_params, + const IPC::Message& nested_msg); - // All instance IDs every queried by any renderer on this plugin. This is - // used to make sure that new instance IDs are unique. This is a non-owning - // pointer, it will be managed by the later that creates this class. + // Dispatches the given resource reply to the appropriate resource in the + // plugin process. + static void DispatchResourceReply( + const ResourceMessageReplyParams& reply_params, + const IPC::Message& nested_msg); + + // All instance IDs ever queried by any renderer on this plugin. This is used + // to make sure that new instance IDs are unique. This is a non-owning + // pointer. It is managed by PluginDispatcher::PluginDelegate. std::set<PP_Instance>* seen_instance_ids_; + scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; + // The IPC channel to the renderer. May be NULL if we're not currently // attached as a filter. IPC::Channel* channel_; diff --git a/chromium/ppapi/proxy/plugin_resource.cc b/chromium/ppapi/proxy/plugin_resource.cc index c450f3c29af..23094fe8444 100644 --- a/chromium/ppapi/proxy/plugin_resource.cc +++ b/chromium/ppapi/proxy/plugin_resource.cc @@ -6,7 +6,9 @@ #include <limits> +#include "ppapi/proxy/plugin_globals.h" #include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/shared_impl/ppapi_globals.h" namespace ppapi { namespace proxy { @@ -16,7 +18,10 @@ PluginResource::PluginResource(Connection connection, PP_Instance instance) connection_(connection), next_sequence_number_(1), sent_create_to_browser_(false), - sent_create_to_renderer_(false) { + sent_create_to_renderer_(false), + resource_reply_thread_registrar_( + PpapiGlobals::Get()->IsPluginGlobals() ? + PluginGlobals::Get()->resource_reply_thread_registrar() : NULL) { } PluginResource::~PluginResource() { @@ -28,6 +33,9 @@ PluginResource::~PluginResource() { connection_.renderer_sender->Send( new PpapiHostMsg_ResourceDestroyed(pp_resource())); } + + if (resource_reply_thread_registrar_) + resource_reply_thread_registrar_->Unregister(pp_resource()); } void PluginResource::OnReplyReceived( @@ -115,7 +123,7 @@ bool PluginResource::SendResourceCall( const IPC::Message& nested_msg) { // For in-process plugins, we need to send the routing ID with the request. // The browser then uses that routing ID when sending the reply so it will be - // routed back to the correct RenderViewImpl. + // routed back to the correct RenderFrameImpl. if (dest == BROWSER && connection_.in_process) { return GetSender(dest)->Send(new PpapiHostMsg_InProcessResourceCall( connection_.browser_sender_routing_id, diff --git a/chromium/ppapi/proxy/plugin_resource.h b/chromium/ppapi/proxy/plugin_resource.h index 9448326d55c..e6d3065d76c 100644 --- a/chromium/ppapi/proxy/plugin_resource.h +++ b/chromium/ppapi/proxy/plugin_resource.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/memory/ref_counted.h" #include "ipc/ipc_message.h" #include "ipc/ipc_sender.h" #include "ppapi/c/pp_errors.h" @@ -17,8 +18,9 @@ #include "ppapi/proxy/ppapi_message_utils.h" #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/proxy/resource_message_params.h" +#include "ppapi/proxy/resource_reply_thread_registrar.h" #include "ppapi/shared_impl/resource.h" - +#include "ppapi/shared_impl/tracked_callback.h" namespace ppapi { namespace proxy { @@ -99,6 +101,23 @@ class PPAPI_PROXY_EXPORT PluginResource : public Resource { const IPC::Message& msg, const CallbackType& callback); + // Comparing with the previous Call() method, this method takes + // |reply_thread_hint| as a hint to determine which thread to handle the reply + // message. + // + // If |reply_thread_hint| is non-blocking, the reply message will be handled + // on the target thread of the callback; otherwise, it will be handled on the + // main thread. + // + // If handling a reply message will cause a TrackedCallback to be run, it is + // recommended to use this version of Call(). It eliminates unnecessary + // thread switching and therefore has better performance. + template<typename ReplyMsgClass, typename CallbackType> + int32_t Call(Destination dest, + const IPC::Message& msg, + const CallbackType& callback, + scoped_refptr<TrackedCallback> reply_thread_hint); + // Calls the browser/renderer with sync messages. Returns the pepper error // code from the call. // |ReplyMsgClass| is the type of the reply message that is expected. If it @@ -159,6 +178,8 @@ class PPAPI_PROXY_EXPORT PluginResource : public Resource { CallbackMap; CallbackMap callbacks_; + scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; + DISALLOW_COPY_AND_ASSIGN(PluginResource); }; @@ -166,6 +187,15 @@ template<typename ReplyMsgClass, typename CallbackType> int32_t PluginResource::Call(Destination dest, const IPC::Message& msg, const CallbackType& callback) { + return Call<ReplyMsgClass>(dest, msg, callback, NULL); +} + +template<typename ReplyMsgClass, typename CallbackType> +int32_t PluginResource::Call( + Destination dest, + const IPC::Message& msg, + const CallbackType& callback, + scoped_refptr<TrackedCallback> reply_thread_hint) { TRACE_EVENT2("ppapi proxy", "PluginResource::Call", "Class", IPC_MESSAGE_ID_CLASS(msg.type()), "Line", IPC_MESSAGE_ID_LINE(msg.type())); @@ -176,6 +206,11 @@ int32_t PluginResource::Call(Destination dest, new PluginResourceCallback<ReplyMsgClass, CallbackType>(callback)); callbacks_.insert(std::make_pair(params.sequence(), plugin_callback)); params.set_has_callback(); + + if (resource_reply_thread_registrar_) { + resource_reply_thread_registrar_->Register( + pp_resource(), params.sequence(), reply_thread_hint); + } SendResourceCall(dest, params, msg); return params.sequence(); } diff --git a/chromium/ppapi/proxy/plugin_resource_var.cc b/chromium/ppapi/proxy/plugin_resource_var.cc index 0ccff749e4d..be4eec5b674 100644 --- a/chromium/ppapi/proxy/plugin_resource_var.cc +++ b/chromium/ppapi/proxy/plugin_resource_var.cc @@ -10,7 +10,7 @@ PluginResourceVar::PluginResourceVar(ppapi::Resource* resource) : resource_(resource) {} PP_Resource PluginResourceVar::GetPPResource() const { - return resource_->pp_resource(); + return resource_ ? resource_->pp_resource() : 0; } bool PluginResourceVar::IsPending() const { diff --git a/chromium/ppapi/proxy/plugin_resource_var.h b/chromium/ppapi/proxy/plugin_resource_var.h index b02718b6a9f..42be66d219e 100644 --- a/chromium/ppapi/proxy/plugin_resource_var.h +++ b/chromium/ppapi/proxy/plugin_resource_var.h @@ -31,6 +31,7 @@ class PPAPI_PROXY_EXPORT PluginResourceVar : public ppapi::ResourceVar { virtual ~PluginResourceVar(); private: + // If NULL, this represents the PP_Resource 0. scoped_refptr<ppapi::Resource> resource_; DISALLOW_COPY_AND_ASSIGN(PluginResourceVar); diff --git a/chromium/ppapi/proxy/plugin_var_tracker.cc b/chromium/ppapi/proxy/plugin_var_tracker.cc index d2a4d74d0e3..a9cbd9c7a62 100644 --- a/chromium/ppapi/proxy/plugin_var_tracker.cc +++ b/chromium/ppapi/proxy/plugin_var_tracker.cc @@ -6,10 +6,13 @@ #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" +#include "ipc/ipc_message.h" #include "ppapi/c/dev/ppp_class_deprecated.h" #include "ppapi/c/ppb_var.h" +#include "ppapi/proxy/file_system_resource.h" #include "ppapi/proxy/plugin_array_buffer_var.h" #include "ppapi/proxy/plugin_dispatcher.h" +#include "ppapi/proxy/plugin_globals.h" #include "ppapi/proxy/plugin_resource_var.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/proxy_object_var.h" @@ -22,6 +25,16 @@ namespace ppapi { namespace proxy { +namespace { + +Connection GetConnectionForInstance(PP_Instance instance) { + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); + DCHECK(dispatcher); + return Connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher); +} + +} // namespace + PluginVarTracker::HostVar::HostVar(PluginDispatcher* d, int32 i) : dispatcher(d), host_object_id(i) { @@ -154,9 +167,49 @@ void PluginVarTracker::ReleaseHostObject(PluginDispatcher* dispatcher, ReleaseVar(found->second); } +PP_Var PluginVarTracker::MakeResourcePPVarFromMessage( + PP_Instance instance, + const IPC::Message& creation_message, + int pending_renderer_id, + int pending_browser_id) { + DCHECK(pending_renderer_id); + DCHECK(pending_browser_id); + switch (creation_message.type()) { + case PpapiPluginMsg_FileSystem_CreateFromPendingHost::ID: { + PP_FileSystemType file_system_type; + if (!UnpackMessage<PpapiPluginMsg_FileSystem_CreateFromPendingHost>( + creation_message, &file_system_type)) { + NOTREACHED() << "Invalid message of type " + "PpapiPluginMsg_FileSystem_CreateFromPendingHost"; + return PP_MakeNull(); + } + // Create a plugin-side resource and attach it to the host resource. + // Note: This only makes sense when the plugin is out of process (which + // should always be true when passing resource vars). + PP_Resource pp_resource = + (new FileSystemResource(GetConnectionForInstance(instance), + instance, + pending_renderer_id, + pending_browser_id, + file_system_type))->GetReference(); + return MakeResourcePPVar(pp_resource); + } + default: { + NOTREACHED() << "Creation message has unexpected type " + << creation_message.type(); + return PP_MakeNull(); + } + } +} + ResourceVar* PluginVarTracker::MakeResourceVar(PP_Resource pp_resource) { + // The resource 0 returns a null resource var. + if (!pp_resource) + return new PluginResourceVar(); + ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker(); ppapi::Resource* resource = resource_tracker->GetResource(pp_resource); + // A non-existant resource other than 0 returns NULL. if (!resource) return NULL; return new PluginResourceVar(resource); @@ -270,9 +323,11 @@ int32 PluginVarTracker::AddVarInternal(Var* var, AddVarRefMode mode) { ProxyObjectVar* proxy_object = var->AsProxyObjectVar(); if (proxy_object) { HostVar host_var(proxy_object->dispatcher(), proxy_object->host_var_id()); - DCHECK(host_var_to_plugin_var_.find(host_var) == - host_var_to_plugin_var_.end()); // Adding an object twice, use - // FindOrMakePluginVarFromHostVar. + // TODO(teravest): Change to DCHECK when http://crbug.com/276347 is + // resolved. + CHECK(host_var_to_plugin_var_.find(host_var) == + host_var_to_plugin_var_.end()); // Adding an object twice, use + // FindOrMakePluginVarFromHostVar. host_var_to_plugin_var_[host_var] = new_id; } return new_id; @@ -394,7 +449,10 @@ scoped_refptr<ProxyObjectVar> PluginVarTracker::FindOrMakePluginVarFromHostVar( // Have this host var, look up the object. VarMap::iterator ret = live_vars_.find(found->second); - DCHECK(ret != live_vars_.end()); + + // We CHECK here because we currently don't fall back sanely. + // This may be involved in a NULL dereference. http://crbug.com/276347 + CHECK(ret != live_vars_.end()); // All objects should be proxy objects. DCHECK(ret->second.var->AsProxyObjectVar()); diff --git a/chromium/ppapi/proxy/plugin_var_tracker.h b/chromium/ppapi/proxy/plugin_var_tracker.h index 126c8fcac59..03a9e5e412b 100644 --- a/chromium/ppapi/proxy/plugin_var_tracker.h +++ b/chromium/ppapi/proxy/plugin_var_tracker.h @@ -59,6 +59,11 @@ class PPAPI_PROXY_EXPORT PluginVarTracker : public VarTracker { const PP_Var& host_object); // VarTracker public overrides. + virtual PP_Var MakeResourcePPVarFromMessage( + PP_Instance instance, + const IPC::Message& creation_message, + int pending_renderer_id, + int pending_browser_id) OVERRIDE; virtual ResourceVar* MakeResourceVar(PP_Resource pp_resource) OVERRIDE; virtual void DidDeleteInstance(PP_Instance instance) OVERRIDE; virtual int TrackSharedMemoryHandle(PP_Instance instance, diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc index 8ca17e442d1..a6da210795d 100644 --- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc +++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc @@ -8,6 +8,7 @@ #include "ppapi/proxy/proxy_channel.h" #include "ppapi/shared_impl/api_id.h" #include "ppapi/shared_impl/host_resource.h" +#include "ppapi/shared_impl/proxy_lock.h" namespace ppapi { namespace proxy { @@ -29,32 +30,6 @@ PpapiCommandBufferProxy::~PpapiCommandBufferProxy() { } } -void PpapiCommandBufferProxy::ReportChannelError() { - if (!channel_error_callback_.is_null()) { - channel_error_callback_.Run(); - channel_error_callback_.Reset(); - } -} - -int PpapiCommandBufferProxy::GetRouteID() const { - NOTIMPLEMENTED(); - return 0; -} - -bool PpapiCommandBufferProxy::Echo(const base::Closure& callback) { - return false; -} - -bool PpapiCommandBufferProxy::ProduceFrontBuffer(const gpu::Mailbox& mailbox) { - NOTIMPLEMENTED(); - return false; -} - -void PpapiCommandBufferProxy::SetChannelErrorCallback( - const base::Closure& callback) { - channel_error_callback_ = callback; -} - bool PpapiCommandBufferProxy::Initialize() { return true; } @@ -74,14 +49,12 @@ gpu::CommandBuffer::State PpapiCommandBufferProxy::GetState() { } gpu::CommandBuffer::State PpapiCommandBufferProxy::GetLastState() { - // Note: The locking command buffer wrapper does not take a global lock before - // calling this function. + ppapi::ProxyLock::AssertAcquiredDebugOnly(); return last_state_; } int32 PpapiCommandBufferProxy::GetLastToken() { - // Note: The locking command buffer wrapper does not take a global lock before - // calling this function. + ppapi::ProxyLock::AssertAcquiredDebugOnly(); return last_state_.token; } @@ -166,6 +139,10 @@ void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) { ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id)); } +void PpapiCommandBufferProxy::Echo(const base::Closure& callback) { + NOTREACHED(); +} + gpu::Buffer PpapiCommandBufferProxy::GetTransferBuffer(int32 id) { if (last_state_.error != gpu::error::kNoError) return gpu::Buffer(); @@ -230,6 +207,53 @@ uint32 PpapiCommandBufferProxy::InsertSyncPoint() { return sync_point; } +void PpapiCommandBufferProxy::SignalSyncPoint(uint32 sync_point, + const base::Closure& callback) { + NOTREACHED(); +} + +void PpapiCommandBufferProxy::SignalQuery(uint32 query, + const base::Closure& callback) { + NOTREACHED(); +} + +void PpapiCommandBufferProxy::SetSurfaceVisible(bool visible) { + NOTREACHED(); +} + +void PpapiCommandBufferProxy::SendManagedMemoryStats( + const gpu::ManagedMemoryStats& stats) { + NOTREACHED(); +} + +gpu::Capabilities PpapiCommandBufferProxy::GetCapabilities() { + // TODO(boliu): Need to implement this to use cc in Pepper. Tracked in + // crbug.com/325391. + return gpu::Capabilities(); +} + +gfx::GpuMemoryBuffer* PpapiCommandBufferProxy::CreateGpuMemoryBuffer( + size_t width, + size_t height, + unsigned internalformat, + int32* id) { + NOTREACHED(); + return NULL; +} + +void PpapiCommandBufferProxy::DestroyGpuMemoryBuffer(int32 id) { + NOTREACHED(); +} + +bool PpapiCommandBufferProxy::GenerateMailboxNames( + unsigned num, std::vector<gpu::Mailbox>* names) { + // TODO(piman): implement this so we can expose mailboxes to pepper + // eventually. + NOTREACHED(); + return false; +} + + bool PpapiCommandBufferProxy::Send(IPC::Message* msg) { DCHECK(last_state_.error == gpu::error::kNoError); diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h index b5c2c93081c..16809bdfea9 100644 --- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h +++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h @@ -8,7 +8,7 @@ #include "base/callback.h" #include "base/containers/hash_tables.h" #include "gpu/command_buffer/common/command_buffer.h" -#include "gpu/ipc/command_buffer_proxy.h" +#include "gpu/command_buffer/common/gpu_control.h" #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/shared_impl/host_resource.h" @@ -21,36 +21,49 @@ namespace proxy { class ProxyChannel; -class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public CommandBufferProxy { +class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, + public gpu::GpuControl { public: PpapiCommandBufferProxy(const HostResource& resource, ProxyChannel* channel); virtual ~PpapiCommandBufferProxy(); - void ReportChannelError(); - - // CommandBufferProxy implementation: - virtual int GetRouteID() const OVERRIDE; - virtual bool Echo(const base::Closure& callback) OVERRIDE; - virtual bool ProduceFrontBuffer(const gpu::Mailbox& mailbox) OVERRIDE; - virtual void SetChannelErrorCallback(const base::Closure& callback) OVERRIDE; - // gpu::CommandBuffer implementation: - virtual bool Initialize(); - virtual State GetState(); - virtual State GetLastState(); - virtual int32 GetLastToken(); - virtual void Flush(int32 put_offset); - virtual State FlushSync(int32 put_offset, int32 last_known_get); - virtual void SetGetBuffer(int32 transfer_buffer_id); - virtual void SetGetOffset(int32 get_offset); - virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id); - virtual void DestroyTransferBuffer(int32 id); - virtual gpu::Buffer GetTransferBuffer(int32 id); - virtual void SetToken(int32 token); - virtual void SetParseError(gpu::error::Error error); - virtual void SetContextLostReason(gpu::error::ContextLostReason reason); - virtual uint32 InsertSyncPoint(); + virtual bool Initialize() OVERRIDE; + virtual State GetState() OVERRIDE; + virtual State GetLastState() OVERRIDE; + virtual int32 GetLastToken() OVERRIDE; + virtual void Flush(int32 put_offset) OVERRIDE; + virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; + virtual void SetGetBuffer(int32 transfer_buffer_id) OVERRIDE; + virtual void SetGetOffset(int32 get_offset) OVERRIDE; + virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id) OVERRIDE; + virtual void DestroyTransferBuffer(int32 id) OVERRIDE; + virtual gpu::Buffer GetTransferBuffer(int32 id) OVERRIDE; + virtual void SetToken(int32 token) OVERRIDE; + virtual void SetParseError(gpu::error::Error error) OVERRIDE; + virtual void SetContextLostReason(gpu::error::ContextLostReason reason) + OVERRIDE; + + // gpu::GpuControl implementation: + virtual gpu::Capabilities GetCapabilities() OVERRIDE; + virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( + size_t width, + size_t height, + unsigned internalformat, + int32* id) OVERRIDE; + virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; + virtual bool GenerateMailboxNames(unsigned num, + std::vector<gpu::Mailbox>* names) OVERRIDE; + virtual uint32 InsertSyncPoint() OVERRIDE; + virtual void SignalSyncPoint(uint32 sync_point, + const base::Closure& callback) OVERRIDE; + virtual void SignalQuery(uint32 query, + const base::Closure& callback) OVERRIDE; + virtual void SetSurfaceVisible(bool visible) OVERRIDE; + virtual void SendManagedMemoryStats(const gpu::ManagedMemoryStats& stats) + OVERRIDE; + virtual void Echo(const base::Closure& callback) OVERRIDE; private: bool Send(IPC::Message* msg); diff --git a/chromium/ppapi/proxy/ppapi_messages.h b/chromium/ppapi/proxy/ppapi_messages.h index 60cc37fafdf..4b4fed8aef4 100644 --- a/chromium/ppapi/proxy/ppapi_messages.h +++ b/chromium/ppapi/proxy/ppapi_messages.h @@ -21,6 +21,7 @@ #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_graphics_2d_dev.h" #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" #include "ppapi/c/dev/ppp_printing_dev.h" @@ -42,6 +43,7 @@ #include "ppapi/c/private/pp_private_font_charset.h" #include "ppapi/c/private/ppb_flash.h" #include "ppapi/c/private/ppb_host_resolver_private.h" +#include "ppapi/c/private/ppb_isolated_file_system_private.h" #include "ppapi/c/private/ppb_net_address_private.h" #include "ppapi/c/private/ppb_pdf.h" #include "ppapi/c/private/ppb_talk_private.h" @@ -80,14 +82,18 @@ IPC_ENUM_TRAITS_MAX_VALUE(ppapi::TCPSocketVersion, 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_MAX_VALUE(PP_FileSystemType, PP_FILESYSTEMTYPE_ISOLATED) +IPC_ENUM_TRAITS_MAX_VALUE(PP_FileType, PP_FILETYPE_OTHER) IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_Permission) IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_SettingType) IPC_ENUM_TRAITS(PP_FlashSetting) +IPC_ENUM_TRAITS_MAX_VALUE(PP_Graphics2D_Dev_ResizeMode, + PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH) IPC_ENUM_TRAITS(PP_ImageDataFormat) IPC_ENUM_TRAITS(PP_InputEvent_MouseButton) IPC_ENUM_TRAITS(PP_InputEvent_Type) +IPC_ENUM_TRAITS_MAX_VALUE(PP_IsolatedFileSystemType_Private, + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE) IPC_ENUM_TRAITS_MAX_VALUE(PP_NetAddressFamily_Private, PP_NETADDRESSFAMILY_PRIVATE_IPV6) IPC_ENUM_TRAITS_MAX_VALUE(PP_NetworkList_State, PP_NETWORKLIST_STATE_UP) @@ -194,6 +200,15 @@ IPC_STRUCT_TRAITS_BEGIN(PP_URLComponents_Dev) IPC_STRUCT_TRAITS_MEMBER(ref) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(PP_FileInfo) + IPC_STRUCT_TRAITS_MEMBER(size) + IPC_STRUCT_TRAITS_MEMBER(type) + IPC_STRUCT_TRAITS_MEMBER(system_type) + IPC_STRUCT_TRAITS_MEMBER(creation_time) + IPC_STRUCT_TRAITS_MEMBER(last_access_time) + IPC_STRUCT_TRAITS_MEMBER(last_modified_time) +IPC_STRUCT_TRAITS_END() + IPC_STRUCT_TRAITS_BEGIN(ppapi::DeviceRefData) IPC_STRUCT_TRAITS_MEMBER(type) IPC_STRUCT_TRAITS_MEMBER(name) @@ -349,9 +364,10 @@ IPC_STRUCT_TRAITS_END() // These are from the browser to the plugin. // Loads the given plugin. -IPC_MESSAGE_CONTROL2(PpapiMsg_LoadPlugin, +IPC_MESSAGE_CONTROL3(PpapiMsg_LoadPlugin, base::FilePath /* path */, - ppapi::PpapiPermissions /* permissions */) + ppapi::PpapiPermissions /* permissions */, + bool /* supports_dev_channel */) // Creates a channel to talk to a renderer. The plugin will respond with // PpapiHostMsg_ChannelCreated. @@ -490,12 +506,6 @@ IPC_MESSAGE_ROUTED4(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, ppapi::proxy::SerializedHandle /* socket_handle */, ppapi::proxy::SerializedHandle /* handle */) -// PPB_FileSystem. -IPC_MESSAGE_ROUTED2( - PpapiMsg_PPBFileSystem_OpenComplete, - ppapi::HostResource /* filesystem */, - int32_t /* result */) - // PPB_Graphics3D. IPC_MESSAGE_ROUTED2(PpapiMsg_PPBGraphics3D_SwapBuffersACK, ppapi::HostResource /* graphics_3d */, @@ -636,22 +646,21 @@ IPC_MESSAGE_ROUTED3( int32_t /* result */) // PPP_ContentDecryptor_Dev -IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_Initialize, +IPC_MESSAGE_ROUTED2(PpapiMsg_PPPContentDecryptor_Initialize, PP_Instance /* instance */, - ppapi::proxy::SerializedVar /* key_system, String */, - bool /* can_challenge_platform */) -IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest, + ppapi::proxy::SerializedVar /* key_system, String */) +IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_CreateSession, PP_Instance /* instance */, + uint32_t /* session_id */, ppapi::proxy::SerializedVar /* type, String */, ppapi::proxy::SerializedVar /* init_data, ArrayBuffer */) -IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_AddKey, +IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_UpdateSession, PP_Instance /* instance */, - ppapi::proxy::SerializedVar /* session_id, String */, - ppapi::proxy::SerializedVar /* key, ArrayBuffer */, - ppapi::proxy::SerializedVar /* init_data, ArrayBuffer */) -IPC_MESSAGE_ROUTED2(PpapiMsg_PPPContentDecryptor_CancelKeyRequest, + uint32_t /* session_id */, + ppapi::proxy::SerializedVar /* response, ArrayBuffer */) +IPC_MESSAGE_ROUTED2(PpapiMsg_PPPContentDecryptor_ReleaseSession, PP_Instance /* instance */, - ppapi::proxy::SerializedVar /* session_id, String */) + uint32_t /* session_id */) IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_Decrypt, PP_Instance /* instance */, ppapi::proxy::PPPDecryptor_Buffer /* buffer */, @@ -974,20 +983,24 @@ IPC_SYNC_MESSAGE_ROUTED2_2( ppapi::proxy::SerializedHandle /* result_shm_handle */) // PPB_ContentDecryptor_Dev messages handled in PPB_Instance_Proxy. -IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_KeyAdded, +IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_SessionCreated, PP_Instance /* instance */, - ppapi::proxy::SerializedVar /* key_system, String */, - ppapi::proxy::SerializedVar /* session_id, String */) -IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBInstance_KeyMessage, + uint32_t /* session_id */, + ppapi::proxy::SerializedVar /* web_session_id, String */) +IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBInstance_SessionMessage, PP_Instance /* instance */, - ppapi::proxy::SerializedVar /* key_system, String */, - ppapi::proxy::SerializedVar /* session_id, String */, + uint32_t /* session_id */, ppapi::proxy::SerializedVar /* message, ArrayBuffer */, - ppapi::proxy::SerializedVar /* default_url, String */) -IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBInstance_KeyError, + ppapi::proxy::SerializedVar /* destination_url, String */) +IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBInstance_SessionReady, + PP_Instance /* instance */, + uint32_t /* session_id */) +IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBInstance_SessionClosed, PP_Instance /* instance */, - ppapi::proxy::SerializedVar /* key_system, String */, - ppapi::proxy::SerializedVar /* session_id, String */, + uint32_t /* session_id */) +IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBInstance_SessionError, + PP_Instance /* instance */, + uint32_t /* session_id */, int32_t /* media_error */, int32_t /* system_code */) IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_DeliverBlock, @@ -1194,12 +1207,6 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_ExtensionsCommon_Call, IPC_MESSAGE_CONTROL1(PpapiPluginMsg_ExtensionsCommon_CallReply, base::ListValue /* output */) -// Ext_CrxFileSystem -IPC_MESSAGE_CONTROL0(PpapiHostMsg_Ext_CrxFileSystem_Create) -IPC_MESSAGE_CONTROL0(PpapiHostMsg_Ext_CrxFileSystem_BrowserOpen) -IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply, - std::string /* fsid */) - // File chooser. IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileChooser_Create) IPC_MESSAGE_CONTROL4(PpapiHostMsg_FileChooser_Show, @@ -1226,14 +1233,6 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileIO_Write, IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileIO_SetLength, int64_t /* length */) IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_Flush) -IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileIO_WillWrite, - int64_t /* offset */, - int32_t /* bytes_to_write */) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileIO_WillSetLength, - int64_t /* length */) -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) @@ -1302,9 +1301,20 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_Create, IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_Open, int64_t /* expected_size */) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileSystem_OpenReply) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_InitIsolatedFileSystem, - std::string /* fsid */) +IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileSystem_InitIsolatedFileSystem, + std::string /* fsid */, + PP_IsolatedFileSystemType_Private /* type */) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileSystem_InitIsolatedFileSystemReply) +// Passed from renderer to browser. Creates an already-open file system with a +// given |root_url| and |file_system_type|. +IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileSystem_CreateFromRenderer, + std::string /* root_url */, + PP_FileSystemType /* file_system_type */) +// Nested within a ResourceVar for file systems being passed from the renderer +// to the plugin. Creates an already-open file system resource on the plugin, +// linked to the existing resource host given in the ResourceVar. +IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FileSystem_CreateFromPendingHost, + PP_FileSystemType /* file_system_type */) // Flash DRM ------------------------------------------------------------------ IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDRM_Create) @@ -1330,6 +1340,14 @@ IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDRM_GetVoucherFile) IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashDRM_GetVoucherFileReply, ppapi::FileRefCreateInfo /* file_info */) +// Requests a value indicating whether the monitor on which the instance is +// displayed is external. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDRM_MonitorIsExternal) +// Reply message for MonitorIsExternal which contains the value indicating if +// the monitor is external. +IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashDRM_MonitorIsExternalReply, + PP_Bool /* is_external */) + // Gamepad. IPC_MESSAGE_CONTROL0(PpapiHostMsg_Gamepad_Create) @@ -1359,9 +1377,14 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_ReplaceContents, ppapi::HostResource /* image_data */) IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Dev_SetScale, float /* scale */) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetOffset, + PP_Point /* offset */) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetResizeMode, + PP_Graphics2D_Dev_ResizeMode /* resize_mode */) // Graphics2D, plugin -> host -> plugin -IPC_MESSAGE_CONTROL0(PpapiHostMsg_Graphics2D_Flush) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Flush, + ppapi::ViewData /* view_data */) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Graphics2D_FlushAck) IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_ReadImageData, @@ -1369,13 +1392,19 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_ReadImageData, PP_Point /* top_left */) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Graphics2D_ReadImageDataAck) +// IsolatedFileSystem +IPC_MESSAGE_CONTROL0(PpapiHostMsg_IsolatedFileSystem_Create) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_IsolatedFileSystem_BrowserOpen, + PP_IsolatedFileSystemType_Private /* type */) +IPC_MESSAGE_CONTROL1(PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply, + std::string /* fsid */) + // NetworkMonitor. IPC_MESSAGE_CONTROL0(PpapiHostMsg_NetworkMonitor_Create) IPC_MESSAGE_CONTROL1(PpapiPluginMsg_NetworkMonitor_NetworkList, ppapi::proxy::SerializedNetworkList /* network_list */) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_NetworkMonitor_Forbidden) - // NetworkProxy ---------------------------------------------------------------- IPC_MESSAGE_CONTROL0(PpapiHostMsg_NetworkProxy_Create) @@ -1433,10 +1462,6 @@ IPC_MESSAGE_CONTROL2(PpapiPluginMsg_HostResolver_ResolveReply, // Platform Verification ------------------------------------------------------- IPC_MESSAGE_CONTROL0(PpapiHostMsg_PlatformVerification_Create) -IPC_MESSAGE_CONTROL0(PpapiHostMsg_PlatformVerification_CanChallengePlatform) -IPC_MESSAGE_CONTROL1( - PpapiHostMsg_PlatformVerification_CanChallengePlatformReply, - bool /* can_challenge_platform */) IPC_MESSAGE_CONTROL2(PpapiHostMsg_PlatformVerification_ChallengePlatform, std::string /* service_id */, std::vector<uint8_t> /* challenge */) @@ -1713,6 +1738,17 @@ IPC_MESSAGE_CONTROL4(PpapiPluginMsg_WebSocket_ClosedReply, uint16_t /* code */, std::string /* reason */) +// OutputProtection ----------------------------------------------------------- + +IPC_MESSAGE_CONTROL0(PpapiHostMsg_OutputProtection_Create) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_OutputProtection_EnableProtection, + uint32_t /* desired_method_mask */) +IPC_MESSAGE_CONTROL0(PpapiPluginMsg_OutputProtection_EnableProtectionReply) +IPC_MESSAGE_CONTROL0(PpapiHostMsg_OutputProtection_QueryStatus) +IPC_MESSAGE_CONTROL2(PpapiPluginMsg_OutputProtection_QueryStatusReply, + uint32_t /* link_mask */, + uint32_t /* protection_mask */) + #if !defined(OS_NACL) && !defined(NACL_WIN64) // Audio input. diff --git a/chromium/ppapi/proxy/ppapi_param_traits.cc b/chromium/ppapi/proxy/ppapi_param_traits.cc index 5d4345f85aa..5ee0a34397a 100644 --- a/chromium/ppapi/proxy/ppapi_param_traits.cc +++ b/chromium/ppapi/proxy/ppapi_param_traits.cc @@ -6,7 +6,6 @@ #include <string.h> // For memcpy -#include "ppapi/c/pp_file_info.h" #include "ppapi/c/pp_resource.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/serialized_var.h" @@ -98,48 +97,6 @@ bool ParamTraits<PP_Bool>::Read(const Message* m, void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { } -// PP_FileInfo ------------------------------------------------------------- - -// static -void ParamTraits<PP_FileInfo>::Write(Message* m, const param_type& p) { - ParamTraits<int64_t>::Write(m, p.size); - ParamTraits<int>::Write(m, static_cast<int>(p.type)); - ParamTraits<int>::Write(m, static_cast<int>(p.system_type)); - ParamTraits<double>::Write(m, p.creation_time); - ParamTraits<double>::Write(m, p.last_access_time); - ParamTraits<double>::Write(m, p.last_modified_time); -} - -// static -bool ParamTraits<PP_FileInfo>::Read(const Message* m, PickleIterator* iter, - param_type* r) { - int type, system_type; - if (!ParamTraits<int64_t>::Read(m, iter, &r->size) || - !ParamTraits<int>::Read(m, iter, &type) || - !ParamTraits<int>::Read(m, iter, &system_type) || - !ParamTraits<double>::Read(m, iter, &r->creation_time) || - !ParamTraits<double>::Read(m, iter, &r->last_access_time) || - !ParamTraits<double>::Read(m, iter, &r->last_modified_time)) - return false; - if (type != PP_FILETYPE_REGULAR && - type != PP_FILETYPE_DIRECTORY && - type != PP_FILETYPE_OTHER) - return false; - r->type = static_cast<PP_FileType>(type); - if (system_type != PP_FILESYSTEMTYPE_INVALID && - system_type != PP_FILESYSTEMTYPE_EXTERNAL && - system_type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && - system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY && - system_type != PP_FILESYSTEMTYPE_ISOLATED) - return false; - r->system_type = static_cast<PP_FileSystemType>(system_type); - return true; -} - -// static -void ParamTraits<PP_FileInfo>::Log(const param_type& p, std::string* l) { -} - // PP_NetAddress_Private ------------------------------------------------------- // static diff --git a/chromium/ppapi/proxy/ppapi_param_traits.h b/chromium/ppapi/proxy/ppapi_param_traits.h index b56ec3e3d4b..3bf5fb6b696 100644 --- a/chromium/ppapi/proxy/ppapi_param_traits.h +++ b/chromium/ppapi/proxy/ppapi_param_traits.h @@ -19,7 +19,6 @@ #include "ppapi/shared_impl/ppapi_permissions.h" #include "ppapi/shared_impl/socket_option_data.h" -struct PP_FileInfo; struct PP_NetAddress_Private; namespace ppapi { @@ -51,14 +50,6 @@ struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> { static void Log(const param_type& p, std::string* l); }; -template<> -struct PPAPI_PROXY_EXPORT ParamTraits<PP_FileInfo> { - typedef PP_FileInfo 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<PP_NetAddress_Private> { typedef PP_NetAddress_Private param_type; diff --git a/chromium/ppapi/proxy/ppb_audio_proxy.cc b/chromium/ppapi/proxy/ppb_audio_proxy.cc index 49ed0afb2d2..58f5abc0d41 100644 --- a/chromium/ppapi/proxy/ppb_audio_proxy.cc +++ b/chromium/ppapi/proxy/ppb_audio_proxy.cc @@ -6,7 +6,6 @@ #include "base/compiler_specific.h" #include "base/threading/simple_thread.h" -#include "media/audio/shared_memory_util.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_audio.h" #include "ppapi/c/ppb_audio_config.h" @@ -262,15 +261,7 @@ void PPB_Audio_Proxy::AudioChannelConnected( // us, as long as the remote side always closes the handles it receives // (in OnMsgNotifyAudioStreamCreated), even in the failure case. SerializedHandle fd_wrapper(SerializedHandle::SOCKET, socket_handle); - - // Note that we must call TotalSharedMemorySizeInBytes because - // Audio allocates extra space in shared memory for book-keeping, so the - // actual size of the shared memory buffer is larger than audio_buffer_length. - // When sending to NaCl, NaClIPCAdapter expects this size to match the size - // of the full shared memory buffer. - SerializedHandle handle_wrapper( - shared_memory, - media::TotalSharedMemorySizeInBytes(audio_buffer_length)); + SerializedHandle handle_wrapper(shared_memory, audio_buffer_length); dispatcher()->Send(new PpapiMsg_PPBAudio_NotifyAudioStreamCreated( API_ID_PPB_AUDIO, resource, result_code, fd_wrapper, handle_wrapper)); } @@ -333,13 +324,8 @@ void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated( } else { EnterResourceNoLock<PPB_AudioConfig_API> config( static_cast<Audio*>(enter.object())->GetCurrentConfig(), true); - // See the comment above about how we must call - // TotalSharedMemorySizeInBytes to get the actual size of the buffer. Here, - // we must call PacketSizeInBytes to get back the size of the audio buffer, - // excluding the bytes that audio uses for book-keeping. static_cast<Audio*>(enter.object())->SetStreamInfo( - enter.resource()->pp_instance(), handle.shmem(), - media::PacketSizeInBytes(handle.size()), + enter.resource()->pp_instance(), handle.shmem(), handle.size(), IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), config.object()->GetSampleRate(), config.object()->GetSampleFrameCount()); diff --git a/chromium/ppapi/proxy/ppb_graphics_3d_proxy.cc b/chromium/ppapi/proxy/ppb_graphics_3d_proxy.cc index 5fb1d1098c8..02e06f76b8f 100644 --- a/chromium/ppapi/proxy/ppb_graphics_3d_proxy.cc +++ b/chromium/ppapi/proxy/ppb_graphics_3d_proxy.cc @@ -12,7 +12,6 @@ #include "ppapi/proxy/ppapi_command_buffer_proxy.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/shared_impl/ppapi_globals.h" -#include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/resource_creation_api.h" #include "ppapi/thunk/thunk.h" @@ -53,132 +52,8 @@ gpu::CommandBuffer::State GetErrorState() { } // namespace -// This class just wraps a CommandBuffer and optionally locks around every -// method. This is used to ensure that we have the Proxy lock any time we enter -// PpapiCommandBufferProxy. -// -// Note, for performance reasons, most of this code is not truly thread -// safe in the sense of multiple threads concurrently rendering to the same -// Graphics3D context; this isn't allowed, and will likely either crash or -// result in undefined behavior. It is assumed that the thread which creates -// the Graphics3D context will be the thread on which subsequent gl rendering -// will be done. This is why it is okay to read need_to_lock_ without the lock; -// it should only ever be read and written on the same thread where the context -// was created. -// -// TODO(nfullagar): At some point, allow multiple threads to concurrently render -// each to its own context. First step is to allow a single thread (either main -// thread or background thread) to render to a single Graphics3D context. -class Graphics3D::LockingCommandBuffer : public gpu::CommandBuffer { - public: - explicit LockingCommandBuffer(gpu::CommandBuffer* gpu_command_buffer) - : gpu_command_buffer_(gpu_command_buffer), need_to_lock_(true) { - } - virtual ~LockingCommandBuffer() { - } - void set_need_to_lock(bool need_to_lock) { need_to_lock_ = need_to_lock; } - bool need_to_lock() const { return need_to_lock_; } - - private: - // MaybeLock acquires the proxy lock on construction if and only if - // need_to_lock is true. If it acquired the lock, it releases it on - // destruction. If need_to_lock is false, then the lock must already be held. - struct MaybeLock { - explicit MaybeLock(bool need_to_lock) : locked_(need_to_lock) { - if (need_to_lock) - ppapi::ProxyLock::Acquire(); - else - ppapi::ProxyLock::AssertAcquired(); - } - ~MaybeLock() { - if (locked_) - ppapi::ProxyLock::Release(); - } - private: - bool locked_; - }; - - // gpu::CommandBuffer implementation: - virtual bool Initialize() OVERRIDE { - MaybeLock lock(need_to_lock_); - return gpu_command_buffer_->Initialize(); - } - virtual State GetState() OVERRIDE { - MaybeLock lock(need_to_lock_); - return gpu_command_buffer_->GetState(); - } - virtual State GetLastState() OVERRIDE { - // During a normal scene, the vast majority of calls are to GetLastState(). - // We don't allow multi-threaded rendering on the same contex, so for - // performance reasons, avoid the global lock for this entry point. We can - // get away with this here because the underlying implementation of - // GetLastState() is trivial and does not involve global or shared state - // between other contexts. - // TODO(nfullagar): We can probably skip MaybeLock for other methods, but - // the performance gain may not be worth it. - // - // MaybeLock lock(need_to_lock_); - return gpu_command_buffer_->GetLastState(); - } - virtual int32 GetLastToken() OVERRIDE { - return GetLastState().token; - } - virtual void Flush(int32 put_offset) OVERRIDE { - MaybeLock lock(need_to_lock_); - gpu_command_buffer_->Flush(put_offset); - } - virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE { - MaybeLock lock(need_to_lock_); - return gpu_command_buffer_->FlushSync(put_offset, last_known_get); - } - virtual void SetGetBuffer(int32 transfer_buffer_id) OVERRIDE { - MaybeLock lock(need_to_lock_); - gpu_command_buffer_->SetGetBuffer(transfer_buffer_id); - } - virtual void SetGetOffset(int32 get_offset) OVERRIDE { - MaybeLock lock(need_to_lock_); - gpu_command_buffer_->SetGetOffset(get_offset); - } - virtual gpu::Buffer CreateTransferBuffer(size_t size, - int32* id) OVERRIDE { - MaybeLock lock(need_to_lock_); - return gpu_command_buffer_->CreateTransferBuffer(size, id); - } - virtual void DestroyTransferBuffer(int32 id) OVERRIDE { - MaybeLock lock(need_to_lock_); - gpu_command_buffer_->DestroyTransferBuffer(id); - } - virtual gpu::Buffer GetTransferBuffer(int32 id) OVERRIDE { - MaybeLock lock(need_to_lock_); - return gpu_command_buffer_->GetTransferBuffer(id); - } - virtual void SetToken(int32 token) OVERRIDE { - MaybeLock lock(need_to_lock_); - gpu_command_buffer_->SetToken(token); - } - virtual void SetParseError(gpu::error::Error error) OVERRIDE { - MaybeLock lock(need_to_lock_); - gpu_command_buffer_->SetParseError(error); - } - virtual void SetContextLostReason( - gpu::error::ContextLostReason reason) OVERRIDE { - MaybeLock lock(need_to_lock_); - gpu_command_buffer_->SetContextLostReason(reason); - } - virtual uint32 InsertSyncPoint() OVERRIDE { - MaybeLock lock(need_to_lock_); - return gpu_command_buffer_->InsertSyncPoint(); - } - - // Weak pointer - see class Graphics3D for the scopted_ptr. - gpu::CommandBuffer* gpu_command_buffer_; - - bool need_to_lock_; -}; - Graphics3D::Graphics3D(const HostResource& resource) - : PPB_Graphics3D_Shared(resource), - num_already_locked_calls_(0) { + : PPB_Graphics3D_Shared(resource) { } Graphics3D::~Graphics3D() { @@ -192,10 +67,7 @@ bool Graphics3D::Init(gpu::gles2::GLES2Implementation* share_gles2) { command_buffer_.reset( new PpapiCommandBufferProxy(host_resource(), dispatcher)); - locking_command_buffer_.reset( - new LockingCommandBuffer(command_buffer_.get())); - ScopedNoLocking already_locked(this); return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize, share_gles2); } @@ -241,14 +113,14 @@ uint32_t Graphics3D::InsertSyncPoint() { } gpu::CommandBuffer* Graphics3D::GetCommandBuffer() { - return locking_command_buffer_.get(); + return command_buffer_.get(); } -int32 Graphics3D::DoSwapBuffers() { - // gles2_impl()->SwapBuffers() results in CommandBuffer calls, and we already - // have the proxy lock. - ScopedNoLocking already_locked(this); +gpu::GpuControl* Graphics3D::GetGpuControl() { + return command_buffer_.get(); +} +int32 Graphics3D::DoSwapBuffers() { gles2_impl()->SwapBuffers(); IPC::Message* msg = new PpapiHostMsg_PPBGraphics3D_SwapBuffers( API_ID_PPB_GRAPHICS_3D, host_resource()); @@ -258,31 +130,6 @@ int32 Graphics3D::DoSwapBuffers() { return PP_OK_COMPLETIONPENDING; } -void Graphics3D::PushAlreadyLocked() { - ppapi::ProxyLock::AssertAcquired(); - if (!locking_command_buffer_) { - NOTREACHED(); - return; - } - if (num_already_locked_calls_ == 0) - locking_command_buffer_->set_need_to_lock(false); - ++num_already_locked_calls_; -} - -void Graphics3D::PopAlreadyLocked() { - // We must have Pushed before we can Pop. - DCHECK(!locking_command_buffer_->need_to_lock()); - DCHECK_GT(num_already_locked_calls_, 0); - ppapi::ProxyLock::AssertAcquired(); - if (!locking_command_buffer_) { - NOTREACHED(); - return; - } - --num_already_locked_calls_; - if (num_already_locked_calls_ == 0) - locking_command_buffer_->set_need_to_lock(true); -} - PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher) : InterfaceProxy(dispatcher), callback_factory_(this) { diff --git a/chromium/ppapi/proxy/ppb_graphics_3d_proxy.h b/chromium/ppapi/proxy/ppb_graphics_3d_proxy.h index ffda80c754a..18ba9dd5e3c 100644 --- a/chromium/ppapi/proxy/ppb_graphics_3d_proxy.h +++ b/chromium/ppapi/proxy/ppb_graphics_3d_proxy.h @@ -24,6 +24,7 @@ class HostResource; namespace proxy { class SerializedHandle; +class PpapiCommandBufferProxy; class Graphics3D : public PPB_Graphics3D_Shared { public: @@ -48,17 +49,12 @@ class Graphics3D : public PPB_Graphics3D_Shared { virtual uint32_t InsertSyncPoint() OVERRIDE; private: - class LockingCommandBuffer; - // PPB_Graphics3D_Shared overrides. virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; + virtual gpu::GpuControl* GetGpuControl() OVERRIDE; virtual int32 DoSwapBuffers() OVERRIDE; - virtual void PushAlreadyLocked() OVERRIDE; - virtual void PopAlreadyLocked() OVERRIDE; - int num_already_locked_calls_; - scoped_ptr<gpu::CommandBuffer> command_buffer_; - scoped_ptr<LockingCommandBuffer> locking_command_buffer_; + scoped_ptr<PpapiCommandBufferProxy> command_buffer_; DISALLOW_COPY_AND_ASSIGN(Graphics3D); }; diff --git a/chromium/ppapi/proxy/ppb_image_data_proxy.cc b/chromium/ppapi/proxy/ppb_image_data_proxy.cc index 0ed3c24a37a..c9d61f9feae 100644 --- a/chromium/ppapi/proxy/ppb_image_data_proxy.cc +++ b/chromium/ppapi/proxy/ppb_image_data_proxy.cc @@ -249,15 +249,15 @@ class ImageDataCache { // Timer callback to expire entries for the given instance. void OnTimer(PP_Instance instance); + typedef std::map<PP_Instance, ImageDataInstanceCache> CacheMap; + CacheMap cache_; + // This class does timer calls and we don't want to run these outside of the // scope of the object. Technically, since this class is a leaked static, // this will never happen and this factory is unnecessary. However, it's // probably better not to make assumptions about the lifetime of this class. base::WeakPtrFactory<ImageDataCache> weak_factory_; - typedef std::map<PP_Instance, ImageDataInstanceCache> CacheMap; - CacheMap cache_; - DISALLOW_COPY_AND_ASSIGN(ImageDataCache); }; diff --git a/chromium/ppapi/proxy/ppb_instance_proxy.cc b/chromium/ppapi/proxy/ppb_instance_proxy.cc index fdaa8c47d25..5d0e7ed3eb0 100644 --- a/chromium/ppapi/proxy/ppb_instance_proxy.cc +++ b/chromium/ppapi/proxy/ppb_instance_proxy.cc @@ -18,7 +18,6 @@ #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/ext_crx_file_system_private_resource.h" #include "ppapi/proxy/extensions_common_resource.h" #include "ppapi/proxy/flash_clipboard_resource.h" #include "ppapi/proxy/flash_file_resource.h" @@ -26,6 +25,7 @@ #include "ppapi/proxy/flash_resource.h" #include "ppapi/proxy/gamepad_resource.h" #include "ppapi/proxy/host_dispatcher.h" +#include "ppapi/proxy/isolated_file_system_private_resource.h" #include "ppapi/proxy/network_proxy_resource.h" #include "ppapi/proxy/pdf_resource.h" #include "ppapi/proxy/plugin_dispatcher.h" @@ -175,12 +175,16 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { OnHostMsgGetPluginInstanceURL) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginReferrerURL, OnHostMsgGetPluginReferrerURL) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, - OnHostMsgKeyAdded) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, - OnHostMsgKeyMessage) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError, - OnHostMsgKeyError) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionCreated, + OnHostMsgSessionCreated) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionMessage, + OnHostMsgSessionMessage) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionReady, + OnHostMsgSessionReady) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionClosed, + OnHostMsgSessionClosed) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionError, + OnHostMsgSessionError) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, OnHostMsgDeliverBlock) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderInitializeDone, @@ -371,15 +375,16 @@ Resource* PPB_Instance_Proxy::GetSingletonResource(PP_Instance instance, case BROKER_SINGLETON_ID: new_singleton = new BrokerResource(connection, instance); break; - case CRX_FILESYSTEM_SINGLETON_ID: - new_singleton = new ExtCrxFileSystemPrivateResource(connection, instance); - break; case EXTENSIONS_COMMON_SINGLETON_ID: new_singleton = new ExtensionsCommonResource(connection, instance); break; case GAMEPAD_SINGLETON_ID: new_singleton = new GamepadResource(connection, instance); break; + case ISOLATED_FILESYSTEM_SINGLETON_ID: + new_singleton = + new IsolatedFileSystemPrivateResource(connection, instance); + break; case NETWORK_PROXY_SINGLETON_ID: new_singleton = new NetworkProxyResource(connection, instance); break; @@ -537,45 +542,46 @@ PP_Var PPB_Instance_Proxy::GetPluginReferrerURL( components); } -void PPB_Instance_Proxy::KeyAdded(PP_Instance instance, - PP_Var key_system, - PP_Var session_id) { - dispatcher()->Send( - new PpapiHostMsg_PPBInstance_KeyAdded( - API_ID_PPB_INSTANCE, - instance, - SerializedVarSendInput(dispatcher(), key_system), - SerializedVarSendInput(dispatcher(), session_id))); +void PPB_Instance_Proxy::SessionCreated(PP_Instance instance, + uint32_t session_id, + PP_Var web_session_id) { + dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionCreated( + API_ID_PPB_INSTANCE, + instance, + session_id, + SerializedVarSendInput(dispatcher(), web_session_id))); } -void PPB_Instance_Proxy::KeyMessage(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - PP_Var message, - PP_Var default_url) { - dispatcher()->Send( - new PpapiHostMsg_PPBInstance_KeyMessage( - API_ID_PPB_INSTANCE, - instance, - SerializedVarSendInput(dispatcher(), key_system), - SerializedVarSendInput(dispatcher(), session_id), - SerializedVarSendInput(dispatcher(), message), - SerializedVarSendInput(dispatcher(), default_url))); +void PPB_Instance_Proxy::SessionMessage(PP_Instance instance, + uint32_t session_id, + PP_Var message, + PP_Var destination_url) { + dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionMessage( + API_ID_PPB_INSTANCE, + instance, + session_id, + SerializedVarSendInput(dispatcher(), message), + SerializedVarSendInput(dispatcher(), destination_url))); } -void PPB_Instance_Proxy::KeyError(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - int32_t media_error, - int32_t system_code) { - dispatcher()->Send( - new PpapiHostMsg_PPBInstance_KeyError( - API_ID_PPB_INSTANCE, - instance, - SerializedVarSendInput(dispatcher(), key_system), - SerializedVarSendInput(dispatcher(), session_id), - media_error, - system_code)); +void PPB_Instance_Proxy::SessionReady(PP_Instance instance, + uint32_t session_id) { + dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady( + API_ID_PPB_INSTANCE, instance, session_id)); +} + +void PPB_Instance_Proxy::SessionClosed(PP_Instance instance, + uint32_t session_id) { + dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionClosed( + API_ID_PPB_INSTANCE, instance, session_id)); +} + +void PPB_Instance_Proxy::SessionError(PP_Instance instance, + uint32_t session_id, + int32_t media_error, + int32_t system_code) { + dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionError( + API_ID_PPB_INSTANCE, instance, session_id, media_error, system_code)); } void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, @@ -675,7 +681,7 @@ void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, void PPB_Instance_Proxy::DeliverSamples( PP_Instance instance, PP_Resource decrypted_samples, - const PP_DecryptedBlockInfo* block_info) { + const PP_DecryptedSampleInfo* sample_info) { PP_Resource host_resource = 0; if (decrypted_samples != 0) { ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker(); @@ -689,8 +695,8 @@ void PPB_Instance_Proxy::DeliverSamples( host_resource = object->host_resource().host_resource(); } - std::string serialized_block_info; - if (!SerializeBlockInfo(*block_info, &serialized_block_info)) { + std::string serialized_sample_info; + if (!SerializeBlockInfo(*sample_info, &serialized_sample_info)) { NOTREACHED(); return; } @@ -699,7 +705,7 @@ void PPB_Instance_Proxy::DeliverSamples( new PpapiHostMsg_PPBInstance_DeliverSamples(API_ID_PPB_INSTANCE, instance, host_resource, - serialized_block_info)); + serialized_sample_info)); } #endif // !defined(OS_NACL) @@ -1042,53 +1048,65 @@ void PPB_Instance_Proxy::OnHostMsgGetPluginReferrerURL( } } -void PPB_Instance_Proxy::OnHostMsgKeyAdded( +void PPB_Instance_Proxy::OnHostMsgSessionCreated( PP_Instance instance, - SerializedVarReceiveInput key_system, - SerializedVarReceiveInput session_id) { + uint32_t session_id, + SerializedVarReceiveInput web_session_id) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) return; EnterInstanceNoLock enter(instance); if (enter.succeeded()) { - enter.functions()->KeyAdded(instance, - key_system.Get(dispatcher()), - session_id.Get(dispatcher())); + enter.functions()->SessionCreated( + instance, session_id, web_session_id.Get(dispatcher())); } } -void PPB_Instance_Proxy::OnHostMsgKeyMessage( +void PPB_Instance_Proxy::OnHostMsgSessionMessage( PP_Instance instance, - SerializedVarReceiveInput key_system, - SerializedVarReceiveInput session_id, + uint32_t session_id, SerializedVarReceiveInput message, - SerializedVarReceiveInput default_url) { + SerializedVarReceiveInput destination_url) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) return; EnterInstanceNoLock enter(instance); if (enter.succeeded()) { - enter.functions()->KeyMessage(instance, - key_system.Get(dispatcher()), - session_id.Get(dispatcher()), - message.Get(dispatcher()), - default_url.Get(dispatcher())); + enter.functions()->SessionMessage(instance, + session_id, + message.Get(dispatcher()), + destination_url.Get(dispatcher())); } } -void PPB_Instance_Proxy::OnHostMsgKeyError( - PP_Instance instance, - SerializedVarReceiveInput key_system, - SerializedVarReceiveInput session_id, - int32_t media_error, - int32_t system_error) { +void PPB_Instance_Proxy::OnHostMsgSessionReady(PP_Instance instance, + uint32_t session_id) { + if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) + return; + EnterInstanceNoLock enter(instance); + if (enter.succeeded()) { + enter.functions()->SessionReady(instance, session_id); + } +} + +void PPB_Instance_Proxy::OnHostMsgSessionClosed(PP_Instance instance, + uint32_t session_id) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) return; EnterInstanceNoLock enter(instance); if (enter.succeeded()) { - enter.functions()->KeyError(instance, - key_system.Get(dispatcher()), - session_id.Get(dispatcher()), - media_error, - system_error); + enter.functions()->SessionClosed(instance, session_id); + } +} + +void PPB_Instance_Proxy::OnHostMsgSessionError(PP_Instance instance, + uint32_t session_id, + int32_t media_error, + int32_t system_error) { + if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) + return; + EnterInstanceNoLock enter(instance); + if (enter.succeeded()) { + enter.functions()->SessionError( + instance, session_id, media_error, system_error); } } @@ -1165,16 +1183,16 @@ void PPB_Instance_Proxy::OnHostMsgDeliverFrame( void PPB_Instance_Proxy::OnHostMsgDeliverSamples( PP_Instance instance, PP_Resource audio_frames, - const std::string& serialized_block_info) { + const std::string& serialized_sample_info) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) return; - PP_DecryptedBlockInfo block_info; - if (!DeserializeBlockInfo(serialized_block_info, &block_info)) + PP_DecryptedSampleInfo sample_info; + if (!DeserializeBlockInfo(serialized_sample_info, &sample_info)) return; EnterInstanceNoLock enter(instance); if (enter.succeeded()) - enter.functions()->DeliverSamples(instance, audio_frames, &block_info); + enter.functions()->DeliverSamples(instance, audio_frames, &sample_info); } void PPB_Instance_Proxy::OnHostMsgSetCursor( diff --git a/chromium/ppapi/proxy/ppb_instance_proxy.h b/chromium/ppapi/proxy/ppb_instance_proxy.h index a6516bc1754..12e56b938e5 100644 --- a/chromium/ppapi/proxy/ppb_instance_proxy.h +++ b/chromium/ppapi/proxy/ppb_instance_proxy.h @@ -117,19 +117,20 @@ class PPB_Instance_Proxy : public InterfaceProxy, virtual PP_Var GetPluginReferrerURL( PP_Instance instance, PP_URLComponents_Dev* components) OVERRIDE; - virtual void KeyAdded(PP_Instance instance, - PP_Var key_system, - PP_Var session_id) OVERRIDE; - virtual void KeyMessage(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - PP_Var message, - PP_Var default_url) OVERRIDE; - virtual void KeyError(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - int32_t media_error, - int32_t system_code) OVERRIDE; + virtual void SessionCreated(PP_Instance instance, + uint32_t session_id, + PP_Var web_session_id) OVERRIDE; + virtual void SessionMessage(PP_Instance instance, + uint32_t session_id, + PP_Var message, + PP_Var destination_url) OVERRIDE; + virtual void SessionReady(PP_Instance instance, uint32_t session_id) OVERRIDE; + virtual void SessionClosed(PP_Instance instance, + uint32_t session_id) OVERRIDE; + virtual void SessionError(PP_Instance instance, + uint32_t session_id, + int32_t media_error, + int32_t system_code) OVERRIDE; virtual void DeliverBlock(PP_Instance instance, PP_Resource decrypted_block, const PP_DecryptedBlockInfo* block_info) OVERRIDE; @@ -146,9 +147,10 @@ class PPB_Instance_Proxy : public InterfaceProxy, virtual void DeliverFrame(PP_Instance instance, PP_Resource decrypted_frame, const PP_DecryptedFrameInfo* frame_info) OVERRIDE; - virtual void DeliverSamples(PP_Instance instance, - PP_Resource audio_frames, - const PP_DecryptedBlockInfo* block_info) OVERRIDE; + virtual void DeliverSamples( + PP_Instance instance, + PP_Resource audio_frames, + const PP_DecryptedSampleInfo* sample_info) OVERRIDE; #endif // !defined(OS_NACL) static const ApiID kApiID = API_ID_PPB_INSTANCE; @@ -219,19 +221,22 @@ class PPB_Instance_Proxy : public InterfaceProxy, SerializedVarReturnValue result); void OnHostMsgGetPluginReferrerURL(PP_Instance instance, SerializedVarReturnValue result); - virtual void OnHostMsgKeyAdded(PP_Instance instance, - SerializedVarReceiveInput key_system, - SerializedVarReceiveInput session_id); - virtual void OnHostMsgKeyMessage(PP_Instance instance, - SerializedVarReceiveInput key_system, - SerializedVarReceiveInput session_id, - SerializedVarReceiveInput message, - SerializedVarReceiveInput default_url); - virtual void OnHostMsgKeyError(PP_Instance instance, - SerializedVarReceiveInput key_system, - SerializedVarReceiveInput session_id, - int32_t media_error, - int32_t system_code); + virtual void OnHostMsgSessionCreated( + PP_Instance instance, + uint32_t session_id, + SerializedVarReceiveInput web_session_id); + virtual void OnHostMsgSessionMessage( + PP_Instance instance, + uint32_t session_id, + SerializedVarReceiveInput message, + SerializedVarReceiveInput destination_url); + virtual void OnHostMsgSessionReady(PP_Instance instance, uint32_t session_id); + virtual void OnHostMsgSessionClosed(PP_Instance instance, + uint32_t session_id); + virtual void OnHostMsgSessionError(PP_Instance instance, + uint32_t session_id, + int32_t media_error, + int32_t system_code); virtual void OnHostMsgDecoderInitializeDone( PP_Instance instance, PP_DecryptorStreamType decoder_type, @@ -253,7 +258,7 @@ class PPB_Instance_Proxy : public InterfaceProxy, virtual void OnHostMsgDeliverSamples( PP_Instance instance, PP_Resource audio_frames, - const std::string& serialized_block_info); + const std::string& serialized_sample_info); #endif // !defined(OS_NACL) // Host -> Plugin message handlers. diff --git a/chromium/ppapi/proxy/ppb_message_loop_proxy.cc b/chromium/ppapi/proxy/ppb_message_loop_proxy.cc index 7e2cdfa6559..582ddcbeb73 100644 --- a/chromium/ppapi/proxy/ppb_message_loop_proxy.cc +++ b/chromium/ppapi/proxy/ppb_message_loop_proxy.cc @@ -189,6 +189,10 @@ void MessageLoopResource::PostClosure( } } +base::MessageLoopProxy* MessageLoopResource::GetMessageLoopProxy() { + return loop_proxy_.get(); +} + // static void MessageLoopResource::ReleaseMessageLoop(void* value) { static_cast<MessageLoopResource*>(value)->DetachFromThread(); diff --git a/chromium/ppapi/proxy/ppb_message_loop_proxy.h b/chromium/ppapi/proxy/ppb_message_loop_proxy.h index 4e3a9332286..d8bfc4c644d 100644 --- a/chromium/ppapi/proxy/ppb_message_loop_proxy.h +++ b/chromium/ppapi/proxy/ppb_message_loop_proxy.h @@ -63,6 +63,8 @@ class PPAPI_PROXY_EXPORT MessageLoopResource : public MessageLoopShared { const base::Closure& closure, int64 delay_ms) OVERRIDE; + virtual base::MessageLoopProxy* GetMessageLoopProxy() OVERRIDE; + // TLS destructor function. static void ReleaseMessageLoop(void* value); diff --git a/chromium/ppapi/proxy/ppb_testing_proxy.cc b/chromium/ppapi/proxy/ppb_testing_proxy.cc index f80e60cbf5a..0b29795f124 100644 --- a/chromium/ppapi/proxy/ppb_testing_proxy.cc +++ b/chromium/ppapi/proxy/ppb_testing_proxy.cc @@ -5,7 +5,7 @@ #include "ppapi/proxy/ppb_testing_proxy.h" #include "base/message_loop/message_loop.h" -#include "ppapi/c/dev/ppb_testing_dev.h" +#include "ppapi/c/private/ppb_testing_private.h" #include "ppapi/proxy/enter_proxy.h" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/ppapi_messages.h" @@ -127,7 +127,7 @@ void SetMinimumArrayBufferSizeForShmem(PP_Instance instance, API_ID_PPB_TESTING, threshold)); } -const PPB_Testing_Dev testing_interface = { +const PPB_Testing_Private testing_interface = { &ReadImageData, &RunMessageLoop, &QuitMessageLoop, @@ -139,18 +139,14 @@ const PPB_Testing_Dev testing_interface = { &SetMinimumArrayBufferSizeForShmem }; -InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) { - return new PPB_Testing_Proxy(dispatcher); -} - } // namespace PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher) : InterfaceProxy(dispatcher), ppb_testing_impl_(NULL) { if (!dispatcher->IsPlugin()) { - ppb_testing_impl_ = static_cast<const PPB_Testing_Dev*>( - dispatcher->local_get_interface()(PPB_TESTING_DEV_INTERFACE)); + ppb_testing_impl_ = static_cast<const PPB_Testing_Private*>( + dispatcher->local_get_interface()(PPB_TESTING_PRIVATE_INTERFACE)); } } @@ -158,15 +154,8 @@ PPB_Testing_Proxy::~PPB_Testing_Proxy() { } // static -const InterfaceProxy::Info* PPB_Testing_Proxy::GetInfo() { - static const Info info = { - &testing_interface, - PPB_TESTING_DEV_INTERFACE, - API_ID_PPB_TESTING, - false, - &CreateTestingProxy, - }; - return &info; +const PPB_Testing_Private* PPB_Testing_Proxy::GetProxyInterface() { + return &testing_interface; } bool PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) { diff --git a/chromium/ppapi/proxy/ppb_testing_proxy.h b/chromium/ppapi/proxy/ppb_testing_proxy.h index 61af47fcb00..bcdb53b4d70 100644 --- a/chromium/ppapi/proxy/ppb_testing_proxy.h +++ b/chromium/ppapi/proxy/ppb_testing_proxy.h @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" -#include "ppapi/c/dev/ppb_testing_dev.h" +#include "ppapi/c/private/ppb_testing_private.h" #include "ppapi/proxy/interface_proxy.h" #include "ppapi/shared_impl/host_resource.h" @@ -25,7 +25,7 @@ class PPB_Testing_Proxy : public InterfaceProxy { PPB_Testing_Proxy(Dispatcher* dispatcher); virtual ~PPB_Testing_Proxy(); - static const Info* GetInfo(); + static const PPB_Testing_Private* GetProxyInterface(); // InterfaceProxy implementation. virtual bool OnMessageReceived(const IPC::Message& msg); @@ -46,7 +46,7 @@ class PPB_Testing_Proxy : public InterfaceProxy { // 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. // In the plugin, this value is always NULL. - const PPB_Testing_Dev* ppb_testing_impl_; + const PPB_Testing_Private* ppb_testing_impl_; DISALLOW_COPY_AND_ASSIGN(PPB_Testing_Proxy); }; diff --git a/chromium/ppapi/proxy/ppb_var_deprecated_proxy.cc b/chromium/ppapi/proxy/ppb_var_deprecated_proxy.cc index 43452ef019a..c29e15281b8 100644 --- a/chromium/ppapi/proxy/ppb_var_deprecated_proxy.cc +++ b/chromium/ppapi/proxy/ppb_var_deprecated_proxy.cc @@ -276,17 +276,13 @@ PP_Var CreateObject(PP_Instance instance, return ret_var; } -InterfaceProxy* CreateVarDeprecatedProxy(Dispatcher* dispatcher) { - return new PPB_Var_Deprecated_Proxy(dispatcher ); -} - } // namespace PPB_Var_Deprecated_Proxy::PPB_Var_Deprecated_Proxy( Dispatcher* dispatcher) : InterfaceProxy(dispatcher), - task_factory_(this), - ppb_var_impl_(NULL) { + ppb_var_impl_(NULL), + task_factory_(this) { if (!dispatcher->IsPlugin()) { ppb_var_impl_ = static_cast<const PPB_Var_Deprecated*>( dispatcher->local_get_interface()(PPB_VAR_DEPRECATED_INTERFACE)); @@ -297,7 +293,7 @@ PPB_Var_Deprecated_Proxy::~PPB_Var_Deprecated_Proxy() { } // static -const InterfaceProxy::Info* PPB_Var_Deprecated_Proxy::GetInfo() { +const PPB_Var_Deprecated* PPB_Var_Deprecated_Proxy::GetProxyInterface() { static const PPB_Var_Deprecated var_deprecated_interface = { ppapi::PPB_Var_Shared::GetVarInterface1_0()->AddRef, ppapi::PPB_Var_Shared::GetVarInterface1_0()->Release, @@ -314,15 +310,7 @@ const InterfaceProxy::Info* PPB_Var_Deprecated_Proxy::GetInfo() { &IsInstanceOf, &CreateObject }; - - static const Info info = { - &var_deprecated_interface, - PPB_VAR_DEPRECATED_INTERFACE, - API_ID_PPB_VAR_DEPRECATED, - false, - &CreateVarDeprecatedProxy, - }; - return &info; + return &var_deprecated_interface; } bool PPB_Var_Deprecated_Proxy::OnMessageReceived(const IPC::Message& msg) { diff --git a/chromium/ppapi/proxy/ppb_var_deprecated_proxy.h b/chromium/ppapi/proxy/ppb_var_deprecated_proxy.h index 59400aede6e..db62fc2af1a 100644 --- a/chromium/ppapi/proxy/ppb_var_deprecated_proxy.h +++ b/chromium/ppapi/proxy/ppb_var_deprecated_proxy.h @@ -28,7 +28,7 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy { explicit PPB_Var_Deprecated_Proxy(Dispatcher* dispatcher); virtual ~PPB_Var_Deprecated_Proxy(); - static const Info* GetInfo(); + static const PPB_Var_Deprecated* GetProxyInterface(); // InterfaceProxy implementation. virtual bool OnMessageReceived(const IPC::Message& msg); @@ -89,10 +89,11 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy { void SetAllowPluginReentrancy(); void DoReleaseObject(int64 object_id); - base::WeakPtrFactory<PPB_Var_Deprecated_Proxy> task_factory_; const PPB_Var_Deprecated* ppb_var_impl_; + base::WeakPtrFactory<PPB_Var_Deprecated_Proxy> task_factory_; + DISALLOW_COPY_AND_ASSIGN(PPB_Var_Deprecated_Proxy); }; diff --git a/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.cc index d32e6320094..167e4764d38 100644 --- a/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.cc +++ b/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.cc @@ -110,8 +110,7 @@ bool InitializePppDecryptorBuffer(PP_Instance instance, } void Initialize(PP_Instance instance, - PP_Var key_system, - PP_Bool can_challenge_platform) { + PP_Var key_system) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); if (!dispatcher) { NOTREACHED(); @@ -122,58 +121,50 @@ void Initialize(PP_Instance instance, new PpapiMsg_PPPContentDecryptor_Initialize( API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, - SerializedVarSendInput(dispatcher, key_system), - PP_ToBool(can_challenge_platform))); + SerializedVarSendInput(dispatcher, key_system))); } -void GenerateKeyRequest(PP_Instance instance, - PP_Var type, - PP_Var init_data) { +void CreateSession(PP_Instance instance, + uint32_t session_id, + PP_Var type, + PP_Var init_data) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); if (!dispatcher) { NOTREACHED(); return; } - dispatcher->Send( - new PpapiMsg_PPPContentDecryptor_GenerateKeyRequest( - API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, - instance, - SerializedVarSendInput(dispatcher, type), - SerializedVarSendInput(dispatcher, init_data))); + dispatcher->Send(new PpapiMsg_PPPContentDecryptor_CreateSession( + API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, + instance, + session_id, + SerializedVarSendInput(dispatcher, type), + SerializedVarSendInput(dispatcher, init_data))); } -void AddKey(PP_Instance instance, - PP_Var session_id, - PP_Var key, - PP_Var init_data) { +void UpdateSession(PP_Instance instance, uint32_t session_id, PP_Var response) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); if (!dispatcher) { NOTREACHED(); return; } - dispatcher->Send( - new PpapiMsg_PPPContentDecryptor_AddKey( - API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, - instance, - SerializedVarSendInput(dispatcher, session_id), - SerializedVarSendInput(dispatcher, key), - SerializedVarSendInput(dispatcher, init_data))); + dispatcher->Send(new PpapiMsg_PPPContentDecryptor_UpdateSession( + API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, + instance, + session_id, + SerializedVarSendInput(dispatcher, response))); } -void CancelKeyRequest(PP_Instance instance, PP_Var session_id) { +void ReleaseSession(PP_Instance instance, uint32_t session_id) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); if (!dispatcher) { NOTREACHED(); return; } - dispatcher->Send( - new PpapiMsg_PPPContentDecryptor_CancelKeyRequest( - API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, - instance, - SerializedVarSendInput(dispatcher, session_id))); + dispatcher->Send(new PpapiMsg_PPPContentDecryptor_ReleaseSession( + API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, session_id)); } void Decrypt(PP_Instance instance, @@ -365,9 +356,9 @@ void DecryptAndDecode(PP_Instance instance, static const PPP_ContentDecryptor_Private content_decryptor_interface = { &Initialize, - &GenerateKeyRequest, - &AddKey, - &CancelKeyRequest, + &CreateSession, + &UpdateSession, + &ReleaseSession, &Decrypt, &InitializeAudioDecoder, &InitializeVideoDecoder, @@ -408,12 +399,12 @@ bool PPP_ContentDecryptor_Private_Proxy::OnMessageReceived( IPC_BEGIN_MESSAGE_MAP(PPP_ContentDecryptor_Private_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Initialize, OnMsgInitialize) - IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest, - OnMsgGenerateKeyRequest) - IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_AddKey, - OnMsgAddKey) - IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_CancelKeyRequest, - OnMsgCancelKeyRequest) + IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_CreateSession, + OnMsgCreateSession) + IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_UpdateSession, + OnMsgUpdateSession) + IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_ReleaseSession, + OnMsgReleaseSession) IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Decrypt, OnMsgDecrypt) IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_InitializeAudioDecoder, @@ -434,50 +425,48 @@ bool PPP_ContentDecryptor_Private_Proxy::OnMessageReceived( void PPP_ContentDecryptor_Private_Proxy::OnMsgInitialize( PP_Instance instance, - SerializedVarReceiveInput key_system, - bool can_challenge_platform) { + SerializedVarReceiveInput key_system) { if (ppp_decryptor_impl_) { CallWhileUnlocked( ppp_decryptor_impl_->Initialize, instance, - ExtractReceivedVarAndAddRef(dispatcher(), &key_system), - PP_FromBool(can_challenge_platform)); + ExtractReceivedVarAndAddRef(dispatcher(), &key_system)); } } -void PPP_ContentDecryptor_Private_Proxy::OnMsgGenerateKeyRequest( +void PPP_ContentDecryptor_Private_Proxy::OnMsgCreateSession( PP_Instance instance, + uint32_t session_id, SerializedVarReceiveInput type, SerializedVarReceiveInput init_data) { if (ppp_decryptor_impl_) { - CallWhileUnlocked(ppp_decryptor_impl_->GenerateKeyRequest, + CallWhileUnlocked(ppp_decryptor_impl_->CreateSession, instance, + session_id, ExtractReceivedVarAndAddRef(dispatcher(), &type), ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); } } -void PPP_ContentDecryptor_Private_Proxy::OnMsgAddKey( +void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession( PP_Instance instance, - SerializedVarReceiveInput session_id, - SerializedVarReceiveInput key, - SerializedVarReceiveInput init_data) { + uint32_t session_id, + SerializedVarReceiveInput response) { if (ppp_decryptor_impl_) { - CallWhileUnlocked(ppp_decryptor_impl_->AddKey, + CallWhileUnlocked(ppp_decryptor_impl_->UpdateSession, instance, - ExtractReceivedVarAndAddRef(dispatcher(), &session_id), - ExtractReceivedVarAndAddRef(dispatcher(), &key), - ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); + session_id, + ExtractReceivedVarAndAddRef(dispatcher(), &response)); } } -void PPP_ContentDecryptor_Private_Proxy::OnMsgCancelKeyRequest( +void PPP_ContentDecryptor_Private_Proxy::OnMsgReleaseSession( PP_Instance instance, - SerializedVarReceiveInput session_id) { + uint32_t session_id) { if (ppp_decryptor_impl_) { - CallWhileUnlocked(ppp_decryptor_impl_->CancelKeyRequest, + CallWhileUnlocked(ppp_decryptor_impl_->ReleaseSession, instance, - ExtractReceivedVarAndAddRef(dispatcher(), &session_id)); + session_id); } } diff --git a/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.h b/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.h index 2e4ad8548a9..dfbcf4f5d42 100644 --- a/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.h +++ b/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.h @@ -31,17 +31,15 @@ class PPP_ContentDecryptor_Private_Proxy : public InterfaceProxy { // Message handlers. void OnMsgInitialize(PP_Instance instance, - SerializedVarReceiveInput key_system, - bool can_challenge_platform); - void OnMsgGenerateKeyRequest(PP_Instance instance, - SerializedVarReceiveInput type, - SerializedVarReceiveInput init_data); - void OnMsgAddKey(PP_Instance instance, - SerializedVarReceiveInput session_id, - SerializedVarReceiveInput key, - SerializedVarReceiveInput init_data); - void OnMsgCancelKeyRequest(PP_Instance instance, - SerializedVarReceiveInput session_id); + SerializedVarReceiveInput key_system); + void OnMsgCreateSession(PP_Instance instance, + uint32_t session_id, + SerializedVarReceiveInput type, + SerializedVarReceiveInput init_data); + void OnMsgUpdateSession(PP_Instance instance, + uint32_t session_id, + SerializedVarReceiveInput response); + void OnMsgReleaseSession(PP_Instance instance, uint32_t session_id); void OnMsgDecrypt(PP_Instance instance, const PPPDecryptor_Buffer& encrypted_buffer, const std::string& serialized_encrypted_block_info); diff --git a/chromium/ppapi/proxy/printing_resource_unittest.cc b/chromium/ppapi/proxy/printing_resource_unittest.cc index af6c7420f27..6551ba17664 100644 --- a/chromium/ppapi/proxy/printing_resource_unittest.cc +++ b/chromium/ppapi/proxy/printing_resource_unittest.cc @@ -8,6 +8,7 @@ #include "ppapi/c/dev/ppb_printing_dev.h" #include "ppapi/c/pp_errors.h" #include "ppapi/proxy/locking_resource_releaser.h" +#include "ppapi/proxy/plugin_message_filter.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppapi_proxy_test.h" #include "ppapi/proxy/printing_resource.h" @@ -76,10 +77,10 @@ TEST_F(PrintingResourceTest, GetDefaultPrintSettings) { PP_FALSE, PP_PRINTOUTPUTFORMAT_PDF }; - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( - PpapiPluginMsg_ResourceReply(reply_params, - PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply( - reply_settings)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, + PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply( + reply_settings)); EXPECT_TRUE(PP_RectEqual(reply_settings.printable_area, output_settings.printable_area)); diff --git a/chromium/ppapi/proxy/raw_var_data.cc b/chromium/ppapi/proxy/raw_var_data.cc index b41304849ba..49ee8c261dd 100644 --- a/chromium/ppapi/proxy/raw_var_data.cc +++ b/chromium/ppapi/proxy/raw_var_data.cc @@ -13,6 +13,7 @@ #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/resource_var.h" #include "ppapi/shared_impl/scoped_pp_var.h" #include "ppapi/shared_impl/var.h" #include "ppapi/shared_impl/var_tracker.h" @@ -241,10 +242,7 @@ RawVarData* RawVarData::Create(PP_VarType type) { case PP_VARTYPE_DICTIONARY: return new DictionaryRawVarData(); case PP_VARTYPE_RESOURCE: - // TODO(mgiuca): Add ResourceRawVarData. (http://crbug.com/177017) - // This path will be reached if a NaCl module attempts to pass a - // PP_VARTYPE_RESOURCE in a message. - break; + return new ResourceRawVarData(); } NOTREACHED(); return NULL; @@ -666,5 +664,88 @@ bool DictionaryRawVarData::Read(PP_VarType type, return true; } +// ResourceRawVarData ---------------------------------------------------------- +ResourceRawVarData::ResourceRawVarData() + : pp_resource_(0), + pending_renderer_host_id_(0), + pending_browser_host_id_(0) {} + +ResourceRawVarData::~ResourceRawVarData() { +} + +PP_VarType ResourceRawVarData::Type() { + return PP_VARTYPE_RESOURCE; +} + +bool ResourceRawVarData::Init(const PP_Var& var, PP_Instance /*instance*/) { + DCHECK(var.type == PP_VARTYPE_RESOURCE); + ResourceVar* resource_var = ResourceVar::FromPPVar(var); + if (!resource_var) + return false; + pp_resource_ = resource_var->GetPPResource(); + const IPC::Message* message = resource_var->GetCreationMessage(); + if (message) + creation_message_.reset(new IPC::Message(*message)); + else + creation_message_.reset(); + pending_renderer_host_id_ = resource_var->GetPendingRendererHostId(); + pending_browser_host_id_ = resource_var->GetPendingBrowserHostId(); + initialized_ = true; + return true; +} + +PP_Var ResourceRawVarData::CreatePPVar(PP_Instance instance) { + // If this is not a pending resource host, just create the var. + if (pp_resource_ || !creation_message_) { + return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar( + pp_resource_); + } + + // This is a pending resource host, so create the resource and var. + return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVarFromMessage( + instance, + *creation_message_, + pending_renderer_host_id_, + pending_browser_host_id_); +} + +void ResourceRawVarData::PopulatePPVar(const PP_Var& var, + const std::vector<PP_Var>& graph) { +} + +void ResourceRawVarData::Write(IPC::Message* m, + const HandleWriter& handle_writer) { + m->WriteInt(static_cast<int>(pp_resource_)); + m->WriteInt(pending_renderer_host_id_); + m->WriteInt(pending_browser_host_id_); + m->WriteBool(creation_message_); + if (creation_message_) + IPC::ParamTraits<IPC::Message>::Write(m, *creation_message_); +} + +bool ResourceRawVarData::Read(PP_VarType type, + const IPC::Message* m, + PickleIterator* iter) { + int value; + if (!m->ReadInt(iter, &value)) + return false; + pp_resource_ = static_cast<PP_Resource>(value); + if (!m->ReadInt(iter, &pending_renderer_host_id_)) + return false; + if (!m->ReadInt(iter, &pending_browser_host_id_)) + return false; + bool has_creation_message; + if (!m->ReadBool(iter, &has_creation_message)) + return false; + if (has_creation_message) { + creation_message_.reset(new IPC::Message()); + if (!IPC::ParamTraits<IPC::Message>::Read(m, iter, creation_message_.get())) + return false; + } else { + creation_message_.reset(); + } + return true; +} + } // namespace proxy } // namespace ppapi diff --git a/chromium/ppapi/proxy/raw_var_data.h b/chromium/ppapi/proxy/raw_var_data.h index c7981d38ff7..d45ea53f24c 100644 --- a/chromium/ppapi/proxy/raw_var_data.h +++ b/chromium/ppapi/proxy/raw_var_data.h @@ -255,6 +255,47 @@ class DictionaryRawVarData : public RawVarData { std::vector<std::pair<std::string, size_t> > children_; }; +// A RawVarData class for resource PP_Vars. +// This class does not hold a reference on the PP_Resource that is being +// serialized. If sending a resource from the plugin to the host, the plugin +// should not release the ResourceVar before sending the serialized message to +// the host, and the host should immediately consume the ResourceVar before +// processing further messages. +class ResourceRawVarData : public RawVarData { + public: + ResourceRawVarData(); + virtual ~ResourceRawVarData(); + + // 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: + // Resource ID in the plugin. If one has not yet been created, this is 0. + // This is a borrowed reference; the resource's refcount is not incremented. + PP_Resource pp_resource_; + + // Pending resource host ID in the renderer. + int pending_renderer_host_id_; + + // Pending resource host ID in the browser. + int pending_browser_host_id_; + + // A message containing information about how to create a plugin-side + // resource. The message type will vary based on the resource type, and will + // usually contain a pending resource host ID, and other required information. + // If the resource was created directly, this is NULL. + scoped_ptr<IPC::Message> creation_message_; +}; + } // namespace proxy } // namespace ppapi diff --git a/chromium/ppapi/proxy/raw_var_data_unittest.cc b/chromium/ppapi/proxy/raw_var_data_unittest.cc index c45ca9d6967..03408923322 100644 --- a/chromium/ppapi/proxy/raw_var_data_unittest.cc +++ b/chromium/ppapi/proxy/raw_var_data_unittest.cc @@ -14,6 +14,7 @@ #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/resource_var.h" #include "ppapi/shared_impl/scoped_pp_var.h" #include "ppapi/shared_impl/test_globals.h" #include "ppapi/shared_impl/unittest_utils.h" @@ -186,5 +187,17 @@ TEST_F(RawVarDataTest, DictionaryArrayTest) { array->Set(index, PP_MakeUndefined()); } +TEST_F(RawVarDataTest, ResourceTest) { + // TODO(mgiuca): This test passes trivially, since GetVarTracker() returns a + // TestVarTracker which returns a null PP_Var. + ScopedPPVar resource( + ScopedPPVar::PassRef(), + PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar(34)); + EXPECT_TRUE(WriteReadAndCompare(resource.get())); + + // TODO(mgiuca): Test a host resource with an IPC::Message. It is currently a + // checkfail to deserialize such a resource. +} + } // namespace proxy } // namespace ppapi diff --git a/chromium/ppapi/proxy/resource_creation_proxy.cc b/chromium/ppapi/proxy/resource_creation_proxy.cc index d1b99ecb014..231142a937d 100644 --- a/chromium/ppapi/proxy/resource_creation_proxy.cc +++ b/chromium/ppapi/proxy/resource_creation_proxy.cc @@ -8,7 +8,6 @@ #include "ppapi/c/pp_size.h" #include "ppapi/proxy/audio_input_resource.h" #include "ppapi/proxy/connection.h" -#include "ppapi/proxy/ext_crx_file_system_private_resource.h" #include "ppapi/proxy/file_chooser_resource.h" #include "ppapi/proxy/file_io_resource.h" #include "ppapi/proxy/file_ref_resource.h" @@ -21,6 +20,7 @@ #include "ppapi/proxy/host_resolver_resource.h" #include "ppapi/proxy/net_address_resource.h" #include "ppapi/proxy/network_monitor_resource.h" +#include "ppapi/proxy/output_protection_resource.h" #include "ppapi/proxy/platform_verification_private_resource.h" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/plugin_globals.h" @@ -313,6 +313,12 @@ PP_Resource ResourceCreationProxy::CreateNetworkMonitor( GetReference(); } +PP_Resource ResourceCreationProxy::CreateOutputProtectionPrivate( + PP_Instance instance) { + return (new OutputProtectionResource(GetConnection(), instance))-> + GetReference(); +} + PP_Resource ResourceCreationProxy::CreatePrinting(PP_Instance instance) { return (new PrintingResource(GetConnection(), instance))->GetReference(); } diff --git a/chromium/ppapi/proxy/resource_creation_proxy.h b/chromium/ppapi/proxy/resource_creation_proxy.h index 1507dc8c6c5..df564da7ca3 100644 --- a/chromium/ppapi/proxy/resource_creation_proxy.h +++ b/chromium/ppapi/proxy/resource_creation_proxy.h @@ -134,6 +134,8 @@ class ResourceCreationProxy : public InterfaceProxy, PP_Instance instance, const PP_NetAddress_Private& private_addr) OVERRIDE; virtual PP_Resource CreateNetworkMonitor(PP_Instance instance) OVERRIDE; + virtual PP_Resource CreateOutputProtectionPrivate( + PP_Instance instance) OVERRIDE; virtual PP_Resource CreatePrinting(PP_Instance) OVERRIDE; virtual PP_Resource CreateTCPServerSocketPrivate( PP_Instance instance) OVERRIDE; diff --git a/chromium/ppapi/proxy/resource_reply_thread_registrar.cc b/chromium/ppapi/proxy/resource_reply_thread_registrar.cc new file mode 100644 index 00000000000..0c49cf5c7b5 --- /dev/null +++ b/chromium/ppapi/proxy/resource_reply_thread_registrar.cc @@ -0,0 +1,71 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/proxy/resource_reply_thread_registrar.h" + +#include "base/logging.h" +#include "base/message_loop/message_loop_proxy.h" +#include "ppapi/shared_impl/proxy_lock.h" +#include "ppapi/shared_impl/tracked_callback.h" + +namespace ppapi { +namespace proxy { + +ResourceReplyThreadRegistrar::ResourceReplyThreadRegistrar( + scoped_refptr<base::MessageLoopProxy> default_thread) + : default_thread_(default_thread) { +} + +ResourceReplyThreadRegistrar::~ResourceReplyThreadRegistrar() { +} + +void ResourceReplyThreadRegistrar::Register( + PP_Resource resource, + int32_t sequence_number, + scoped_refptr<TrackedCallback> reply_thread_hint) { + ProxyLock::AssertAcquiredDebugOnly(); + + // Use the default thread if |reply_thread_hint| is NULL or blocking. + if (!reply_thread_hint || reply_thread_hint->is_blocking()) + return; + + DCHECK(reply_thread_hint->target_loop()); + scoped_refptr<base::MessageLoopProxy> reply_thread( + reply_thread_hint->target_loop()->GetMessageLoopProxy()); + { + base::AutoLock auto_lock(lock_); + + if (reply_thread == default_thread_) + return; + + map_[resource][sequence_number] = reply_thread; + } +} + +void ResourceReplyThreadRegistrar::Unregister(PP_Resource resource) { + base::AutoLock auto_lock(lock_); + map_.erase(resource); +} + +scoped_refptr<base::MessageLoopProxy> +ResourceReplyThreadRegistrar::GetTargetThreadAndUnregister( + PP_Resource resource, + int32_t sequence_number) { + base::AutoLock auto_lock(lock_); + ResourceMap::iterator resource_iter = map_.find(resource); + if (resource_iter == map_.end()) + return default_thread_; + + SequenceNumberMap::iterator sequence_number_iter = + resource_iter->second.find(sequence_number); + if (sequence_number_iter == resource_iter->second.end()) + return default_thread_; + + scoped_refptr<base::MessageLoopProxy> target = sequence_number_iter->second; + resource_iter->second.erase(sequence_number_iter); + return target; +} + +} // namespace proxy +} // namespace ppapi diff --git a/chromium/ppapi/proxy/resource_reply_thread_registrar.h b/chromium/ppapi/proxy/resource_reply_thread_registrar.h new file mode 100644 index 00000000000..eef6d615965 --- /dev/null +++ b/chromium/ppapi/proxy/resource_reply_thread_registrar.h @@ -0,0 +1,70 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_ +#define PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_ + +#include <map> + +#include "base/basictypes.h" +#include "base/memory/ref_counted.h" +#include "base/synchronization/lock.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/proxy/ppapi_proxy_export.h" + + +namespace base { +class MessageLoopProxy; +} + +namespace ppapi { + +class TrackedCallback; + +namespace proxy { + +// ResourceReplyThreadRegistrar records the handling thread for +// PpapiPluginMsg_ResourceReply messages. +// This class is thread safe. +class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar + : public base::RefCountedThreadSafe<ResourceReplyThreadRegistrar> { + public: + explicit ResourceReplyThreadRegistrar( + scoped_refptr<base::MessageLoopProxy> default_thread); + + // This method can only be called while holding the Pepper proxy lock; the + // other methods can be called with/without the Pepper proxy lock. + void Register(PP_Resource resource, + int32_t sequence_number, + scoped_refptr<TrackedCallback> reply_thread_hint); + + void Unregister(PP_Resource resource); + + scoped_refptr<base::MessageLoopProxy> GetTargetThreadAndUnregister( + PP_Resource resource, + int32_t sequence_number); + + private: + friend class base::RefCountedThreadSafe<ResourceReplyThreadRegistrar>; + + typedef std::map<int32_t, scoped_refptr<base::MessageLoopProxy> > + SequenceNumberMap; + typedef std::map<PP_Resource, SequenceNumberMap> ResourceMap; + + ~ResourceReplyThreadRegistrar(); + + // The lock that protects the data members below. + // Please note that we should never try to acquire the Pepper proxy lock while + // holding |lock_|, otherwise we will cause deadlock. + base::Lock lock_; + ResourceMap map_; + scoped_refptr<base::MessageLoopProxy> default_thread_; + + DISALLOW_COPY_AND_ASSIGN(ResourceReplyThreadRegistrar); +}; + +} // namespace proxy +} // namespace ppapi + +#endif // PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_ diff --git a/chromium/ppapi/proxy/talk_resource_unittest.cc b/chromium/ppapi/proxy/talk_resource_unittest.cc index e81a8a6aca3..3b7d5ff43fe 100644 --- a/chromium/ppapi/proxy/talk_resource_unittest.cc +++ b/chromium/ppapi/proxy/talk_resource_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "ppapi/proxy/locking_resource_releaser.h" +#include "ppapi/proxy/plugin_message_filter.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppapi_proxy_test.h" #include "ppapi/proxy/talk_resource.h" @@ -58,8 +59,7 @@ class TalkResourceTest : public PluginProxyTest { ResourceMessageReplyParams reply_params(params.pp_resource(), params.sequence()); reply_params.set_result(result); - IPC::Message reply_msg = PpapiPluginMsg_ResourceReply(reply_params, reply); - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(reply_msg)); + PluginMessageFilter::DispatchResourceReplyForTest(reply_params, reply); } }; @@ -84,9 +84,8 @@ TEST_F(TalkResourceTest, GetPermission) { ResourceMessageReplyParams reply_params(params.pp_resource(), params.sequence()); reply_params.set_result(1); - IPC::Message reply = PpapiPluginMsg_ResourceReply( + PluginMessageFilter::DispatchResourceReplyForTest( reply_params, PpapiPluginMsg_Talk_RequestPermissionReply()); - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(reply)); ASSERT_TRUE(callback.called()); ASSERT_EQ(1, callback.result()); @@ -111,9 +110,8 @@ TEST_F(TalkResourceTest, RequestPermission) { ResourceMessageReplyParams reply_params(params.pp_resource(), params.sequence()); reply_params.set_result(1); - IPC::Message reply = PpapiPluginMsg_ResourceReply( + PluginMessageFilter::DispatchResourceReplyForTest( reply_params, PpapiPluginMsg_Talk_RequestPermissionReply()); - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(reply)); ASSERT_TRUE(callback.called()); ASSERT_EQ(1, callback.result()); @@ -143,9 +141,8 @@ TEST_F(TalkResourceTest, StartStopRemoting) { // Receive an event ASSERT_FALSE(event_callback.called()); ResourceMessageReplyParams notify_params(res.get(), 0); - IPC::Message notify = PpapiPluginMsg_ResourceReply( + PluginMessageFilter::DispatchResourceReplyForTest( notify_params, PpapiPluginMsg_Talk_NotifyEvent(PP_TALKEVENT_ERROR)); - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(notify)); ASSERT_TRUE(event_callback.called()); ASSERT_EQ(PP_TALKEVENT_ERROR, event_callback.result()); @@ -165,7 +162,8 @@ TEST_F(TalkResourceTest, StartStopRemoting) { // Events should be discarded at this point event_callback.Reset(); - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(notify)); + PluginMessageFilter::DispatchResourceReplyForTest( + notify_params, PpapiPluginMsg_Talk_NotifyEvent(PP_TALKEVENT_ERROR)); ASSERT_FALSE(event_callback.called()); } diff --git a/chromium/ppapi/proxy/tcp_socket_resource_base.cc b/chromium/ppapi/proxy/tcp_socket_resource_base.cc index 6cb9d0b7b51..fff2da3cf8a 100644 --- a/chromium/ppapi/proxy/tcp_socket_resource_base.cc +++ b/chromium/ppapi/proxy/tcp_socket_resource_base.cc @@ -84,7 +84,8 @@ int32_t TCPSocketResourceBase::BindImpl( BROWSER, PpapiHostMsg_TCPSocket_Bind(*addr), base::Bind(&TCPSocketResourceBase::OnPluginMsgBindReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } @@ -106,7 +107,8 @@ int32_t TCPSocketResourceBase::ConnectImpl( BROWSER, PpapiHostMsg_TCPSocket_Connect(host, port), base::Bind(&TCPSocketResourceBase::OnPluginMsgConnectReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } @@ -127,7 +129,8 @@ int32_t TCPSocketResourceBase::ConnectWithNetAddressImpl( BROWSER, PpapiHostMsg_TCPSocket_ConnectWithNetAddress(*addr), base::Bind(&TCPSocketResourceBase::OnPluginMsgConnectReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } @@ -172,7 +175,8 @@ int32_t TCPSocketResourceBase::SSLHandshakeImpl( trusted_certificates_, untrusted_certificates_), base::Bind(&TCPSocketResourceBase::OnPluginMsgSSLHandshakeReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } @@ -233,7 +237,8 @@ int32_t TCPSocketResourceBase::ReadImpl( BROWSER, PpapiHostMsg_TCPSocket_Read(bytes_to_read_), base::Bind(&TCPSocketResourceBase::OnPluginMsgReadReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } @@ -259,7 +264,8 @@ int32_t TCPSocketResourceBase::WriteImpl( BROWSER, PpapiHostMsg_TCPSocket_Write(std::string(buffer, bytes_to_write)), base::Bind(&TCPSocketResourceBase::OnPluginMsgWriteReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } @@ -280,7 +286,8 @@ int32_t TCPSocketResourceBase::ListenImpl( BROWSER, PpapiHostMsg_TCPSocket_Listen(backlog), base::Bind(&TCPSocketResourceBase::OnPluginMsgListenReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } @@ -301,7 +308,8 @@ int32_t TCPSocketResourceBase::AcceptImpl( BROWSER, PpapiHostMsg_TCPSocket_Accept(), base::Bind(&TCPSocketResourceBase::OnPluginMsgAcceptReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } @@ -363,7 +371,8 @@ int32_t TCPSocketResourceBase::SetOptionImpl( BROWSER, PpapiHostMsg_TCPSocket_SetOption(name, option_data), base::Bind(&TCPSocketResourceBase::OnPluginMsgSetOptionReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } diff --git a/chromium/ppapi/proxy/udp_socket_resource_base.cc b/chromium/ppapi/proxy/udp_socket_resource_base.cc index 8ef3835feca..79ac3484d25 100644 --- a/chromium/ppapi/proxy/udp_socket_resource_base.cc +++ b/chromium/ppapi/proxy/udp_socket_resource_base.cc @@ -91,7 +91,8 @@ int32_t UDPSocketResourceBase::SetOptionImpl( PpapiHostMsg_UDPSocket_SetOption(name, option_data), base::Bind(&UDPSocketResourceBase::OnPluginMsgSetOptionReply, base::Unretained(this), - callback)); + callback), + callback); return PP_OK_COMPLETIONPENDING; } @@ -112,7 +113,8 @@ int32_t UDPSocketResourceBase::BindImpl( BROWSER, PpapiHostMsg_UDPSocket_Bind(*addr), base::Bind(&UDPSocketResourceBase::OnPluginMsgBindReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } @@ -146,7 +148,8 @@ int32_t UDPSocketResourceBase::RecvFromImpl( BROWSER, PpapiHostMsg_UDPSocket_RecvFrom(bytes_to_read_), base::Bind(&UDPSocketResourceBase::OnPluginMsgRecvFromReply, - base::Unretained(this), addr)); + base::Unretained(this), addr), + callback); return PP_OK_COMPLETIONPENDING; } @@ -180,7 +183,8 @@ int32_t UDPSocketResourceBase::SendToImpl( BROWSER, PpapiHostMsg_UDPSocket_SendTo(std::string(buffer, num_bytes), *addr), base::Bind(&UDPSocketResourceBase::OnPluginMsgSendToReply, - base::Unretained(this))); + base::Unretained(this)), + callback); return PP_OK_COMPLETIONPENDING; } diff --git a/chromium/ppapi/proxy/websocket_resource.cc b/chromium/ppapi/proxy/websocket_resource.cc index 394a2c54f9e..c998cd94b72 100644 --- a/chromium/ppapi/proxy/websocket_resource.cc +++ b/chromium/ppapi/proxy/websocket_resource.cc @@ -137,13 +137,13 @@ int32_t WebSocketResource::Close(uint16_t code, // Validate |code| and |reason|. scoped_refptr<StringVar> reason_string_var; std::string reason_string; - WebKit::WebSocket::CloseEventCode event_code = - static_cast<WebKit::WebSocket::CloseEventCode>(code); + blink::WebSocket::CloseEventCode event_code = + static_cast<blink::WebSocket::CloseEventCode>(code); if (code == PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED) { // PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED and CloseEventCodeNotSpecified are // assigned to different values. A conversion is needed if // PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED is specified. - event_code = WebKit::WebSocket::CloseEventCodeNotSpecified; + event_code = blink::WebSocket::CloseEventCodeNotSpecified; } else { if (!(code == PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE || (PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN <= code && diff --git a/chromium/ppapi/proxy/websocket_resource_unittest.cc b/chromium/ppapi/proxy/websocket_resource_unittest.cc index ecd9111c980..5cfc71a88e3 100644 --- a/chromium/ppapi/proxy/websocket_resource_unittest.cc +++ b/chromium/ppapi/proxy/websocket_resource_unittest.cc @@ -8,6 +8,7 @@ #include "ppapi/c/ppb_var.h" #include "ppapi/c/ppb_websocket.h" #include "ppapi/proxy/locking_resource_releaser.h" +#include "ppapi/proxy/plugin_message_filter.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppapi_proxy_test.h" #include "ppapi/proxy/websocket_resource.h" @@ -84,9 +85,8 @@ TEST_F(WebSocketResourceTest, Connect) { ResourceMessageReplyParams reply_params(params.pp_resource(), params.sequence()); reply_params.set_result(PP_OK); - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( - PpapiPluginMsg_ResourceReply(reply_params, - PpapiPluginMsg_WebSocket_ConnectReply(url, protocol1)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, PpapiPluginMsg_WebSocket_ConnectReply(url, protocol1)); EXPECT_EQ(PP_OK, g_callback_result); EXPECT_EQ(true, g_callback_called); @@ -102,20 +102,17 @@ TEST_F(WebSocketResourceTest, UnsolicitedReplies) { // Check if BufferedAmountReply is handled. 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)))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, PpapiPluginMsg_WebSocket_BufferedAmountReply(19760227u)); uint64_t amount = websocket_iface->GetBufferedAmount(res.get()); EXPECT_EQ(19760227u, amount); // Check if StateReply is handled. - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( - PpapiPluginMsg_ResourceReply( - reply_params, - PpapiPluginMsg_WebSocket_StateReply( - static_cast<int32_t>(PP_WEBSOCKETREADYSTATE_CLOSING))))); + PluginMessageFilter::DispatchResourceReplyForTest( + reply_params, + PpapiPluginMsg_WebSocket_StateReply( + static_cast<int32_t>(PP_WEBSOCKETREADYSTATE_CLOSING))); PP_WebSocketReadyState state = websocket_iface->GetReadyState(res.get()); EXPECT_EQ(PP_WEBSOCKETREADYSTATE_CLOSING, state); @@ -143,9 +140,9 @@ TEST_F(WebSocketResourceTest, MessageError) { ResourceMessageReplyParams connect_reply_params(params.pp_resource(), params.sequence()); connect_reply_params.set_result(PP_OK); - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( - PpapiPluginMsg_ResourceReply(connect_reply_params, - PpapiPluginMsg_WebSocket_ConnectReply(url, std::string())))); + PluginMessageFilter::DispatchResourceReplyForTest( + connect_reply_params, + PpapiPluginMsg_WebSocket_ConnectReply(url, std::string())); EXPECT_EQ(PP_OK, g_callback_result); EXPECT_TRUE(g_callback_called); @@ -157,9 +154,8 @@ TEST_F(WebSocketResourceTest, MessageError) { // Synthesize a WebSocket_ErrorReply message. ResourceMessageReplyParams error_reply_params(res.get(), 0); error_reply_params.set_result(PP_OK); - ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( - PpapiPluginMsg_ResourceReply(error_reply_params, - PpapiPluginMsg_WebSocket_ErrorReply()))); + PluginMessageFilter::DispatchResourceReplyForTest( + error_reply_params, PpapiPluginMsg_WebSocket_ErrorReply()); EXPECT_EQ(PP_ERROR_FAILED, g_callback_result); EXPECT_TRUE(g_callback_called); diff --git a/chromium/ppapi/shared_impl/DEPS b/chromium/ppapi/shared_impl/DEPS index 30cc66e9a58..48f8c434080 100644 --- a/chromium/ppapi/shared_impl/DEPS +++ b/chromium/ppapi/shared_impl/DEPS @@ -5,6 +5,7 @@ include_rules = [ "+media/base", "+skia", "+webkit/common/webpreferences.h", + "+webkit/common/fileapi/file_system_types.h", # The untrusted build references the NaCl integrated runtime (IRT). "+native_client/src/untrusted/irt", diff --git a/chromium/ppapi/shared_impl/api_id.h b/chromium/ppapi/shared_impl/api_id.h index c482a029a38..104a078a07a 100644 --- a/chromium/ppapi/shared_impl/api_id.h +++ b/chromium/ppapi/shared_impl/api_id.h @@ -31,7 +31,6 @@ enum ApiID { API_ID_PPB_FONT, API_ID_PPB_GRAPHICS_2D, API_ID_PPB_GRAPHICS_3D, - API_ID_PPB_HOSTRESOLVER_PRIVATE, API_ID_PPB_IMAGE_DATA, API_ID_PPB_INSTANCE, API_ID_PPB_INSTANCE_PRIVATE, diff --git a/chromium/ppapi/shared_impl/file_system_util.cc b/chromium/ppapi/shared_impl/file_system_util.cc new file mode 100644 index 00000000000..330995cceb8 --- /dev/null +++ b/chromium/ppapi/shared_impl/file_system_util.cc @@ -0,0 +1,50 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/shared_impl/file_system_util.h" + +#include "base/logging.h" + +namespace ppapi { + +fileapi::FileSystemType PepperFileSystemTypeToFileSystemType( + PP_FileSystemType type) { + switch (type) { + case PP_FILESYSTEMTYPE_LOCALTEMPORARY: + return fileapi::kFileSystemTypeTemporary; + case PP_FILESYSTEMTYPE_LOCALPERSISTENT: + return fileapi::kFileSystemTypePersistent; + case PP_FILESYSTEMTYPE_EXTERNAL: + return fileapi::kFileSystemTypeExternal; + default: + return fileapi::kFileSystemTypeUnknown; + } +} + +bool FileSystemTypeIsValid(PP_FileSystemType type) { + return (type == PP_FILESYSTEMTYPE_LOCALPERSISTENT || + type == PP_FILESYSTEMTYPE_LOCALTEMPORARY || + type == PP_FILESYSTEMTYPE_EXTERNAL || + type == PP_FILESYSTEMTYPE_ISOLATED); +} + +bool FileSystemTypeHasQuota(PP_FileSystemType type) { + return (type == PP_FILESYSTEMTYPE_LOCALTEMPORARY || + type == PP_FILESYSTEMTYPE_LOCALPERSISTENT); +} + +std::string IsolatedFileSystemTypeToRootName( + PP_IsolatedFileSystemType_Private type) { + switch (type) { + case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX: + return "crxfs"; + case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE: + return "pluginprivate"; + default: + NOTREACHED() << type; + return std::string(); + } +} + +} // namespace ppapi diff --git a/chromium/ppapi/shared_impl/file_system_util.h b/chromium/ppapi/shared_impl/file_system_util.h new file mode 100644 index 00000000000..5b39f697578 --- /dev/null +++ b/chromium/ppapi/shared_impl/file_system_util.h @@ -0,0 +1,30 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_SHARED_IMPL_FILE_SYSTEM_UTIL_H_ +#define PPAPI_SHARED_IMPL_FILE_SYSTEM_UTIL_H_ + +#include <string> + +#include "ppapi/c/pp_file_info.h" +#include "ppapi/c/private/ppb_isolated_file_system_private.h" +#include "ppapi/shared_impl/ppapi_shared_export.h" +#include "webkit/common/fileapi/file_system_types.h" + +namespace ppapi { + +PPAPI_SHARED_EXPORT +fileapi::FileSystemType PepperFileSystemTypeToFileSystemType( + PP_FileSystemType type); + +PPAPI_SHARED_EXPORT bool FileSystemTypeIsValid(PP_FileSystemType type); + +PPAPI_SHARED_EXPORT bool FileSystemTypeHasQuota(PP_FileSystemType type); + +PPAPI_SHARED_EXPORT std::string IsolatedFileSystemTypeToRootName( + PP_IsolatedFileSystemType_Private type); + +} // namespace ppapi + +#endif // PPAPI_SHARED_IMPL_FILE_SYSTEM_UTIL_H_ diff --git a/chromium/ppapi/shared_impl/file_type_conversion.cc b/chromium/ppapi/shared_impl/file_type_conversion.cc index 917d1968ea5..1a4bb16c7be 100644 --- a/chromium/ppapi/shared_impl/file_type_conversion.cc +++ b/chromium/ppapi/shared_impl/file_type_conversion.cc @@ -44,12 +44,13 @@ bool PepperFileOpenFlagsToPlatformFileFlags(int32_t pp_open_flags, bool pp_exclusive = !!(pp_open_flags & PP_FILEOPENFLAG_EXCLUSIVE); bool pp_append = !!(pp_open_flags & PP_FILEOPENFLAG_APPEND); - int flags = 0; + // Pepper allows Touch on any open file, so always set this Windows-only flag. + int flags = base::PLATFORM_FILE_WRITE_ATTRIBUTES; + if (pp_read) flags |= base::PLATFORM_FILE_READ; if (pp_write) { flags |= base::PLATFORM_FILE_WRITE; - flags |= base::PLATFORM_FILE_WRITE_ATTRIBUTES; } if (pp_append) { if (pp_write) diff --git a/chromium/ppapi/shared_impl/ppapi_globals.h b/chromium/ppapi/shared_impl/ppapi_globals.h index fdc939a2880..93ab2998e34 100644 --- a/chromium/ppapi/shared_impl/ppapi_globals.h +++ b/chromium/ppapi/shared_impl/ppapi_globals.h @@ -115,7 +115,7 @@ class PPAPI_SHARED_EXPORT PpapiGlobals { // Returns a task runner for file operations that may block. // TODO(bbudge) Move this to PluginGlobals when we no longer support // in-process plugins. - virtual base::TaskRunner* GetFileTaskRunner(PP_Instance instance) = 0; + virtual base::TaskRunner* GetFileTaskRunner() = 0; // Returns the command line for the process. virtual std::string GetCmdLine() = 0; diff --git a/chromium/ppapi/shared_impl/ppapi_nacl_channel_args.cc b/chromium/ppapi/shared_impl/ppapi_nacl_channel_args.cc index 7e20a530f1d..670e4e762dc 100644 --- a/chromium/ppapi/shared_impl/ppapi_nacl_channel_args.cc +++ b/chromium/ppapi/shared_impl/ppapi_nacl_channel_args.cc @@ -8,7 +8,8 @@ namespace ppapi { // We must provide explicit definitions of these functions for builds on // Windows. -PpapiNaClChannelArgs::PpapiNaClChannelArgs() { +PpapiNaClChannelArgs::PpapiNaClChannelArgs() : off_the_record(false), + supports_dev_channel(false) { } PpapiNaClChannelArgs::~PpapiNaClChannelArgs() { diff --git a/chromium/ppapi/shared_impl/ppapi_nacl_channel_args.h b/chromium/ppapi/shared_impl/ppapi_nacl_channel_args.h index 462a3a09461..1e4e4d58f1f 100644 --- a/chromium/ppapi/shared_impl/ppapi_nacl_channel_args.h +++ b/chromium/ppapi/shared_impl/ppapi_nacl_channel_args.h @@ -19,6 +19,7 @@ struct PPAPI_SHARED_EXPORT PpapiNaClChannelArgs { bool off_the_record; PpapiPermissions permissions; + bool supports_dev_channel; // Switches from the command-line. std::vector<std::string> switch_names; diff --git a/chromium/ppapi/shared_impl/ppb_audio_shared.cc b/chromium/ppapi/shared_impl/ppb_audio_shared.cc index 25d9011696c..1b12d5c5efc 100644 --- a/chromium/ppapi/shared_impl/ppb_audio_shared.cc +++ b/chromium/ppapi/shared_impl/ppb_audio_shared.cc @@ -5,7 +5,6 @@ #include "ppapi/shared_impl/ppb_audio_shared.h" #include "base/logging.h" -#include "media/audio/shared_memory_util.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/ppb_audio_config_shared.h" #include "ppapi/shared_impl/proxy_lock.h" @@ -63,7 +62,8 @@ PPB_Audio_Shared::PPB_Audio_Shared() #endif user_data_(NULL), client_buffer_size_bytes_(0), - bytes_per_second_(0) { + bytes_per_second_(0), + buffer_index_(0) { } PPB_Audio_Shared::~PPB_Audio_Shared() { @@ -113,9 +113,9 @@ void PPB_Audio_Shared::SetStreamInfo( shared_memory_size_ = shared_memory_size; bytes_per_second_ = kAudioOutputChannels * (kBitsPerAudioOutputSample / 8) * sample_rate; + buffer_index_ = 0; - if (!shared_memory_->Map( - media::TotalSharedMemorySizeInBytes(shared_memory_size_))) { + if (!shared_memory_->Map(shared_memory_size_)) { PpapiGlobals::Get()->LogWithSource( instance, PP_LOGLEVEL_WARNING, @@ -203,31 +203,31 @@ void PPB_Audio_Shared::CallRun(void* self) { #endif void PPB_Audio_Shared::Run() { - int pending_data; - const int bytes_per_frame = - sizeof(*audio_bus_->channel(0)) * audio_bus_->channels(); - + int pending_data = 0; while (sizeof(pending_data) == - socket_->Receive(&pending_data, sizeof(pending_data)) && - pending_data != media::kPauseMark) { + socket_->Receive(&pending_data, sizeof(pending_data))) { + // |buffer_index_| must track the number of Receive() calls. See the Send() + // call below for why this is important. + ++buffer_index_; + if (pending_data < 0) + break; + PP_TimeDelta latency = static_cast<double>(pending_data) / bytes_per_second_; callback_.Run(client_buffer_.get(), client_buffer_size_bytes_, latency, user_data_); - // Deinterleave the audio data into the shared memory as float. + // Deinterleave the audio data into the shared memory as floats. audio_bus_->FromInterleaved( client_buffer_.get(), audio_bus_->frames(), kBitsPerAudioOutputSample / 8); - // Let the host know we are done. - // TODO(dalecurtis): Technically this is not the exact size. Due to channel - // padding for alignment, there may be more data available than this. We're - // relying on AudioSyncReader::Read() to parse this with that in mind. - // Rename these methods to Set/GetActualFrameCount(). - media::SetActualDataSizeInBytes( - shared_memory_.get(), shared_memory_size_, - audio_bus_->frames() * bytes_per_frame); + // Let the other end know which buffer we just filled. The buffer index is + // used to ensure the other end is getting the buffer it expects. For more + // details on how this works see AudioSyncReader::WaitUntilDataIsReady(). + size_t bytes_sent = socket_->Send(&buffer_index_, sizeof(buffer_index_)); + if (bytes_sent != sizeof(buffer_index_)) + break; } } diff --git a/chromium/ppapi/shared_impl/ppb_audio_shared.h b/chromium/ppapi/shared_impl/ppb_audio_shared.h index d7faa5b5b28..738c56b083e 100644 --- a/chromium/ppapi/shared_impl/ppb_audio_shared.h +++ b/chromium/ppapi/shared_impl/ppb_audio_shared.h @@ -136,6 +136,9 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared // The size (in bytes) of one second of audio data. Used to calculate latency. size_t bytes_per_second_; + // Buffer index used to coordinate with the browser side audio receiver. + uint32_t buffer_index_; + DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Shared); }; diff --git a/chromium/ppapi/shared_impl/ppb_gamepad_shared.h b/chromium/ppapi/shared_impl/ppb_gamepad_shared.h index 2a30c7d874a..72d53311e52 100644 --- a/chromium/ppapi/shared_impl/ppb_gamepad_shared.h +++ b/chromium/ppapi/shared_impl/ppb_gamepad_shared.h @@ -17,7 +17,7 @@ namespace ppapi { #pragma pack(push, 1) -// This must match the definition of WebKit::Gamepad. The GamepadHost unit test +// This must match the definition of blink::Gamepad. The GamepadHost unit test // has some compile asserts to validate this. struct WebKitGamepad { static const size_t kIdLengthCap = 128; @@ -47,7 +47,7 @@ struct WebKitGamepad { float buttons[kButtonsLengthCap]; }; -// This must match the definition of WebKit::Gamepads. The GamepadHost unit +// This must match the definition of blink::Gamepads. The GamepadHost unit // test has some compile asserts to validate this. struct WebKitGamepads { static const size_t kItemsLengthCap = 4; diff --git a/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.cc index e24a13c4617..be8ee76431c 100644 --- a/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.cc +++ b/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.cc @@ -50,7 +50,6 @@ int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { if ((width < 0) || (height < 0)) return PP_ERROR_BADARGUMENT; - ScopedNoLocking already_locked(this); gles2_impl()->ResizeCHROMIUM(width, height, 1.f); // TODO(alokp): Check if resize succeeded and return appropriate error code. return PP_OK; @@ -58,7 +57,6 @@ int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { int32_t PPB_Graphics3D_Shared::SwapBuffers( scoped_refptr<TrackedCallback> callback) { - ScopedNoLocking already_locked(this); if (HasPendingSwap()) { Log(PP_LOGLEVEL_ERROR, "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " "with previous swap still pending."); @@ -85,13 +83,11 @@ void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target, GLenum format, GLenum type, GLenum access) { - ScopedNoLocking already_locked(this); return gles2_impl_->MapTexSubImage2DCHROMIUM( target, level, xoffset, yoffset, width, height, format, type, access); } void PPB_Graphics3D_Shared::UnmapTexSubImage2DCHROMIUM(const void* mem) { - ScopedNoLocking already_locked(this); gles2_impl_->UnmapTexSubImage2DCHROMIUM(mem); } @@ -108,7 +104,6 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl( int32 command_buffer_size, int32 transfer_buffer_size, gpu::gles2::GLES2Implementation* share_gles2) { - ScopedNoLocking already_locked(this); gpu::CommandBuffer* command_buffer = GetCommandBuffer(); DCHECK(command_buffer); @@ -123,14 +118,17 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl( const int32 kMaxTransferBufferSize = 16 * 1024 * 1024; transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); + const bool bind_creates_resources = true; + const bool free_everything_when_invisible = false; + // Create the object exposing the OpenGL API. gles2_impl_.reset(new gpu::gles2::GLES2Implementation( gles2_helper_.get(), share_gles2 ? share_gles2->share_group() : NULL, transfer_buffer_.get(), - true, - NULL // Do not use GpuMemoryBuffers. - )); + bind_creates_resources, + free_everything_when_invisible, + GetGpuControl())); if (!gles2_impl_->Initialize( transfer_buffer_size, @@ -146,19 +144,10 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl( } void PPB_Graphics3D_Shared::DestroyGLES2Impl() { - ScopedNoLocking already_locked(this); gles2_impl_.reset(); transfer_buffer_.reset(); gles2_helper_.reset(); } -void PPB_Graphics3D_Shared::PushAlreadyLocked() { - // Do nothing. This should be overridden in the plugin side. -} - -void PPB_Graphics3D_Shared::PopAlreadyLocked() { - // Do nothing. This should be overridden in the plugin side. -} - } // namespace ppapi diff --git a/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.h b/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.h index 482cb4cf035..d576d57fa27 100644 --- a/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.h +++ b/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.h @@ -15,6 +15,7 @@ namespace gpu { class CommandBuffer; +class GpuControl; class TransferBuffer; namespace gles2 { class GLES2CmdHelper; @@ -58,33 +59,12 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared void SwapBuffersACK(int32_t pp_error); protected: - // ScopedNoLocking makes sure we don't try to lock again when we already have - // the proxy lock. This is used when we need to use the CommandBuffer - // (possibly via gles2_impl) but we already have the proxy lock. The - // CommandBuffer in the plugin side of the proxy will otherwise try to acquire - // the ProxyLock, causing a crash because we already own the lock. (Locks in - // Chromium are never recursive). - class ScopedNoLocking { - public: - explicit ScopedNoLocking(PPB_Graphics3D_Shared* graphics3d_shared) - : graphics3d_shared_(graphics3d_shared) { - graphics3d_shared_->PushAlreadyLocked(); - } - ~ScopedNoLocking() { - graphics3d_shared_->PopAlreadyLocked(); - } - private: - PPB_Graphics3D_Shared* graphics3d_shared_; // Weak - - DISALLOW_COPY_AND_ASSIGN(ScopedNoLocking); - }; - - PPB_Graphics3D_Shared(PP_Instance instance); PPB_Graphics3D_Shared(const HostResource& host_resource); virtual ~PPB_Graphics3D_Shared(); virtual gpu::CommandBuffer* GetCommandBuffer() = 0; + virtual gpu::GpuControl* GetGpuControl() = 0; virtual int32 DoSwapBuffers() = 0; bool HasPendingSwap() const; @@ -94,17 +74,6 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared void DestroyGLES2Impl(); private: - // On the plugin side, we need to know that we already have the lock, so that - // we don't try to acquire it again. The default implementation does nothing; - // the Plugin side of the proxy must implement these. - friend class ScopedNoLocking; - virtual void PushAlreadyLocked(); - virtual void PopAlreadyLocked(); - - // The VideoDecoder needs to be able to call Graphics3D Flush() after taking - // the proxy lock. Hence it needs access to ScopedNoLocking. - friend class PPB_VideoDecoder_Shared; - scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; scoped_ptr<gpu::TransferBuffer> transfer_buffer_; scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; diff --git a/chromium/ppapi/shared_impl/ppb_image_data_shared.cc b/chromium/ppapi/shared_impl/ppb_image_data_shared.cc index 50751a03829..3900c92197a 100644 --- a/chromium/ppapi/shared_impl/ppb_image_data_shared.cc +++ b/chromium/ppapi/shared_impl/ppb_image_data_shared.cc @@ -26,7 +26,12 @@ PP_ImageDataFormat PPB_ImageData_Shared::GetNativeImageDataFormat() { NOTIMPLEMENTED(); return PP_IMAGEDATAFORMAT_BGRA_PREMUL; #else - return PP_IMAGEDATAFORMAT_BGRA_PREMUL; + if (SK_B32_SHIFT == 0) + return PP_IMAGEDATAFORMAT_BGRA_PREMUL; + else if (SK_R32_SHIFT == 0) + return PP_IMAGEDATAFORMAT_RGBA_PREMUL; + else + return PP_IMAGEDATAFORMAT_BGRA_PREMUL; // Default to something on failure #endif } diff --git a/chromium/ppapi/shared_impl/ppb_message_loop_shared.h b/chromium/ppapi/shared_impl/ppb_message_loop_shared.h index fd6d1618d1d..ed7bddb6de0 100644 --- a/chromium/ppapi/shared_impl/ppb_message_loop_shared.h +++ b/chromium/ppapi/shared_impl/ppb_message_loop_shared.h @@ -13,6 +13,10 @@ #include "ppapi/shared_impl/resource.h" #include "ppapi/thunk/ppb_message_loop_api.h" +namespace base { +class MessageLoopProxy; +} + namespace tracked_objects { class Location; } @@ -44,6 +48,8 @@ class PPAPI_SHARED_EXPORT MessageLoopShared const base::Closure& closure, int64 delay_ms) = 0; + virtual base::MessageLoopProxy* GetMessageLoopProxy() = 0; + DISALLOW_COPY_AND_ASSIGN(MessageLoopShared); }; diff --git a/chromium/ppapi/shared_impl/ppb_opengles2_shared.cc b/chromium/ppapi/shared_impl/ppb_opengles2_shared.cc index 03db4631f14..5c05065dcd8 100644 --- a/chromium/ppapi/shared_impl/ppb_opengles2_shared.cc +++ b/chromium/ppapi/shared_impl/ppb_opengles2_shared.cc @@ -17,827 +17,1344 @@ namespace ppapi { namespace { -gpu::gles2::GLES2Implementation* GetGLES(PP_Resource context) { - thunk::EnterResource<thunk::PPB_Graphics3D_API> enter_g3d(context, false); - DCHECK(enter_g3d.succeeded()); - return static_cast<PPB_Graphics3D_Shared*>(enter_g3d.object())->gles2_impl(); +typedef thunk::EnterResource<thunk::PPB_Graphics3D_API> Enter3D; + +gpu::gles2::GLES2Implementation* ToGles2Impl(Enter3D* enter) { + DCHECK(enter); + DCHECK(enter->succeeded()); + return static_cast<PPB_Graphics3D_Shared*>(enter->object())->gles2_impl(); } void ActiveTexture(PP_Resource context_id, GLenum texture) { - GetGLES(context_id)->ActiveTexture(texture); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->ActiveTexture(texture); + } } void AttachShader(PP_Resource context_id, GLuint program, GLuint shader) { - GetGLES(context_id)->AttachShader(program, shader); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->AttachShader(program, shader); + } } void BindAttribLocation( PP_Resource context_id, GLuint program, GLuint index, const char* name) { - GetGLES(context_id)->BindAttribLocation(program, index, name); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BindAttribLocation(program, index, name); + } } void BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) { - GetGLES(context_id)->BindBuffer(target, buffer); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BindBuffer(target, buffer); + } } void BindFramebuffer( PP_Resource context_id, GLenum target, GLuint framebuffer) { - GetGLES(context_id)->BindFramebuffer(target, framebuffer); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BindFramebuffer(target, framebuffer); + } } void BindRenderbuffer( PP_Resource context_id, GLenum target, GLuint renderbuffer) { - GetGLES(context_id)->BindRenderbuffer(target, renderbuffer); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BindRenderbuffer(target, renderbuffer); + } } void BindTexture(PP_Resource context_id, GLenum target, GLuint texture) { - GetGLES(context_id)->BindTexture(target, texture); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BindTexture(target, texture); + } } void BlendColor( PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - GetGLES(context_id)->BlendColor(red, green, blue, alpha); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BlendColor(red, green, blue, alpha); + } } void BlendEquation(PP_Resource context_id, GLenum mode) { - GetGLES(context_id)->BlendEquation(mode); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BlendEquation(mode); + } } void BlendEquationSeparate( PP_Resource context_id, GLenum modeRGB, GLenum modeAlpha) { - GetGLES(context_id)->BlendEquationSeparate(modeRGB, modeAlpha); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BlendEquationSeparate(modeRGB, modeAlpha); + } } void BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) { - GetGLES(context_id)->BlendFunc(sfactor, dfactor); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BlendFunc(sfactor, dfactor); + } } void BlendFuncSeparate( PP_Resource context_id, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { - GetGLES(context_id)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + } } void BufferData( PP_Resource context_id, GLenum target, GLsizeiptr size, const void* data, GLenum usage) { - GetGLES(context_id)->BufferData(target, size, data, usage); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BufferData(target, size, data, usage); + } } void BufferSubData( PP_Resource context_id, GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { - GetGLES(context_id)->BufferSubData(target, offset, size, data); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BufferSubData(target, offset, size, data); + } } GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) { - return GetGLES(context_id)->CheckFramebufferStatus(target); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->CheckFramebufferStatus(target); + } else { + return 0; + } } void Clear(PP_Resource context_id, GLbitfield mask) { - GetGLES(context_id)->Clear(mask); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Clear(mask); + } } void ClearColor( PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - GetGLES(context_id)->ClearColor(red, green, blue, alpha); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->ClearColor(red, green, blue, alpha); + } } void ClearDepthf(PP_Resource context_id, GLclampf depth) { - GetGLES(context_id)->ClearDepthf(depth); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->ClearDepthf(depth); + } } void ClearStencil(PP_Resource context_id, GLint s) { - GetGLES(context_id)->ClearStencil(s); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->ClearStencil(s); + } } void ColorMask( PP_Resource context_id, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { - GetGLES(context_id)->ColorMask(red, green, blue, alpha); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->ColorMask(red, green, blue, alpha); + } } void CompileShader(PP_Resource context_id, GLuint shader) { - GetGLES(context_id)->CompileShader(shader); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->CompileShader(shader); + } } void CompressedTexImage2D( PP_Resource context_id, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { - GetGLES( - context_id)->CompressedTexImage2D( - target, level, internalformat, width, height, border, imageSize, - data); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->CompressedTexImage2D( + target, level, internalformat, width, height, border, imageSize, + data); + } } void CompressedTexSubImage2D( PP_Resource context_id, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { - GetGLES( - context_id)->CompressedTexSubImage2D( - target, level, xoffset, yoffset, width, height, format, imageSize, - data); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->CompressedTexSubImage2D( + target, level, xoffset, yoffset, width, height, format, imageSize, + data); + } } void CopyTexImage2D( PP_Resource context_id, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - GetGLES( - context_id)->CopyTexImage2D( - target, level, internalformat, x, y, width, height, border); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->CopyTexImage2D( + target, level, internalformat, x, y, width, height, border); + } } void CopyTexSubImage2D( PP_Resource context_id, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - GetGLES( - context_id)->CopyTexSubImage2D( - target, level, xoffset, yoffset, x, y, width, height); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->CopyTexSubImage2D( + target, level, xoffset, yoffset, x, y, width, height); + } } GLuint CreateProgram(PP_Resource context_id) { - return GetGLES(context_id)->CreateProgram(); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->CreateProgram(); + } else { + return 0; + } } GLuint CreateShader(PP_Resource context_id, GLenum type) { - return GetGLES(context_id)->CreateShader(type); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->CreateShader(type); + } else { + return 0; + } } void CullFace(PP_Resource context_id, GLenum mode) { - GetGLES(context_id)->CullFace(mode); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->CullFace(mode); + } } void DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) { - GetGLES(context_id)->DeleteBuffers(n, buffers); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DeleteBuffers(n, buffers); + } } void DeleteFramebuffers( PP_Resource context_id, GLsizei n, const GLuint* framebuffers) { - GetGLES(context_id)->DeleteFramebuffers(n, framebuffers); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DeleteFramebuffers(n, framebuffers); + } } void DeleteProgram(PP_Resource context_id, GLuint program) { - GetGLES(context_id)->DeleteProgram(program); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DeleteProgram(program); + } } void DeleteRenderbuffers( PP_Resource context_id, GLsizei n, const GLuint* renderbuffers) { - GetGLES(context_id)->DeleteRenderbuffers(n, renderbuffers); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DeleteRenderbuffers(n, renderbuffers); + } } void DeleteShader(PP_Resource context_id, GLuint shader) { - GetGLES(context_id)->DeleteShader(shader); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DeleteShader(shader); + } } void DeleteTextures( PP_Resource context_id, GLsizei n, const GLuint* textures) { - GetGLES(context_id)->DeleteTextures(n, textures); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DeleteTextures(n, textures); + } } void DepthFunc(PP_Resource context_id, GLenum func) { - GetGLES(context_id)->DepthFunc(func); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DepthFunc(func); + } } void DepthMask(PP_Resource context_id, GLboolean flag) { - GetGLES(context_id)->DepthMask(flag); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DepthMask(flag); + } } void DepthRangef(PP_Resource context_id, GLclampf zNear, GLclampf zFar) { - GetGLES(context_id)->DepthRangef(zNear, zFar); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DepthRangef(zNear, zFar); + } } void DetachShader(PP_Resource context_id, GLuint program, GLuint shader) { - GetGLES(context_id)->DetachShader(program, shader); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DetachShader(program, shader); + } } void Disable(PP_Resource context_id, GLenum cap) { - GetGLES(context_id)->Disable(cap); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Disable(cap); + } } void DisableVertexAttribArray(PP_Resource context_id, GLuint index) { - GetGLES(context_id)->DisableVertexAttribArray(index); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DisableVertexAttribArray(index); + } } void DrawArrays( PP_Resource context_id, GLenum mode, GLint first, GLsizei count) { - GetGLES(context_id)->DrawArrays(mode, first, count); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DrawArrays(mode, first, count); + } } void DrawElements( PP_Resource context_id, GLenum mode, GLsizei count, GLenum type, const void* indices) { - GetGLES(context_id)->DrawElements(mode, count, type, indices); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DrawElements(mode, count, type, indices); + } } void Enable(PP_Resource context_id, GLenum cap) { - GetGLES(context_id)->Enable(cap); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Enable(cap); + } } void EnableVertexAttribArray(PP_Resource context_id, GLuint index) { - GetGLES(context_id)->EnableVertexAttribArray(index); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->EnableVertexAttribArray(index); + } } void Finish(PP_Resource context_id) { - GetGLES(context_id)->Finish(); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Finish(); + } } void Flush(PP_Resource context_id) { - GetGLES(context_id)->Flush(); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Flush(); + } } void FramebufferRenderbuffer( PP_Resource context_id, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { - GetGLES( - context_id)->FramebufferRenderbuffer( - target, attachment, renderbuffertarget, renderbuffer); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->FramebufferRenderbuffer( + target, attachment, renderbuffertarget, renderbuffer); + } } void FramebufferTexture2D( PP_Resource context_id, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { - GetGLES( - context_id)->FramebufferTexture2D( - target, attachment, textarget, texture, level); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->FramebufferTexture2D( + target, attachment, textarget, texture, level); + } } void FrontFace(PP_Resource context_id, GLenum mode) { - GetGLES(context_id)->FrontFace(mode); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->FrontFace(mode); + } } void GenBuffers(PP_Resource context_id, GLsizei n, GLuint* buffers) { - GetGLES(context_id)->GenBuffers(n, buffers); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GenBuffers(n, buffers); + } } void GenerateMipmap(PP_Resource context_id, GLenum target) { - GetGLES(context_id)->GenerateMipmap(target); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GenerateMipmap(target); + } } void GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) { - GetGLES(context_id)->GenFramebuffers(n, framebuffers); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GenFramebuffers(n, framebuffers); + } } void GenRenderbuffers( PP_Resource context_id, GLsizei n, GLuint* renderbuffers) { - GetGLES(context_id)->GenRenderbuffers(n, renderbuffers); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GenRenderbuffers(n, renderbuffers); + } } void GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) { - GetGLES(context_id)->GenTextures(n, textures); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GenTextures(n, textures); + } } void GetActiveAttrib( PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { - GetGLES( - context_id)->GetActiveAttrib( - program, index, bufsize, length, size, type, name); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->GetActiveAttrib( + program, index, bufsize, length, size, type, name); + } } void GetActiveUniform( PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { - GetGLES( - context_id)->GetActiveUniform( - program, index, bufsize, length, size, type, name); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->GetActiveUniform( + program, index, bufsize, length, size, type, name); + } } void GetAttachedShaders( PP_Resource context_id, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { - GetGLES(context_id)->GetAttachedShaders(program, maxcount, count, shaders); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetAttachedShaders(program, maxcount, count, shaders); + } } GLint GetAttribLocation( PP_Resource context_id, GLuint program, const char* name) { - return GetGLES(context_id)->GetAttribLocation(program, name); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->GetAttribLocation(program, name); + } else { + return -1; + } } void GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) { - GetGLES(context_id)->GetBooleanv(pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetBooleanv(pname, params); + } } void GetBufferParameteriv( PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { - GetGLES(context_id)->GetBufferParameteriv(target, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetBufferParameteriv(target, pname, params); + } } GLenum GetError(PP_Resource context_id) { - return GetGLES(context_id)->GetError(); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->GetError(); + } else { + return 0; + } } void GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) { - GetGLES(context_id)->GetFloatv(pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetFloatv(pname, params); + } } void GetFramebufferAttachmentParameteriv( PP_Resource context_id, GLenum target, GLenum attachment, GLenum pname, GLint* params) { - GetGLES( - context_id)->GetFramebufferAttachmentParameteriv( - target, attachment, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->GetFramebufferAttachmentParameteriv( + target, attachment, pname, params); + } } void GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) { - GetGLES(context_id)->GetIntegerv(pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetIntegerv(pname, params); + } } void GetProgramiv( PP_Resource context_id, GLuint program, GLenum pname, GLint* params) { - GetGLES(context_id)->GetProgramiv(program, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetProgramiv(program, pname, params); + } } void GetProgramInfoLog( PP_Resource context_id, GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { - GetGLES(context_id)->GetProgramInfoLog(program, bufsize, length, infolog); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetProgramInfoLog(program, bufsize, length, infolog); + } } void GetRenderbufferParameteriv( PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { - GetGLES(context_id)->GetRenderbufferParameteriv(target, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetRenderbufferParameteriv(target, pname, params); + } } void GetShaderiv( PP_Resource context_id, GLuint shader, GLenum pname, GLint* params) { - GetGLES(context_id)->GetShaderiv(shader, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetShaderiv(shader, pname, params); + } } void GetShaderInfoLog( PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { - GetGLES(context_id)->GetShaderInfoLog(shader, bufsize, length, infolog); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetShaderInfoLog(shader, bufsize, length, infolog); + } } void GetShaderPrecisionFormat( PP_Resource context_id, GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { - GetGLES( - context_id)->GetShaderPrecisionFormat( - shadertype, precisiontype, range, precision); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->GetShaderPrecisionFormat( + shadertype, precisiontype, range, precision); + } } void GetShaderSource( PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { - GetGLES(context_id)->GetShaderSource(shader, bufsize, length, source); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetShaderSource(shader, bufsize, length, source); + } } const GLubyte* GetString(PP_Resource context_id, GLenum name) { - return GetGLES(context_id)->GetString(name); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->GetString(name); + } else { + return NULL; + } } void GetTexParameterfv( PP_Resource context_id, GLenum target, GLenum pname, GLfloat* params) { - GetGLES(context_id)->GetTexParameterfv(target, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetTexParameterfv(target, pname, params); + } } void GetTexParameteriv( PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { - GetGLES(context_id)->GetTexParameteriv(target, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetTexParameteriv(target, pname, params); + } } void GetUniformfv( PP_Resource context_id, GLuint program, GLint location, GLfloat* params) { - GetGLES(context_id)->GetUniformfv(program, location, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetUniformfv(program, location, params); + } } void GetUniformiv( PP_Resource context_id, GLuint program, GLint location, GLint* params) { - GetGLES(context_id)->GetUniformiv(program, location, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetUniformiv(program, location, params); + } } GLint GetUniformLocation( PP_Resource context_id, GLuint program, const char* name) { - return GetGLES(context_id)->GetUniformLocation(program, name); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->GetUniformLocation(program, name); + } else { + return -1; + } } void GetVertexAttribfv( PP_Resource context_id, GLuint index, GLenum pname, GLfloat* params) { - GetGLES(context_id)->GetVertexAttribfv(index, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetVertexAttribfv(index, pname, params); + } } void GetVertexAttribiv( PP_Resource context_id, GLuint index, GLenum pname, GLint* params) { - GetGLES(context_id)->GetVertexAttribiv(index, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetVertexAttribiv(index, pname, params); + } } void GetVertexAttribPointerv( PP_Resource context_id, GLuint index, GLenum pname, void** pointer) { - GetGLES(context_id)->GetVertexAttribPointerv(index, pname, pointer); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetVertexAttribPointerv(index, pname, pointer); + } } void Hint(PP_Resource context_id, GLenum target, GLenum mode) { - GetGLES(context_id)->Hint(target, mode); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Hint(target, mode); + } } GLboolean IsBuffer(PP_Resource context_id, GLuint buffer) { - return GetGLES(context_id)->IsBuffer(buffer); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->IsBuffer(buffer); + } else { + return GL_FALSE; + } } GLboolean IsEnabled(PP_Resource context_id, GLenum cap) { - return GetGLES(context_id)->IsEnabled(cap); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->IsEnabled(cap); + } else { + return GL_FALSE; + } } GLboolean IsFramebuffer(PP_Resource context_id, GLuint framebuffer) { - return GetGLES(context_id)->IsFramebuffer(framebuffer); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->IsFramebuffer(framebuffer); + } else { + return GL_FALSE; + } } GLboolean IsProgram(PP_Resource context_id, GLuint program) { - return GetGLES(context_id)->IsProgram(program); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->IsProgram(program); + } else { + return GL_FALSE; + } } GLboolean IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) { - return GetGLES(context_id)->IsRenderbuffer(renderbuffer); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->IsRenderbuffer(renderbuffer); + } else { + return GL_FALSE; + } } GLboolean IsShader(PP_Resource context_id, GLuint shader) { - return GetGLES(context_id)->IsShader(shader); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->IsShader(shader); + } else { + return GL_FALSE; + } } GLboolean IsTexture(PP_Resource context_id, GLuint texture) { - return GetGLES(context_id)->IsTexture(texture); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->IsTexture(texture); + } else { + return GL_FALSE; + } } void LineWidth(PP_Resource context_id, GLfloat width) { - GetGLES(context_id)->LineWidth(width); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->LineWidth(width); + } } void LinkProgram(PP_Resource context_id, GLuint program) { - GetGLES(context_id)->LinkProgram(program); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->LinkProgram(program); + } } void PixelStorei(PP_Resource context_id, GLenum pname, GLint param) { - GetGLES(context_id)->PixelStorei(pname, param); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->PixelStorei(pname, param); + } } void PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) { - GetGLES(context_id)->PolygonOffset(factor, units); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->PolygonOffset(factor, units); + } } void ReadPixels( PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { - GetGLES(context_id)->ReadPixels(x, y, width, height, format, type, pixels); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->ReadPixels(x, y, width, height, format, type, pixels); + } } void ReleaseShaderCompiler(PP_Resource context_id) { - GetGLES(context_id)->ReleaseShaderCompiler(); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->ReleaseShaderCompiler(); + } } void RenderbufferStorage( PP_Resource context_id, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { - GetGLES( - context_id)->RenderbufferStorage(target, internalformat, width, height); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->RenderbufferStorage(target, internalformat, width, height); + } } void SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) { - GetGLES(context_id)->SampleCoverage(value, invert); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->SampleCoverage(value, invert); + } } void Scissor( PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) { - GetGLES(context_id)->Scissor(x, y, width, height); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Scissor(x, y, width, height); + } } void ShaderBinary( PP_Resource context_id, GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) { - GetGLES(context_id)->ShaderBinary(n, shaders, binaryformat, binary, length); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->ShaderBinary(n, shaders, binaryformat, binary, length); + } } void ShaderSource( PP_Resource context_id, GLuint shader, GLsizei count, const char** str, const GLint* length) { - GetGLES(context_id)->ShaderSource(shader, count, str, length); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->ShaderSource(shader, count, str, length); + } } void StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) { - GetGLES(context_id)->StencilFunc(func, ref, mask); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->StencilFunc(func, ref, mask); + } } void StencilFuncSeparate( PP_Resource context_id, GLenum face, GLenum func, GLint ref, GLuint mask) { - GetGLES(context_id)->StencilFuncSeparate(face, func, ref, mask); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->StencilFuncSeparate(face, func, ref, mask); + } } void StencilMask(PP_Resource context_id, GLuint mask) { - GetGLES(context_id)->StencilMask(mask); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->StencilMask(mask); + } } void StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) { - GetGLES(context_id)->StencilMaskSeparate(face, mask); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->StencilMaskSeparate(face, mask); + } } void StencilOp( PP_Resource context_id, GLenum fail, GLenum zfail, GLenum zpass) { - GetGLES(context_id)->StencilOp(fail, zfail, zpass); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->StencilOp(fail, zfail, zpass); + } } void StencilOpSeparate( PP_Resource context_id, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { - GetGLES(context_id)->StencilOpSeparate(face, fail, zfail, zpass); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->StencilOpSeparate(face, fail, zfail, zpass); + } } void TexImage2D( PP_Resource context_id, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { - GetGLES( - context_id)->TexImage2D( - target, level, internalformat, width, height, border, format, type, - pixels); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->TexImage2D( + target, level, internalformat, width, height, border, format, type, + pixels); + } } void TexParameterf( PP_Resource context_id, GLenum target, GLenum pname, GLfloat param) { - GetGLES(context_id)->TexParameterf(target, pname, param); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->TexParameterf(target, pname, param); + } } void TexParameterfv( PP_Resource context_id, GLenum target, GLenum pname, const GLfloat* params) { - GetGLES(context_id)->TexParameterfv(target, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->TexParameterfv(target, pname, params); + } } void TexParameteri( PP_Resource context_id, GLenum target, GLenum pname, GLint param) { - GetGLES(context_id)->TexParameteri(target, pname, param); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->TexParameteri(target, pname, param); + } } void TexParameteriv( PP_Resource context_id, GLenum target, GLenum pname, const GLint* params) { - GetGLES(context_id)->TexParameteriv(target, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->TexParameteriv(target, pname, params); + } } void TexSubImage2D( PP_Resource context_id, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { - GetGLES( - context_id)->TexSubImage2D( - target, level, xoffset, yoffset, width, height, format, type, - pixels); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->TexSubImage2D( + target, level, xoffset, yoffset, width, height, format, type, + pixels); + } } void Uniform1f(PP_Resource context_id, GLint location, GLfloat x) { - GetGLES(context_id)->Uniform1f(location, x); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform1f(location, x); + } } void Uniform1fv( PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { - GetGLES(context_id)->Uniform1fv(location, count, v); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform1fv(location, count, v); + } } void Uniform1i(PP_Resource context_id, GLint location, GLint x) { - GetGLES(context_id)->Uniform1i(location, x); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform1i(location, x); + } } void Uniform1iv( PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { - GetGLES(context_id)->Uniform1iv(location, count, v); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform1iv(location, count, v); + } } void Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) { - GetGLES(context_id)->Uniform2f(location, x, y); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform2f(location, x, y); + } } void Uniform2fv( PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { - GetGLES(context_id)->Uniform2fv(location, count, v); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform2fv(location, count, v); + } } void Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) { - GetGLES(context_id)->Uniform2i(location, x, y); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform2i(location, x, y); + } } void Uniform2iv( PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { - GetGLES(context_id)->Uniform2iv(location, count, v); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform2iv(location, count, v); + } } void Uniform3f( PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z) { - GetGLES(context_id)->Uniform3f(location, x, y, z); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform3f(location, x, y, z); + } } void Uniform3fv( PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { - GetGLES(context_id)->Uniform3fv(location, count, v); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform3fv(location, count, v); + } } void Uniform3i( PP_Resource context_id, GLint location, GLint x, GLint y, GLint z) { - GetGLES(context_id)->Uniform3i(location, x, y, z); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform3i(location, x, y, z); + } } void Uniform3iv( PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { - GetGLES(context_id)->Uniform3iv(location, count, v); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform3iv(location, count, v); + } } void Uniform4f( PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GetGLES(context_id)->Uniform4f(location, x, y, z, w); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform4f(location, x, y, z, w); + } } void Uniform4fv( PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { - GetGLES(context_id)->Uniform4fv(location, count, v); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform4fv(location, count, v); + } } void Uniform4i( PP_Resource context_id, GLint location, GLint x, GLint y, GLint z, GLint w) { - GetGLES(context_id)->Uniform4i(location, x, y, z, w); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform4i(location, x, y, z, w); + } } void Uniform4iv( PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { - GetGLES(context_id)->Uniform4iv(location, count, v); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Uniform4iv(location, count, v); + } } void UniformMatrix2fv( PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { - GetGLES(context_id)->UniformMatrix2fv(location, count, transpose, value); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->UniformMatrix2fv(location, count, transpose, value); + } } void UniformMatrix3fv( PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { - GetGLES(context_id)->UniformMatrix3fv(location, count, transpose, value); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->UniformMatrix3fv(location, count, transpose, value); + } } void UniformMatrix4fv( PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { - GetGLES(context_id)->UniformMatrix4fv(location, count, transpose, value); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->UniformMatrix4fv(location, count, transpose, value); + } } void UseProgram(PP_Resource context_id, GLuint program) { - GetGLES(context_id)->UseProgram(program); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->UseProgram(program); + } } void ValidateProgram(PP_Resource context_id, GLuint program) { - GetGLES(context_id)->ValidateProgram(program); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->ValidateProgram(program); + } } void VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) { - GetGLES(context_id)->VertexAttrib1f(indx, x); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->VertexAttrib1f(indx, x); + } } void VertexAttrib1fv( PP_Resource context_id, GLuint indx, const GLfloat* values) { - GetGLES(context_id)->VertexAttrib1fv(indx, values); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->VertexAttrib1fv(indx, values); + } } void VertexAttrib2f( PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) { - GetGLES(context_id)->VertexAttrib2f(indx, x, y); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->VertexAttrib2f(indx, x, y); + } } void VertexAttrib2fv( PP_Resource context_id, GLuint indx, const GLfloat* values) { - GetGLES(context_id)->VertexAttrib2fv(indx, values); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->VertexAttrib2fv(indx, values); + } } void VertexAttrib3f( PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z) { - GetGLES(context_id)->VertexAttrib3f(indx, x, y, z); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->VertexAttrib3f(indx, x, y, z); + } } void VertexAttrib3fv( PP_Resource context_id, GLuint indx, const GLfloat* values) { - GetGLES(context_id)->VertexAttrib3fv(indx, values); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->VertexAttrib3fv(indx, values); + } } void VertexAttrib4f( PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GetGLES(context_id)->VertexAttrib4f(indx, x, y, z, w); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->VertexAttrib4f(indx, x, y, z, w); + } } void VertexAttrib4fv( PP_Resource context_id, GLuint indx, const GLfloat* values) { - GetGLES(context_id)->VertexAttrib4fv(indx, values); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->VertexAttrib4fv(indx, values); + } } void VertexAttribPointer( PP_Resource context_id, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { - GetGLES( - context_id)->VertexAttribPointer( - indx, size, type, normalized, stride, ptr); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->VertexAttribPointer( + indx, size, type, normalized, stride, ptr); + } } void Viewport( PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) { - GetGLES(context_id)->Viewport(x, y, width, height); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->Viewport(x, y, width, height); + } } void BlitFramebufferEXT( PP_Resource context_id, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { - GetGLES( - context_id)->BlitFramebufferEXT( - srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, - filter); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->BlitFramebufferCHROMIUM( + srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, + filter); + } } void RenderbufferStorageMultisampleEXT( PP_Resource context_id, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - GetGLES( - context_id)->RenderbufferStorageMultisampleEXT( - target, samples, internalformat, width, height); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->RenderbufferStorageMultisampleCHROMIUM( + target, samples, internalformat, width, height); + } } void GenQueriesEXT(PP_Resource context_id, GLsizei n, GLuint* queries) { - GetGLES(context_id)->GenQueriesEXT(n, queries); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GenQueriesEXT(n, queries); + } } void DeleteQueriesEXT( PP_Resource context_id, GLsizei n, const GLuint* queries) { - GetGLES(context_id)->DeleteQueriesEXT(n, queries); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->DeleteQueriesEXT(n, queries); + } } GLboolean IsQueryEXT(PP_Resource context_id, GLuint id) { - return GetGLES(context_id)->IsQueryEXT(id); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->IsQueryEXT(id); + } else { + return GL_FALSE; + } } void BeginQueryEXT(PP_Resource context_id, GLenum target, GLuint id) { - GetGLES(context_id)->BeginQueryEXT(target, id); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->BeginQueryEXT(target, id); + } } void EndQueryEXT(PP_Resource context_id, GLenum target) { - GetGLES(context_id)->EndQueryEXT(target); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->EndQueryEXT(target); + } } void GetQueryivEXT( PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { - GetGLES(context_id)->GetQueryivEXT(target, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetQueryivEXT(target, pname, params); + } } void GetQueryObjectuivEXT( PP_Resource context_id, GLuint id, GLenum pname, GLuint* params) { - GetGLES(context_id)->GetQueryObjectuivEXT(id, pname, params); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->GetQueryObjectuivEXT(id, pname, params); + } } GLboolean EnableFeatureCHROMIUM(PP_Resource context_id, const char* feature) { - return GetGLES(context_id)->EnableFeatureCHROMIUM(feature); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl(&enter)->EnableFeatureCHROMIUM(feature); + } else { + return GL_FALSE; + } } void* MapBufferSubDataCHROMIUM( PP_Resource context_id, GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { - return GetGLES( - context_id)->MapBufferSubDataCHROMIUM(target, offset, size, access); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl( + &enter)->MapBufferSubDataCHROMIUM(target, offset, size, access); + } else { + return NULL; + } } void UnmapBufferSubDataCHROMIUM(PP_Resource context_id, const void* mem) { - GetGLES(context_id)->UnmapBufferSubDataCHROMIUM(mem); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->UnmapBufferSubDataCHROMIUM(mem); + } } void* MapTexSubImage2DCHROMIUM( PP_Resource context_id, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access) { - return GetGLES( - context_id)->MapTexSubImage2DCHROMIUM( - target, level, xoffset, yoffset, width, height, format, type, - access); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + return ToGles2Impl( + &enter)->MapTexSubImage2DCHROMIUM( + target, level, xoffset, yoffset, width, height, format, type, + access); + } else { + return NULL; + } } void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id, const void* mem) { - GetGLES(context_id)->UnmapTexSubImage2DCHROMIUM(mem); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->UnmapTexSubImage2DCHROMIUM(mem); + } } void DrawArraysInstancedANGLE( PP_Resource context_id, GLenum mode, GLint first, GLsizei count, GLsizei primcount) { - GetGLES(context_id)->DrawArraysInstancedANGLE(mode, first, count, primcount); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->DrawArraysInstancedANGLE(mode, first, count, primcount); + } } void DrawElementsInstancedANGLE( PP_Resource context_id, GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount) { - GetGLES( - context_id)->DrawElementsInstancedANGLE( - mode, count, type, indices, primcount); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl( + &enter)->DrawElementsInstancedANGLE( + mode, count, type, indices, primcount); + } } void VertexAttribDivisorANGLE( PP_Resource context_id, GLuint index, GLuint divisor) { - GetGLES(context_id)->VertexAttribDivisorANGLE(index, divisor); + Enter3D enter(context_id, true); + if (enter.succeeded()) { + ToGles2Impl(&enter)->VertexAttribDivisorANGLE(index, divisor); + } } } // namespace diff --git a/chromium/ppapi/shared_impl/ppb_video_decoder_shared.cc b/chromium/ppapi/shared_impl/ppb_video_decoder_shared.cc index 7d8d021b5b3..8b75cc7c89a 100644 --- a/chromium/ppapi/shared_impl/ppb_video_decoder_shared.cc +++ b/chromium/ppapi/shared_impl/ppb_video_decoder_shared.cc @@ -96,15 +96,13 @@ void PPB_VideoDecoder_Shared::RunBitstreamBufferCallback( } void PPB_VideoDecoder_Shared::FlushCommandBuffer() { - if (gles2_impl_) { - // To call Flush() we have to tell Graphics3D that we hold the proxy lock. - thunk::EnterResource<thunk::PPB_Graphics3D_API, false> enter_g3d( - graphics_context_, false); - DCHECK(enter_g3d.succeeded()); - PPB_Graphics3D_Shared* graphics3d = - static_cast<PPB_Graphics3D_Shared*>(enter_g3d.object()); - PPB_Graphics3D_Shared::ScopedNoLocking dont_lock(graphics3d); - gles2_impl_->Flush(); + // Ensure that graphics_context is still live before using gles2_impl_. + // Our "plugin reference" is not enough to keep graphics_context alive if + // DidDeleteInstance() has been called. + if (PpapiGlobals::Get()->GetResourceTracker()->GetResource( + graphics_context_)) { + if (gles2_impl_) + gles2_impl_->Flush(); } } diff --git a/chromium/ppapi/shared_impl/proxy_lock.h b/chromium/ppapi/shared_impl/proxy_lock.h index 9a81a13baa1..f6dea318417 100644 --- a/chromium/ppapi/shared_impl/proxy_lock.h +++ b/chromium/ppapi/shared_impl/proxy_lock.h @@ -50,6 +50,11 @@ class PPAPI_SHARED_EXPORT ProxyLock { // Assert that the lock is owned by the current thread (in the plugin // process). Does nothing when running in-process (or in the host process). static void AssertAcquired(); + static void AssertAcquiredDebugOnly() { +#ifndef NDEBUG + AssertAcquired(); +#endif + } // We have some unit tests where one thread pretends to be the host and one // pretends to be the plugin. This allows the lock to do nothing on only one diff --git a/chromium/ppapi/shared_impl/resource.h b/chromium/ppapi/shared_impl/resource.h index 15ce142c139..ec4f5179c1f 100644 --- a/chromium/ppapi/shared_impl/resource.h +++ b/chromium/ppapi/shared_impl/resource.h @@ -51,12 +51,14 @@ F(PPB_HostResolver_Private_API) \ F(PPB_ImageData_API) \ F(PPB_InputEvent_API) \ + F(PPB_IsolatedFileSystem_Private_API) \ F(PPB_LayerCompositor_API) \ F(PPB_MessageLoop_API) \ F(PPB_NetAddress_API) \ F(PPB_NetworkList_API) \ F(PPB_NetworkMonitor_API) \ F(PPB_NetworkProxy_API) \ + F(PPB_OutputProtection_API) \ F(PPB_PDF_API) \ F(PPB_PlatformVerification_API) \ F(PPB_Printing_API) \ diff --git a/chromium/ppapi/shared_impl/resource_tracker.h b/chromium/ppapi/shared_impl/resource_tracker.h index ee93376b4ca..6feeea7692b 100644 --- a/chromium/ppapi/shared_impl/resource_tracker.h +++ b/chromium/ppapi/shared_impl/resource_tracker.h @@ -126,14 +126,14 @@ class PPAPI_SHARED_EXPORT ResourceTracker { int32 last_resource_value_; - base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_; - // 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_; + base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(ResourceTracker); }; diff --git a/chromium/ppapi/shared_impl/resource_var.cc b/chromium/ppapi/shared_impl/resource_var.cc index 3e34c381f70..1260843a28a 100644 --- a/chromium/ppapi/shared_impl/resource_var.cc +++ b/chromium/ppapi/shared_impl/resource_var.cc @@ -9,6 +9,14 @@ namespace ppapi { +int ResourceVar::GetPendingRendererHostId() const { + return 0; +} + +int ResourceVar::GetPendingBrowserHostId() const { + return 0; +} + const IPC::Message* ResourceVar::GetCreationMessage() const { return NULL; } diff --git a/chromium/ppapi/shared_impl/resource_var.h b/chromium/ppapi/shared_impl/resource_var.h index 0b8bab2354c..96d2403c30c 100644 --- a/chromium/ppapi/shared_impl/resource_var.h +++ b/chromium/ppapi/shared_impl/resource_var.h @@ -25,6 +25,12 @@ class PPAPI_SHARED_EXPORT ResourceVar : public Var { // plugin side. It should be AddRef'd if the resource is passed to the user. virtual PP_Resource GetPPResource() const = 0; + // Gets the pending resource host ID in the renderer. + virtual int GetPendingRendererHostId() const; + + // Gets the pending resource host ID in the browser. + virtual int GetPendingBrowserHostId() const; + // Gets the message for creating a plugin-side resource. Returns NULL if the // message is empty (which is always true on the plugin side). virtual const IPC::Message* GetCreationMessage() const; diff --git a/chromium/ppapi/shared_impl/singleton_resource_id.h b/chromium/ppapi/shared_impl/singleton_resource_id.h index 2d89de6807f..90b0e6f61fb 100644 --- a/chromium/ppapi/shared_impl/singleton_resource_id.h +++ b/chromium/ppapi/shared_impl/singleton_resource_id.h @@ -15,13 +15,13 @@ enum SingletonResourceID { // resource model. BROKER_SINGLETON_ID, BROWSER_FONT_SINGLETON_ID, - CRX_FILESYSTEM_SINGLETON_ID, EXTENSIONS_COMMON_SINGLETON_ID, FLASH_CLIPBOARD_SINGLETON_ID, FLASH_FILE_SINGLETON_ID, FLASH_FULLSCREEN_SINGLETON_ID, FLASH_SINGLETON_ID, GAMEPAD_SINGLETON_ID, + ISOLATED_FILESYSTEM_SINGLETON_ID, NETWORK_PROXY_SINGLETON_ID, PDF_SINGLETON_ID, TRUETYPE_FONT_SINGLETON_ID, diff --git a/chromium/ppapi/shared_impl/test_globals.cc b/chromium/ppapi/shared_impl/test_globals.cc index f4d58cfd8d0..2739e26373d 100644 --- a/chromium/ppapi/shared_impl/test_globals.cc +++ b/chromium/ppapi/shared_impl/test_globals.cc @@ -71,7 +71,7 @@ MessageLoopShared* TestGlobals::GetCurrentMessageLoop() { return NULL; } -base::TaskRunner* TestGlobals::GetFileTaskRunner(PP_Instance instance) { +base::TaskRunner* TestGlobals::GetFileTaskRunner() { return NULL; } diff --git a/chromium/ppapi/shared_impl/test_globals.h b/chromium/ppapi/shared_impl/test_globals.h index 2a0ece302a1..2b4b5cbcbf3 100644 --- a/chromium/ppapi/shared_impl/test_globals.h +++ b/chromium/ppapi/shared_impl/test_globals.h @@ -18,6 +18,13 @@ class TestVarTracker : public VarTracker { public: TestVarTracker() : VarTracker(THREAD_SAFE) {} virtual ~TestVarTracker() {} + virtual PP_Var MakeResourcePPVarFromMessage( + PP_Instance instance, + const IPC::Message& creation_message, + int pending_renderer_id, + int pending_browser_id) OVERRIDE { + return PP_MakeNull(); + } virtual ResourceVar* MakeResourceVar(PP_Resource pp_resource) OVERRIDE { return NULL; } @@ -73,7 +80,7 @@ class TestGlobals : public PpapiGlobals { const std::string& source, const std::string& value) OVERRIDE; virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; - virtual base::TaskRunner* GetFileTaskRunner(PP_Instance instance) OVERRIDE; + virtual base::TaskRunner* GetFileTaskRunner() OVERRIDE; // PpapiGlobals overrides: virtual bool IsHostGlobals() const OVERRIDE; diff --git a/chromium/ppapi/shared_impl/tracked_callback.h b/chromium/ppapi/shared_impl/tracked_callback.h index 92af19bed35..c8b6c013628 100644 --- a/chromium/ppapi/shared_impl/tracked_callback.h +++ b/chromium/ppapi/shared_impl/tracked_callback.h @@ -113,6 +113,10 @@ class PPAPI_SHARED_EXPORT TrackedCallback return !callback_.func; } + MessageLoopShared* target_loop() const { + return target_loop_.get(); + } + // Determines if the given callback is pending. A callback is pending if it // has not completed and has not been aborted. When receiving a plugin call, // use this to detect if |callback| represents an operation in progress. When diff --git a/chromium/ppapi/shared_impl/var.cc b/chromium/ppapi/shared_impl/var.cc index d128d90241a..56def197c67 100644 --- a/chromium/ppapi/shared_impl/var.cc +++ b/chromium/ppapi/shared_impl/var.cc @@ -19,12 +19,6 @@ namespace ppapi { // Var ------------------------------------------------------------------------- -Var::Var() : var_id_(0) { -} - -Var::~Var() { -} - // static std::string Var::PPVarToLogString(PP_Var var) { switch (var.type) { @@ -126,6 +120,12 @@ int32 Var::GetExistingVarID() const { return var_id_; } +Var::Var() : var_id_(0) { +} + +Var::~Var() { +} + int32 Var::GetOrCreateVarID() { VarTracker* tracker = PpapiGlobals::Get()->GetVarTracker(); if (var_id_) { diff --git a/chromium/ppapi/shared_impl/var.h b/chromium/ppapi/shared_impl/var.h index d656019c74e..a52dc3accc3 100644 --- a/chromium/ppapi/shared_impl/var.h +++ b/chromium/ppapi/shared_impl/var.h @@ -31,8 +31,6 @@ class VarTracker; // Represents a non-POD var. class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> { public: - virtual ~Var(); - // Returns a string representing the given var for logging purposes. static std::string PPVarToLogString(PP_Var var); @@ -60,9 +58,11 @@ class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> { int32 GetExistingVarID() const; protected: + friend class base::RefCounted<Var>; friend class VarTracker; Var(); + virtual ~Var(); // Returns the unique ID associated with this string or object, creating it // if necessary. The return value will be 0 if the string or object is diff --git a/chromium/ppapi/shared_impl/var_tracker.h b/chromium/ppapi/shared_impl/var_tracker.h index 379f645bbf8..a63c74372bd 100644 --- a/chromium/ppapi/shared_impl/var_tracker.h +++ b/chromium/ppapi/shared_impl/var_tracker.h @@ -21,6 +21,10 @@ #include "ppapi/shared_impl/ppapi_shared_export.h" #include "ppapi/shared_impl/var.h" +namespace IPC { +class Message; +} // namespace IPC + namespace ppapi { class ArrayBufferVar; @@ -85,17 +89,33 @@ class PPAPI_SHARED_EXPORT VarTracker { // usually immediately put this in a scoped_refptr). ArrayBufferVar* MakeArrayBufferVar(uint32 size_in_bytes, const void* data); + // Creates a new resource var from a resource creation message. Returns a + // PP_Var that references a new PP_Resource, both with an initial reference + // count of 1. On the host side, |creation_message| is ignored, and an empty + // resource var is always returned. + virtual PP_Var MakeResourcePPVarFromMessage( + PP_Instance instance, + const IPC::Message& creation_message, + int pending_renderer_id, + int pending_browser_id) = 0; + // Creates a new resource var that points to a given resource ID. Returns a // PP_Var that references it and has an initial reference count of 1. + // If |pp_resource| is 0, returns a valid, empty resource var. On the plugin + // side (where it is possible to tell which resources exist), if |pp_resource| + // does not exist, returns a null var. PP_Var MakeResourcePPVar(PP_Resource pp_resource); // Creates a new resource var that points to a given resource ID. This is // implemented by the host and plugin tracker separately, because the plugin // keeps a reference to the resource, and the host does not. + // If |pp_resource| is 0, returns a valid, empty resource var. On the plugin + // side (where it is possible to tell which resources exist), if |pp_resource| + // does not exist, returns NULL. virtual ResourceVar* MakeResourceVar(PP_Resource pp_resource) = 0; - // Return a vector containing all PP_Vars that are in the tracker. This is - // to help implement PPB_Testing_Dev.GetLiveVars and should generally not be + // Return a vector containing all PP_Vars that are in the tracker. This is to + // help implement PPB_Testing_Private.GetLiveVars and should generally not be // used in production code. The PP_Vars are returned in no particular order, // and their reference counts are unaffected. std::vector<PP_Var> GetLiveVars(); diff --git a/chromium/ppapi/tests/extensions/extensions.gyp b/chromium/ppapi/tests/extensions/extensions.gyp new file mode 100644 index 00000000000..d063b83f47e --- /dev/null +++ b/chromium/ppapi/tests/extensions/extensions.gyp @@ -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. + +{ + 'includes': [ + '../../../ppapi/ppapi_nacl_test_common.gypi', + ], + 'targets': [ + { + 'target_name': 'ppapi_tests_extensions_socket', + 'type': 'none', + 'variables': { + 'nexe_target': 'ppapi_tests_extensions_socket', + 'build_newlib': 1, + 'build_glibc': 0, + 'build_pnacl_newlib': 0, + 'nexe_destination_dir': 'test_data/ppapi/tests/extensions/socket', + 'sources': [ + 'socket/test_socket.cc', + '<(DEPTH)/ppapi/tests/test_utils.cc', + '<(DEPTH)/ppapi/tests/test_utils.h', + ], + 'test_files': [ + 'socket/controller.js', + 'socket/index.html', + 'socket/main.js', + 'socket/manifest.json', + ], + }, + }, + ], +} diff --git a/chromium/ppapi/thunk/interfaces_ppb_private.h b/chromium/ppapi/thunk/interfaces_ppb_private.h index 038d5c521c0..11d5e526709 100644 --- a/chromium/ppapi/thunk/interfaces_ppb_private.h +++ b/chromium/ppapi/thunk/interfaces_ppb_private.h @@ -25,8 +25,8 @@ PROXIED_IFACE(PPB_Broker, PPB_BROKER_TRUSTED_INTERFACE_0_3, PROXIED_IFACE(PPB_Instance, PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0, PPB_BrowserFont_Trusted_1_0) PROXIED_IFACE(PPB_Instance, - PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7, - PPB_ContentDecryptor_Private_0_7) + PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_9, + PPB_ContentDecryptor_Private_0_9) PROXIED_IFACE(PPB_Instance, PPB_CHARSET_TRUSTED_INTERFACE_1_0, PPB_CharSet_Trusted_1_0) PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_TRUSTED_INTERFACE_0_5, @@ -45,19 +45,20 @@ PROXIED_IFACE(PPB_Instance, PPB_FLASHFULLSCREEN_INTERFACE_1_0, PROXIED_IFACE(NoAPIName, PPB_PDF_INTERFACE, PPB_PDF) #if defined(OS_CHROMEOS) -PROXIED_IFACE(NoAPIName, PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_1, - PPB_PlatformVerification_Private_0_1) +PROXIED_IFACE(NoAPIName, PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2, + PPB_PlatformVerification_Private_0_2) #endif PROXIED_IFACE(NoAPIName, PPB_TALK_PRIVATE_INTERFACE_1_0, PPB_Talk_Private_1_0) PROXIED_IFACE(NoAPIName, PPB_TALK_PRIVATE_INTERFACE_2_0, PPB_Talk_Private_2_0) -// 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_URLLOADERTRUSTED_INTERFACE_0_3, PPB_URLLoaderTrusted_0_3) +PROXIED_IFACE(NoAPIName, PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1, + PPB_OutputProtection_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/chromium/ppapi/thunk/interfaces_ppb_private_no_permissions.h b/chromium/ppapi/thunk/interfaces_ppb_private_no_permissions.h index 15e8043eefa..3b4446f9fbe 100644 --- a/chromium/ppapi/thunk/interfaces_ppb_private_no_permissions.h +++ b/chromium/ppapi/thunk/interfaces_ppb_private_no_permissions.h @@ -40,6 +40,8 @@ PROXIED_IFACE(NoAPIName, PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1, PPB_Ext_CrxFileSystem_Private_0_1) PROXIED_IFACE(NoAPIName, PPB_FILEIO_PRIVATE_INTERFACE_0_1, PPB_FileIO_Private_0_1) +PROXIED_IFACE(NoAPIName, PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2, + PPB_IsolatedFileSystem_Private_0_2) PROXIED_IFACE(NoAPIName, PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1, PPB_VideoDestination_Private_0_1) diff --git a/chromium/ppapi/thunk/interfaces_ppb_public_dev.h b/chromium/ppapi/thunk/interfaces_ppb_public_dev.h index 1ba0435313d..2c894e409da 100644 --- a/chromium/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/chromium/ppapi/thunk/interfaces_ppb_public_dev.h @@ -10,10 +10,9 @@ // Map the old dev console interface to the stable one (which is the same) to // keep Flash, etc. working. PROXIED_IFACE(PPB_Instance, "PPB_Console(Dev);0.1", PPB_Console_1_0) +PROXIED_IFACE(NoAPIName, PPB_ALARMS_DEV_INTERFACE_0_1, PPB_Alarms_Dev_0_1) 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_EXT_SOCKET_DEV_INTERFACE_0_2, @@ -36,6 +35,8 @@ PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_2, PPB_TextInput_Dev_0_2) PROXIED_IFACE(NoAPIName, PPB_TRUETYPEFONT_DEV_INTERFACE_0_1, PPB_TrueTypeFont_Dev_0_1) +PROXIED_IFACE(NoAPIName, PPB_VAR_RESOURCE_DEV_INTERFACE_0_1, + PPB_VarResource_Dev_0_1) PROXIED_IFACE(NoAPIName, PPB_VIEW_DEV_INTERFACE_0_1, PPB_View_Dev_0_1) UNPROXIED_IFACE(PPB_Instance, PPB_ZOOM_DEV_INTERFACE_0_2, PPB_Zoom_Dev_0_2) @@ -66,6 +67,8 @@ 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_GRAPHICS2D_DEV_INTERFACE_0_1, PPB_Graphics2D_Dev_0_1) +PROXIED_IFACE(NoAPIName, PPB_GRAPHICS2D_DEV_INTERFACE_0_2, + PPB_Graphics2D_Dev_0_2) 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_URLUTIL_DEV_INTERFACE_0_7, PPB_URLUtil_Dev_0_7) diff --git a/chromium/ppapi/thunk/ppb_alarms_dev_thunk.cc b/chromium/ppapi/thunk/ppb_alarms_dev_thunk.cc new file mode 100644 index 00000000000..2d2ae14b89f --- /dev/null +++ b/chromium/ppapi/thunk/ppb_alarms_dev_thunk.cc @@ -0,0 +1,82 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/logging.h" +#include "ppapi/c/dev/ppb_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 { + +// TODO(yzshen): crbug.com/327197 Implement the thunk. + +void Create(PP_Instance instance, + PP_Var name, + const PP_Alarms_AlarmCreateInfo_Dev* alarm_info) { + NOTIMPLEMENTED(); +} + +int32_t Get(PP_Instance instance, + PP_Var name, + PP_Alarms_Alarm_Dev* alarm, + PP_CompletionCallback callback) { + EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback); + if (enter.failed()) + return enter.retval(); + + NOTIMPLEMENTED(); + + return enter.SetResult(PP_ERROR_FAILED); +} + +int32_t GetAll(PP_Instance instance, + PP_Alarms_Alarm_Array_Dev* alarms, + PP_ArrayOutput array_allocator, + PP_CompletionCallback callback) { + EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback); + if (enter.failed()) + return enter.retval(); + + NOTIMPLEMENTED(); + + return enter.SetResult(PP_ERROR_FAILED); +} + +void Clear(PP_Instance instance, PP_Var name) { + NOTIMPLEMENTED(); +} + +void ClearAll(PP_Instance instance) { + NOTIMPLEMENTED(); +} + +uint32_t AddOnAlarmListener(PP_Instance instance, + PP_Alarms_OnAlarm_Dev callback, + void* user_data) { + NOTIMPLEMENTED(); + return 0; +} + +const PPB_Alarms_Dev_0_1 g_ppb_alarms_dev_0_1_thunk = { + &Create, + &Get, + &GetAll, + &Clear, + &ClearAll, + &AddOnAlarmListener +}; + +} // namespace + +const PPB_Alarms_Dev_0_1* GetPPB_Alarms_Dev_0_1_Thunk() { + return &g_ppb_alarms_dev_0_1_thunk; +} + +} // namespace thunk +} // namespace ppapi diff --git a/chromium/ppapi/thunk/ppb_content_decryptor_private_thunk.cc b/chromium/ppapi/thunk/ppb_content_decryptor_private_thunk.cc index 7fe79e12848..e434f4f7226 100644 --- a/chromium/ppapi/thunk/ppb_content_decryptor_private_thunk.cc +++ b/chromium/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 Tue Sep 17 11:31:05 2013. +// modified Fri Dec 6 12:16:22 2013. #include "ppapi/c/pp_errors.h" #include "ppapi/c/private/ppb_content_decryptor_private.h" @@ -18,46 +18,58 @@ namespace thunk { namespace { -void KeyAdded(PP_Instance instance, - struct PP_Var key_system, - struct PP_Var session_id) { - VLOG(4) << "PPB_ContentDecryptor_Private::KeyAdded()"; +void SessionCreated(PP_Instance instance, + uint32_t session_id, + struct PP_Var web_session_id) { + VLOG(4) << "PPB_ContentDecryptor_Private::SessionCreated()"; EnterInstance enter(instance); if (enter.failed()) return; - enter.functions()->KeyAdded(instance, key_system, session_id); + enter.functions()->SessionCreated(instance, session_id, web_session_id); } -void KeyMessage(PP_Instance instance, - struct PP_Var key_system, - struct PP_Var session_id, - struct PP_Var message, - struct PP_Var default_url) { - VLOG(4) << "PPB_ContentDecryptor_Private::KeyMessage()"; +void SessionMessage(PP_Instance instance, + uint32_t session_id, + struct PP_Var message, + struct PP_Var destination_url) { + VLOG(4) << "PPB_ContentDecryptor_Private::SessionMessage()"; EnterInstance enter(instance); if (enter.failed()) return; - enter.functions()->KeyMessage(instance, - key_system, - session_id, - message, - default_url); + enter.functions()->SessionMessage(instance, + session_id, + message, + destination_url); } -void KeyError(PP_Instance instance, - struct PP_Var key_system, - struct PP_Var session_id, - int32_t media_error, - int32_t system_code) { - VLOG(4) << "PPB_ContentDecryptor_Private::KeyError()"; +void SessionReady(PP_Instance instance, uint32_t session_id) { + VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()"; EnterInstance enter(instance); if (enter.failed()) return; - enter.functions()->KeyError(instance, - key_system, - session_id, - media_error, - system_code); + enter.functions()->SessionReady(instance, session_id); +} + +void SessionClosed(PP_Instance instance, uint32_t session_id) { + VLOG(4) << "PPB_ContentDecryptor_Private::SessionClosed()"; + EnterInstance enter(instance); + if (enter.failed()) + return; + enter.functions()->SessionClosed(instance, session_id); +} + +void SessionError(PP_Instance instance, + uint32_t session_id, + int32_t media_error, + int32_t system_code) { + VLOG(4) << "PPB_ContentDecryptor_Private::SessionError()"; + EnterInstance enter(instance); + if (enter.failed()) + return; + enter.functions()->SessionError(instance, + session_id, + media_error, + system_code); } void DeliverBlock(PP_Instance instance, @@ -123,21 +135,23 @@ void DeliverFrame(PP_Instance instance, void DeliverSamples( PP_Instance instance, PP_Resource audio_frames, - const struct PP_DecryptedBlockInfo* decrypted_block_info) { + const struct PP_DecryptedSampleInfo* decrypted_sample_info) { VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()"; EnterInstance enter(instance); if (enter.failed()) return; enter.functions()->DeliverSamples(instance, audio_frames, - decrypted_block_info); + decrypted_sample_info); } -const PPB_ContentDecryptor_Private_0_7 - g_ppb_contentdecryptor_private_thunk_0_7 = { - &KeyAdded, - &KeyMessage, - &KeyError, +const PPB_ContentDecryptor_Private_0_9 + g_ppb_contentdecryptor_private_thunk_0_9 = { + &SessionCreated, + &SessionMessage, + &SessionReady, + &SessionClosed, + &SessionError, &DeliverBlock, &DecoderInitializeDone, &DecoderDeinitializeDone, @@ -148,9 +162,9 @@ const PPB_ContentDecryptor_Private_0_7 } // namespace -const PPB_ContentDecryptor_Private_0_7* - GetPPB_ContentDecryptor_Private_0_7_Thunk() { - return &g_ppb_contentdecryptor_private_thunk_0_7; +const PPB_ContentDecryptor_Private_0_9* + GetPPB_ContentDecryptor_Private_0_9_Thunk() { + return &g_ppb_contentdecryptor_private_thunk_0_9; } } // namespace thunk diff --git a/chromium/ppapi/thunk/ppb_ext_alarms_thunk.cc b/chromium/ppapi/thunk/ppb_ext_alarms_thunk.cc deleted file mode 100644 index 2fc88d08f5b..00000000000 --- a/chromium/ppapi/thunk/ppb_ext_alarms_thunk.cc +++ /dev/null @@ -1,95 +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 <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()->PostRenderer("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()->CallRenderer( - "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()->CallRenderer( - "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()->PostRenderer("alarms.clear", args); -} - -void ClearAll(PP_Instance instance) { - EnterInstanceAPI<ExtensionsCommon_API> enter(instance); - if (enter.failed()) - return; - - std::vector<PP_Var> args; - enter.functions()->PostRenderer("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/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc b/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc index 7e18ba941de..67f0ec86865 100644 --- a/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc +++ b/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc @@ -2,16 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From private/ppb_ext_crx_file_system_private.idl, -// modified Fri May 3 09:24:58 2013. - #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/private/ppb_ext_crx_file_system_private.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppb_ext_crx_file_system_private_api.h" #include "ppapi/thunk/ppb_instance_api.h" +#include "ppapi/thunk/ppb_isolated_file_system_private_api.h" #include "ppapi/thunk/resource_creation_api.h" #include "ppapi/thunk/thunk.h" @@ -24,12 +21,15 @@ int32_t Open(PP_Instance instance, PP_Resource* file_system, struct PP_CompletionCallback callback) { VLOG(4) << "PPB_Ext_CrxFileSystem_Private::Open()"; - EnterInstanceAPI<PPB_Ext_CrxFileSystem_Private_API> enter(instance, callback); + EnterInstanceAPI<PPB_IsolatedFileSystem_Private_API> enter(instance, + callback); if (enter.failed()) return enter.retval(); - return enter.SetResult(enter.functions()->Open(instance, - file_system, - enter.callback())); + return enter.SetResult(enter.functions()->Open( + instance, + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX, + file_system, + enter.callback())); } const PPB_Ext_CrxFileSystem_Private_0_1 diff --git a/chromium/ppapi/thunk/ppb_file_io_api.h b/chromium/ppapi/thunk/ppb_file_io_api.h index ec7f16d1140..b794f1ca80b 100644 --- a/chromium/ppapi/thunk/ppb_file_io_api.h +++ b/chromium/ppapi/thunk/ppb_file_io_api.h @@ -45,14 +45,6 @@ class PPAPI_THUNK_EXPORT PPB_FileIO_API { virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0; virtual void Close() = 0; - // Trusted API. - virtual int32_t GetOSFileDescriptor() = 0; - virtual int32_t WillWrite(int64_t offset, - int32_t bytes_to_write, - 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, diff --git a/chromium/ppapi/thunk/ppb_file_io_trusted_thunk.cc b/chromium/ppapi/thunk/ppb_file_io_trusted_thunk.cc deleted file mode 100644 index 3336026e8e4..00000000000 --- a/chromium/ppapi/thunk/ppb_file_io_trusted_thunk.cc +++ /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. - -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/trusted/ppb_file_io_trusted.h" -#include "ppapi/shared_impl/tracked_callback.h" -#include "ppapi/thunk/enter.h" -#include "ppapi/thunk/thunk.h" -#include "ppapi/thunk/ppb_file_io_api.h" -#include "ppapi/thunk/resource_creation_api.h" - -namespace ppapi { -namespace thunk { - -namespace { - -typedef EnterResource<PPB_FileIO_API> EnterFileIO; - -int32_t GetOSFileDescriptor(PP_Resource file_io) { - EnterFileIO enter(file_io, true); - if (enter.failed()) - return enter.retval(); - return enter.object()->GetOSFileDescriptor(); -} - -int32_t WillWrite(PP_Resource file_io, - int64_t offset, - int32_t bytes_to_write, - PP_CompletionCallback callback) { - EnterFileIO enter(file_io, callback, true); - if (enter.failed()) - return enter.retval(); - return enter.SetResult(enter.object()->WillWrite(offset, bytes_to_write, - enter.callback())); -} - -int32_t WillSetLength(PP_Resource file_io, - int64_t length, - PP_CompletionCallback callback) { - EnterFileIO enter(file_io, callback, true); - if (enter.failed()) - return enter.retval(); - return enter.SetResult(enter.object()->WillSetLength(length, - enter.callback())); -} - -const PPB_FileIOTrusted g_ppb_file_io_trusted_thunk = { - &GetOSFileDescriptor, - &WillWrite, - &WillSetLength -}; - -} // namespace - -const PPB_FileIOTrusted_0_4* GetPPB_FileIOTrusted_0_4_Thunk() { - return &g_ppb_file_io_trusted_thunk; -} - -} // namespace thunk -} // namespace ppapi diff --git a/chromium/ppapi/thunk/ppb_flash_drm_api.h b/chromium/ppapi/thunk/ppb_flash_drm_api.h index 87712b916b6..9937bef45e6 100644 --- a/chromium/ppapi/thunk/ppb_flash_drm_api.h +++ b/chromium/ppapi/thunk/ppb_flash_drm_api.h @@ -20,6 +20,9 @@ class PPAPI_THUNK_EXPORT PPB_Flash_DRM_API { virtual PP_Bool GetHmonitor(int64_t* hmonitor) = 0; virtual int32_t GetVoucherFile(PP_Resource* file_ref, scoped_refptr<TrackedCallback> callback) = 0; + virtual int32_t MonitorIsExternal( + PP_Bool* is_external, + scoped_refptr<TrackedCallback> callback) = 0; }; } // namespace thunk diff --git a/chromium/ppapi/thunk/ppb_flash_drm_thunk.cc b/chromium/ppapi/thunk/ppb_flash_drm_thunk.cc index eff2fdf74d8..a7a3cbaa3ce 100644 --- a/chromium/ppapi/thunk/ppb_flash_drm_thunk.cc +++ b/chromium/ppapi/thunk/ppb_flash_drm_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_flash_drm.idl modified Sat Jun 8 16:45:26 2013. +// From private/ppb_flash_drm.idl modified Mon Nov 11 14:49:53 2013. #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" @@ -56,6 +56,17 @@ int32_t GetVoucherFile(PP_Resource drm, enter.callback())); } +int32_t MonitorIsExternal(PP_Resource drm, + PP_Bool* is_external, + struct PP_CompletionCallback callback) { + VLOG(4) << "PPB_Flash_DRM::MonitorIsExternal()"; + EnterResource<PPB_Flash_DRM_API> enter(drm, callback, true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->MonitorIsExternal(is_external, + enter.callback())); +} + const PPB_Flash_DRM_1_0 g_ppb_flash_drm_thunk_1_0 = { &Create, &GetDeviceID, @@ -63,11 +74,23 @@ const PPB_Flash_DRM_1_0 g_ppb_flash_drm_thunk_1_0 = { &GetVoucherFile }; +const PPB_Flash_DRM_1_1 g_ppb_flash_drm_thunk_1_1 = { + &Create, + &GetDeviceID, + &GetHmonitor, + &GetVoucherFile, + &MonitorIsExternal +}; + } // namespace const PPB_Flash_DRM_1_0* GetPPB_Flash_DRM_1_0_Thunk() { return &g_ppb_flash_drm_thunk_1_0; } +const PPB_Flash_DRM_1_1* GetPPB_Flash_DRM_1_1_Thunk() { + return &g_ppb_flash_drm_thunk_1_1; +} + } // namespace thunk } // namespace ppapi diff --git a/chromium/ppapi/thunk/ppb_graphics_2d_api.h b/chromium/ppapi/thunk/ppb_graphics_2d_api.h index 4e1bda398b8..0709a50ba91 100644 --- a/chromium/ppapi/thunk/ppb_graphics_2d_api.h +++ b/chromium/ppapi/thunk/ppb_graphics_2d_api.h @@ -6,6 +6,7 @@ #define PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_ #include "base/memory/ref_counted.h" +#include "ppapi/c/dev/ppb_graphics_2d_dev.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_point.h" @@ -36,6 +37,8 @@ class PPAPI_THUNK_EXPORT PPB_Graphics2D_API { // Dev interface. virtual PP_Bool SetScale(float scale) = 0; virtual float GetScale() = 0; + virtual void SetOffset(const PP_Point* offset) = 0; + virtual void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) = 0; // Test only virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0; diff --git a/chromium/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc b/chromium/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc index 760ecee2a4d..288215555bb 100644 --- a/chromium/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc +++ b/chromium/ppapi/thunk/ppb_graphics_2d_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_graphics_2d_dev.idl modified Fri Apr 26 08:52:02 2013. +// From dev/ppb_graphics_2d_dev.idl modified Fri Nov 8 13:58:50 2013. #include "ppapi/c/dev/ppb_graphics_2d_dev.h" #include "ppapi/c/pp_errors.h" @@ -34,9 +34,34 @@ float GetScale(PP_Resource resource) { return enter.object()->GetScale(); } +void SetOffset(PP_Resource resource, const struct PP_Point* offset) { + VLOG(4) << "PPB_Graphics2D_Dev::SetOffset()"; + EnterResource<PPB_Graphics2D_API> enter(resource, true); + if (enter.failed()) + return; + enter.object()->SetOffset(offset); +} + +void SetResizeMode(PP_Resource resource, + PP_Graphics2D_Dev_ResizeMode resize_mode) { + VLOG(4) << "PPB_Graphics2D_Dev::SetResizeMode()"; + EnterResource<PPB_Graphics2D_API> enter(resource, true); + if (enter.failed()) + return; + enter.object()->SetResizeMode(resize_mode); +} + const PPB_Graphics2D_Dev_0_1 g_ppb_graphics2d_dev_thunk_0_1 = { &SetScale, - &GetScale + &GetScale, + &SetResizeMode +}; + +const PPB_Graphics2D_Dev_0_2 g_ppb_graphics2d_dev_thunk_0_2 = { + &SetScale, + &GetScale, + &SetOffset, + &SetResizeMode }; } // namespace @@ -45,5 +70,9 @@ const PPB_Graphics2D_Dev_0_1* GetPPB_Graphics2D_Dev_0_1_Thunk() { return &g_ppb_graphics2d_dev_thunk_0_1; } +const PPB_Graphics2D_Dev_0_2* GetPPB_Graphics2D_Dev_0_2_Thunk() { + return &g_ppb_graphics2d_dev_thunk_0_2; +} + } // namespace thunk } // namespace ppapi diff --git a/chromium/ppapi/thunk/ppb_instance_api.h b/chromium/ppapi/thunk/ppb_instance_api.h index 0d424a5ed53..bac3f97292a 100644 --- a/chromium/ppapi/thunk/ppb_instance_api.h +++ b/chromium/ppapi/thunk/ppb_instance_api.h @@ -142,19 +142,19 @@ class PPB_Instance_API { PP_URLComponents_Dev* components) = 0; #if !defined(OS_NACL) // Content Decryptor. - virtual void KeyAdded(PP_Instance instance, - PP_Var key_system, - PP_Var session_id) = 0; - virtual void KeyMessage(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - PP_Var message, - PP_Var default_url) = 0; - virtual void KeyError(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - int32_t media_error, - int32_t system_error) = 0; + virtual void SessionCreated(PP_Instance instance, + uint32 session_id, + PP_Var web_session_id) = 0; + virtual void SessionMessage(PP_Instance instance, + uint32 session_id, + PP_Var message, + PP_Var destination_url) = 0; + virtual void SessionReady(PP_Instance instance, uint32 session_id) = 0; + virtual void SessionClosed(PP_Instance instance, uint32 session_id) = 0; + virtual void SessionError(PP_Instance instance, + uint32 session_id, + int32_t media_error, + int32_t system_error) = 0; virtual void DeliverBlock(PP_Instance instance, PP_Resource decrypted_block, const PP_DecryptedBlockInfo* block_info) = 0; @@ -173,7 +173,7 @@ class PPB_Instance_API { const PP_DecryptedFrameInfo* frame_info) = 0; virtual void DeliverSamples(PP_Instance instance, PP_Resource audio_frames, - const PP_DecryptedBlockInfo* block_info) = 0; + const PP_DecryptedSampleInfo* sample_info) = 0; // URLUtil. virtual PP_Var ResolveRelativeToDocument( diff --git a/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_api.h b/chromium/ppapi/thunk/ppb_isolated_file_system_private_api.h index 9af926d3b12..bca233279fe 100644 --- a/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_api.h +++ b/chromium/ppapi/thunk/ppb_isolated_file_system_private_api.h @@ -1,11 +1,12 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef PPAPI_THUNK_PPB_EXT_CRX_FILE_SYSTEM_API_H_ -#define PPAPI_THUNK_PPB_EXT_CRX_FILE_SYSTEM_API_H_ +#ifndef PPAPI_THUNK_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_API_H_ +#define PPAPI_THUNK_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_API_H_ #include "base/memory/ref_counted.h" +#include "ppapi/c/private/ppb_isolated_file_system_private.h" #include "ppapi/shared_impl/singleton_resource_id.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/ppapi_thunk_export.h" @@ -16,19 +17,20 @@ class TrackedCallback; namespace thunk { -class PPAPI_THUNK_EXPORT PPB_Ext_CrxFileSystem_Private_API { +class PPAPI_THUNK_EXPORT PPB_IsolatedFileSystem_Private_API { public: - virtual ~PPB_Ext_CrxFileSystem_Private_API() {} + virtual ~PPB_IsolatedFileSystem_Private_API() {} virtual int32_t Open(PP_Instance instance, + PP_IsolatedFileSystemType_Private type, PP_Resource* file_system, scoped_refptr<TrackedCallback> callback) = 0; static const SingletonResourceID kSingletonResourceID = - CRX_FILESYSTEM_SINGLETON_ID; + ISOLATED_FILESYSTEM_SINGLETON_ID; }; } // namespace thunk } // namespace ppapi -#endif // PPAPI_THUNK_PPB_EXT_CRX_FILE_SYSTEM_API_H_ +#endif // PPAPI_THUNK_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_API_H_ diff --git a/chromium/ppapi/thunk/ppb_isolated_file_system_private_thunk.cc b/chromium/ppapi/thunk/ppb_isolated_file_system_private_thunk.cc new file mode 100644 index 00000000000..cd58b24527e --- /dev/null +++ b/chromium/ppapi/thunk/ppb_isolated_file_system_private_thunk.cc @@ -0,0 +1,51 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// From private/ppb_isolated_file_system_private.idl, +// modified Fri Nov 8 02:21:15 2013. + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/private/ppb_isolated_file_system_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_isolated_file_system_private_api.h" +#include "ppapi/thunk/resource_creation_api.h" +#include "ppapi/thunk/thunk.h" + +namespace ppapi { +namespace thunk { + +namespace { + +int32_t Open(PP_Instance instance, + PP_IsolatedFileSystemType_Private type, + PP_Resource* file_system, + struct PP_CompletionCallback callback) { + VLOG(4) << "PPB_IsolatedFileSystem_Private::Open()"; + EnterInstanceAPI<PPB_IsolatedFileSystem_Private_API> enter(instance, + callback); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.functions()->Open(instance, + type, + file_system, + enter.callback())); +} + +const PPB_IsolatedFileSystem_Private_0_2 + g_ppb_isolatedfilesystem_private_thunk_0_2 = { + &Open +}; + +} // namespace + +const PPB_IsolatedFileSystem_Private_0_2* + GetPPB_IsolatedFileSystem_Private_0_2_Thunk() { + return &g_ppb_isolatedfilesystem_private_thunk_0_2; +} + +} // namespace thunk +} // namespace ppapi diff --git a/chromium/ppapi/thunk/ppb_output_protection_api.h b/chromium/ppapi/thunk/ppb_output_protection_api.h new file mode 100644 index 00000000000..8a12090ae5d --- /dev/null +++ b/chromium/ppapi/thunk/ppb_output_protection_api.h @@ -0,0 +1,32 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_THUNK_OUTPUT_PROTECTION_API_H_ +#define PPAPI_THUNK_OUTPUT_PROTECTION_API_H_ + +#include "ppapi/c/private/ppb_output_protection_private.h" + +namespace ppapi { + +class TrackedCallback; + +namespace thunk { + +class PPB_OutputProtection_API { + public: + virtual ~PPB_OutputProtection_API() {} + + virtual int32_t QueryStatus( + uint32_t* link_mask, + uint32_t* protection_mask, + const scoped_refptr<TrackedCallback>& callback) = 0; + virtual int32_t EnableProtection( + uint32_t desired_method_mask, + const scoped_refptr<TrackedCallback>& callback) = 0; +}; + +} // namespace thunk +} // namespace ppapi + +#endif // PPAPI_THUNK_OUTPUT_PROTECTION_API_H_ diff --git a/chromium/ppapi/thunk/ppb_pdf_api.h b/chromium/ppapi/thunk/ppb_pdf_api.h index c5d276a4bfe..a23c527189e 100644 --- a/chromium/ppapi/thunk/ppb_pdf_api.h +++ b/chromium/ppapi/thunk/ppb_pdf_api.h @@ -31,6 +31,7 @@ class PPB_PDF_API { virtual void Print() = 0; virtual PP_Resource GetResourceImageForScale(PP_ResourceImage image_id, float scale) = 0; + virtual PP_Bool IsOutOfProcess() = 0; static const SingletonResourceID kSingletonResourceID = PDF_SINGLETON_ID; }; diff --git a/chromium/ppapi/thunk/ppb_pdf_thunk.cc b/chromium/ppapi/thunk/ppb_pdf_thunk.cc index 94334d143a9..282f8934850 100644 --- a/chromium/ppapi/thunk/ppb_pdf_thunk.cc +++ b/chromium/ppapi/thunk/ppb_pdf_thunk.cc @@ -133,6 +133,20 @@ PP_Resource GetResourceImageForScale(PP_Instance instance, return enter.functions()->GetResourceImageForScale(image_id, scale); } +PP_Var ModalPromptForPassword(PP_Instance instance_id, + PP_Var message) { + // TODO(raymes): Implement or remove this function. + NOTIMPLEMENTED(); + return PP_MakeUndefined(); +} + +PP_Bool IsOutOfProcess(PP_Instance instance) { + EnterInstanceAPI<PPB_PDF_API> enter(instance); + if (enter.failed()) + return PP_FALSE; + return enter.functions()->IsOutOfProcess(); +} + const PPB_PDF g_ppb_pdf_thunk = { &GetLocalizedString, &GetResourceImage, @@ -148,7 +162,9 @@ const PPB_PDF g_ppb_pdf_thunk = { &SaveAs, &Print, &IsFeatureEnabled, - &GetResourceImageForScale + &GetResourceImageForScale, + &ModalPromptForPassword, + &IsOutOfProcess, }; } // namespace diff --git a/chromium/ppapi/thunk/ppb_platform_verification_api.h b/chromium/ppapi/thunk/ppb_platform_verification_api.h index fc2872b0cb3..3f7f188ad88 100644 --- a/chromium/ppapi/thunk/ppb_platform_verification_api.h +++ b/chromium/ppapi/thunk/ppb_platform_verification_api.h @@ -18,9 +18,6 @@ class PPAPI_THUNK_EXPORT PPB_PlatformVerification_API { public: virtual ~PPB_PlatformVerification_API() {} - virtual int32_t CanChallengePlatform( - PP_Bool* can_challenge_platform, - const scoped_refptr<TrackedCallback>& callback) = 0; virtual int32_t ChallengePlatform( const PP_Var& service_id, const PP_Var& challenge, diff --git a/chromium/ppapi/thunk/ppb_platform_verification_private_thunk.cc b/chromium/ppapi/thunk/ppb_platform_verification_private_thunk.cc index 74cd360e8da..37d842eeb7d 100644 --- a/chromium/ppapi/thunk/ppb_platform_verification_private_thunk.cc +++ b/chromium/ppapi/thunk/ppb_platform_verification_private_thunk.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. // From private/ppb_platform_verification_private.idl, -// modified Thu Sep 12 11:48:28 2013. +// modified Fri Oct 18 15:02:09 2013. #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" @@ -34,18 +34,6 @@ PP_Bool IsPlatformVerification(PP_Resource resource) { return PP_FromBool(enter.succeeded()); } -int32_t CanChallengePlatform(PP_Resource instance, - PP_Bool* can_challenge_platform, - struct PP_CompletionCallback callback) { - VLOG(4) << "PPB_PlatformVerification_Private::CanChallengePlatform()"; - EnterResource<PPB_PlatformVerification_API> enter(instance, callback, true); - if (enter.failed()) - return enter.retval(); - return enter.SetResult(enter.object()->CanChallengePlatform( - can_challenge_platform, - enter.callback())); -} - int32_t ChallengePlatform(PP_Resource instance, struct PP_Var service_id, struct PP_Var challenge, @@ -66,19 +54,18 @@ int32_t ChallengePlatform(PP_Resource instance, enter.callback())); } -const PPB_PlatformVerification_Private_0_1 - g_ppb_platformverification_private_thunk_0_1 = { +const PPB_PlatformVerification_Private_0_2 + g_ppb_platformverification_private_thunk_0_2 = { &Create, &IsPlatformVerification, - &CanChallengePlatform, &ChallengePlatform }; } // namespace -const PPB_PlatformVerification_Private_0_1* - GetPPB_PlatformVerification_Private_0_1_Thunk() { - return &g_ppb_platformverification_private_thunk_0_1; +const PPB_PlatformVerification_Private_0_2* + GetPPB_PlatformVerification_Private_0_2_Thunk() { + return &g_ppb_platformverification_private_thunk_0_2; } } // namespace thunk diff --git a/chromium/ppapi/thunk/ppb_var_resource_dev_thunk.cc b/chromium/ppapi/thunk/ppb_var_resource_dev_thunk.cc new file mode 100644 index 00000000000..e02ea5d14ec --- /dev/null +++ b/chromium/ppapi/thunk/ppb_var_resource_dev_thunk.cc @@ -0,0 +1,46 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/c/dev/ppb_var_resource_dev.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/shared_impl/ppapi_globals.h" +#include "ppapi/shared_impl/proxy_lock.h" +#include "ppapi/shared_impl/resource_tracker.h" +#include "ppapi/shared_impl/resource_var.h" +#include "ppapi/shared_impl/var_tracker.h" +#include "ppapi/thunk/thunk.h" + +namespace ppapi { +namespace thunk { + +namespace { + +PP_Resource VarToResource(struct PP_Var var) { + ProxyAutoLock lock; + ResourceVar* resource = ResourceVar::FromPPVar(var); + if (!resource) + return 0; + PP_Resource pp_resource = resource->GetPPResource(); + PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(pp_resource); + return pp_resource; +} + +struct PP_Var VarFromResource(PP_Resource resource) { + ProxyAutoLock lock; + return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar(resource); +} + +const PPB_VarResource_Dev_0_1 g_ppb_varresource_dev_0_1_thunk = { + &VarToResource, + &VarFromResource +}; + +} // namespace + +const PPB_VarResource_Dev_0_1* GetPPB_VarResource_Dev_0_1_Thunk() { + return &g_ppb_varresource_dev_0_1_thunk; +} + +} // namespace thunk +} // namespace ppapi diff --git a/chromium/ppapi/thunk/resource_creation_api.h b/chromium/ppapi/thunk/resource_creation_api.h index aa731cfd7ba..61eaa973f02 100644 --- a/chromium/ppapi/thunk/resource_creation_api.h +++ b/chromium/ppapi/thunk/resource_creation_api.h @@ -146,6 +146,7 @@ class ResourceCreationAPI { PP_Instance instance, const PP_NetAddress_Private& private_addr) = 0; virtual PP_Resource CreateNetworkMonitor(PP_Instance instance) = 0; + virtual PP_Resource CreateOutputProtectionPrivate(PP_Instance instance) = 0; virtual PP_Resource CreatePrinting(PP_Instance instance) = 0; virtual PP_Resource CreateTCPServerSocketPrivate(PP_Instance instance) = 0; virtual PP_Resource CreateTCPSocket1_0(PP_Instance instace) = 0; |