summaryrefslogtreecommitdiff
path: root/chromium/ppapi
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-12 14:07:37 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-17 10:29:26 +0000
commitec02ee4181c49b61fce1c8fb99292dbb8139cc90 (patch)
tree25cde714b2b71eb639d1cd53f5a22e9ba76e14ef /chromium/ppapi
parentbb09965444b5bb20b096a291445170876225268d (diff)
downloadqtwebengine-chromium-ec02ee4181c49b61fce1c8fb99292dbb8139cc90.tar.gz
BASELINE: Update Chromium to 59.0.3071.134
Change-Id: Id02ef6fb2204c5fd21668a1c3e6911c83b17585a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/ppapi')
-rw-r--r--chromium/ppapi/BUILD.gn3
-rw-r--r--chromium/ppapi/api/dev/ppb_audio_output_dev.idl229
-rw-r--r--chromium/ppapi/api/dev/ppb_device_ref_dev.idl3
-rw-r--r--chromium/ppapi/c/BUILD.gn28
-rw-r--r--chromium/ppapi/c/dev/ppb_audio_output_dev.h249
-rw-r--r--chromium/ppapi/c/dev/ppb_device_ref_dev.h5
-rw-r--r--chromium/ppapi/c/pp_macros.h4
-rw-r--r--chromium/ppapi/cpp/BUILD.gn2
-rw-r--r--chromium/ppapi/cpp/dev/audio_output_dev.cc98
-rw-r--r--chromium/ppapi/cpp/dev/audio_output_dev.h84
-rw-r--r--chromium/ppapi/features/BUILD.gn1
-rw-r--r--chromium/ppapi/features/features.gni6
-rw-r--r--chromium/ppapi/host/BUILD.gn5
-rw-r--r--chromium/ppapi/nacl_irt/ppapi_dispatcher.cc3
-rw-r--r--chromium/ppapi/native_client/src/untrusted/irt_stub/BUILD.gn2
-rw-r--r--chromium/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c72
-rw-r--r--chromium/ppapi/proxy/BUILD.gn14
-rw-r--r--chromium/ppapi/proxy/audio_output_resource.cc318
-rw-r--r--chromium/ppapi/proxy/audio_output_resource.h149
-rw-r--r--chromium/ppapi/proxy/dispatch_reply_message.h102
-rw-r--r--chromium/ppapi/proxy/interface_list.cc4
-rw-r--r--chromium/ppapi/proxy/plugin_globals.cc31
-rw-r--r--chromium/ppapi/proxy/plugin_globals.h17
-rw-r--r--chromium/ppapi/proxy/plugin_resource_callback.h4
-rw-r--r--chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc7
-rw-r--r--chromium/ppapi/proxy/ppapi_command_buffer_proxy.h3
-rw-r--r--chromium/ppapi/proxy/ppapi_messages.h16
-rw-r--r--chromium/ppapi/proxy/resource_creation_proxy.cc5
-rw-r--r--chromium/ppapi/proxy/resource_creation_proxy.h1
-rw-r--r--chromium/ppapi/proxy/tcp_socket_resource_base.cc3
-rw-r--r--chromium/ppapi/proxy/tcp_socket_resource_constants.cc18
-rw-r--r--chromium/ppapi/proxy/tcp_socket_resource_constants.h11
-rw-r--r--chromium/ppapi/proxy/udp_socket_filter.cc8
-rw-r--r--chromium/ppapi/proxy/udp_socket_resource_constants.cc22
-rw-r--r--chromium/ppapi/proxy/udp_socket_resource_constants.h15
-rw-r--r--chromium/ppapi/shared_impl/api_id.h1
-rw-r--r--chromium/ppapi/shared_impl/ppapi_constants.h5
-rw-r--r--chromium/ppapi/shared_impl/ppapi_globals.cc4
-rw-r--r--chromium/ppapi/shared_impl/ppapi_globals.h6
-rw-r--r--chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.cc5
-rw-r--r--chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.h1
-rw-r--r--chromium/ppapi/shared_impl/proxy_lock.h36
-rw-r--r--chromium/ppapi/shared_impl/resource.h1
-rw-r--r--chromium/ppapi/shared_impl/tracked_callback.cc5
-rw-r--r--chromium/ppapi/thunk/BUILD.gn15
-rw-r--r--chromium/ppapi/thunk/enter.cc71
-rw-r--r--chromium/ppapi/thunk/enter.h21
-rw-r--r--chromium/ppapi/thunk/interfaces_ppb_public_dev.h1
-rw-r--r--chromium/ppapi/thunk/ppb_audio_output_api.h43
-rw-r--r--chromium/ppapi/thunk/ppb_audio_output_dev_thunk.cc116
-rw-r--r--chromium/ppapi/thunk/resource_creation_api.h1
51 files changed, 1627 insertions, 247 deletions
diff --git a/chromium/ppapi/BUILD.gn b/chromium/ppapi/BUILD.gn
index 072b04b0e0e..794ee96b2e6 100644
--- a/chromium/ppapi/BUILD.gn
+++ b/chromium/ppapi/BUILD.gn
@@ -440,8 +440,11 @@ if (enable_nacl) {
"tests/test_nacl_irt_stack_alignment.cc",
"tests/test_nacl_irt_stack_alignment.h",
"tests/test_tcp_server_socket_private_disallowed.cc",
+ "tests/test_tcp_server_socket_private_disallowed.h",
"tests/test_tcp_socket_private_disallowed.cc",
+ "tests/test_tcp_socket_private_disallowed.h",
"tests/test_udp_socket_private_disallowed.cc",
+ "tests/test_udp_socket_private_disallowed.h",
]
defines = [
diff --git a/chromium/ppapi/api/dev/ppb_audio_output_dev.idl b/chromium/ppapi/api/dev/ppb_audio_output_dev.idl
new file mode 100644
index 00000000000..edd8679cef2
--- /dev/null
+++ b/chromium/ppapi/api/dev/ppb_audio_output_dev.idl
@@ -0,0 +1,229 @@
+/* Copyright (c) 2017 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_AudioOutput_dev</code> interface, which
+ * provides realtime stereo audio streaming capabilities.
+ */
+
+[generate_thunk]
+
+label Chrome {
+ M59 = 0.1
+};
+
+/**
+ * <code>PPB_AudioOutput_Callback</code> defines the type of an audio callback
+ * function used to fill the audio buffer with data. Please see the
+ * Create() function in the <code>PPB_AudioOutput</code> interface for
+ * more details on this callback.
+ *
+ * @param[out] sample_buffer A buffer to fill with audio data.
+ * @param[in] buffer_size_in_bytes The size of the buffer in bytes.
+ * @param[in] latency How long before the audio data is to be presented.
+ * @param[inout] user_data An opaque pointer that was passed into
+ * <code>PPB_AudioOutput.Create()</code>.
+ */
+typedef void PPB_AudioOutput_Callback([out] mem_t sample_buffer,
+ [in] uint32_t buffer_size_in_bytes,
+ [in] PP_TimeDelta latency,
+ [inout] mem_t user_data);
+
+/**
+ * The <code>PPB_AudioOutput</code> interface contains pointers to several
+ * functions for handling audio resources.
+ * Please see descriptions for each <code>PPB_AudioOutput</code> and
+ * <code>PPB_AudioConfig</code> function for more details. A C example using
+ * <code>PPB_AudioOutput</code> and <code>PPB_AudioConfig</code> follows.
+ *
+ * <strong>Example: </strong>
+ *
+ * @code
+ * void audio_output_callback(void* sample_buffer,
+ * uint32_t buffer_size_in_bytes,
+ * PP_TimeDelta latency,
+ * void* user_data) {
+ * ... quickly fill in the buffer with samples and return to caller ...
+ * }
+ *
+ * ...Assume the application has cached the audio configuration interface in
+ * audio_config_interface and the audio interface in
+ * audio_output_interface...
+ *
+ * uint32_t count = audio_config_interface->RecommendSampleFrameCount(
+ * PP_AUDIOSAMPLERATE_44100, 4096);
+ * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit(
+ * pp_instance, PP_AUDIOSAMPLERATE_44100, count);
+ * PP_Resource pp_audio_output = audio_interface->Create(pp_instance,
+ * pp_audio_config, audio_callback, NULL);
+ * audio_interface->EnumerateDevices(pp_audio_output, output_device_list,
+ * callback);
+ * audio_interface->Open(pp_audio_output, device_ref, pp_audio_config,
+ * audio_output_callback, user_data, callback);
+ * audio_output_interface->StartPlayback(pp_audio_output);
+ *
+ * ...audio_output_callback() will now be periodically invoked on a separate
+ * thread...
+ * @endcode
+ */
+
+[macro="PPB_AUDIO_OUTPUT_DEV_INTERFACE"]
+interface PPB_AudioOutput_Dev {
+ /**
+ * Creates an audio output resource.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying one instance of
+ * a module.
+ *
+ * @return A <code>PP_Resource</code> corresponding to an audio output resource
+ * if successful, 0 if failed.
+ */
+ PP_Resource Create(
+ [in] PP_Instance instance);
+
+ /**
+ * Determines if the given resource is an audio output resource.
+ *
+ * @param[in] resource A <code>PP_Resource</code> containing a resource.
+ *
+ * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
+ * resource is an audio output resource, otherwise <code>PP_FALSE</code>.
+ */
+ PP_Bool IsAudioOutput(
+ [in] PP_Resource resource);
+
+ /**
+ * Enumerates audio output devices.
+ *
+ * @param[in] audio_output A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ * @param[in] output An output array which will receive
+ * <code>PPB_DeviceRef_Dev</code> resources on success. Please note that the
+ * ref count of those resources has already been increased by 1 for the
+ * caller.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+ * completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t EnumerateDevices(
+ [in] PP_Resource audio_output,
+ [in] PP_ArrayOutput output,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Requests device change notifications.
+ *
+ * @param[in] audio_output A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ * @param[in] callback The callback to receive notifications. If not NULL, it
+ * will be called once for the currently available devices, and then every
+ * time the list of available devices changes. All calls will happen on the
+ * same thread as the one on which MonitorDeviceChange() is called. It will
+ * receive notifications until <code>audio_output</code> is destroyed or
+ * <code>MonitorDeviceChange()</code> is called to set a new callback for
+ * <code>audio_output</code>. You can pass NULL to cancel sending
+ * notifications.
+ * @param[inout] user_data An opaque pointer that will be passed to
+ * <code>callback</code>.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t MonitorDeviceChange(
+ [in] PP_Resource audio_output,
+ [in] PP_MonitorDeviceChangeCallback callback,
+ [inout] mem_t user_data);
+
+ /**
+ * Open() opens an audio output device. No sound will be heard until
+ * StartPlayback() is called. The callback is called with the buffer address
+ * and given user data whenever the buffer needs to be filled. From within the
+ * callback, you should not call <code>PPB_AudioOutput</code> functions. The
+ * callback will be called on a different thread than the one which created
+ * the interface. For performance-critical applications (i.e. low-latency
+ * audio), the callback should avoid blocking or calling functions that can
+ * obtain locks, such as malloc. The layout and the size of the buffer passed
+ * to the audio callback will be determined by the device configuration and is
+ * specified in the <code>AudioConfig</code> documentation.
+ *
+ * @param[in] audio_output A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ * @param[in] device_ref Identifies an audio output device. It could be one of
+ * the resource in the array returned by EnumerateDevices(), or 0 which means
+ * the default device.
+ * @param[in] config A <code>PPB_AudioConfig</code> audio configuration
+ * resource.
+ * @param[in] audio_output_callback A <code>PPB_AudioOutput_Callback</code>
+ * function that will be called when audio buffer needs to be filled.
+ * @param[inout] user_data An opaque pointer that will be passed into
+ * <code>audio_output_callback</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run when this
+ * open operation is completed.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t Open(
+ [in] PP_Resource audio_output,
+ [in] PP_Resource device_ref,
+ [in] PP_Resource config,
+ [in] PPB_AudioOutput_Callback audio_output_callback,
+ [inout] mem_t user_data,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * GetCurrrentConfig() returns an audio config resource for the given audio
+ * output resource.
+ *
+ * @param[in] config A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ *
+ * @return A <code>PP_Resource</code> containing the audio config resource if
+ * successful.
+ */
+ PP_Resource GetCurrentConfig(
+ [in] PP_Resource audio_output);
+
+ /**
+ * StartPlayback() starts the playback of the audio output resource and begins
+ * periodically calling the callback.
+ *
+ * @param[in] config A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ *
+ * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
+ * successful, otherwise <code>PP_FALSE</code>. Also returns
+ * <code>PP_TRUE</code> (and be a no-op) if called while playback is already
+ * in progress.
+ */
+ PP_Bool StartPlayback(
+ [in] PP_Resource audio_output);
+
+ /**
+ * StopPlayback() stops the playback of the audio resource.
+ *
+ * @param[in] config A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ *
+ * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
+ * successful, otherwise <code>PP_FALSE</code>. Also returns
+ * <code>PP_TRUE</code> (and is a no-op) if called while playback is already
+ * stopped. If a callback is in progress, StopPlayback() will block until the
+ * callback completes.
+ */
+ PP_Bool StopPlayback(
+ [in] PP_Resource audio_output);
+
+ /**
+ * Close() closes the audio output device, and stops playback if necessary. It is
+ * not valid to call Open() again after a call to this method.
+ * If an audio output resource is destroyed while a device is still open, then
+ * it will be implicitly closed, so you are not required to call this method.
+ *
+ * @param[in] audio_output A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ */
+ void Close(
+ [in] PP_Resource audio_output);
+};
diff --git a/chromium/ppapi/api/dev/ppb_device_ref_dev.idl b/chromium/ppapi/api/dev/ppb_device_ref_dev.idl
index 98d127234f4..b6135843bf7 100644
--- a/chromium/ppapi/api/dev/ppb_device_ref_dev.idl
+++ b/chromium/ppapi/api/dev/ppb_device_ref_dev.idl
@@ -36,7 +36,8 @@ typedef void PP_MonitorDeviceChangeCallback(
enum PP_DeviceType_Dev {
PP_DEVICETYPE_DEV_INVALID = 0,
PP_DEVICETYPE_DEV_AUDIOCAPTURE = 1,
- PP_DEVICETYPE_DEV_VIDEOCAPTURE = 2
+ PP_DEVICETYPE_DEV_VIDEOCAPTURE = 2,
+ PP_DEVICETYPE_DEV_AUDIOOUTPUT = 3
};
interface PPB_DeviceRef_Dev {
diff --git a/chromium/ppapi/c/BUILD.gn b/chromium/ppapi/c/BUILD.gn
index cd9cf210bd0..cd3fda9d4e0 100644
--- a/chromium/ppapi/c/BUILD.gn
+++ b/chromium/ppapi/c/BUILD.gn
@@ -9,6 +9,7 @@ source_set("c") {
"pp_bool.h",
"pp_codecs.h",
"pp_completion_callback.h",
+ "pp_directory_entry.h",
"pp_errors.h",
"pp_file_info.h",
"pp_graphics_3d.h",
@@ -30,6 +31,7 @@ source_set("c") {
"ppb_audio_config.h",
"ppb_audio_encoder.h",
"ppb_compositor.h",
+ "ppb_compositor_layer.h",
"ppb_console.h",
"ppb_core.h",
"ppb_file_io.h",
@@ -69,49 +71,71 @@ source_set("c") {
"ppb_video_encoder.h",
"ppb_video_frame.h",
"ppb_view.h",
+ "ppb_vpn_provider.h",
"ppb_websocket.h",
"ppp.h",
"ppp_graphics_3d.h",
"ppp_input_event.h",
"ppp_instance.h",
+ "ppp_message_handler.h",
"ppp_messaging.h",
"ppp_mouse_lock.h",
# Dev interfaces.
"dev/pp_cursor_type_dev.h",
+ "dev/pp_print_settings_dev.h",
+ "dev/pp_video_capture_dev.h",
"dev/pp_video_dev.h",
+ "dev/ppb_audio_input_dev.h",
+ "dev/ppb_audio_output_dev.h",
"dev/ppb_buffer_dev.h",
"dev/ppb_char_set_dev.h",
+ "dev/ppb_crypto_dev.h",
"dev/ppb_cursor_control_dev.h",
"dev/ppb_device_ref_dev.h",
"dev/ppb_file_chooser_dev.h",
+ "dev/ppb_gles_chromium_texture_mapping_dev.h",
"dev/ppb_ime_input_event_dev.h",
"dev/ppb_memory_dev.h",
+ "dev/ppb_opengles2ext_dev.h",
"dev/ppb_printing_dev.h",
"dev/ppb_text_input_dev.h",
+ "dev/ppb_trace_event_dev.h",
"dev/ppb_truetype_font_dev.h",
"dev/ppb_url_util_dev.h",
+ "dev/ppb_video_capture_dev.h",
"dev/ppb_video_decoder_dev.h",
+ "dev/ppb_view_dev.h",
"dev/ppp_network_state_dev.h",
+ "dev/ppp_printing_dev.h",
"dev/ppp_text_input_dev.h",
+ "dev/ppp_video_capture_dev.h",
"dev/ppp_video_decoder_dev.h",
# Private interfaces.
+ "private/pp_content_decryptor.h",
"private/pp_file_handle.h",
"private/pp_private_font_charset.h",
+ "private/pp_video_capture_format.h",
"private/pp_video_frame_private.h",
"private/ppb_camera_capabilities_private.h",
"private/ppb_camera_device_private.h",
"private/ppb_content_decryptor_private.h",
+ "private/ppb_display_color_profile_private.h",
"private/ppb_ext_crx_file_system_private.h",
+ "private/ppb_file_io_private.h",
+ "private/ppb_file_ref_private.h",
"private/ppb_find_private.h",
"private/ppb_flash.h",
"private/ppb_flash_clipboard.h",
+ "private/ppb_flash_device_id.h",
+ "private/ppb_flash_drm.h",
"private/ppb_flash_file.h",
"private/ppb_flash_font_file.h",
"private/ppb_flash_fullscreen.h",
"private/ppb_flash_menu.h",
"private/ppb_flash_message_loop.h",
+ "private/ppb_flash_print.h",
"private/ppb_host_resolver_private.h",
"private/ppb_instance_private.h",
"private/ppb_isolated_file_system_private.h",
@@ -130,7 +154,10 @@ source_set("c") {
"private/ppb_x509_certificate_private.h",
"private/ppp_content_decryptor_private.h",
"private/ppp_find_private.h",
+ "private/ppp_flash_browser_operations.h",
"private/ppp_instance_private.h",
+ "private/ppp_pdf.h",
+ "private/ppp_pexe_stream_handler.h",
# Deprecated interfaces.
"dev/deprecated_bool.h",
@@ -140,6 +167,7 @@ source_set("c") {
# Trusted interfaces.
"trusted/ppb_broker_trusted.h",
"trusted/ppb_browser_font_trusted.h",
+ "trusted/ppb_char_set_trusted.h",
"trusted/ppb_file_chooser_trusted.h",
"trusted/ppb_url_loader_trusted.h",
"trusted/ppp_broker.h",
diff --git a/chromium/ppapi/c/dev/ppb_audio_output_dev.h b/chromium/ppapi/c/dev/ppb_audio_output_dev.h
new file mode 100644
index 00000000000..7edfc422b7e
--- /dev/null
+++ b/chromium/ppapi/c/dev/ppb_audio_output_dev.h
@@ -0,0 +1,249 @@
+/* Copyright (c) 2017 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_audio_output_dev.idl modified Fri Apr 7 07:07:59 2017. */
+
+#ifndef PPAPI_C_DEV_PPB_AUDIO_OUTPUT_DEV_H_
+#define PPAPI_C_DEV_PPB_AUDIO_OUTPUT_DEV_H_
+
+#include "ppapi/c/dev/ppb_device_ref_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_resource.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_time.h"
+
+#define PPB_AUDIO_OUTPUT_DEV_INTERFACE_0_1 "PPB_AudioOutput(Dev);0.1"
+#define PPB_AUDIO_OUTPUT_DEV_INTERFACE PPB_AUDIO_OUTPUT_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_AudioOutput_dev</code> interface, which
+ * provides realtime stereo audio streaming capabilities.
+ */
+
+
+/**
+ * @addtogroup Typedefs
+ * @{
+ */
+/**
+ * <code>PPB_AudioOutput_Callback</code> defines the type of an audio callback
+ * function used to fill the audio buffer with data. Please see the
+ * Create() function in the <code>PPB_AudioOutput</code> interface for
+ * more details on this callback.
+ *
+ * @param[out] sample_buffer A buffer to fill with audio data.
+ * @param[in] buffer_size_in_bytes The size of the buffer in bytes.
+ * @param[in] latency How long before the audio data is to be presented.
+ * @param[inout] user_data An opaque pointer that was passed into
+ * <code>PPB_AudioOutput.Create()</code>.
+ */
+typedef void (*PPB_AudioOutput_Callback)(void* sample_buffer,
+ uint32_t buffer_size_in_bytes,
+ PP_TimeDelta latency,
+ void* user_data);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * The <code>PPB_AudioOutput</code> interface contains pointers to several
+ * functions for handling audio resources.
+ * Please see descriptions for each <code>PPB_AudioOutput</code> and
+ * <code>PPB_AudioConfig</code> function for more details. A C example using
+ * <code>PPB_AudioOutput</code> and <code>PPB_AudioConfig</code> follows.
+ *
+ * <strong>Example: </strong>
+ *
+ * @code
+ * void audio_output_callback(void* sample_buffer,
+ * uint32_t buffer_size_in_bytes,
+ * PP_TimeDelta latency,
+ * void* user_data) {
+ * ... quickly fill in the buffer with samples and return to caller ...
+ * }
+ *
+ * ...Assume the application has cached the audio configuration interface in
+ * audio_config_interface and the audio interface in
+ * audio_output_interface...
+ *
+ * uint32_t count = audio_config_interface->RecommendSampleFrameCount(
+ * PP_AUDIOSAMPLERATE_44100, 4096);
+ * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit(
+ * pp_instance, PP_AUDIOSAMPLERATE_44100, count);
+ * PP_Resource pp_audio_output = audio_interface->Create(pp_instance,
+ * pp_audio_config, audio_callback, NULL);
+ * audio_interface->EnumerateDevices(pp_audio_output, output_device_list,
+ * callback);
+ * audio_interface->Open(pp_audio_output, device_ref, pp_audio_config,
+ * audio_output_callback, user_data, callback);
+ * audio_output_interface->StartPlayback(pp_audio_output);
+ *
+ * ...audio_output_callback() will now be periodically invoked on a separate
+ * thread...
+ * @endcode
+ */
+struct PPB_AudioOutput_Dev_0_1 {
+ /**
+ * Creates an audio output resource.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying one instance of
+ * a module.
+ *
+ * @return A <code>PP_Resource</code> corresponding to an audio output
+ resource
+ * if successful, 0 if failed.
+ */
+ PP_Resource (*Create)(PP_Instance instance);
+ /**
+ * Determines if the given resource is an audio output resource.
+ *
+ * @param[in] resource A <code>PP_Resource</code> containing a resource.
+ *
+ * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
+ * resource is an audio output resource, otherwise <code>PP_FALSE</code>.
+ */
+ PP_Bool (*IsAudioOutput)(PP_Resource resource);
+ /**
+ * Enumerates audio output devices.
+ *
+ * @param[in] audio_output A <code>PP_Resource</code> corresponding to an
+ audio
+ * output resource.
+ * @param[in] output An output array which will receive
+ * <code>PPB_DeviceRef_Dev</code> resources on success. Please note that the
+ * ref count of those resources has already been increased by 1 for the
+ * caller.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+ * completion.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*EnumerateDevices)(PP_Resource audio_output,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback);
+ /**
+ * Requests device change notifications.
+ *
+ * @param[in] audio_output A <code>PP_Resource</code> corresponding to an
+ audio
+ * output resource.
+ * @param[in] callback The callback to receive notifications. If not NULL, it
+ * will be called once for the currently available devices, and then every
+ * time the list of available devices changes. All calls will happen on the
+ * same thread as the one on which MonitorDeviceChange() is called. It will
+ * receive notifications until <code>audio_output</code> is destroyed or
+ * <code>MonitorDeviceChange()</code> is called to set a new callback for
+ * <code>audio_output</code>. You can pass NULL to cancel sending
+ * notifications.
+ * @param[inout] user_data An opaque pointer that will be passed to
+ * <code>callback</code>.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*MonitorDeviceChange)(PP_Resource audio_output,
+ PP_MonitorDeviceChangeCallback callback,
+ void* user_data);
+ /**
+ * Open() opens an audio output device. No sound will be heard until
+ * StartPlayback() is called. The callback is called with the buffer address
+ * and given user data whenever the buffer needs to be filled. From within the
+ * callback, you should not call <code>PPB_AudioOutput</code> functions. The
+ * callback will be called on a different thread than the one which created
+ * the interface. For performance-critical applications (i.e. low-latency
+ * audio), the callback should avoid blocking or calling functions that can
+ * obtain locks, such as malloc. The layout and the size of the buffer passed
+ * to the audio callback will be determined by the device configuration and is
+ * specified in the <code>AudioConfig</code> documentation.
+ *
+ * @param[in] audio_output A <code>PP_Resource</code> corresponding to an
+ audio
+ * output resource.
+ * @param[in] device_ref Identifies an audio output device. It could be one of
+ * the resource in the array returned by EnumerateDevices(), or 0 which means
+ * the default device.
+ * @param[in] config A <code>PPB_AudioConfig</code> audio configuration
+ * resource.
+ * @param[in] audio_output_callback A <code>PPB_AudioOutput_Callback</code>
+ * function that will be called when audio buffer needs to be filled.
+ * @param[inout] user_data An opaque pointer that will be passed into
+ * <code>audio_output_callback</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run when this
+ * open operation is completed.
+ *
+ * @return An error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Open)(PP_Resource audio_output,
+ PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioOutput_Callback audio_output_callback,
+ void* user_data,
+ struct PP_CompletionCallback callback);
+ /**
+ * GetCurrrentConfig() returns an audio config resource for the given audio
+ * output resource.
+ *
+ * @param[in] config A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ *
+ * @return A <code>PP_Resource</code> containing the audio config resource if
+ * successful.
+ */
+ PP_Resource (*GetCurrentConfig)(PP_Resource audio_output);
+ /**
+ * StartPlayback() starts the playback of the audio output resource and begins
+ * periodically calling the callback.
+ *
+ * @param[in] config A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ *
+ * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
+ * successful, otherwise <code>PP_FALSE</code>. Also returns
+ * <code>PP_TRUE</code> (and be a no-op) if called while playback is already
+ * in progress.
+ */
+ PP_Bool (*StartPlayback)(PP_Resource audio_output);
+ /**
+ * StopPlayback() stops the playback of the audio resource.
+ *
+ * @param[in] config A <code>PP_Resource</code> corresponding to an audio
+ * output resource.
+ *
+ * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
+ * successful, otherwise <code>PP_FALSE</code>. Also returns
+ * <code>PP_TRUE</code> (and is a no-op) if called while playback is already
+ * stopped. If a callback is in progress, StopPlayback() will block until the
+ * callback completes.
+ */
+ PP_Bool (*StopPlayback)(PP_Resource audio_output);
+ /**
+ * Close() closes the audio output device,
+ and stops playback if necessary. It is
+ * not valid to call Open() again after a call to this method.
+ * If an audio output resource is destroyed while a device is still open, then
+ * it will be implicitly closed, so you are not required to call this method.
+ *
+ * @param[in] audio_output A <code>PP_Resource</code> corresponding to an
+ audio
+ * output resource.
+ */
+ void (*Close)(PP_Resource audio_output);
+};
+
+typedef struct PPB_AudioOutput_Dev_0_1 PPB_AudioOutput_Dev;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_DEV_PPB_AUDIO_OUTPUT_DEV_H_ */
+
diff --git a/chromium/ppapi/c/dev/ppb_device_ref_dev.h b/chromium/ppapi/c/dev/ppb_device_ref_dev.h
index 62d75a6ad61..2b8b18d0fa3 100644
--- a/chromium/ppapi/c/dev/ppb_device_ref_dev.h
+++ b/chromium/ppapi/c/dev/ppb_device_ref_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_device_ref_dev.idl modified Wed Nov 07 13:28:37 2012. */
+/* From dev/ppb_device_ref_dev.idl modified Mon Jan 09 12:04:09 2017. */
#ifndef PPAPI_C_DEV_PPB_DEVICE_REF_DEV_H_
#define PPAPI_C_DEV_PPB_DEVICE_REF_DEV_H_
@@ -55,7 +55,8 @@ typedef void (*PP_MonitorDeviceChangeCallback)(void* user_data,
typedef enum {
PP_DEVICETYPE_DEV_INVALID = 0,
PP_DEVICETYPE_DEV_AUDIOCAPTURE = 1,
- PP_DEVICETYPE_DEV_VIDEOCAPTURE = 2
+ PP_DEVICETYPE_DEV_VIDEOCAPTURE = 2,
+ PP_DEVICETYPE_DEV_AUDIOOUTPUT = 3
} PP_DeviceType_Dev;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DeviceType_Dev, 4);
/**
diff --git a/chromium/ppapi/c/pp_macros.h b/chromium/ppapi/c/pp_macros.h
index 16dc079d2f4..291d2d6c484 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 Thu Oct 15 10:46:35 2015. */
+/* From pp_macros.idl modified Sat Dec 6 22:11:47 2014. */
#ifndef PPAPI_C_PP_MACROS_H_
#define PPAPI_C_PP_MACROS_H_
-#define PPAPI_RELEASE 55
+#define PPAPI_RELEASE 59
/**
* @file
diff --git a/chromium/ppapi/cpp/BUILD.gn b/chromium/ppapi/cpp/BUILD.gn
index 586ca715e06..1252d7af87c 100644
--- a/chromium/ppapi/cpp/BUILD.gn
+++ b/chromium/ppapi/cpp/BUILD.gn
@@ -161,6 +161,8 @@ source_set("objects") {
# Dev interfaces.
"dev/audio_input_dev.cc",
"dev/audio_input_dev.h",
+ "dev/audio_output_dev.cc",
+ "dev/audio_output_dev.h",
"dev/buffer_dev.cc",
"dev/buffer_dev.h",
"dev/crypto_dev.cc",
diff --git a/chromium/ppapi/cpp/dev/audio_output_dev.cc b/chromium/ppapi/cpp/dev/audio_output_dev.cc
new file mode 100644
index 00000000000..56e55b0923b
--- /dev/null
+++ b/chromium/ppapi/cpp/dev/audio_output_dev.cc
@@ -0,0 +1,98 @@
+// Copyright (c) 2017 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/audio_output_dev.h"
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <>
+const char* interface_name<PPB_AudioOutput_Dev_0_1>() {
+ return PPB_AUDIO_OUTPUT_DEV_INTERFACE_0_1;
+}
+
+} // namespace
+
+AudioOutput_Dev::AudioOutput_Dev() {}
+
+AudioOutput_Dev::AudioOutput_Dev(const InstanceHandle& instance) {
+ if (has_interface<PPB_AudioOutput_Dev_0_1>()) {
+ PassRefFromConstructor(get_interface<PPB_AudioOutput_Dev_0_1>()->Create(
+ instance.pp_instance()));
+ }
+}
+
+AudioOutput_Dev::~AudioOutput_Dev() {}
+
+// static
+bool AudioOutput_Dev::IsAvailable() {
+ return has_interface<PPB_AudioOutput_Dev_0_1>();
+}
+
+int32_t AudioOutput_Dev::EnumerateDevices(
+ const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >& callback) {
+ if (has_interface<PPB_AudioOutput_Dev_0_1>()) {
+ return get_interface<PPB_AudioOutput_Dev_0_1>()->EnumerateDevices(
+ pp_resource(), callback.output(), callback.pp_completion_callback());
+ }
+
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t AudioOutput_Dev::MonitorDeviceChange(
+ PP_MonitorDeviceChangeCallback callback,
+ void* user_data) {
+ if (has_interface<PPB_AudioOutput_Dev_0_1>()) {
+ return get_interface<PPB_AudioOutput_Dev_0_1>()->MonitorDeviceChange(
+ pp_resource(), callback, user_data);
+ }
+
+ return PP_ERROR_NOINTERFACE;
+}
+
+int32_t AudioOutput_Dev::Open(const DeviceRef_Dev& device_ref,
+ const AudioConfig& config,
+ PPB_AudioOutput_Callback audio_output_callback,
+ void* user_data,
+ const CompletionCallback& callback) {
+ if (has_interface<PPB_AudioOutput_Dev_0_1>()) {
+ return get_interface<PPB_AudioOutput_Dev_0_1>()->Open(
+ pp_resource(), device_ref.pp_resource(), config.pp_resource(),
+ audio_output_callback, user_data, callback.pp_completion_callback());
+ }
+
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+bool AudioOutput_Dev::StartPlayback() {
+ if (has_interface<PPB_AudioOutput_Dev_0_1>()) {
+ return PP_ToBool(
+ get_interface<PPB_AudioOutput_Dev_0_1>()->StartPlayback(pp_resource()));
+ }
+
+ return false;
+}
+
+bool AudioOutput_Dev::StopPlayback() {
+ if (has_interface<PPB_AudioOutput_Dev_0_1>()) {
+ return PP_ToBool(
+ get_interface<PPB_AudioOutput_Dev_0_1>()->StopPlayback(pp_resource()));
+ }
+
+ return false;
+}
+
+void AudioOutput_Dev::Close() {
+ if (has_interface<PPB_AudioOutput_Dev_0_1>()) {
+ get_interface<PPB_AudioOutput_Dev_0_1>()->Close(pp_resource());
+ }
+}
+
+} // namespace pp
diff --git a/chromium/ppapi/cpp/dev/audio_output_dev.h b/chromium/ppapi/cpp/dev/audio_output_dev.h
new file mode 100644
index 00000000000..ebe2fb505a9
--- /dev/null
+++ b/chromium/ppapi/cpp/dev/audio_output_dev.h
@@ -0,0 +1,84 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_DEV_AUDIO_OUTPUT_DEV_H_
+#define PPAPI_CPP_DEV_AUDIO_OUTPUT_DEV_H_
+
+#include <stdint.h>
+
+#include <vector>
+
+#include "ppapi/c/dev/ppb_audio_output_dev.h"
+#include "ppapi/cpp/audio_config.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/dev/device_ref_dev.h"
+#include "ppapi/cpp/resource.h"
+
+namespace pp {
+
+class InstanceHandle;
+
+class AudioOutput_Dev : public Resource {
+ public:
+ // An empty constructor for an AudioOutput resource.
+ AudioOutput_Dev();
+
+ // Constructor to create an audio output resource.
+ explicit AudioOutput_Dev(const InstanceHandle& instance);
+
+ virtual ~AudioOutput_Dev();
+
+ // Static function for determining whether the browser supports the required
+ // AudioOutput interface.
+ //
+ // @return true if the interface is available, false otherwise.
+ static bool IsAvailable();
+
+ int32_t EnumerateDevices(
+ const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >& cb);
+
+ int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+ void* user_data);
+
+ // If |device_ref| is null (i.e., is_null() returns true), the default device
+ // will be used.
+ int32_t Open(const DeviceRef_Dev& device_ref,
+ const AudioConfig& config,
+ PPB_AudioOutput_Callback audio_output_callback,
+ void* user_data,
+ const CompletionCallback& callback);
+
+ // Getter function for returning the internal <code>PPB_AudioConfig</code>
+ // struct.
+ //
+ // @return A mutable reference to the PPB_AudioConfig struct.
+ AudioConfig& config() { return config_; }
+
+ // Getter function for returning the internal <code>PPB_AudioConfig</code>
+ // struct.
+ //
+ // @return A const reference to the internal <code>PPB_AudioConfig</code>
+ // struct.
+ const AudioConfig& config() const { return config_; }
+
+ // StartPlayback() starts playback of audio.
+ //
+ // @return true if successful, otherwise false.
+ bool StartPlayback();
+
+ // StopPlayback stops playback of audio.
+ //
+ // @return true if successful, otherwise false.
+ bool StopPlayback();
+
+ // Close closes the audio output device.
+ void Close();
+
+ private:
+ AudioConfig config_;
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_DEV_AUDIO_OUTPUT_DEV_H_
diff --git a/chromium/ppapi/features/BUILD.gn b/chromium/ppapi/features/BUILD.gn
index cbb8e6edc7e..f2e3b501843 100644
--- a/chromium/ppapi/features/BUILD.gn
+++ b/chromium/ppapi/features/BUILD.gn
@@ -12,6 +12,7 @@ import("//ppapi/features/features.gni")
buildflag_header("features") {
header = "features.h"
flags = [
+ "ENABLE_CDM_HOST_VERIFICATION=$enable_cdm_host_verification",
"ENABLE_PEPPER_CDMS=$enable_pepper_cdms",
"ENABLE_PLUGINS=$enable_plugins",
]
diff --git a/chromium/ppapi/features/features.gni b/chromium/ppapi/features/features.gni
index 5982e3146d0..30f8f05e12e 100644
--- a/chromium/ppapi/features/features.gni
+++ b/chromium/ppapi/features/features.gni
@@ -2,8 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni")
import("//build/config/features.gni")
+import("//third_party/widevine/cdm/widevine.gni")
declare_args() {
enable_plugins = !is_android && !is_ios && !is_chromecast
@@ -14,3 +16,7 @@ declare_args() {
# This is available as a buildflag for C++ preprocessor, see
# //ppapi:features.
enable_pepper_cdms = enable_plugins && (is_linux || is_mac || is_win)
+
+# Enables host verification for CDMs.
+enable_cdm_host_verification = enable_pepper_cdms && (is_mac || is_win) &&
+ (is_chrome_branded || enable_widevine)
diff --git a/chromium/ppapi/host/BUILD.gn b/chromium/ppapi/host/BUILD.gn
index 2404a67a515..32d33282786 100644
--- a/chromium/ppapi/host/BUILD.gn
+++ b/chromium/ppapi/host/BUILD.gn
@@ -31,7 +31,6 @@ component("host") {
deps = [
"//base",
- "//ipc",
"//media:shared_memory_support",
"//ppapi/c",
"//ppapi/proxy:ipc",
@@ -40,4 +39,8 @@ component("host") {
"//ui/surface",
"//url",
]
+
+ public_deps = [
+ "//ipc",
+ ]
}
diff --git a/chromium/ppapi/nacl_irt/ppapi_dispatcher.cc b/chromium/ppapi/nacl_irt/ppapi_dispatcher.cc
index 789a75ce5da..460dbec3df3 100644
--- a/chromium/ppapi/nacl_irt/ppapi_dispatcher.cc
+++ b/chromium/ppapi/nacl_irt/ppapi_dispatcher.cc
@@ -165,9 +165,6 @@ void PpapiDispatcher::OnMsgInitializeNaClDispatcher(
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
logging::InitLogging(settings);
- proxy::PluginGlobals::Get()->set_keepalive_throttle_interval_milliseconds(
- args.keepalive_throttle_interval_milliseconds);
-
// Tell the process-global GetInterface which interfaces it can return to the
// plugin.
proxy::InterfaceList::SetProcessGlobalPermissions(args.permissions);
diff --git a/chromium/ppapi/native_client/src/untrusted/irt_stub/BUILD.gn b/chromium/ppapi/native_client/src/untrusted/irt_stub/BUILD.gn
index a492353d9ae..288a922c5f2 100644
--- a/chromium/ppapi/native_client/src/untrusted/irt_stub/BUILD.gn
+++ b/chromium/ppapi/native_client/src/untrusted/irt_stub/BUILD.gn
@@ -14,7 +14,9 @@ static_library("ppapi_stub_lib") {
"plugin_main_irt.c",
"ppapi_plugin_main.c",
"ppapi_plugin_start.c",
+ "ppapi_start.h",
"thread_creator.c",
+ "thread_creator.h",
]
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
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 56b190b8a37..6e8a8aa7cde 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
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016 The Chromium Authors. All rights reserved.
+/* Copyright (c) 2017 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.
*/
@@ -8,6 +8,7 @@
#include "ppapi/c/ppb.h"
#include "ppapi/c/dev/ppb_audio_input_dev.h"
+#include "ppapi/c/dev/ppb_audio_output_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_ime_input_event_dev.h"
@@ -156,6 +157,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Messaging_1_0;
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_AudioOutput_Dev_0_1;
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;
@@ -2751,6 +2753,55 @@ static void Pnacl_M30_PPB_AudioInput_Dev_Close(PP_Resource audio_input) {
/* End wrapper methods for PPB_AudioInput_Dev_0_4 */
+/* Begin wrapper methods for PPB_AudioOutput_Dev_0_1 */
+
+static PP_Resource Pnacl_M59_PPB_AudioOutput_Dev_Create(PP_Instance instance) {
+ const struct PPB_AudioOutput_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1.real_iface;
+ return iface->Create(instance);
+}
+
+static PP_Bool Pnacl_M59_PPB_AudioOutput_Dev_IsAudioOutput(PP_Resource resource) {
+ const struct PPB_AudioOutput_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1.real_iface;
+ return iface->IsAudioOutput(resource);
+}
+
+static int32_t Pnacl_M59_PPB_AudioOutput_Dev_EnumerateDevices(PP_Resource audio_output, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
+ const struct PPB_AudioOutput_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1.real_iface;
+ return iface->EnumerateDevices(audio_output, *output, *callback);
+}
+
+static int32_t Pnacl_M59_PPB_AudioOutput_Dev_MonitorDeviceChange(PP_Resource audio_output, PP_MonitorDeviceChangeCallback callback, void* user_data) {
+ const struct PPB_AudioOutput_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1.real_iface;
+ return iface->MonitorDeviceChange(audio_output, callback, user_data);
+}
+
+static int32_t Pnacl_M59_PPB_AudioOutput_Dev_Open(PP_Resource audio_output, PP_Resource device_ref, PP_Resource config, PPB_AudioOutput_Callback audio_output_callback, void* user_data, struct PP_CompletionCallback* callback) {
+ const struct PPB_AudioOutput_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1.real_iface;
+ return iface->Open(audio_output, device_ref, config, audio_output_callback, user_data, *callback);
+}
+
+static PP_Resource Pnacl_M59_PPB_AudioOutput_Dev_GetCurrentConfig(PP_Resource audio_output) {
+ const struct PPB_AudioOutput_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1.real_iface;
+ return iface->GetCurrentConfig(audio_output);
+}
+
+static PP_Bool Pnacl_M59_PPB_AudioOutput_Dev_StartPlayback(PP_Resource audio_output) {
+ const struct PPB_AudioOutput_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1.real_iface;
+ return iface->StartPlayback(audio_output);
+}
+
+static PP_Bool Pnacl_M59_PPB_AudioOutput_Dev_StopPlayback(PP_Resource audio_output) {
+ const struct PPB_AudioOutput_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1.real_iface;
+ return iface->StopPlayback(audio_output);
+}
+
+static void Pnacl_M59_PPB_AudioOutput_Dev_Close(PP_Resource audio_output) {
+ const struct PPB_AudioOutput_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1.real_iface;
+ iface->Close(audio_output);
+}
+
+/* End wrapper methods for PPB_AudioOutput_Dev_0_1 */
+
/* Not generating wrapper methods for PPB_Buffer_Dev_0_4 */
/* Not generating wrapper methods for PPB_Crypto_Dev_0_1 */
@@ -5408,6 +5459,18 @@ static const struct PPB_AudioInput_Dev_0_4 Pnacl_Wrappers_PPB_AudioInput_Dev_0_4
.Close = (void (*)(PP_Resource audio_input))&Pnacl_M30_PPB_AudioInput_Dev_Close
};
+static const struct PPB_AudioOutput_Dev_0_1 Pnacl_Wrappers_PPB_AudioOutput_Dev_0_1 = {
+ .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M59_PPB_AudioOutput_Dev_Create,
+ .IsAudioOutput = (PP_Bool (*)(PP_Resource resource))&Pnacl_M59_PPB_AudioOutput_Dev_IsAudioOutput,
+ .EnumerateDevices = (int32_t (*)(PP_Resource audio_output, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M59_PPB_AudioOutput_Dev_EnumerateDevices,
+ .MonitorDeviceChange = (int32_t (*)(PP_Resource audio_output, PP_MonitorDeviceChangeCallback callback, void* user_data))&Pnacl_M59_PPB_AudioOutput_Dev_MonitorDeviceChange,
+ .Open = (int32_t (*)(PP_Resource audio_output, PP_Resource device_ref, PP_Resource config, PPB_AudioOutput_Callback audio_output_callback, void* user_data, struct PP_CompletionCallback callback))&Pnacl_M59_PPB_AudioOutput_Dev_Open,
+ .GetCurrentConfig = (PP_Resource (*)(PP_Resource audio_output))&Pnacl_M59_PPB_AudioOutput_Dev_GetCurrentConfig,
+ .StartPlayback = (PP_Bool (*)(PP_Resource audio_output))&Pnacl_M59_PPB_AudioOutput_Dev_StartPlayback,
+ .StopPlayback = (PP_Bool (*)(PP_Resource audio_output))&Pnacl_M59_PPB_AudioOutput_Dev_StopPlayback,
+ .Close = (void (*)(PP_Resource audio_output))&Pnacl_M59_PPB_AudioOutput_Dev_Close
+};
+
/* Not generating wrapper interface for PPB_Buffer_Dev_0_4 */
/* Not generating wrapper interface for PPB_Crypto_Dev_0_1 */
@@ -6322,6 +6385,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4 = {
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1 = {
+ .iface_macro = PPB_AUDIO_OUTPUT_DEV_INTERFACE_0_1,
+ .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_AudioOutput_Dev_0_1,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1 = {
.iface_macro = PPB_DEVICEREF_DEV_INTERFACE_0_1,
.wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_DeviceRef_Dev_0_1,
@@ -6690,6 +6759,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_WebSocket_1_0,
&Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3,
&Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4,
+ &Pnacl_WrapperInfo_PPB_AudioOutput_Dev_0_1,
&Pnacl_WrapperInfo_PPB_DeviceRef_Dev_0_1,
&Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_5,
&Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6,
diff --git a/chromium/ppapi/proxy/BUILD.gn b/chromium/ppapi/proxy/BUILD.gn
index ce07d16af22..b5727788952 100644
--- a/chromium/ppapi/proxy/BUILD.gn
+++ b/chromium/ppapi/proxy/BUILD.gn
@@ -219,6 +219,8 @@ component("proxy") {
sources += [
"audio_input_resource.cc",
"audio_input_resource.h",
+ "audio_output_resource.cc",
+ "audio_output_resource.h",
"broker_dispatcher.cc",
"broker_dispatcher.h",
"browser_font_singleton_resource.cc",
@@ -274,6 +276,7 @@ component("proxy") {
]
public_deps = [
+ "//ipc",
"//ppapi/proxy:ipc_sources",
]
@@ -282,7 +285,6 @@ component("proxy") {
"//base",
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/ipc/common:command_buffer_traits",
- "//ipc",
"//media:shared_memory_support",
"//mojo/edk/system",
"//ppapi/c",
@@ -308,13 +310,9 @@ component("proxy") {
source_set("common") {
sources = [
- "tcp_socket_resource_constants.cc",
"tcp_socket_resource_constants.h",
- "udp_socket_resource_constants.cc",
"udp_socket_resource_constants.h",
]
-
- configs += [ ":proxy_implementation" ]
}
group("ipc") {
@@ -361,10 +359,14 @@ source_set("ipc_sources") {
deps = [
"//base",
"//gpu/ipc/common:command_buffer_traits",
- "//ipc",
"//ppapi/c",
"//ppapi/shared_impl",
]
+
+ public_deps = [
+ "//ipc",
+ ]
+
if (!is_nacl) {
deps += [ "//skia" ]
}
diff --git a/chromium/ppapi/proxy/audio_output_resource.cc b/chromium/ppapi/proxy/audio_output_resource.cc
new file mode 100644
index 00000000000..6eeb0f08f72
--- /dev/null
+++ b/chromium/ppapi/proxy/audio_output_resource.cc
@@ -0,0 +1,318 @@
+// Copyright (c) 2017 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/audio_output_resource.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
+#include "ipc/ipc_platform_file.h"
+#include "media/base/audio_bus.h"
+#include "media/base/audio_parameters.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/proxy/serialized_handle.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/ppb_audio_config_shared.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_audio_config_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+AudioOutputResource::AudioOutputResource(Connection connection,
+ PP_Instance instance)
+ : PluginResource(connection, instance),
+ open_state_(BEFORE_OPEN),
+ playing_(false),
+ shared_memory_size_(0),
+ audio_output_callback_(NULL),
+ user_data_(NULL),
+ enumeration_helper_(this),
+ bytes_per_second_(0),
+ sample_frame_count_(0),
+ client_buffer_size_bytes_(0) {
+ SendCreate(RENDERER, PpapiHostMsg_AudioOutput_Create());
+}
+
+AudioOutputResource::~AudioOutputResource() {
+ Close();
+}
+
+thunk::PPB_AudioOutput_API* AudioOutputResource::AsPPB_AudioOutput_API() {
+ return this;
+}
+
+void AudioOutputResource::OnReplyReceived(
+ const ResourceMessageReplyParams& params,
+ const IPC::Message& msg) {
+ if (!enumeration_helper_.HandleReply(params, msg))
+ PluginResource::OnReplyReceived(params, msg);
+}
+
+int32_t AudioOutputResource::EnumerateDevices(
+ const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) {
+ return enumeration_helper_.EnumerateDevices(output, callback);
+}
+
+int32_t AudioOutputResource::MonitorDeviceChange(
+ PP_MonitorDeviceChangeCallback callback,
+ void* user_data) {
+ return enumeration_helper_.MonitorDeviceChange(callback, user_data);
+}
+
+int32_t AudioOutputResource::Open(
+ PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioOutput_Callback audio_output_callback,
+ void* user_data,
+ scoped_refptr<TrackedCallback> callback) {
+ return CommonOpen(device_ref, config, audio_output_callback, user_data,
+ callback);
+}
+
+PP_Resource AudioOutputResource::GetCurrentConfig() {
+ // AddRef for the caller.
+ if (config_.get())
+ PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_);
+ return config_;
+}
+
+PP_Bool AudioOutputResource::StartPlayback() {
+ if (open_state_ == CLOSED || (open_state_ == BEFORE_OPEN &&
+ !TrackedCallback::IsPending(open_callback_))) {
+ return PP_FALSE;
+ }
+ if (playing_)
+ return PP_TRUE;
+
+ playing_ = true;
+
+ StartThread();
+
+ Post(RENDERER, PpapiHostMsg_AudioOutput_StartOrStop(true));
+ return PP_TRUE;
+}
+
+PP_Bool AudioOutputResource::StopPlayback() {
+ if (open_state_ == CLOSED)
+ return PP_FALSE;
+ if (!playing_)
+ return PP_TRUE;
+
+ // If the audio output device hasn't been opened, set |playing_| to false and
+ // return directly.
+ if (open_state_ == BEFORE_OPEN) {
+ playing_ = false;
+ return PP_TRUE;
+ }
+
+ Post(RENDERER, PpapiHostMsg_AudioOutput_StartOrStop(false));
+
+ StopThread();
+ playing_ = false;
+
+ return PP_TRUE;
+}
+
+void AudioOutputResource::Close() {
+ if (open_state_ == CLOSED)
+ return;
+
+ open_state_ = CLOSED;
+ Post(RENDERER, PpapiHostMsg_AudioOutput_Close());
+ StopThread();
+
+ if (TrackedCallback::IsPending(open_callback_))
+ open_callback_->PostAbort();
+}
+
+void AudioOutputResource::LastPluginRefWasDeleted() {
+ enumeration_helper_.LastPluginRefWasDeleted();
+}
+
+void AudioOutputResource::OnPluginMsgOpenReply(
+ const ResourceMessageReplyParams& params) {
+ if (open_state_ == BEFORE_OPEN && params.result() == PP_OK) {
+ IPC::PlatformFileForTransit socket_handle_for_transit =
+ IPC::InvalidPlatformFileForTransit();
+ params.TakeSocketHandleAtIndex(0, &socket_handle_for_transit);
+ base::SyncSocket::Handle socket_handle =
+ IPC::PlatformFileForTransitToPlatformFile(socket_handle_for_transit);
+ CHECK(socket_handle != base::SyncSocket::kInvalidHandle);
+
+ SerializedHandle serialized_shared_memory_handle =
+ params.TakeHandleOfTypeAtIndex(1, SerializedHandle::SHARED_MEMORY);
+ CHECK(serialized_shared_memory_handle.IsHandleValid());
+
+ open_state_ = OPENED;
+ SetStreamInfo(serialized_shared_memory_handle.shmem(),
+ serialized_shared_memory_handle.size(), socket_handle);
+ } else {
+ playing_ = false;
+ }
+
+ // The callback may have been aborted by Close().
+ if (TrackedCallback::IsPending(open_callback_))
+ open_callback_->Run(params.result());
+}
+
+void AudioOutputResource::SetStreamInfo(
+ base::SharedMemoryHandle shared_memory_handle,
+ size_t shared_memory_size,
+ base::SyncSocket::Handle socket_handle) {
+ socket_.reset(new base::CancelableSyncSocket(socket_handle));
+ shared_memory_.reset(new base::SharedMemory(shared_memory_handle, false));
+ shared_memory_size_ = shared_memory_size;
+ DCHECK(!shared_memory_->memory());
+
+ // If we fail to map the shared memory into the caller's address space we
+ // might as well fail here since nothing will work if this is the case.
+ CHECK(shared_memory_->Map(shared_memory_size_));
+
+ // Create a new audio bus and wrap the audio data section in shared memory.
+ media::AudioOutputBuffer* buffer =
+ static_cast<media::AudioOutputBuffer*>(shared_memory_->memory());
+ audio_bus_ = media::AudioBus::WrapMemory(kAudioOutputChannels,
+ sample_frame_count_, buffer->audio);
+
+ // Ensure that the size of the created audio bus matches the allocated
+ // size in shared memory.
+ // Example: DCHECK_EQ(8208 - 16, 8192) for |sample_frame_count_| = 2048.
+ const uint32_t audio_bus_size_bytes = media::AudioBus::CalculateMemorySize(
+ audio_bus_->channels(), audio_bus_->frames());
+ DCHECK_EQ(shared_memory_size_ - sizeof(media::AudioOutputBufferParameters),
+ audio_bus_size_bytes);
+
+ // Setup integer audio buffer for user audio data
+ client_buffer_size_bytes_ = audio_bus_->frames() * audio_bus_->channels() *
+ kBitsPerAudioOutputSample / 8;
+ client_buffer_.reset(new uint8_t[client_buffer_size_bytes_]);
+}
+
+void AudioOutputResource::StartThread() {
+ // Don't start the thread unless all our state is set up correctly.
+ if (!audio_output_callback_ || !socket_.get() || !shared_memory_->memory() ||
+ !audio_bus_.get() || !client_buffer_.get() || bytes_per_second_ == 0)
+ return;
+
+ // Clear contents of shm buffer before starting audio thread. This will
+ // prevent a burst of static if for some reason the audio thread doesn't
+ // start up quickly enough.
+ memset(shared_memory_->memory(), 0, shared_memory_size_);
+ memset(client_buffer_.get(), 0, client_buffer_size_bytes_);
+
+ DCHECK(!audio_output_thread_.get());
+ audio_output_thread_.reset(
+ new base::DelegateSimpleThread(this, "plugin_audio_output_thread"));
+ audio_output_thread_->Start();
+}
+
+void AudioOutputResource::StopThread() {
+ // Shut down the socket to escape any hanging |Receive|s.
+ if (socket_.get())
+ socket_->Shutdown();
+ if (audio_output_thread_.get()) {
+ audio_output_thread_->Join();
+ audio_output_thread_.reset();
+ }
+}
+
+void AudioOutputResource::Run() {
+ // The shared memory represents AudioOutputBufferParameters and the actual
+ // data buffer stored as an audio bus.
+ media::AudioOutputBuffer* buffer =
+ static_cast<media::AudioOutputBuffer*>(shared_memory_->memory());
+
+ // This is a constantly increasing counter that is used to verify on the
+ // browser side that buffers are in sync.
+ uint32_t buffer_index = 0;
+
+ while (true) {
+ int pending_data = 0;
+ size_t bytes_read = socket_->Receive(&pending_data, sizeof(pending_data));
+ if (bytes_read != sizeof(pending_data)) {
+ DCHECK_EQ(bytes_read, 0U);
+ break;
+ }
+ if (pending_data < 0)
+ break;
+
+ {
+ base::TimeDelta delay =
+ base::TimeDelta::FromMicroseconds(buffer->params.delay);
+
+ audio_output_callback_(client_buffer_.get(), client_buffer_size_bytes_,
+ delay.InSecondsF(), user_data_);
+ }
+
+ // Deinterleave the audio data into the shared memory as floats.
+ audio_bus_->FromInterleaved(client_buffer_.get(), audio_bus_->frames(),
+ kBitsPerAudioOutputSample / 8);
+
+ // Inform other side that we have read the data from the shared memory.
+ // 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().
+ ++buffer_index;
+ size_t bytes_sent = socket_->Send(&buffer_index, sizeof(buffer_index));
+ if (bytes_sent != sizeof(buffer_index)) {
+ DCHECK_EQ(bytes_sent, 0U);
+ break;
+ }
+ }
+}
+
+int32_t AudioOutputResource::CommonOpen(
+ PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioOutput_Callback audio_output_callback,
+ void* user_data,
+ scoped_refptr<TrackedCallback> callback) {
+ std::string device_id;
+ // |device_id| remains empty if |device_ref| is 0, which means the default
+ // device.
+ if (device_ref != 0) {
+ thunk::EnterResourceNoLock<thunk::PPB_DeviceRef_API> enter_device_ref(
+ device_ref, true);
+ if (enter_device_ref.failed())
+ return PP_ERROR_BADRESOURCE;
+ device_id = enter_device_ref.object()->GetDeviceRefData().id;
+ }
+
+ if (TrackedCallback::IsPending(open_callback_))
+ return PP_ERROR_INPROGRESS;
+ if (open_state_ != BEFORE_OPEN)
+ return PP_ERROR_FAILED;
+
+ if (!audio_output_callback)
+ return PP_ERROR_BADARGUMENT;
+ thunk::EnterResourceNoLock<thunk::PPB_AudioConfig_API> enter_config(config,
+ true);
+ if (enter_config.failed())
+ return PP_ERROR_BADARGUMENT;
+
+ config_ = config;
+ audio_output_callback_ = audio_output_callback;
+ user_data_ = user_data;
+ open_callback_ = callback;
+ bytes_per_second_ = kAudioOutputChannels * (kBitsPerAudioOutputSample / 8) *
+ enter_config.object()->GetSampleRate();
+ sample_frame_count_ = enter_config.object()->GetSampleFrameCount();
+
+ PpapiHostMsg_AudioOutput_Open msg(
+ device_id, enter_config.object()->GetSampleRate(),
+ enter_config.object()->GetSampleFrameCount());
+ Call<PpapiPluginMsg_AudioOutput_OpenReply>(
+ RENDERER, msg,
+ base::Bind(&AudioOutputResource::OnPluginMsgOpenReply,
+ base::Unretained(this)));
+ return PP_OK_COMPLETIONPENDING;
+}
+} // namespace proxy
+} // namespace ppapi
diff --git a/chromium/ppapi/proxy/audio_output_resource.h b/chromium/ppapi/proxy/audio_output_resource.h
new file mode 100644
index 00000000000..ee654e1c2e0
--- /dev/null
+++ b/chromium/ppapi/proxy/audio_output_resource.h
@@ -0,0 +1,149 @@
+// Copyright (c) 2017 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_AUDIO_OUTPUT_RESOURCE_H_
+#define PPAPI_PROXY_AUDIO_OUTPUT_RESOURCE_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <memory>
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/shared_memory.h"
+#include "base/sync_socket.h"
+#include "base/threading/simple_thread.h"
+#include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/proxy/device_enumeration_resource_helper.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
+#include "ppapi/thunk/ppb_audio_output_api.h"
+
+namespace media {
+class AudioBus;
+}
+
+namespace ppapi {
+namespace proxy {
+
+class ResourceMessageReplyParams;
+
+class AudioOutputResource : public PluginResource,
+ public thunk::PPB_AudioOutput_API,
+ public base::DelegateSimpleThread::Delegate {
+ public:
+ AudioOutputResource(Connection connection, PP_Instance instance);
+ ~AudioOutputResource() override;
+
+ // Resource overrides.
+ thunk::PPB_AudioOutput_API* AsPPB_AudioOutput_API() override;
+ void OnReplyReceived(const ResourceMessageReplyParams& params,
+ const IPC::Message& msg) override;
+
+ // PPB_AudioOutput_API implementation.
+ int32_t EnumerateDevices(const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) override;
+ int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+ void* user_data) override;
+ int32_t Open(PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioOutput_Callback audio_output_callback,
+ void* user_data,
+ scoped_refptr<TrackedCallback> callback) override;
+
+ PP_Resource GetCurrentConfig() override;
+
+ bool playing() const { return playing_; }
+
+ PP_Bool StartPlayback() override;
+ PP_Bool StopPlayback() override;
+ void Close() override;
+
+ protected:
+ // Resource override.
+ void LastPluginRefWasDeleted() override;
+
+ private:
+ enum OpenState { BEFORE_OPEN, OPENED, CLOSED };
+
+ void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params);
+
+ // Sets the shared memory and socket handles.
+ void SetStreamInfo(base::SharedMemoryHandle shared_memory_handle,
+ size_t shared_memory_size,
+ base::SyncSocket::Handle socket_handle);
+
+ // Starts execution of the audio output thread.
+ void StartThread();
+
+ // Stops execution of the audio output thread.
+ void StopThread();
+
+ // DelegateSimpleThread::Delegate implementation.
+ // Run on the audio output thread.
+ void Run() override;
+
+ int32_t CommonOpen(PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioOutput_Callback audio_output_callback,
+ void* user_data,
+ scoped_refptr<TrackedCallback> callback);
+
+ OpenState open_state_;
+
+ // True if playing the stream.
+ bool playing_;
+
+ // Socket used to notify us when new samples are available. This pointer is
+ // created in SetStreamInfo().
+ std::unique_ptr<base::CancelableSyncSocket> socket_;
+
+ // Sample buffer in shared memory. This pointer is created in
+ // SetStreamInfo(). The memory is only mapped when the audio thread is
+ // created.
+ std::unique_ptr<base::SharedMemory> shared_memory_;
+
+ // The size of the sample buffer in bytes.
+ size_t shared_memory_size_;
+
+ // When the callback is set, this thread is spawned for calling it.
+ std::unique_ptr<base::DelegateSimpleThread> audio_output_thread_;
+
+ // Callback to call when new samples are available.
+ PPB_AudioOutput_Callback audio_output_callback_;
+
+ // User data pointer passed verbatim to the callback function.
+ void* user_data_;
+
+ // The callback is not directly passed to OnPluginMsgOpenReply() because we
+ // would like to be able to cancel it early in Close().
+ scoped_refptr<TrackedCallback> open_callback_;
+
+ // Owning reference to the current config object. This isn't actually used,
+ // we just dish it out as requested by the plugin.
+ ScopedPPResource config_;
+
+ DeviceEnumerationResourceHelper enumeration_helper_;
+
+ // The data size (in bytes) of one second of audio output. Used to calculate
+ // latency.
+ size_t bytes_per_second_;
+
+ // AudioBus for shuttling data across the shared memory.
+ std::unique_ptr<media::AudioBus> audio_bus_;
+ int sample_frame_count_;
+
+ // Internal buffer for client's integer audio data.
+ int client_buffer_size_bytes_;
+ std::unique_ptr<uint8_t[]> client_buffer_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioOutputResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_AUDIO_OUTPUT_RESOURCE_H_
diff --git a/chromium/ppapi/proxy/dispatch_reply_message.h b/chromium/ppapi/proxy/dispatch_reply_message.h
index fc19adc9456..442320e067e 100644
--- a/chromium/ppapi/proxy/dispatch_reply_message.h
+++ b/chromium/ppapi/proxy/dispatch_reply_message.h
@@ -13,6 +13,7 @@
#include <tuple>
#include "base/callback.h"
+#include "base/tuple.h"
#include "ipc/ipc_message_macros.h"
#include "ppapi/c/pp_errors.h"
@@ -21,49 +22,50 @@ namespace proxy {
class ResourceMessageReplyParams;
-template <class ObjT, class Method>
-inline void DispatchResourceReply(ObjT* obj, Method method,
- const ResourceMessageReplyParams& params,
- const std::tuple<>& arg) {
- (obj->*method)(params);
+template <typename ObjT, typename Method, typename TupleType, size_t... indices>
+inline void DispatchResourceReplyImpl(ObjT* obj,
+ Method method,
+ const ResourceMessageReplyParams& params,
+ TupleType&& args_tuple,
+ base::IndexSequence<indices...>) {
+ (obj->*method)(params,
+ std::get<indices>(std::forward<TupleType>(args_tuple))...);
}
-template <class ObjT, class Method, class A>
-inline void DispatchResourceReply(ObjT* obj, Method method,
+// Runs |method| on |obj| with |params| and expanded |args_tuple|.
+// I.e. Followings are equivalent.
+// DispatchResourceReply(obj, &Obj::Method, params, std::tie(a, b, c));
+// obj->Method(params, a, b, c);
+template <typename ObjT, typename Method, typename TupleType>
+inline void DispatchResourceReply(ObjT* obj,
+ Method method,
const ResourceMessageReplyParams& params,
- const std::tuple<A>& arg) {
- (obj->*method)(params, std::get<0>(arg));
+ TupleType&& args_tuple) {
+ DispatchResourceReplyImpl(obj, method, params,
+ std::forward<TupleType>(args_tuple),
+ base::MakeIndexSequenceForTuple<TupleType>());
}
-template<class ObjT, class Method, class A, class B>
-inline void DispatchResourceReply(ObjT* obj, Method method,
- const ResourceMessageReplyParams& params,
- const std::tuple<A, B>& arg) {
- (obj->*method)(params, std::get<0>(arg), std::get<1>(arg));
+template <typename CallbackType, typename TupleType, size_t... indices>
+inline void DispatchResourceReplyImpl(CallbackType&& callback,
+ const ResourceMessageReplyParams& params,
+ TupleType&& args_tuple,
+ base::IndexSequence<indices...>) {
+ std::forward<CallbackType>(callback).Run(
+ params, std::get<indices>(std::forward<TupleType>(args_tuple))...);
}
-template<class ObjT, class Method, class A, class B, class C>
-inline void DispatchResourceReply(ObjT* obj, Method method,
+// Runs |callback| with |params| and expanded |args_tuple|.
+// I.e. Followings are equivalent.
+// DispatchResourceReply(callback, params, std::tie(a, b, c));
+// callback.Run(params, a, b, c);
+template <typename CallbackType, typename TupleType>
+inline void DispatchResourceReply(CallbackType&& callback,
const ResourceMessageReplyParams& params,
- const std::tuple<A, B, C>& arg) {
- (obj->*method)(params, std::get<0>(arg), std::get<1>(arg),
- std::get<2>(arg));
-}
-
-template<class ObjT, class Method, class A, class B, class C, class D>
-inline void DispatchResourceReply(ObjT* obj, Method method,
- const ResourceMessageReplyParams& params,
- const std::tuple<A, B, C, D>& arg) {
- (obj->*method)(params, std::get<0>(arg), std::get<1>(arg),
- std::get<2>(arg), std::get<3>(arg));
-}
-
-template<class ObjT, class Method, class A, class B, class C, class D, class E>
-inline void DispatchResourceReply(ObjT* obj, Method method,
- const ResourceMessageReplyParams& params,
- const std::tuple<A, B, C, D, E>& arg) {
- (obj->*method)(params, std::get<0>(arg), std::get<1>(arg),
- std::get<2>(arg), std::get<3>(arg), std::get<4>(arg));
+ TupleType&& args_tuple) {
+ DispatchResourceReplyImpl(std::forward<CallbackType>(callback), params,
+ std::forward<TupleType>(args_tuple),
+ base::MakeIndexSequenceForTuple<TupleType>());
}
// Used to dispatch resource replies. In most cases, you should not call this
@@ -119,18 +121,34 @@ void DispatchResourceReplyOrDefaultParams(
}
}
-// Template specialization for |Callback|s that only accept a
-// |ResourceMessageReplyParams|. In this case |msg| shouldn't contain any
-// arguments, so just call the |method| with the |reply_params|.
-template<class MsgClass, class Method>
+template <typename MsgClass, typename CallbackType>
void DispatchResourceReplyOrDefaultParams(
- base::Callback<void(const ResourceMessageReplyParams&)>* obj,
- Method method,
+ CallbackType&& callback,
const ResourceMessageReplyParams& reply_params,
const IPC::Message& msg) {
+ typename MsgClass::Schema::Param msg_params;
+ // We either expect the nested message type to match, or that there is no
+ // nested message. No nested message indicates a default reply sent from
+ // the host: when the resource message handler returns an error, a reply
+ // is implicitly sent with no nested message.
DCHECK(msg.type() == MsgClass::ID || msg.type() == 0)
<< "Resource reply message of unexpected type.";
- (obj->*method)(reply_params);
+ if (msg.type() == MsgClass::ID && MsgClass::Read(&msg, &msg_params)) {
+ // Message type matches and the parameters were successfully read.
+ DispatchResourceReply(std::forward<CallbackType>(callback), reply_params,
+ msg_params);
+ } else {
+ // The nested message is empty because the host handler didn't explicitly
+ // send a reply (likely), or you screwed up and didn't use the correct
+ // message type when calling this function (you should have hit the
+ // assertion above, Einstein).
+ //
+ // Dispatch the reply function with the default parameters. We explicitly
+ // use a new Params() structure since if the Read failed due to an invalid
+ // message, the params could have been partially filled in.
+ DispatchResourceReply(std::forward<CallbackType>(callback), reply_params,
+ typename MsgClass::Schema::Param());
+ }
}
// When using PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL* below, use this macro to
diff --git a/chromium/ppapi/proxy/interface_list.cc b/chromium/ppapi/proxy/interface_list.cc
index 07483d87f32..d14a9318c54 100644
--- a/chromium/ppapi/proxy/interface_list.cc
+++ b/chromium/ppapi/proxy/interface_list.cc
@@ -12,6 +12,7 @@
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "ppapi/c/dev/ppb_audio_input_dev.h"
+#include "ppapi/c/dev/ppb_audio_output_dev.h"
#include "ppapi/c/dev/ppb_buffer_dev.h"
#include "ppapi/c/dev/ppb_char_set_dev.h"
#include "ppapi/c/dev/ppb_crypto_dev.h"
@@ -168,7 +169,8 @@ InterfaceProxy* ProxyFactory(Dispatcher* dispatcher) {
return new ProxyClass(dispatcher);
}
-base::LazyInstance<PpapiPermissions> g_process_global_permissions;
+base::LazyInstance<PpapiPermissions>::DestructorAtExit
+ g_process_global_permissions;
} // namespace
diff --git a/chromium/ppapi/proxy/plugin_globals.cc b/chromium/ppapi/proxy/plugin_globals.cc
index f2ee4efa500..862031ae053 100644
--- a/chromium/ppapi/proxy/plugin_globals.cc
+++ b/chromium/ppapi/proxy/plugin_globals.cc
@@ -64,9 +64,6 @@ PluginGlobals::PluginGlobals(
resource_reply_thread_registrar_(
new ResourceReplyThreadRegistrar(GetMainThreadMessageLoop())),
udp_socket_filter_(new UDPSocketFilter()),
- plugin_recently_active_(false),
- keepalive_throttle_interval_milliseconds_(
- ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds),
weak_factory_(this) {
DCHECK(!plugin_globals_);
plugin_globals_ = this;
@@ -88,9 +85,6 @@ PluginGlobals::PluginGlobals(
ipc_task_runner_(ipc_task_runner),
resource_reply_thread_registrar_(
new ResourceReplyThreadRegistrar(GetMainThreadMessageLoop())),
- plugin_recently_active_(false),
- keepalive_throttle_interval_milliseconds_(
- kKeepaliveThrottleIntervalDefaultMilliseconds),
weak_factory_(this) {
DCHECK(!plugin_globals_);
}
@@ -185,22 +179,6 @@ base::TaskRunner* PluginGlobals::GetFileTaskRunner() {
return file_thread_->task_runner().get();
}
-void PluginGlobals::MarkPluginIsActive() {
- if (!plugin_recently_active_) {
- plugin_recently_active_ = true;
- if (!GetBrowserSender() || !base::ThreadTaskRunnerHandle::IsSet())
- return;
- GetBrowserSender()->Send(new PpapiHostMsg_Keepalive());
- DCHECK(keepalive_throttle_interval_milliseconds_);
- GetMainThreadMessageLoop()->PostDelayedTask(
- FROM_HERE,
- RunWhileLocked(base::Bind(&PluginGlobals::OnReleaseKeepaliveThrottle,
- weak_factory_.GetWeakPtr())),
- base::TimeDelta::FromMilliseconds(
- keepalive_throttle_interval_milliseconds_));
- }
-}
-
IPC::Sender* PluginGlobals::GetBrowserSender() {
// CAUTION: This function is called without the ProxyLock. See also
// InterfaceList::GetInterfaceForPPB.
@@ -251,18 +229,9 @@ void PluginGlobals::RegisterResourceMessageFilters(
plugin_filter->AddResourceMessageFilter(udp_socket_filter_.get());
}
-void PluginGlobals::set_keepalive_throttle_interval_milliseconds(unsigned i) {
- keepalive_throttle_interval_milliseconds_ = i;
-}
-
bool PluginGlobals::IsPluginGlobals() const {
return true;
}
-void PluginGlobals::OnReleaseKeepaliveThrottle() {
- ppapi::ProxyLock::AssertAcquiredDebugOnly();
- plugin_recently_active_ = false;
-}
-
} // namespace proxy
} // namespace ppapi
diff --git a/chromium/ppapi/proxy/plugin_globals.h b/chromium/ppapi/proxy/plugin_globals.h
index 2821ce7aca6..09ce0d6ba23 100644
--- a/chromium/ppapi/proxy/plugin_globals.h
+++ b/chromium/ppapi/proxy/plugin_globals.h
@@ -77,7 +77,6 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
const std::string& value) override;
MessageLoopShared* GetCurrentMessageLoop() override;
base::TaskRunner* GetFileTaskRunner() override;
- void MarkPluginIsActive() override;
// Returns the channel for sending to the browser.
IPC::Sender* GetBrowserSender();
@@ -149,20 +148,12 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
void RegisterResourceMessageFilters(
ppapi::proxy::PluginMessageFilter* plugin_filter);
- // Interval to limit how many IPC messages are sent indicating that the plugin
- // is active and should be kept alive. The value must be smaller than any
- // threshold used to kill inactive plugins by the embedder host.
- void set_keepalive_throttle_interval_milliseconds(unsigned i);
-
private:
class BrowserSender;
// PpapiGlobals overrides.
bool IsPluginGlobals() const override;
- // Locks the proxy lock and releases the throttle on keepalive IPC messages.
- void OnReleaseKeepaliveThrottle();
-
static PluginGlobals* plugin_globals_;
PluginProxyDelegate* plugin_proxy_delegate_;
@@ -195,14 +186,6 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
scoped_refptr<UDPSocketFilter> udp_socket_filter_;
- // Indicates activity by the plugin. Used to monitor when a plugin can be
- // shutdown due to idleness. Current needs do not require differentiating
- // between idle state between multiple instances, if any are active they are
- // all considered active.
- bool plugin_recently_active_;
-
- unsigned keepalive_throttle_interval_milliseconds_;
-
// Member variables should appear before the WeakPtrFactory, see weak_ptr.h.
base::WeakPtrFactory<PluginGlobals> weak_factory_;
diff --git a/chromium/ppapi/proxy/plugin_resource_callback.h b/chromium/ppapi/proxy/plugin_resource_callback.h
index ecde1c2cd82..0e67b73bdda 100644
--- a/chromium/ppapi/proxy/plugin_resource_callback.h
+++ b/chromium/ppapi/proxy/plugin_resource_callback.h
@@ -36,8 +36,8 @@ class PluginResourceCallback : public PluginResourceCallbackBase {
void Run(
const ResourceMessageReplyParams& reply_params,
const IPC::Message& msg) override {
- DispatchResourceReplyOrDefaultParams<MsgClass>(
- &callback_, &CallbackType::Run, reply_params, msg);
+ DispatchResourceReplyOrDefaultParams<MsgClass>(callback_, reply_params,
+ msg);
}
private:
diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc
index 8a5d0622a70..dab3a5861be 100644
--- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc
+++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc
@@ -214,8 +214,13 @@ void PpapiCommandBufferProxy::SignalSyncToken(const gpu::SyncToken& sync_token,
NOTIMPLEMENTED();
}
+void PpapiCommandBufferProxy::WaitSyncTokenHint(
+ const gpu::SyncToken& sync_token) {
+ // TODO(sunnyps): Forward sync token dependency hints to the renderer.
+}
+
bool PpapiCommandBufferProxy::CanWaitUnverifiedSyncToken(
- const gpu::SyncToken* sync_token) {
+ const gpu::SyncToken& sync_token) {
return false;
}
diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h
index 5f43ed4d88e..af1bfa42ef5 100644
--- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h
+++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -71,7 +71,8 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer,
bool IsFenceSyncReleased(uint64_t release) override;
void SignalSyncToken(const gpu::SyncToken& sync_token,
const base::Closure& callback) override;
- bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override;
+ void WaitSyncTokenHint(const gpu::SyncToken& sync_token) override;
+ bool CanWaitUnverifiedSyncToken(const gpu::SyncToken& sync_token) override;
int32_t GetExtraCommandBufferData() const override;
private:
diff --git a/chromium/ppapi/proxy/ppapi_messages.h b/chromium/ppapi/proxy/ppapi_messages.h
index 36d6d8730fa..39bcec7312a 100644
--- a/chromium/ppapi/proxy/ppapi_messages.h
+++ b/chromium/ppapi/proxy/ppapi_messages.h
@@ -474,7 +474,6 @@ IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(ppapi::PpapiNaClPluginArgs)
IPC_STRUCT_TRAITS_MEMBER(off_the_record)
IPC_STRUCT_TRAITS_MEMBER(permissions)
- IPC_STRUCT_TRAITS_MEMBER(keepalive_throttle_interval_milliseconds)
IPC_STRUCT_TRAITS_MEMBER(switch_names)
IPC_STRUCT_TRAITS_MEMBER(switch_values)
IPC_STRUCT_TRAITS_END()
@@ -963,10 +962,7 @@ IPC_SYNC_MESSAGE_CONTROL2_1(PpapiMsg_PnaclTranslatorLink,
/* success status result */
bool)
-// Reports to the browser that a plugin has been active.
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_Keepalive)
-// -----------------------------------------------------------------------------
// These are from the plugin to the renderer.
// Reply to PpapiMsg_CreateChannel. The handle will be NULL if the channel
@@ -2250,6 +2246,18 @@ IPC_MESSAGE_CONTROL0(PpapiPluginMsg_AudioInput_OpenReply)
IPC_MESSAGE_CONTROL1(PpapiHostMsg_AudioInput_StartOrStop, bool /* capture */)
IPC_MESSAGE_CONTROL0(PpapiHostMsg_AudioInput_Close)
+// Audio output.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_AudioOutput_Create)
+IPC_MESSAGE_CONTROL3(PpapiHostMsg_AudioOutput_Open,
+ std::string /* device_id */,
+ PP_AudioSampleRate /* sample_rate */,
+ uint32_t /* sample_frame_count */)
+// Reply to an Open call. This supplies a socket handle and a shared memory
+// handle. Both handles are passed in the ReplyParams struct.
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_AudioOutput_OpenReply)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_AudioOutput_StartOrStop, bool /* playback */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_AudioOutput_Close)
+
// BrowserFont -----------------------------------------------------------------
IPC_MESSAGE_CONTROL0(PpapiHostMsg_BrowserFontSingleton_Create)
diff --git a/chromium/ppapi/proxy/resource_creation_proxy.cc b/chromium/ppapi/proxy/resource_creation_proxy.cc
index 1c79bc5cf62..0e414285882 100644
--- a/chromium/ppapi/proxy/resource_creation_proxy.cc
+++ b/chromium/ppapi/proxy/resource_creation_proxy.cc
@@ -9,6 +9,7 @@
#include "ppapi/c/pp_size.h"
#include "ppapi/proxy/audio_encoder_resource.h"
#include "ppapi/proxy/audio_input_resource.h"
+#include "ppapi/proxy/audio_output_resource.h"
#include "ppapi/proxy/camera_device_resource.h"
#include "ppapi/proxy/compositor_resource.h"
#include "ppapi/proxy/connection.h"
@@ -429,6 +430,10 @@ PP_Resource ResourceCreationProxy::CreateAudioInput(
return (new AudioInputResource(GetConnection(), instance))->GetReference();
}
+PP_Resource ResourceCreationProxy::CreateAudioOutput(PP_Instance instance) {
+ return (new AudioOutputResource(GetConnection(), instance))->GetReference();
+}
+
PP_Resource ResourceCreationProxy::CreateBroker(PP_Instance instance) {
return PPB_Broker_Proxy::CreateProxyResource(instance);
}
diff --git a/chromium/ppapi/proxy/resource_creation_proxy.h b/chromium/ppapi/proxy/resource_creation_proxy.h
index b7b0c31381f..f83c53d9667 100644
--- a/chromium/ppapi/proxy/resource_creation_proxy.h
+++ b/chromium/ppapi/proxy/resource_creation_proxy.h
@@ -163,6 +163,7 @@ class ResourceCreationProxy : public InterfaceProxy,
PP_Resource CreateX509CertificatePrivate(PP_Instance instance) override;
#if !defined(OS_NACL)
PP_Resource CreateAudioInput(PP_Instance instance) override;
+ PP_Resource CreateAudioOutput(PP_Instance instance) override;
PP_Resource CreateBroker(PP_Instance instance) override;
PP_Resource CreateBrowserFont(
PP_Instance instance,
diff --git a/chromium/ppapi/proxy/tcp_socket_resource_base.cc b/chromium/ppapi/proxy/tcp_socket_resource_base.cc
index 2ec45c25f4f..356a43e22db 100644
--- a/chromium/ppapi/proxy/tcp_socket_resource_base.cc
+++ b/chromium/ppapi/proxy/tcp_socket_resource_base.cc
@@ -207,7 +207,8 @@ int32_t TCPSocketResourceBase::ReadImpl(
return PP_ERROR_INPROGRESS;
read_buffer_ = buffer;
bytes_to_read_ =
- std::min(bytes_to_read, TCPSocketResourceConstants::kMaxReadSize);
+ std::min(bytes_to_read,
+ static_cast<int32_t>(TCPSocketResourceConstants::kMaxReadSize));
read_callback_ = callback;
Call<PpapiPluginMsg_TCPSocket_ReadReply>(
diff --git a/chromium/ppapi/proxy/tcp_socket_resource_constants.cc b/chromium/ppapi/proxy/tcp_socket_resource_constants.cc
deleted file mode 100644
index 49fb59f0030..00000000000
--- a/chromium/ppapi/proxy/tcp_socket_resource_constants.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2017 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/tcp_socket_resource_constants.h"
-
-namespace ppapi {
-namespace proxy {
-
-const int32_t TCPSocketResourceConstants::kMaxReadSize = 1024 * 1024;
-const int32_t TCPSocketResourceConstants::kMaxWriteSize = 1024 * 1024;
-const int32_t TCPSocketResourceConstants::kMaxSendBufferSize =
- 1024 * TCPSocketResourceConstants::kMaxWriteSize;
-const int32_t TCPSocketResourceConstants::kMaxReceiveBufferSize =
- 1024 * TCPSocketResourceConstants::kMaxReadSize;
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/chromium/ppapi/proxy/tcp_socket_resource_constants.h b/chromium/ppapi/proxy/tcp_socket_resource_constants.h
index 9c5833a7a87..d9d08b0412c 100644
--- a/chromium/ppapi/proxy/tcp_socket_resource_constants.h
+++ b/chromium/ppapi/proxy/tcp_socket_resource_constants.h
@@ -5,30 +5,29 @@
#include <stdint.h>
#include "base/macros.h"
-#include "ppapi/proxy/ppapi_proxy_export.h"
namespace ppapi {
namespace proxy {
-class PPAPI_PROXY_EXPORT TCPSocketResourceConstants {
+class TCPSocketResourceConstants {
public:
// The maximum number of bytes that each PpapiHostMsg_PPBTCPSocket_Read
// message is allowed to request.
- static const int32_t kMaxReadSize;
+ enum { kMaxReadSize = 1024 * 1024 };
// The maximum number of bytes that each PpapiHostMsg_PPBTCPSocket_Write
// message is allowed to carry.
- static const int32_t kMaxWriteSize;
+ enum { kMaxWriteSize = 1024 * 1024 };
// The maximum number that we allow for setting
// PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE. This number is only for input
// argument sanity check, it doesn't mean the browser guarantees to support
// such a buffer size.
- static const int32_t kMaxSendBufferSize;
+ enum { kMaxSendBufferSize = 1024 * kMaxWriteSize };
// The maximum number that we allow for setting
// PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE. This number is only for input
// argument sanity check, it doesn't mean the browser guarantees to support
// such a buffer size.
- static const int32_t kMaxReceiveBufferSize;
+ enum { kMaxReceiveBufferSize = 1024 * kMaxReadSize };
private:
DISALLOW_COPY_AND_ASSIGN(TCPSocketResourceConstants);
diff --git a/chromium/ppapi/proxy/udp_socket_filter.cc b/chromium/ppapi/proxy/udp_socket_filter.cc
index 85cab054613..119b4e49971 100644
--- a/chromium/ppapi/proxy/udp_socket_filter.cc
+++ b/chromium/ppapi/proxy/udp_socket_filter.cc
@@ -153,7 +153,8 @@ void UDPSocketFilter::RecvQueue::DataReceivedOnIOThread(
const PP_NetAddress_Private& addr) {
DCHECK(PluginGlobals::Get()->ipc_task_runner()->RunsTasksOnCurrentThread());
DCHECK_LT(recv_buffers_.size(),
- UDPSocketResourceConstants::kPluginReceiveBufferSlots);
+ static_cast<size_t>(
+ UDPSocketResourceConstants::kPluginReceiveBufferSlots));
if (!TrackedCallback::IsPending(recvfrom_callback_) || !read_buffer_) {
recv_buffers_.push(RecvBuffer());
@@ -213,8 +214,9 @@ int32_t UDPSocketFilter::RecvQueue::RequestData(
if (recv_buffers_.empty()) {
read_buffer_ = buffer_out;
- bytes_to_read_ =
- std::min(num_bytes, UDPSocketResourceConstants::kMaxReadSize);
+ bytes_to_read_ = std::min(
+ num_bytes,
+ static_cast<int32_t>(UDPSocketResourceConstants::kMaxReadSize));
recvfrom_addr_resource_ = addr_out;
recvfrom_callback_ = callback;
return PP_OK_COMPLETIONPENDING;
diff --git a/chromium/ppapi/proxy/udp_socket_resource_constants.cc b/chromium/ppapi/proxy/udp_socket_resource_constants.cc
deleted file mode 100644
index 3f4f1296989..00000000000
--- a/chromium/ppapi/proxy/udp_socket_resource_constants.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 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/udp_socket_resource_constants.h"
-
-namespace ppapi {
-namespace proxy {
-
-const int32_t UDPSocketResourceConstants::kMaxWriteSize = 128 * 1024;
-const int32_t UDPSocketResourceConstants::kMaxReadSize = 128 * 1024;
-
-const int32_t UDPSocketResourceConstants::kMaxSendBufferSize =
- 1024 * UDPSocketResourceConstants::kMaxWriteSize;
-const int32_t UDPSocketResourceConstants::kMaxReceiveBufferSize =
- 1024 * UDPSocketResourceConstants::kMaxReadSize;
-
-const size_t UDPSocketResourceConstants::kPluginSendBufferSlots = 8u;
-const size_t UDPSocketResourceConstants::kPluginReceiveBufferSlots = 32u;
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/chromium/ppapi/proxy/udp_socket_resource_constants.h b/chromium/ppapi/proxy/udp_socket_resource_constants.h
index e9dd953c2df..e3f8f22ff15 100644
--- a/chromium/ppapi/proxy/udp_socket_resource_constants.h
+++ b/chromium/ppapi/proxy/udp_socket_resource_constants.h
@@ -5,37 +5,36 @@
#include <stdint.h>
#include "base/macros.h"
-#include "ppapi/proxy/ppapi_proxy_export.h"
namespace ppapi {
namespace proxy {
-class PPAPI_PROXY_EXPORT UDPSocketResourceConstants {
+class UDPSocketResourceConstants {
public:
// The maximum number of bytes that each
// PpapiPluginMsg_PPBUDPSocket_PushRecvResult message is allowed to carry.
- static const int32_t kMaxReadSize;
+ enum { kMaxReadSize = 128 * 1024 };
// The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_SendTo
// message is allowed to carry.
- static const int32_t kMaxWriteSize;
+ enum { kMaxWriteSize = 128 * 1024 };
// The maximum number that we allow for setting
// PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE. This number is only for input
// argument sanity check, it doesn't mean the browser guarantees to support
// such a buffer size.
- static const int32_t kMaxSendBufferSize;
+ enum { kMaxSendBufferSize = 1024 * kMaxWriteSize };
// The maximum number that we allow for setting
// PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE. This number is only for input
// argument sanity check, it doesn't mean the browser guarantees to support
// such a buffer size.
- static const int32_t kMaxReceiveBufferSize;
+ enum { kMaxReceiveBufferSize = 1024 * kMaxReadSize };
// The maximum number of received packets that we allow instances of this
// class to buffer.
- static const size_t kPluginReceiveBufferSlots;
+ enum { kPluginReceiveBufferSlots = 32u };
// The maximum number of buffers that we allow instances of this class to be
// sending before we block the plugin.
- static const size_t kPluginSendBufferSlots;
+ enum { kPluginSendBufferSlots = 8u };
private:
DISALLOW_COPY_AND_ASSIGN(UDPSocketResourceConstants);
diff --git a/chromium/ppapi/shared_impl/api_id.h b/chromium/ppapi/shared_impl/api_id.h
index a049948522e..ff8511d89da 100644
--- a/chromium/ppapi/shared_impl/api_id.h
+++ b/chromium/ppapi/shared_impl/api_id.h
@@ -15,6 +15,7 @@ enum ApiID {
API_ID_PPB_AUDIO = 1,
API_ID_PPB_AUDIO_CONFIG,
API_ID_PPB_AUDIO_INPUT_DEV,
+ API_ID_PPB_AUDIO_OUTPUT_DEV,
API_ID_PPB_BROKER,
API_ID_PPB_BUFFER,
API_ID_PPB_CONTEXT_3D,
diff --git a/chromium/ppapi/shared_impl/ppapi_constants.h b/chromium/ppapi/shared_impl/ppapi_constants.h
index c26d9a7d01e..6fdb00e45dc 100644
--- a/chromium/ppapi/shared_impl/ppapi_constants.h
+++ b/chromium/ppapi/shared_impl/ppapi_constants.h
@@ -10,11 +10,6 @@
namespace ppapi {
-// Default interval to space out IPC messages sent indicating that a plugin is
-// active and should be kept alive. The value must be smaller than any threshold
-// used to kill inactive plugins by the embedder host.
-const unsigned kKeepaliveThrottleIntervalDefaultMilliseconds = 5000;
-
#if defined(OS_WIN)
const char kPowerSaverTestPluginName[] = "power_saver_test_plugin.dll";
#elif defined(OS_MACOSX)
diff --git a/chromium/ppapi/shared_impl/ppapi_globals.cc b/chromium/ppapi/shared_impl/ppapi_globals.cc
index b016c9c3712..5a93ad61d63 100644
--- a/chromium/ppapi/shared_impl/ppapi_globals.cc
+++ b/chromium/ppapi/shared_impl/ppapi_globals.cc
@@ -15,7 +15,7 @@ namespace ppapi {
namespace {
// Thread-local globals for testing. See SetPpapiGlobalsOnThreadForTest for more
// information.
-base::LazyInstance<base::ThreadLocalPointer<PpapiGlobals> >::Leaky
+base::LazyInstance<base::ThreadLocalPointer<PpapiGlobals>>::Leaky
tls_ppapi_globals_for_test = LAZY_INSTANCE_INITIALIZER;
} // namespace
@@ -66,8 +66,6 @@ bool PpapiGlobals::IsHostGlobals() const { return false; }
bool PpapiGlobals::IsPluginGlobals() const { return false; }
-void PpapiGlobals::MarkPluginIsActive() {}
-
// static
PpapiGlobals* PpapiGlobals::GetThreadLocalPointer() {
return tls_ppapi_globals_for_test.Pointer()->Get();
diff --git a/chromium/ppapi/shared_impl/ppapi_globals.h b/chromium/ppapi/shared_impl/ppapi_globals.h
index f069ab06592..3dcc901fa77 100644
--- a/chromium/ppapi/shared_impl/ppapi_globals.h
+++ b/chromium/ppapi/shared_impl/ppapi_globals.h
@@ -128,12 +128,6 @@ class PPAPI_SHARED_EXPORT PpapiGlobals {
virtual bool IsHostGlobals() const;
virtual bool IsPluginGlobals() const;
- // Records that the plugin is active. The plugin reports that it is active to
- // containers that monitor and shutdown idle content such as background apps.
- // This method only has an effect on the plugin process, calls from the
- // renderer process will have no effect.
- virtual void MarkPluginIsActive();
-
private:
// Return the thread-local pointer which is used only for unit testing. It
// should always be NULL when running in production. It allows separate
diff --git a/chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.cc b/chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.cc
index 4dd511040c4..c30470b14cd 100644
--- a/chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.cc
+++ b/chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.cc
@@ -10,10 +10,7 @@ namespace ppapi {
// We must provide explicit definitions of these functions for builds on
// Windows.
PpapiNaClPluginArgs::PpapiNaClPluginArgs()
- : off_the_record(false),
- supports_dev_channel(false),
- keepalive_throttle_interval_milliseconds(
- kKeepaliveThrottleIntervalDefaultMilliseconds) {}
+ : off_the_record(false), supports_dev_channel(false) {}
PpapiNaClPluginArgs::~PpapiNaClPluginArgs() {}
diff --git a/chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.h b/chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.h
index 993131d3b09..2f18c8e025d 100644
--- a/chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.h
+++ b/chromium/ppapi/shared_impl/ppapi_nacl_plugin_args.h
@@ -20,7 +20,6 @@ struct PPAPI_SHARED_EXPORT PpapiNaClPluginArgs {
bool off_the_record;
PpapiPermissions permissions;
bool supports_dev_channel;
- unsigned keepalive_throttle_interval_milliseconds;
// Switches from the command-line.
std::vector<std::string> switch_names;
diff --git a/chromium/ppapi/shared_impl/proxy_lock.h b/chromium/ppapi/shared_impl/proxy_lock.h
index 366504eeb9a..66a5688f334 100644
--- a/chromium/ppapi/shared_impl/proxy_lock.h
+++ b/chromium/ppapi/shared_impl/proxy_lock.h
@@ -191,6 +191,12 @@ class RunWhileLockedHelper<void()> {
// is destroyed on the same thread (see the comments in the destructor).
DCHECK(ptr->thread_checker_.CalledOnValidThread());
ProxyAutoLock lock;
+
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // |lock| above protects the access to Resource instances.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
+
{
// Use a scope and local Callback to ensure that the callback is cleared
// before the lock is released, even in the unlikely event that Run()
@@ -222,6 +228,12 @@ class RunWhileLockedHelper<void()> {
// call the ResourceTracker and also the Resource's destructor, which
// both require the ProxyLock.
ProxyAutoLock lock;
+
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // |lock| above protects the access to Resource instances.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
+
callback_.reset();
}
}
@@ -246,6 +258,10 @@ class RunWhileLockedHelper<void(P1)> {
P1 p1) {
DCHECK(ptr->thread_checker_.CalledOnValidThread());
ProxyAutoLock lock;
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // |lock| above protects the access to Resource instances.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
{
std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
temp_callback->Run(p1);
@@ -255,6 +271,10 @@ class RunWhileLockedHelper<void(P1)> {
DCHECK(thread_checker_.CalledOnValidThread());
if (callback_) {
ProxyAutoLock lock;
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // |lock| above protects the access to Resource instances.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
callback_.reset();
}
}
@@ -278,6 +298,10 @@ class RunWhileLockedHelper<void(P1, P2)> {
P2 p2) {
DCHECK(ptr->thread_checker_.CalledOnValidThread());
ProxyAutoLock lock;
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // |lock| above protects the access to Resource instances.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
{
std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
temp_callback->Run(p1, p2);
@@ -287,6 +311,10 @@ class RunWhileLockedHelper<void(P1, P2)> {
DCHECK(thread_checker_.CalledOnValidThread());
if (callback_) {
ProxyAutoLock lock;
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // |lock| above protects the access to Resource instances.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
callback_.reset();
}
}
@@ -311,6 +339,10 @@ class RunWhileLockedHelper<void(P1, P2, P3)> {
P3 p3) {
DCHECK(ptr->thread_checker_.CalledOnValidThread());
ProxyAutoLock lock;
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // |lock| above protects the access to Resource instances.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
{
std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
temp_callback->Run(p1, p2, p3);
@@ -320,6 +352,10 @@ class RunWhileLockedHelper<void(P1, P2, P3)> {
DCHECK(thread_checker_.CalledOnValidThread());
if (callback_) {
ProxyAutoLock lock;
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // |lock| above protects the access to Resource instances.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
callback_.reset();
}
}
diff --git a/chromium/ppapi/shared_impl/resource.h b/chromium/ppapi/shared_impl/resource.h
index 8d30ed46d06..687f9615f85 100644
--- a/chromium/ppapi/shared_impl/resource.h
+++ b/chromium/ppapi/shared_impl/resource.h
@@ -24,6 +24,7 @@
F(PPB_AudioConfig_API) \
F(PPB_AudioEncoder_API) \
F(PPB_AudioInput_API) \
+ F(PPB_AudioOutput_API) \
F(PPB_AudioTrusted_API) \
F(PPB_Broker_API) \
F(PPB_Broker_Instance_API) \
diff --git a/chromium/ppapi/shared_impl/tracked_callback.cc b/chromium/ppapi/shared_impl/tracked_callback.cc
index 8a689dd1d65..8c38c6241c1 100644
--- a/chromium/ppapi/shared_impl/tracked_callback.cc
+++ b/chromium/ppapi/shared_impl/tracked_callback.cc
@@ -228,6 +228,11 @@ void TrackedCallback::MarkAsCompletedWithLock() {
if (resource_id_)
tracker_->Remove(thiz);
tracker_ = NULL;
+
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // |lock_| protects the access to Resource instances.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
target_loop_ = NULL;
}
diff --git a/chromium/ppapi/thunk/BUILD.gn b/chromium/ppapi/thunk/BUILD.gn
index 258e0446494..44ef7d05ecd 100644
--- a/chromium/ppapi/thunk/BUILD.gn
+++ b/chromium/ppapi/thunk/BUILD.gn
@@ -12,6 +12,16 @@ source_set("thunk") {
sources = [
"enter.cc",
"enter.h",
+ "interfaces_legacy.h",
+ "interfaces_postamble.h",
+ "interfaces_ppb_private.h",
+ "interfaces_ppb_private_flash.h",
+ "interfaces_ppb_private_no_permissions.h",
+ "interfaces_ppb_public_dev.h",
+ "interfaces_ppb_public_dev_channel.h",
+ "interfaces_ppb_public_stable.h",
+ "interfaces_preamble.h",
+ "ppapi_thunk_export.h",
"ppb_audio_api.h",
"ppb_audio_buffer_api.h",
"ppb_audio_buffer_thunk.cc",
@@ -20,8 +30,10 @@ source_set("thunk") {
"ppb_audio_encoder_api.h",
"ppb_audio_encoder_thunk.cc",
"ppb_audio_input_api.h",
+ "ppb_audio_output_api.h",
"ppb_audio_thunk.cc",
"ppb_broker_api.h",
+ "ppb_browser_font_singleton_api.h",
"ppb_browser_font_trusted_api.h",
"ppb_buffer_api.h",
"ppb_camera_capabilities_api.h",
@@ -50,6 +62,7 @@ source_set("thunk") {
"ppb_find_private_thunk.cc",
"ppb_flash_clipboard_api.h",
"ppb_flash_drm_api.h",
+ "ppb_flash_file_api.h",
"ppb_flash_font_file_api.h",
"ppb_flash_fullscreen_api.h",
"ppb_flash_functions_api.h",
@@ -144,12 +157,14 @@ source_set("thunk") {
"ppb_websocket_thunk.cc",
"ppb_x509_certificate_private_api.h",
"ppb_x509_certificate_private_thunk.cc",
+ "resource_creation_api.h",
"thunk.h",
]
if (!is_nacl) {
sources += [
"ppb_audio_input_dev_thunk.cc",
+ "ppb_audio_output_dev_thunk.cc",
"ppb_broker_thunk.cc",
"ppb_browser_font_trusted_thunk.cc",
"ppb_buffer_thunk.cc",
diff --git a/chromium/ppapi/thunk/enter.cc b/chromium/ppapi/thunk/enter.cc
index a98a3ec3102..84cfc5bb743 100644
--- a/chromium/ppapi/thunk/enter.cc
+++ b/chromium/ppapi/thunk/enter.cc
@@ -9,7 +9,6 @@
#include "base/message_loop/message_loop.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h"
-#include "ppapi/c/pp_errors.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/ppb_instance_api.h"
@@ -35,53 +34,39 @@ namespace thunk {
namespace subtle {
-EnterBase::EnterBase()
- : resource_(NULL),
- retval_(PP_OK) {
- PpapiGlobals::Get()->MarkPluginIsActive();
-}
+EnterBase::EnterBase() {}
-EnterBase::EnterBase(PP_Resource resource)
- : resource_(GetResource(resource)),
- retval_(PP_OK) {
- PpapiGlobals::Get()->MarkPluginIsActive();
-}
+EnterBase::EnterBase(PP_Resource resource) : resource_(GetResource(resource)) {}
EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id)
- : resource_(GetSingletonResource(instance, resource_id)),
- retval_(PP_OK) {
- PpapiGlobals::Get()->MarkPluginIsActive();
+ : resource_(GetSingletonResource(instance, resource_id)) {
+ if (!resource_)
+ retval_ = PP_ERROR_BADARGUMENT;
}
EnterBase::EnterBase(PP_Resource resource,
const PP_CompletionCallback& callback)
- : resource_(GetResource(resource)),
- retval_(PP_OK) {
+ : EnterBase(resource) {
callback_ = new TrackedCallback(resource_, callback);
- PpapiGlobals::Get()->MarkPluginIsActive();
}
-EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id,
+EnterBase::EnterBase(PP_Instance instance,
+ SingletonResourceID resource_id,
const PP_CompletionCallback& callback)
- : resource_(GetSingletonResource(instance, resource_id)),
- retval_(PP_OK) {
- if (!resource_)
- retval_ = PP_ERROR_BADARGUMENT;
+ : EnterBase(instance, resource_id) {
callback_ = new TrackedCallback(resource_, callback);
- PpapiGlobals::Get()->MarkPluginIsActive();
}
EnterBase::~EnterBase() {
// callback_ is cleared any time it is run, scheduled to be run, or once we
// know it will be completed asynchronously. So by this point it should be
- // NULL.
- DCHECK(!callback_.get())
- << "|callback_| is not NULL. Did you forget to call "
- "|EnterBase::SetResult| in the interface's thunk?";
+ // null.
+ DCHECK(!callback_) << "|callback_| is not null. Did you forget to call "
+ "|EnterBase::SetResult| in the interface's thunk?";
}
int32_t EnterBase::SetResult(int32_t result) {
- if (!callback_.get()) {
+ if (!callback_) {
// It doesn't make sense to call SetResult if there is no callback.
NOTREACHED();
retval_ = result;
@@ -110,7 +95,7 @@ int32_t EnterBase::SetResult(int32_t result) {
retval_ = result;
}
}
- callback_ = NULL;
+ callback_ = nullptr;
return retval_;
}
@@ -125,7 +110,7 @@ Resource* EnterBase::GetSingletonResource(PP_Instance instance,
PPB_Instance_API* ppb_instance =
PpapiGlobals::Get()->GetInstanceAPI(instance);
if (!ppb_instance)
- return NULL;
+ return nullptr;
return ppb_instance->GetSingletonResource(instance, resource_id);
}
@@ -135,11 +120,11 @@ void EnterBase::SetStateForCallbackError(bool report_error) {
// In-process plugins can't make PPAPI calls off the main thread.
CHECK(IsMainThread());
}
- if (callback_.get()) {
+ if (callback_) {
if (callback_->is_blocking() && IsMainThread()) {
// Blocking callbacks are never allowed on the main thread.
callback_->MarkAsCompleted();
- callback_ = NULL;
+ callback_ = nullptr;
retval_ = PP_ERROR_BLOCKS_MAIN_THREAD;
if (report_error) {
std::string message(
@@ -151,7 +136,7 @@ void EnterBase::SetStateForCallbackError(bool report_error) {
CurrentThreadHandlingBlockingMessage()) {
// Blocking callbacks are not allowed while handling a blocking message.
callback_->MarkAsCompleted();
- callback_ = NULL;
+ callback_ = nullptr;
retval_ = PP_ERROR_WOULD_BLOCK_THREAD;
if (report_error) {
std::string message("Blocking callbacks are not allowed while handling "
@@ -179,7 +164,7 @@ void EnterBase::SetStateForCallbackError(bool report_error) {
}
callback_->MarkAsCompleted();
- callback_ = NULL;
+ callback_ = nullptr;
retval_ = PP_ERROR_NO_MESSAGE_LOOP;
if (report_error) {
std::string message(
@@ -192,7 +177,7 @@ void EnterBase::SetStateForCallbackError(bool report_error) {
}
void EnterBase::ClearCallback() {
- callback_ = NULL;
+ callback_ = nullptr;
}
void EnterBase::SetStateForResourceError(PP_Resource pp_resource,
@@ -208,14 +193,14 @@ void EnterBase::SetStateForResourceError(PP_Resource pp_resource,
if (object)
return; // Everything worked.
- if (callback_.get() && callback_->is_required()) {
+ if (callback_ && callback_->is_required()) {
callback_->PostRun(static_cast<int32_t>(PP_ERROR_BADRESOURCE));
- callback_ = NULL;
+ callback_ = nullptr;
retval_ = PP_OK_COMPLETIONPENDING;
} else {
- if (callback_.get())
+ if (callback_)
callback_->MarkAsCompleted();
- callback_ = NULL;
+ callback_ = nullptr;
retval_ = PP_ERROR_BADRESOURCE;
}
@@ -250,14 +235,14 @@ void EnterBase::SetStateForFunctionError(PP_Instance pp_instance,
if (object)
return; // Everything worked.
- if (callback_.get() && callback_->is_required()) {
+ if (callback_ && callback_->is_required()) {
callback_->PostRun(static_cast<int32_t>(PP_ERROR_BADARGUMENT));
- callback_ = NULL;
+ callback_ = nullptr;
retval_ = PP_OK_COMPLETIONPENDING;
} else {
- if (callback_.get())
+ if (callback_)
callback_->MarkAsCompleted();
- callback_ = NULL;
+ callback_ = nullptr;
retval_ = PP_ERROR_BADARGUMENT;
}
diff --git a/chromium/ppapi/thunk/enter.h b/chromium/ppapi/thunk/enter.h
index 307b44691f0..041a2dd5883 100644
--- a/chromium/ppapi/thunk/enter.h
+++ b/chromium/ppapi/thunk/enter.h
@@ -148,8 +148,8 @@ class PPAPI_THUNK_EXPORT EnterBase {
// For Enter objects that need a resource, we'll store a pointer to the
// Resource object so that we don't need to look it up more than once. For
- // Enter objects with no resource, this will be NULL.
- Resource* resource_;
+ // Enter objects with no resource, this will be null.
+ Resource* resource_ = nullptr;
private:
bool CallbackIsValid() const;
@@ -161,10 +161,10 @@ class PPAPI_THUNK_EXPORT EnterBase {
void SetStateForCallbackError(bool report_error);
// Holds the callback. For Enter objects that aren't given a callback, this
- // will be NULL.
+ // will be null.
scoped_refptr<TrackedCallback> callback_;
- int32_t retval_;
+ int32_t retval_ = PP_OK;
};
} // namespace subtle
@@ -195,7 +195,7 @@ class EnterResource
if (resource_)
object_ = resource_->GetAs<ResourceT>();
else
- object_ = NULL;
+ object_ = nullptr;
// Validate the resource (note, if both are wrong, we will return
// PP_ERROR_BADRESOURCE; last in wins).
SetStateForResourceError(resource, resource_, object_, report_error);
@@ -265,16 +265,13 @@ class EnterInstanceAPI
public subtle::EnterBase {
public:
explicit EnterInstanceAPI(PP_Instance instance)
- : EnterBase(instance, ApiT::kSingletonResourceID),
- functions_(NULL) {
+ : EnterBase(instance, ApiT::kSingletonResourceID) {
if (resource_)
functions_ = resource_->GetAs<ApiT>();
SetStateForFunctionError(instance, functions_, true);
}
- EnterInstanceAPI(PP_Instance instance,
- const PP_CompletionCallback& callback)
- : EnterBase(instance, ApiT::kSingletonResourceID, callback),
- functions_(NULL) {
+ EnterInstanceAPI(PP_Instance instance, const PP_CompletionCallback& callback)
+ : EnterBase(instance, ApiT::kSingletonResourceID, callback) {
if (resource_)
functions_ = resource_->GetAs<ApiT>();
SetStateForFunctionError(instance, functions_, true);
@@ -287,7 +284,7 @@ class EnterInstanceAPI
ApiT* functions() const { return functions_; }
private:
- ApiT* functions_;
+ ApiT* functions_ = nullptr;
};
template<typename ApiT>
diff --git a/chromium/ppapi/thunk/interfaces_ppb_public_dev.h b/chromium/ppapi/thunk/interfaces_ppb_public_dev.h
index ca28d014bc1..5c69935ae01 100644
--- a/chromium/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/chromium/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -26,6 +26,7 @@ PROXIED_API(PPB_VideoDecoder)
PROXIED_IFACE(PPB_AUDIO_INPUT_DEV_INTERFACE_0_3, PPB_AudioInput_Dev_0_3)
PROXIED_IFACE(PPB_AUDIO_INPUT_DEV_INTERFACE_0_4, PPB_AudioInput_Dev_0_4)
+PROXIED_IFACE(PPB_AUDIO_OUTPUT_DEV_INTERFACE_0_1, PPB_AudioOutput_Dev_0_1)
PROXIED_IFACE(PPB_BUFFER_DEV_INTERFACE_0_4, PPB_Buffer_Dev_0_4)
PROXIED_IFACE(PPB_CHAR_SET_DEV_INTERFACE_0_4, PPB_CharSet_Dev_0_4)
PROXIED_IFACE(PPB_CRYPTO_DEV_INTERFACE_0_1, PPB_Crypto_Dev_0_1)
diff --git a/chromium/ppapi/thunk/ppb_audio_output_api.h b/chromium/ppapi/thunk/ppb_audio_output_api.h
new file mode 100644
index 00000000000..4fceee757d1
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_audio_output_api.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2017 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_AUDIO_OUTPUT_API_H_
+#define PPAPI_THUNK_AUDIO_OUTPUT_API_H_
+
+#include <stdint.h>
+
+#include <string>
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/dev/ppb_audio_output_dev.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPB_AudioOutput_API {
+ public:
+ virtual ~PPB_AudioOutput_API() {}
+
+ virtual int32_t EnumerateDevices(const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+ void* user_data) = 0;
+ virtual int32_t Open(PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioOutput_Callback audio_output_callback,
+ void* user_data,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Resource GetCurrentConfig() = 0;
+ virtual PP_Bool StartPlayback() = 0;
+ virtual PP_Bool StopPlayback() = 0;
+ virtual void Close() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_AUDIO_OUTPUT_API_H_
diff --git a/chromium/ppapi/thunk/ppb_audio_output_dev_thunk.cc b/chromium/ppapi/thunk/ppb_audio_output_dev_thunk.cc
new file mode 100644
index 00000000000..a5f5b12c375
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_audio_output_dev_thunk.cc
@@ -0,0 +1,116 @@
+// Copyright (c) 2017 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_audio_output_dev.idl modified Fri Mar 31 08:08:16 2017.
+
+#include <stdint.h>
+
+#include "ppapi/c/dev/ppb_audio_output_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+#include "ppapi/thunk/ppb_audio_output_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_AudioOutput_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateAudioOutput(instance);
+}
+
+PP_Bool IsAudioOutput(PP_Resource resource) {
+ VLOG(4) << "PPB_AudioOutput_Dev::IsAudioOutput()";
+ EnterResource<PPB_AudioOutput_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t EnumerateDevices(PP_Resource audio_output,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_AudioOutput_Dev::EnumerateDevices()";
+ EnterResource<PPB_AudioOutput_API> enter(audio_output, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(
+ enter.object()->EnumerateDevices(output, enter.callback()));
+}
+
+int32_t MonitorDeviceChange(PP_Resource audio_output,
+ PP_MonitorDeviceChangeCallback callback,
+ void* user_data) {
+ VLOG(4) << "PPB_AudioOutput_Dev::MonitorDeviceChange()";
+ EnterResource<PPB_AudioOutput_API> enter(audio_output, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->MonitorDeviceChange(callback, user_data);
+}
+
+int32_t Open(PP_Resource audio_output,
+ PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioOutput_Callback audio_output_callback,
+ void* user_data,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_AudioOutput_Dev::Open()";
+ EnterResource<PPB_AudioOutput_API> enter(audio_output, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open(
+ device_ref, config, audio_output_callback, user_data, enter.callback()));
+}
+
+PP_Resource GetCurrentConfig(PP_Resource audio_output) {
+ VLOG(4) << "PPB_AudioOutput_Dev::GetCurrentConfig()";
+ EnterResource<PPB_AudioOutput_API> enter(audio_output, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetCurrentConfig();
+}
+
+PP_Bool StartPlayback(PP_Resource audio_output) {
+ VLOG(4) << "PPB_AudioOutput_Dev::StartPlayback()";
+ EnterResource<PPB_AudioOutput_API> enter(audio_output, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->StartPlayback();
+}
+
+PP_Bool StopPlayback(PP_Resource audio_output) {
+ VLOG(4) << "PPB_AudioOutput_Dev::StopPlayback()";
+ EnterResource<PPB_AudioOutput_API> enter(audio_output, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->StopPlayback();
+}
+
+void Close(PP_Resource audio_output) {
+ VLOG(4) << "PPB_AudioOutput_Dev::Close()";
+ EnterResource<PPB_AudioOutput_API> enter(audio_output, true);
+ if (enter.failed())
+ return;
+ enter.object()->Close();
+}
+
+const PPB_AudioOutput_Dev_0_1 g_ppb_audiooutput_dev_thunk_0_1 = {
+ &Create, &IsAudioOutput, &EnumerateDevices, &MonitorDeviceChange,
+ &Open, &GetCurrentConfig, &StartPlayback, &StopPlayback,
+ &Close};
+
+} // namespace
+
+PPAPI_THUNK_EXPORT const PPB_AudioOutput_Dev_0_1*
+GetPPB_AudioOutput_Dev_0_1_Thunk() {
+ return &g_ppb_audiooutput_dev_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/resource_creation_api.h b/chromium/ppapi/thunk/resource_creation_api.h
index aba7f8b4d5b..682f6803bba 100644
--- a/chromium/ppapi/thunk/resource_creation_api.h
+++ b/chromium/ppapi/thunk/resource_creation_api.h
@@ -185,6 +185,7 @@ class ResourceCreationAPI {
virtual PP_Resource CreateX509CertificatePrivate(PP_Instance instance) = 0;
#if !defined(OS_NACL)
virtual PP_Resource CreateAudioInput(PP_Instance instance) = 0;
+ virtual PP_Resource CreateAudioOutput(PP_Instance instance) = 0;
virtual PP_Resource CreateBroker(PP_Instance instance) = 0;
virtual PP_Resource CreateBrowserFont(
PP_Instance instance,