diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-07-14 17:41:05 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-08-04 12:37:36 +0000 |
commit | 399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch) | |
tree | 6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/ppapi | |
parent | 7366110654eec46f21b6824f302356426f48cd74 (diff) | |
download | qtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz |
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/ppapi')
48 files changed, 1290 insertions, 267 deletions
diff --git a/chromium/ppapi/BUILD.gn b/chromium/ppapi/BUILD.gn index 6cac3cf42d3..856308aea65 100644 --- a/chromium/ppapi/BUILD.gn +++ b/chromium/ppapi/BUILD.gn @@ -7,11 +7,14 @@ import("//build/config/features.gni") assert(!is_android || enable_plugins, "//ppapi should not be referenced when is_android && !enable_plugins") +if (is_mac) { + import("//build/config/mac/rules.gni") +} + copy("copy_test_files") { visibility = [ ":*" ] sources = [ # Keep "test_case.html.mock-http-headers" with "test_case.html". - "tests/ppapi_nacl_tests_newlib.nmf", "tests/test_case.html", "tests/test_case.html.mock-http-headers", "tests/test_page.css", @@ -38,7 +41,7 @@ import("//build/config/nacl/rules.gni") import("//ppapi/ppapi_sources.gni") import("//testing/test.gni") -shared_library("ppapi_tests") { +source_set("ppapi_tests_sources") { sources = ppapi_sources.test_common_source_files + ppapi_sources.test_trusted_source_files @@ -59,7 +62,21 @@ shared_library("ppapi_tests") { ] } -shared_library("power_saver_test_plugin") { +if (!is_mac) { + shared_library("ppapi_tests") { + deps = [ + ":ppapi_tests_sources", + ] + } +} else { + mac_plugin_bundle("ppapi_tests") { + deps = [ + ":ppapi_tests_sources", + ] + } +} + +source_set("power_saver_test_plugin_sources") { sources = [ "tests/power_saver_test_plugin.cc", "tests/test_utils.cc", @@ -72,7 +89,21 @@ shared_library("power_saver_test_plugin") { ] } -loadable_module("blink_deprecated_test_plugin") { +if (!is_mac) { + shared_library("power_saver_test_plugin") { + deps = [ + ":power_saver_test_plugin_sources", + ] + } +} else { + mac_plugin_bundle("power_saver_test_plugin") { + deps = [ + ":power_saver_test_plugin_sources", + ] + } +} + +source_set("blink_deprecated_test_plugin_sources") { sources = [ "tests/blink_deprecated_test_plugin.cc", ] @@ -85,7 +116,21 @@ loadable_module("blink_deprecated_test_plugin") { ] } -loadable_module("blink_test_plugin") { +if (!is_mac) { + loadable_module("blink_deprecated_test_plugin") { + deps = [ + ":blink_deprecated_test_plugin_sources", + ] + } +} else { + mac_plugin_bundle("blink_deprecated_test_plugin") { + deps = [ + ":blink_deprecated_test_plugin_sources", + ] + } +} + +source_set("blink_test_plugin_sources") { sources = [ "tests/blink_test_plugin.cc", ] @@ -98,6 +143,20 @@ loadable_module("blink_test_plugin") { ] } +if (!is_mac) { + loadable_module("blink_test_plugin") { + deps = [ + ":blink_test_plugin_sources", + ] + } +} else { + mac_plugin_bundle("blink_test_plugin") { + deps = [ + ":blink_test_plugin_sources", + ] + } +} + test("ppapi_unittests") { sources = [ "host/resource_message_filter_unittest.cc", @@ -177,6 +236,7 @@ executable("pepper_hash_for_uma") { deps = [ "//base", "//build/config/sanitizers:deps", + "//build/win:default_exe_manifest", ] } @@ -186,6 +246,7 @@ if (is_nacl_glibc) { # link time as the test executable requires symbols defined in the # shared library. configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] + configs += [ "//build/config/gcc:symbol_visibility_default" ] sources = ppapi_sources.cpp_source_files sources += [ @@ -225,9 +286,10 @@ source_set("ppapi_gles2_lib") { } if (enable_nacl) { + import("//ppapi/native_client/nacl_test_data.gni") + if (is_nacl) { - executable("ppapi_nacl_tests_nexe") { - output_name = "ppapi_nacl_tests" + nacl_test_data("ppapi_nacl_tests") { include_dirs = [ "lib/gl/include" ] sources = ppapi_sources.test_common_source_files + ppapi_sources.test_nacl_source_files @@ -235,154 +297,19 @@ if (enable_nacl) { "GL_GLEXT_PROTOTYPES", "PPAPI_TEST_IMPLEMENTATION", ] - ldflags = [ "-pthread" ] deps = [ ":ppapi_cpp_lib", - "//build/config/nacl:nacl_base", - "//ppapi/native_client:ppapi_lib", - ] - } - - if (current_cpu == "pnacl") { - action("translate_pexe_to_nexe") { - # We specify the toolchain explicitly because in the Non-SFI case, we - # still want to use the pexe built using the newlib_pnacl toolchain. - tests = ":ppapi_nacl_tests_nexe(//build/toolchain/nacl:newlib_pnacl)" - - pexe = get_label_info(tests, "root_out_dir") + "/ppapi_nacl_tests.pexe" - nexe = "${root_out_dir}/ppapi_nacl_tests.nexe" - - script = "${nacl_toolchain_bindir}/pydir/loader.py" - sources = [ - pexe, - ] - outputs = [ - nexe, - ] - - if (is_nacl_nonsfi) { - if (target_cpu == "x86" || target_cpu == "x64") { - arch = "x86-32-nonsfi" - } else if (target_cpu == "arm") { - arch = "arm-nonsfi" - } - } else { - # TODO(phosek): remove the following once change 1360243003 is rolled - # into Chrome and use $target_cpu directly. - if (target_cpu == "x86") { - arch = "i686" - } else if (target_cpu == "x64") { - arch = "x86-64" - } else if (target_cpu == "arm") { - arch = "armv7" - } - } - - # The pre-translated object file has to be linked with an IRT shim to - # get a runnable nexe. This is handled by pnacl-translate, which passes - # -l:libpnacl_irt_shim.a to native linker, and we need to ensure the - # linker can find the correct library. - if (is_nacl_nonsfi) { - pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:newlib_pnacl_nonsfi)" - } else { - pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:clang_newlib_${target_cpu})" - } - - args = [ - "pnacl-translate", - rebase_path(pexe, root_build_dir), - "-o", - rebase_path(nexe, root_build_dir), - "-arch", - arch, - "-Wl,-L" + - rebase_path(get_label_info(pnacl_irt_shim, "target_out_dir")), - ] - deps = [ - tests, - ] - data_deps = [ - pnacl_irt_shim, - ] - } - } - - copy("ppapi_nacl_tests_copy") { - sources = [ - "${root_out_dir}/ppapi_nacl_tests.nexe", - ] - - # The CPU names used in tests/ppapi_nacl_tests_newlib.nmf - # are the ones used in GYP (x32 for x86). - if (target_cpu == "x86" || - (is_nacl_nonsfi && (target_cpu == "x86" || target_cpu == "x64"))) { - nmf_cpu = "x32" - } else { - nmf_cpu = target_cpu - } - if (current_cpu == "pnacl") { - if (is_nacl_nonsfi) { - suffix = "pnacl_newlib_${nmf_cpu}_nonsfi" - } else { - suffix = "pnacl_newlib_${nmf_cpu}" - } - } else if (is_nacl_glibc) { - suffix = "glibc_${nmf_cpu}" - } else { - suffix = "newlib_${nmf_cpu}" - } - outputs = [ - "${root_build_dir}/{{source_name_part}}_${suffix}.nexe", ] if (current_cpu == "pnacl") { - deps = [ - ":translate_pexe_to_nexe", - ] - } else { - deps = [ - ":ppapi_nacl_tests_nexe", - ] + pretranslate_pexe = true } } - - if (is_nacl_nonsfi) { - generate_nonsfi_test_nmf("ppapi_nacl_tests_nmf") { - nmf = "${root_build_dir}/ppapi_nacl_tests_pnacl_nonsfi.nmf" - files = get_target_outputs(":ppapi_nacl_tests_copy") - executable = files[0] - deps = [ - ":ppapi_nacl_tests_copy", - ] - } - } else { - generate_nmf("ppapi_nacl_tests_nmf") { - if (is_nacl_glibc) { - nmf = "${root_build_dir}/ppapi_nacl_tests_glibc.nmf" - stage_dependencies = root_build_dir - } else if (current_cpu == "pnacl") { - nmf = "${root_build_dir}/ppapi_nacl_tests_pnacl.nmf" - } else { - nmf = "${root_build_dir}/ppapi_nacl_tests_newlib.nmf" - } - executables = get_target_outputs(":ppapi_nacl_tests_copy") - deps = [ - ":ppapi_nacl_tests_copy", - ] - } - } - - group("ppapi_nacl_tests") { - data_deps = [ - ":ppapi_nacl_tests_copy", - ":ppapi_nacl_tests_nmf", - ] - } } group("ppapi_nacl_tests_all") { data_deps = [ ":copy_test_files", - ":ppapi_nacl_tests_copy(//build/toolchain/nacl:clang_newlib_${target_cpu})", + ":ppapi_nacl_tests(//build/toolchain/nacl:clang_newlib_${target_cpu})", ":ppapi_nacl_tests(//build/toolchain/nacl:glibc_${target_cpu})", ":ppapi_nacl_tests(//build/toolchain/nacl:newlib_pnacl)", ":ppapi_nacl_tests(//build/toolchain/nacl:newlib_pnacl_nonsfi)", diff --git a/chromium/ppapi/api/ppb_graphics_2d.idl b/chromium/ppapi/api/ppb_graphics_2d.idl index 56450f0c29d..f2fa64a5853 100644 --- a/chromium/ppapi/api/ppb_graphics_2d.idl +++ b/chromium/ppapi/api/ppb_graphics_2d.idl @@ -12,7 +12,8 @@ label Chrome { M14 = 1.0, - M27 = 1.1 + M27 = 1.1, + M52 = 1.2 }; /** @@ -282,5 +283,26 @@ interface PPB_Graphics2D { float_t GetScale( [in] PP_Resource resource); + /** + * SetLayerTransform() sets a transformation factor that will be applied for + * the current graphics context displayed on the output device. If both + * SetScale and SetLayerTransform will be used, they are going to get combined + * for the final result. + * + * This function has no effect until you call Flush(). + * + * @param[in] scale The scale to be applied. + * @param[in] origin The origin of the scale. + * @param[in] translate The translation to be applied. + * + * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> + * if the resource is invalid or the scale factor is 0 or less. + */ + [version=1.2] + PP_Bool SetLayerTransform( + [in] PP_Resource resource, + [in] float_t scale, + [in] PP_Point origin, + [in] PP_Point translate); }; diff --git a/chromium/ppapi/api/ppb_vpn_provider.idl b/chromium/ppapi/api/ppb_vpn_provider.idl new file mode 100644 index 00000000000..92a8b4af5b9 --- /dev/null +++ b/chromium/ppapi/api/ppb_vpn_provider.idl @@ -0,0 +1,159 @@ +/* Copyright 2016 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_VpnProvider</code> interface. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M52 = 0.1 +}; + +/** + * Use the <code>PPB_VpnProvider</code> interface to implement a VPN client. + * Important: This API is available only on Chrome OS. + * + * This interface enhances the <code>chrome.vpnProvider</code> JavaScript API by + * providing a high performance path for packet handling. + * + * Permissions: Apps permission <code>vpnProvider</code> is required for + * <code>PPB_VpnProvider.Bind()</code>. + * + * Typical usage: + * - Create a <code>PPB_VpnProvider</code> instance. + * - Register the callback for <code>PPB_VpnProvider.ReceivePacket()</code>. + * - In the extension follow the usual workflow for configuring a VPN connection + * via the <code>chrome.vpnProvider</code> API until the step for notifying + * the connection state as "connected". + * - Bind to the previously created connection using + * <code>PPB_VpnProvider.Bind()</code>. + * - Notify the connection state as "connected" from JavaScript using + * <code>chrome.vpnProvider.notifyConnectionStateChanged</code>. + * - When the steps above are completed without errors, a virtual tunnel is + * created to the network stack of Chrome OS. IP packets can be sent through + * the tunnel using <code>PPB_VpnProvider.SendPacket()</code> and any packets + * originating on the Chrome OS device will be received using the callback + * registered for <code>PPB_VpnProvider.ReceivePacket()</code>. + * - When the user disconnects from the VPN configuration or there is an error + * the extension will be notfied via + * <code>chrome.vpnProvider.onPlatformMessage</code>. + */ +interface PPB_VpnProvider { + /** + * Create() creates a VpnProvider instance. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the VpnProvider. + * + * @return A <code>PP_Resource</code> corresponding to a VpnProvider if + * successful. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * IsVpnProvider() determines if the provided <code>resource</code> is a + * VpnProvider instance. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a + * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the + * <code>resource</code> is invalid or some type other than + * <code>PPB_VpnProvider</code>. + */ + PP_Bool IsVpnProvider([in] PP_Resource resource); + + /** + * Bind() binds to an existing configuration created from JavaScript by + * <code>chrome.vpnProvider.createConfig</code>. All packets will be routed + * via <code>SendPacket</code> and <code>ReceivePacket</code>. The user should + * register the callback for <code>ReceivePacket</code> before calling + * <code>Bind()</code>. + * + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @param[in] configuration_id A <code>PP_VARTYPE_STRING</code> representing + * the configuration id from the callback of + * <code>chrome.vpnProvider.createConfig</code>. + * + * @param[in] configuration_name A <code>PP_VARTYPE_STRING</code> representing + * the configuration name as defined by the user when calling + * <code>chrome.vpnProvider.createConfig</code>. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + * <code>Bind()</code> has not completed. + * Returns <code>PP_ERROR_BADARGUMENT</code> if either + * <code>configuration_id</code> or <code>configuration_name</code> are not of + * type <code>PP_VARTYPE_STRING</code>. + * Returns <code>PP_ERROR_NOACCESS</code> if the caller does the have the + * required "vpnProvider" permission. + * Returns <code>PP_ERROR_FAILED</code> if <code>connection_id</code> and + * <code>connection_name</code> could not be matched with the existing + * connection, or if the plugin originates from a different extension than the + * one that created the connection. + */ + int32_t Bind([in] PP_Resource vpn_provider, + [in] PP_Var configuration_id, + [in] PP_Var configuration_name, + [in] PP_CompletionCallback callback); + + /** + * SendPacket() sends an IP packet through the tunnel created for the VPN + * session. This will succeed only when the VPN session is owned by the + * module and the connection is bound. + * + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to + * an IP packet to be sent to the platform. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_FAILED</code> if the connection is not bound. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + * <code>SendPacket()</code> has not completed. + * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>packet</code> is not of + * type <code>PP_VARTYPE_ARRAY_BUFFER</code>. + */ + int32_t SendPacket([in] PP_Resource vpn_provider, + [in] PP_Var packet, + [in] PP_CompletionCallback callback); + + /** + * ReceivePacket() receives an IP packet from the tunnel for the VPN session. + * This function only returns a single packet. This function must be called at + * least N times to receive N packets, no matter the size of each packet. The + * callback should be registered before calling <code>Bind()</code>. + * + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @param[out] packet The received packet is copied to provided + * <code>packet</code>. The <code>packet</code> must remain valid until + * ReceivePacket() completes. Its received <code>PP_VarType</code> will be + * <code>PP_VARTYPE_ARRAY_BUFFER</code>. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + * <code>ReceivePacket()</code> has not completed. + */ + int32_t ReceivePacket([in] PP_Resource vpn_provider, + [out] PP_Var packet, + [in] PP_CompletionCallback callback); +}; diff --git a/chromium/ppapi/c/pp_macros.h b/chromium/ppapi/c/pp_macros.h index d408b6a3e06..72985488326 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 Fri Jun 13 10:40:42 2014. */ +/* From pp_macros.idl modified Mon Feb 1 13:37:12 2016. */ #ifndef PPAPI_C_PP_MACROS_H_ #define PPAPI_C_PP_MACROS_H_ -#define PPAPI_RELEASE 48 +#define PPAPI_RELEASE 52 /** * @file diff --git a/chromium/ppapi/c/ppb_graphics_2d.h b/chromium/ppapi/c/ppb_graphics_2d.h index 251f34e33c2..73832653972 100644 --- a/chromium/ppapi/c/ppb_graphics_2d.h +++ b/chromium/ppapi/c/ppb_graphics_2d.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_graphics_2d.idl modified Fri Apr 26 08:49:08 2013. */ +/* From ppb_graphics_2d.idl modified Wed Apr 20 13:37:06 2016. */ #ifndef PPAPI_C_PPB_GRAPHICS_2D_H_ #define PPAPI_C_PPB_GRAPHICS_2D_H_ @@ -20,7 +20,8 @@ #define PPB_GRAPHICS_2D_INTERFACE_1_0 "PPB_Graphics2D;1.0" #define PPB_GRAPHICS_2D_INTERFACE_1_1 "PPB_Graphics2D;1.1" -#define PPB_GRAPHICS_2D_INTERFACE PPB_GRAPHICS_2D_INTERFACE_1_1 +#define PPB_GRAPHICS_2D_INTERFACE_1_2 "PPB_Graphics2D;1.2" +#define PPB_GRAPHICS_2D_INTERFACE PPB_GRAPHICS_2D_INTERFACE_1_2 /** * @file @@ -36,7 +37,7 @@ /** * <code>PPB_Graphics2D</code> defines the interface for a 2D graphics context. */ -struct PPB_Graphics2D_1_1 { +struct PPB_Graphics2D_1_2 { /** * Create() creates a 2D graphics context. The returned graphics context will * not be bound to the module instance on creation (call BindGraphics() on @@ -276,9 +277,28 @@ struct PPB_Graphics2D_1_1 { * is not a valid <code>Graphics2D</code> context, this will return 0.0. */ float (*GetScale)(PP_Resource resource); + /** + * SetLayerTransform() sets a transformation factor that will be applied for + * the current graphics context displayed on the output device. If both + * SetScale and SetLayerTransform will be used, they are going to get combined + * for the final result. + * + * This function has no effect until you call Flush(). + * + * @param[in] scale The scale to be applied. + * @param[in] origin The origin of the scale. + * @param[in] translate The translation to be applied. + * + * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> + * if the resource is invalid or the scale factor is 0 or less. + */ + PP_Bool (*SetLayerTransform)(PP_Resource resource, + float scale, + const struct PP_Point* origin, + const struct PP_Point* translate); }; -typedef struct PPB_Graphics2D_1_1 PPB_Graphics2D; +typedef struct PPB_Graphics2D_1_2 PPB_Graphics2D; struct PPB_Graphics2D_1_0 { PP_Resource (*Create)(PP_Instance instance, @@ -299,6 +319,28 @@ struct PPB_Graphics2D_1_0 { int32_t (*Flush)(PP_Resource graphics_2d, struct PP_CompletionCallback callback); }; + +struct PPB_Graphics2D_1_1 { + PP_Resource (*Create)(PP_Instance instance, + const struct PP_Size* size, + PP_Bool is_always_opaque); + PP_Bool (*IsGraphics2D)(PP_Resource resource); + PP_Bool (*Describe)(PP_Resource graphics_2d, + struct PP_Size* size, + PP_Bool* is_always_opaque); + void (*PaintImageData)(PP_Resource graphics_2d, + PP_Resource image_data, + const struct PP_Point* top_left, + const struct PP_Rect* src_rect); + void (*Scroll)(PP_Resource graphics_2d, + const struct PP_Rect* clip_rect, + const struct PP_Point* amount); + void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); + int32_t (*Flush)(PP_Resource graphics_2d, + struct PP_CompletionCallback callback); + PP_Bool (*SetScale)(PP_Resource resource, float scale); + float (*GetScale)(PP_Resource resource); +}; /** * @} */ diff --git a/chromium/ppapi/c/ppb_vpn_provider.h b/chromium/ppapi/c/ppb_vpn_provider.h new file mode 100644 index 00000000000..d9682caf6ab --- /dev/null +++ b/chromium/ppapi/c/ppb_vpn_provider.h @@ -0,0 +1,175 @@ +/* Copyright 2016 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_vpn_provider.idl modified Fri May 6 20:42:01 2016. */ + +#ifndef PPAPI_C_PPB_VPN_PROVIDER_H_ +#define PPAPI_C_PPB_VPN_PROVIDER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_VPNPROVIDER_INTERFACE_0_1 "PPB_VpnProvider;0.1" /* dev */ +/** + * @file + * This file defines the <code>PPB_VpnProvider</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Use the <code>PPB_VpnProvider</code> interface to implement a VPN client. + * Important: This API is available only on Chrome OS. + * + * This interface enhances the <code>chrome.vpnProvider</code> JavaScript API by + * providing a high performance path for packet handling. + * + * Permissions: Apps permission <code>vpnProvider</code> is required for + * <code>PPB_VpnProvider.Bind()</code>. + * + * Typical usage: + * - Create a <code>PPB_VpnProvider</code> instance. + * - Register the callback for <code>PPB_VpnProvider.ReceivePacket()</code>. + * - In the extension follow the usual workflow for configuring a VPN connection + * via the <code>chrome.vpnProvider</code> API until the step for notifying + * the connection state as "connected". + * - Bind to the previously created connection using + * <code>PPB_VpnProvider.Bind()</code>. + * - Notify the connection state as "connected" from JavaScript using + * <code>chrome.vpnProvider.notifyConnectionStateChanged</code>. + * - When the steps above are completed without errors, a virtual tunnel is + * created to the network stack of Chrome OS. IP packets can be sent through + * the tunnel using <code>PPB_VpnProvider.SendPacket()</code> and any packets + * originating on the Chrome OS device will be received using the callback + * registered for <code>PPB_VpnProvider.ReceivePacket()</code>. + * - When the user disconnects from the VPN configuration or there is an error + * the extension will be notfied via + * <code>chrome.vpnProvider.onPlatformMessage</code>. + */ +struct PPB_VpnProvider_0_1 { /* dev */ + /** + * Create() creates a VpnProvider instance. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the VpnProvider. + * + * @return A <code>PP_Resource</code> corresponding to a VpnProvider if + * successful. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsVpnProvider() determines if the provided <code>resource</code> is a + * VpnProvider instance. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a + * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the + * <code>resource</code> is invalid or some type other than + * <code>PPB_VpnProvider</code>. + */ + PP_Bool (*IsVpnProvider)(PP_Resource resource); + /** + * Bind() binds to an existing configuration created from JavaScript by + * <code>chrome.vpnProvider.createConfig</code>. All packets will be routed + * via <code>SendPacket</code> and <code>ReceivePacket</code>. The user should + * register the callback for <code>ReceivePacket</code> before calling + * <code>Bind()</code>. + * + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @param[in] configuration_id A <code>PP_VARTYPE_STRING</code> representing + * the configuration id from the callback of + * <code>chrome.vpnProvider.createConfig</code>. + * + * @param[in] configuration_name A <code>PP_VARTYPE_STRING</code> representing + * the configuration name as defined by the user when calling + * <code>chrome.vpnProvider.createConfig</code>. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + * <code>Bind()</code> has not completed. + * Returns <code>PP_ERROR_BADARGUMENT</code> if either + * <code>configuration_id</code> or <code>configuration_name</code> are not of + * type <code>PP_VARTYPE_STRING</code>. + * Returns <code>PP_ERROR_NOACCESS</code> if the caller does the have the + * required "vpnProvider" permission. + * Returns <code>PP_ERROR_FAILED</code> if <code>connection_id</code> and + * <code>connection_name</code> could not be matched with the existing + * connection, or if the plugin originates from a different extension than the + * one that created the connection. + */ + int32_t (*Bind)(PP_Resource vpn_provider, + struct PP_Var configuration_id, + struct PP_Var configuration_name, + struct PP_CompletionCallback callback); + /** + * SendPacket() sends an IP packet through the tunnel created for the VPN + * session. This will succeed only when the VPN session is owned by the + * module and the connection is bound. + * + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to + * an IP packet to be sent to the platform. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_FAILED</code> if the connection is not bound. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + * <code>SendPacket()</code> has not completed. + * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>packet</code> is not of + * type <code>PP_VARTYPE_ARRAY_BUFFER</code>. + */ + int32_t (*SendPacket)(PP_Resource vpn_provider, + struct PP_Var packet, + struct PP_CompletionCallback callback); + /** + * ReceivePacket() receives an IP packet from the tunnel for the VPN session. + * This function only returns a single packet. This function must be called at + * least N times to receive N packets, no matter the size of each packet. The + * callback should be registered before calling <code>Bind()</code>. + * + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @param[out] packet The received packet is copied to provided + * <code>packet</code>. The <code>packet</code> must remain valid until + * ReceivePacket() completes. Its received <code>PP_VarType</code> will be + * <code>PP_VARTYPE_ARRAY_BUFFER</code>. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + * <code>ReceivePacket()</code> has not completed. + */ + int32_t (*ReceivePacket)(PP_Resource vpn_provider, + struct PP_Var* packet, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VPN_PROVIDER_H_ */ + diff --git a/chromium/ppapi/cpp/graphics_2d.cc b/chromium/ppapi/cpp/graphics_2d.cc index 3a766c83546..d196cabd583 100644 --- a/chromium/ppapi/cpp/graphics_2d.cc +++ b/chromium/ppapi/cpp/graphics_2d.cc @@ -26,6 +26,11 @@ template <> const char* interface_name<PPB_Graphics2D_1_1>() { return PPB_GRAPHICS_2D_INTERFACE_1_1; } +template <> const char* interface_name<PPB_Graphics2D_1_2>() { + return PPB_GRAPHICS_2D_INTERFACE_1_2; +} + + } // namespace Graphics2D::Graphics2D() : Resource() { @@ -152,4 +157,14 @@ float Graphics2D::GetScale() { return get_interface<PPB_Graphics2D_1_1>()->GetScale(pp_resource()); } +bool Graphics2D::SetLayerTransform(float scale, + const Point& origin, + const Point& translate) { + if (!has_interface<PPB_Graphics2D_1_2>()) + return false; + return PP_ToBool(get_interface<PPB_Graphics2D_1_2>()->SetLayerTransform( + pp_resource(), scale, &origin.pp_point(), &translate.pp_point())); +} + + } // namespace pp diff --git a/chromium/ppapi/cpp/graphics_2d.h b/chromium/ppapi/cpp/graphics_2d.h index c6a23905d6f..86b89c77efb 100644 --- a/chromium/ppapi/cpp/graphics_2d.h +++ b/chromium/ppapi/cpp/graphics_2d.h @@ -284,6 +284,9 @@ class Graphics2D : public Resource { /// is 1.0. float GetScale(); + bool SetLayerTransform(float scale, + const Point& origin, + const Point& translate); private: Size size_; }; diff --git a/chromium/ppapi/cpp/vpn_provider.cc b/chromium/ppapi/cpp/vpn_provider.cc new file mode 100644 index 00000000000..d44b7bc94d4 --- /dev/null +++ b/chromium/ppapi/cpp/vpn_provider.cc @@ -0,0 +1,68 @@ +// Copyright 2016 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/vpn_provider.h" + +#include "ppapi/c/ppb_vpn_provider.h" +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/instance_handle.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/var_array.h" + +namespace pp { + +namespace { + +template <> +const char* interface_name<PPB_VpnProvider_0_1>() { + return PPB_VPNPROVIDER_INTERFACE_0_1; +} +} // namespace + +VpnProvider::VpnProvider(const InstanceHandle& instance) + : associated_instance_(instance) { + if (has_interface<PPB_VpnProvider_0_1>()) { + PassRefFromConstructor(get_interface<PPB_VpnProvider_0_1>()->Create( + associated_instance_.pp_instance())); + } +} + +VpnProvider::~VpnProvider() {} + +// static +bool VpnProvider::IsAvailable() { + return has_interface<PPB_VpnProvider_0_1>(); +} + +int32_t VpnProvider::Bind(const Var& configuration_id, + const Var& configuration_name, + const CompletionCallback& callback) { + if (has_interface<PPB_VpnProvider_0_1>()) { + return get_interface<PPB_VpnProvider_0_1>()->Bind( + pp_resource(), configuration_id.pp_var(), configuration_name.pp_var(), + callback.pp_completion_callback()); + } + return PP_ERROR_NOINTERFACE; +} + +int32_t VpnProvider::SendPacket(const Var& packet, + const CompletionCallback& callback) { + if (has_interface<PPB_VpnProvider_0_1>()) { + return get_interface<PPB_VpnProvider_0_1>()->SendPacket( + pp_resource(), packet.pp_var(), callback.pp_completion_callback()); + } + return PP_ERROR_NOINTERFACE; +} + +int32_t VpnProvider::ReceivePacket( + const CompletionCallbackWithOutput<Var>& callback) { + if (has_interface<PPB_VpnProvider_0_1>()) { + return get_interface<PPB_VpnProvider_0_1>()->ReceivePacket( + pp_resource(), callback.output(), callback.pp_completion_callback()); + } + return PP_ERROR_NOINTERFACE; +} + +} // namespace pp diff --git a/chromium/ppapi/cpp/vpn_provider.h b/chromium/ppapi/cpp/vpn_provider.h new file mode 100644 index 00000000000..9d94981e586 --- /dev/null +++ b/chromium/ppapi/cpp/vpn_provider.h @@ -0,0 +1,135 @@ +// Copyright 2016 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_VPN_PROVIDER_H_ +#define PPAPI_CPP_VPN_PROVIDER_H_ + +#include <string> + +#include "ppapi/c/ppb_vpn_provider.h" +#include "ppapi/cpp/completion_callback.h" + +namespace pp { + +class InstanceHandle; + +/// @file +/// This file defines the VpnProvider interface providing a way to implement a +/// VPN client. +/// Important: This API is available only on Chrome OS. + +/// The <code>VpnProvider</code> class enhances the +/// <code>chrome.vpnProvider</code> JavaScript API by providing a high +/// performance path for packet handling. +/// +/// Permissions: Apps permission <code>vpnProvider</code> is required for +/// <code>VpnProvider.Bind()</code>. +/// +/// Typical usage: +/// - Create a <code>VpnProvider</code> instance. +/// - Register the callback for <code>VpnProvider.ReceivePacket()</code>. +/// - In the extension follow the usual workflow for configuring a VPN +/// connection via the <code>chrome.vpnProvider</code> API until the step for +/// notifying the connection state as "connected". +/// - Bind to the previously created connection using +/// <code>VpnProvider.Bind()</code>. +/// - Notify the connection state as "connected" from JavaScript using +/// <code>chrome.vpnProvider.notifyConnectionStateChanged</code>. +/// - When the steps above are completed without errors, a virtual tunnel is +/// created to the network stack of Chrome OS. IP packets can be sent through +/// the tunnel using <code>VpnProvider.SendPacket()</code> and any packets +/// originating on the Chrome OS device will be received using the callback +/// registered for <code>VpnProvider.ReceivePacket()</code>. +/// - When the user disconnects from the VPN configuration or there is an error +/// the extension will be notfied via +/// <code>chrome.vpnProvider.onPlatformMessage</code>. +class VpnProvider : public Resource { + public: + /// Constructs a VpnProvider object. + /// + /// @param[in] instance The instance with which this resource will be + /// associated. + explicit VpnProvider(const InstanceHandle& instance); + + /// Destructs a VpnProvider object. + virtual ~VpnProvider(); + + /// Static function for determining whether the browser supports the + /// <code>VpnProvider</code> interface. + /// + /// @return true if the interface is available, false otherwise. + static bool IsAvailable(); + + /// Binds to an existing configuration created from JavaScript by + /// <code>chrome.vpnProvider.createConfig</code>. All packets will be routed + /// via <code>SendPacket</code> and <code>ReceivePacket</code>. The user + /// should register the callback for <code>ReceivePacket</code> before calling + /// <code>Bind()</code>. + /// + /// @param[in] configuration_id The configuration id from the callback of + /// <code>chrome.vpnProvider.createConfig</code>. This <code>Var</code> must + /// be of string type. + /// + /// @param[in] configuration_name The configuration name as defined by the + /// user when calling <code>chrome.vpnProvider.createConfig</code>. This + /// <code>Var</code> must be of string type. + /// + /// @param[in] callback A <code>CompletionCallback</code> to be called on + /// completion. + /// + /// @return An int32_t containing an error code from <code>pp_errors.h</code>. + /// Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + /// <code>Bind()</code> has not completed. + /// Returns <code>PP_ERROR_BADARGUMENT</code> if the <code>Var</code> type of + /// either <code>configuration_id</code> or <code>configuration_name</code> is + /// not of string type. + /// Returns <code>PP_ERROR_NOACCESS</code> if the caller does the have the + /// required "vpnProvider" permission. + /// Returns <code>PP_ERROR_FAILED</code> if <code>connection_id</code> and + /// <code>connection_name</code> could not be matched with the existing + /// connection, or if the plugin originates from a different extension than + /// the one that created the connection. + int32_t Bind(const Var& configuration_id, + const Var& configuration_name, + const CompletionCallback& callback); + + /// Sends an IP packet through the tunnel created for the VPN session. This + /// will succeed only when the VPN session is owned by the module and + /// connection is bound. + /// + /// @param[in] packet IP packet to be sent to the platform. The + /// <code>Var</code> must be of ArrayBuffer type. + /// + /// @param[in] callback A <code>CompletionCallback</code> to be called on + /// completion. + /// + /// @return An int32_t containing an error code from <code>pp_errors.h</code>. + /// Returns <code>PP_ERROR_FAILED</code> if the connection is not bound. + /// Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + /// <code>SendPacket()</code> has not completed. + /// Returns <code>PP_ERROR_BADARGUMENT</code> if the <code>Var</code> type of + /// <code>packet</code> is not of ArrayBuffer type. + int32_t SendPacket(const Var& packet, const CompletionCallback& callback); + + /// Receives an IP packet from the tunnel for the VPN session. This function + /// only returns a single packet. That is, this function must be called at + /// least N times to receive N packets, no matter the size of each packet. The + /// callback should be registered before calling <code>Bind()</code>. + /// + /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be + /// called upon completion of ReceivePacket. It will be passed an ArrayBuffer + /// type <code>Var</code> containing an IP packet to be sent to the platform. + /// + /// @return An int32_t containing an error code from <code>pp_errors.h</code>. + /// Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + /// <code>ReceivePacket()</code> has not completed. + int32_t ReceivePacket(const CompletionCallbackWithOutput<Var>& callback); + + private: + InstanceHandle associated_instance_; +}; + +} // namespace pp + +#endif // PPAPI_CPP_VPN_PROVIDER_H_ diff --git a/chromium/ppapi/examples/ppapi_example.gni b/chromium/ppapi/examples/ppapi_example.gni index 5345b1df0c1..3cedcc027dc 100644 --- a/chromium/ppapi/examples/ppapi_example.gni +++ b/chromium/ppapi/examples/ppapi_example.gni @@ -2,21 +2,35 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +if (is_mac) { + import("//build/config/mac/rules.gni") +} + # Declares a PPAPI example target of the correct type for the current platform # and with the right linker flags. template("ppapi_example") { - # TODO(GYP) on Mac this should be loadable_module. - shared_library(target_name) { - testonly = true - if (defined(invoker.output_name)) { - output_name = invoker.output_name + if (!is_mac) { + shared_library(target_name) { + testonly = true + + if (defined(invoker.output_name)) { + output_name = invoker.output_name + } + + sources = invoker.sources + deps = invoker.deps } - sources = invoker.sources - deps = invoker.deps + } else { + mac_plugin_bundle(target_name) { + testonly = true + + if (defined(invoker.output_name)) { + output_name = invoker.output_name + } + + sources = invoker.sources + deps = invoker.deps - if (is_mac) { - # TODO(GYP) this should be a mac bundle - output_extension = "plugin" ldflags = [ # Not to strip important symbols by -Wl,-dead_strip. "-Wl,-exported_symbol,_PPP_GetInterface", diff --git a/chromium/ppapi/host/resource_message_filter.cc b/chromium/ppapi/host/resource_message_filter.cc index d08f5259368..0b5a469b2b8 100644 --- a/chromium/ppapi/host/resource_message_filter.cc +++ b/chromium/ppapi/host/resource_message_filter.cc @@ -8,7 +8,7 @@ #include "base/location.h" #include "base/single_thread_task_runner.h" #include "base/task_runner.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "ipc/ipc_message.h" #include "ppapi/c/pp_errors.h" #include "ppapi/host/ppapi_host.h" diff --git a/chromium/ppapi/nacl_irt/manifest_service.cc b/chromium/ppapi/nacl_irt/manifest_service.cc index 4d4aa4240c6..030cc4a9634 100644 --- a/chromium/ppapi/nacl_irt/manifest_service.cc +++ b/chromium/ppapi/nacl_irt/manifest_service.cc @@ -102,11 +102,8 @@ bool ManifestService::OpenResource(const char* file, int* fd) { // inside NaClIPCAdapter. uint64_t file_token_lo = 0; uint64_t file_token_hi = 0; - if (!filter_->Send(new PpapiHostMsg_OpenResource( - file, - &ipc_fd, - &file_token_lo, - &file_token_hi))) { + if (!filter_->Send(new PpapiHostMsg_OpenResource(file, &file_token_lo, + &file_token_hi, &ipc_fd))) { LOG(ERROR) << "ManifestService::OpenResource failed:" << file; *fd = -1; return false; diff --git a/chromium/ppapi/native_client/nacl_test_data.gni b/chromium/ppapi/native_client/nacl_test_data.gni index 5437ae7b953..398645c7b0d 100644 --- a/chromium/ppapi/native_client/nacl_test_data.gni +++ b/chromium/ppapi/native_client/nacl_test_data.gni @@ -27,14 +27,17 @@ if (current_cpu == "pnacl") { # output_name: name of the ouput file other than the default # sources: source files for a target # generate_nmf: whether to generate a manifest (default true) -# nonstable_pexe: use non-finalized pexe -# debug_pexe: copy both non-finalized and finalized pexe -# destination_dir: the output directory relative to the $root_build_dir -# test_files: additional test files to copy to $destination_dir -# nmfflags: additional flags for the nmf generator +# pretranslate_pexe: whether to pre-translate pexe to nexe during build +# (default true for Non-SFI, otherwise false) +# nonstable_pexe: use non-finalized pexe (default false) +# debug_pexe: copy both non-finalized and finalized pexe (default false) +# destination_dir: the output directory relative to the $root_build_dir, +# if ommitted the output directory is $root_build_dir and the manifest +# will be suffixed with the name of the toolchain (optional) +# test_files: additional test files to copy to $destination_dir (optional) +# nmfflags: additional flags for the nmf generator (optional) template("nacl_test_data") { assert(defined(invoker.sources)) - assert(defined(invoker.destination_dir)) forward_variables_from(invoker, [ "destination_dir" ]) if (defined(invoker.output_name)) { @@ -50,21 +53,69 @@ template("nacl_test_data") { } else { nmf_cpu = current_cpu } + + if (current_cpu == "pnacl") { + if (defined(invoker.pretranslate_pexe)) { + pretranslate_pexe = invoker.pretranslate_pexe + } else { + pretranslate_pexe = is_nacl_nonsfi + } + } else { + pretranslate_pexe = false + } + + # Note this can't test "is_win" because it's evaluated in the NaCl + # toolchain context where is_win==false because current_os=="nacl". + # It tests target_cpu rather than current_cpu because it's also + # needed in the current_cpu=="pnacl" && pretranslate_pexe case. + if (target_os == "win" && target_cpu == "x86" && !is_nacl_nonsfi && + (current_cpu == "x86" || pretranslate_pexe)) { + # x86 Windows builds of Chrome run on both x86 Windows and x64 + # Windows. On x64 Windows, only x64 NaCl is supported, so those + # tests are needed too. + extra_tc_cpu = "x64" + if (current_cpu == "x86") { + extra_nmf_cpu = "x86_64" + } + } + if (is_nacl_glibc) { suffix = "glibc_${nmf_cpu}" + if (defined(extra_nmf_cpu)) { + extra_suffix = "glibc_${extra_nmf_cpu}" + glibc_tc = "//build/toolchain/nacl:glibc" + assert(current_toolchain == "${glibc_tc}_${current_cpu}") + extra_toolchain = "${glibc_tc}_${extra_tc_cpu}" + } } else { suffix = "newlib_${nmf_cpu}" + if (defined(extra_nmf_cpu)) { + extra_suffix = "newlib_${extra_nmf_cpu}" + newlib_tc = "//build/toolchain/nacl:clang_newlib" + assert(current_toolchain == "${newlib_tc}_${current_cpu}") + extra_toolchain = "${newlib_tc}_${extra_tc_cpu}" + } } suffixed_output_name = "${output_name}_${suffix}" + if (defined(extra_nmf_cpu)) { + extra_suffixed_output_name = "${output_name}_${extra_suffix}" + } + if (pretranslate_pexe) { + pexe_translate_target_name = target_name + "_translate_pexe_" + if (defined(extra_tc_cpu)) { + # There will be an extra pretranslation done below for the + # extra CPU (i.e. for x64 on x86 Windows). + extra_pexe_translate_target_name = + pexe_translate_target_name + extra_tc_cpu + } + pexe_translate_target_name += target_cpu + } if (defined(invoker.generate_nmf)) { generate_nmf = invoker.generate_nmf } else { generate_nmf = true } nexe_target_name = target_name + "_nexe" - if (is_nacl_nonsfi) { - pexe_translate_target_name = target_name + "_translate_pexe" - } nexe_copy_target_name = target_name + "_copy_nexe" if (current_cpu == "pnacl" && !is_nacl_nonsfi) { if (defined(invoker.debug_pexe) && invoker.debug_pexe) { @@ -79,6 +130,30 @@ template("nacl_test_data") { } final_target_name = target_name + # When the destination_dir is specified, the build artifacts end up + # in the that directory and the manifest is the same as the target name. + # When the destination_dir is not specified, the artifacts end up + # in the root build directory and the manifests are suffixed to ensure + # they do not overlap in case when we build the same test using multiple + # different toolchains. + if (defined(invoker.destination_dir)) { + target_dir = + "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}" + if (generate_nmf) { + nmf_name = output_name + } + } else { + target_dir = root_build_dir + if (generate_nmf) { + if (is_nacl_nonsfi) { + nacl_toolchain_name = "pnacl_${nacl_toolchain_variant}" + } else { + nacl_toolchain_name = nacl_toolchain_variant + } + nmf_name = "${output_name}_${nacl_toolchain_name}" + } + } + executable(nexe_target_name) { visibility = [ ":*" ] output_name = suffixed_output_name @@ -86,6 +161,8 @@ template("nacl_test_data") { forward_variables_from(invoker, [ "cflags", + "defines", + "include_dirs", "ldflags", "libs", ]) @@ -99,56 +176,97 @@ template("nacl_test_data") { } } - if (is_nacl_nonsfi) { - action(pexe_translate_target_name) { - visibility = [ ":$nexe_copy_target_name" ] + if (current_cpu == "pnacl" && pretranslate_pexe) { + # This is a template so it can be invoked twice in the + # defined(extra_tc_cpu) case below. + template("nacl_test_data_pretranslate_pexe") { + action(target_name) { + translate_cpu = invoker.translate_cpu - # We specify the toolchain explicitly because in the Non-SFI case, we - # still want to use the pexe built using the newlib_pnacl toolchain. - tests = ":$nexe_target_name(//build/toolchain/nacl:newlib_pnacl)" + visibility = [ ":$nexe_copy_target_name" ] - pexe = get_label_info(tests, "root_out_dir") + - "/${suffixed_output_name}.pexe" - if (target_cpu == "x86" || target_cpu == "x64") { - nmf_cpu = "x32" - } else { - nmf_cpu = target_cpu - } - nexe = - "${root_out_dir}/${output_name}_pnacl_newlib_${nmf_cpu}_nonsfi.nexe" + # We specify the toolchain explicitly because in the Non-SFI case, we + # still want to use the pexe built using the newlib_pnacl toolchain. + tests = ":ppapi_nacl_tests_nexe(//build/toolchain/nacl:newlib_pnacl)" - script = "${nacl_toolchain_bindir}/pydir/loader.py" - sources = [ - pexe, - ] - outputs = [ - nexe, - ] + pexe = get_label_info(tests, "root_out_dir") + + "/${suffixed_output_name}.pexe" + if (translate_cpu == "x86" || + (is_nacl_nonsfi && + (translate_cpu == "x86" || translate_cpu == "x64"))) { + nmf_cpu = "x32" + } else { + nmf_cpu = translate_cpu + } + if (is_nacl_nonsfi) { + suffix = "pnacl_newlib_${nmf_cpu}_nonsfi" + } else { + suffix = "pnacl_newlib_${nmf_cpu}" + } + nexe = "${root_out_dir}/${output_name}_${suffix}.nexe" - if (target_cpu == "x86" || target_cpu == "x64") { - arch = "x86-32-nonsfi" - } else if (target_cpu == "arm") { - arch = "arm-nonsfi" - } + script = "${nacl_toolchain_bindir}/pydir/loader.py" + sources = [ + pexe, + ] + outputs = [ + nexe, + ] - pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:newlib_pnacl_nonsfi)" + if (is_nacl_nonsfi) { + if (translate_cpu == "x86" || translate_cpu == "x64") { + arch = "x86-32-nonsfi" + } else if (translate_cpu == "arm") { + arch = "arm-nonsfi" + } + } else { + # TODO(phosek): remove the following once change 1360243003 is rolled + # into Chrome and use translate_cpu directly. + if (translate_cpu == "x86") { + arch = "i686" + } else if (translate_cpu == "x64") { + arch = "x86-64" + } else if (translate_cpu == "arm") { + arch = "armv7" + } + } - args = [ - "pnacl-translate", - rebase_path(pexe, root_build_dir), - "-o", - rebase_path(nexe, root_build_dir), - "-arch", - arch, - "-Wl,-L" + - rebase_path(get_label_info(pnacl_irt_shim, "target_out_dir")), - ] - deps = [ - ":$nexe_target_name(//build/toolchain/nacl:newlib_pnacl)", - ] - data_deps = [ - pnacl_irt_shim, - ] + # The pre-translated object file has to be linked with an IRT shim to + # get a runnable nexe. This is handled by pnacl-translate, which passes + # -l:libpnacl_irt_shim.a to native linker, and we need to ensure the + # linker can find the correct library. + if (is_nacl_nonsfi) { + pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:newlib_pnacl_nonsfi)" + } else { + pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:clang_newlib_${translate_cpu})" + } + + args = [ + "pnacl-translate", + rebase_path(pexe, root_build_dir), + "-o", + rebase_path(nexe, root_build_dir), + "-arch", + arch, + "-Wl,-L" + + rebase_path(get_label_info(pnacl_irt_shim, "target_out_dir")), + ] + deps = [ + ":$nexe_target_name(//build/toolchain/nacl:newlib_pnacl)", + ] + data_deps = [ + pnacl_irt_shim, + ] + } + } + + nacl_test_data_pretranslate_pexe(pexe_translate_target_name) { + translate_cpu = target_cpu + } + if (defined(extra_tc_cpu)) { + nacl_test_data_pretranslate_pexe(extra_pexe_translate_target_name) { + translate_cpu = extra_tc_cpu + } } } @@ -157,8 +275,13 @@ template("nacl_test_data") { if (generate_nmf) { visibility += [ ":$nmf_target_name" ] } - if (current_cpu == "pnacl" && !is_nacl_nonsfi) { - if (defined(invoker.nonstable_pexe) && invoker.nonstable_pexe) { + if (current_cpu == "pnacl") { + if (pretranslate_pexe) { + sources = get_target_outputs(":${pexe_translate_target_name}") + if (defined(extra_tc_cpu)) { + sources += get_target_outputs(":${extra_pexe_translate_target_name}") + } + } else if (defined(invoker.nonstable_pexe) && invoker.nonstable_pexe) { sources = [ "${root_out_dir}/exe.unstripped/${suffixed_output_name}.pexe", ] @@ -167,24 +290,35 @@ template("nacl_test_data") { "${root_out_dir}/${suffixed_output_name}.pexe", ] } - } else if (is_nacl_nonsfi) { - sources = get_target_outputs(":${pexe_translate_target_name}") } else { sources = [ "${root_out_dir}/${suffixed_output_name}.nexe", ] + if (defined(extra_nmf_cpu)) { + extra_root_out_dir = + get_label_info(":${nexe_target_name}(${extra_toolchain})", + "root_out_dir") + sources += + [ "${extra_root_out_dir}/${extra_suffixed_output_name}.nexe" ] + } } outputs = [ - "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/{{source_file_part}}", + "${target_dir}/{{source_file_part}}", ] - if (is_nacl_nonsfi) { + if (current_cpu == "pnacl" && pretranslate_pexe) { deps = [ ":$pexe_translate_target_name", ] + if (defined(extra_tc_cpu)) { + deps += [ ":$extra_pexe_translate_target_name" ] + } } else { deps = [ ":$nexe_target_name", ] + if (defined(extra_nmf_cpu)) { + deps += [ ":${nexe_target_name}(${extra_toolchain})" ] + } } } @@ -196,7 +330,7 @@ template("nacl_test_data") { "${root_out_dir}/exe.unstripped/${suffixed_output_name}.pexe", ] outputs = [ - "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/{{source_name_part}}.pexe.debug", + "${target_dir}/{{source_name_part}}.pexe.debug", ] deps = [ ":$nexe_target_name", @@ -210,7 +344,7 @@ template("nacl_test_data") { generate_nonsfi_test_nmf(nmf_target_name) { visibility = [ ":$final_target_name" ] forward_variables_from(invoker, [ "nmfflags" ]) - nmf = "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/${output_name}.nmf" + nmf = "${target_dir}/${nmf_name}.nmf" files = get_target_outputs(":$nexe_copy_target_name") executable = files[0] deps = [ @@ -221,12 +355,11 @@ template("nacl_test_data") { generate_nmf(nmf_target_name) { visibility = [ ":$final_target_name" ] forward_variables_from(invoker, [ "nmfflags" ]) - nmf = "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/${output_name}.nmf" + nmf = "${target_dir}/${nmf_name}.nmf" executables = get_target_outputs(":$nexe_copy_target_name") if (is_nacl_glibc) { lib_prefix = "${output_name}_libs" - stage_dependencies = - "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}" + stage_dependencies = target_dir } deps = [ ":$nexe_copy_target_name", @@ -240,7 +373,7 @@ template("nacl_test_data") { visibility = [ ":$final_target_name" ] sources = invoker.test_files outputs = [ - "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/{{source_file_part}}", + "${target_dir}/{{source_file_part}}", ] } } 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 0ce018b2431..a492353d9ae 100644 --- a/chromium/ppapi/native_client/src/untrusted/irt_stub/BUILD.gn +++ b/chromium/ppapi/native_client/src/untrusted/irt_stub/BUILD.gn @@ -17,6 +17,7 @@ static_library("ppapi_stub_lib") { "thread_creator.c", ] configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] + configs += [ "//build/config/gcc:symbol_visibility_default" ] cflags = [ "-fPIC" ] deps = [ "//build/config/nacl:nacl_base", 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 f8ae75c97cf..56b190b8a37 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 @@ -49,6 +49,7 @@ #include "ppapi/c/ppb_var_dictionary.h" #include "ppapi/c/ppb_video_decoder.h" #include "ppapi/c/ppb_video_encoder.h" +#include "ppapi/c/ppb_vpn_provider.h" #include "ppapi/c/ppb_websocket.h" #include "ppapi/c/ppp_messaging.h" #include "ppapi/c/private/ppb_camera_device_private.h" @@ -107,6 +108,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileSystem_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_1; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics3D_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0; @@ -149,6 +151,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoEncoder_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoEncoder_0_2; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VpnProvider_0_1; 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; @@ -871,6 +874,60 @@ static float Pnacl_M27_PPB_Graphics2D_GetScale(PP_Resource resource) { /* End wrapper methods for PPB_Graphics2D_1_1 */ +/* Begin wrapper methods for PPB_Graphics2D_1_2 */ + +static PP_Resource Pnacl_M52_PPB_Graphics2D_Create(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + return iface->Create(instance, size, is_always_opaque); +} + +static PP_Bool Pnacl_M52_PPB_Graphics2D_IsGraphics2D(PP_Resource resource) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + return iface->IsGraphics2D(resource); +} + +static PP_Bool Pnacl_M52_PPB_Graphics2D_Describe(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opaque) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + return iface->Describe(graphics_2d, size, is_always_opaque); +} + +static void Pnacl_M52_PPB_Graphics2D_PaintImageData(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + iface->PaintImageData(graphics_2d, image_data, top_left, src_rect); +} + +static void Pnacl_M52_PPB_Graphics2D_Scroll(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + iface->Scroll(graphics_2d, clip_rect, amount); +} + +static void Pnacl_M52_PPB_Graphics2D_ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + iface->ReplaceContents(graphics_2d, image_data); +} + +static int32_t Pnacl_M52_PPB_Graphics2D_Flush(PP_Resource graphics_2d, struct PP_CompletionCallback* callback) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + return iface->Flush(graphics_2d, *callback); +} + +static PP_Bool Pnacl_M52_PPB_Graphics2D_SetScale(PP_Resource resource, float scale) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + return iface->SetScale(resource, scale); +} + +static float Pnacl_M52_PPB_Graphics2D_GetScale(PP_Resource resource) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + return iface->GetScale(resource); +} + +static PP_Bool Pnacl_M52_PPB_Graphics2D_SetLayerTransform(PP_Resource resource, float scale, const struct PP_Point* origin, const struct PP_Point* translate) { + const struct PPB_Graphics2D_1_2 *iface = Pnacl_WrapperInfo_PPB_Graphics2D_1_2.real_iface; + return iface->SetLayerTransform(resource, scale, origin, translate); +} + +/* End wrapper methods for PPB_Graphics2D_1_2 */ + /* Begin wrapper methods for PPB_Graphics3D_1_0 */ static int32_t Pnacl_M15_PPB_Graphics3D_GetAttribMaxValue(PP_Resource instance, int32_t attribute, int32_t* value) { @@ -2456,6 +2513,35 @@ static void Pnacl_M44_PPB_VideoEncoder_Close(PP_Resource video_encoder) { /* Not generating wrapper methods for PPB_View_1_2 */ +/* Begin wrapper methods for PPB_VpnProvider_0_1 */ + +static PP_Resource Pnacl_M52_PPB_VpnProvider_Create(PP_Instance instance) { + const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface; + return iface->Create(instance); +} + +static PP_Bool Pnacl_M52_PPB_VpnProvider_IsVpnProvider(PP_Resource resource) { + const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface; + return iface->IsVpnProvider(resource); +} + +static int32_t Pnacl_M52_PPB_VpnProvider_Bind(PP_Resource vpn_provider, struct PP_Var* configuration_id, struct PP_Var* configuration_name, struct PP_CompletionCallback* callback) { + const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface; + return iface->Bind(vpn_provider, *configuration_id, *configuration_name, *callback); +} + +static int32_t Pnacl_M52_PPB_VpnProvider_SendPacket(PP_Resource vpn_provider, struct PP_Var* packet, struct PP_CompletionCallback* callback) { + const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface; + return iface->SendPacket(vpn_provider, *packet, *callback); +} + +static int32_t Pnacl_M52_PPB_VpnProvider_ReceivePacket(PP_Resource vpn_provider, struct PP_Var* packet, struct PP_CompletionCallback* callback) { + const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface; + return iface->ReceivePacket(vpn_provider, packet, *callback); +} + +/* End wrapper methods for PPB_VpnProvider_0_1 */ + /* Begin wrapper methods for PPB_WebSocket_1_0 */ static PP_Resource Pnacl_M18_PPB_WebSocket_Create(PP_Instance instance) { @@ -4795,6 +4881,19 @@ static const struct PPB_Graphics2D_1_1 Pnacl_Wrappers_PPB_Graphics2D_1_1 = { .GetScale = (float (*)(PP_Resource resource))&Pnacl_M27_PPB_Graphics2D_GetScale }; +static const struct PPB_Graphics2D_1_2 Pnacl_Wrappers_PPB_Graphics2D_1_2 = { + .Create = (PP_Resource (*)(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque))&Pnacl_M52_PPB_Graphics2D_Create, + .IsGraphics2D = (PP_Bool (*)(PP_Resource resource))&Pnacl_M52_PPB_Graphics2D_IsGraphics2D, + .Describe = (PP_Bool (*)(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opaque))&Pnacl_M52_PPB_Graphics2D_Describe, + .PaintImageData = (void (*)(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect))&Pnacl_M52_PPB_Graphics2D_PaintImageData, + .Scroll = (void (*)(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount))&Pnacl_M52_PPB_Graphics2D_Scroll, + .ReplaceContents = (void (*)(PP_Resource graphics_2d, PP_Resource image_data))&Pnacl_M52_PPB_Graphics2D_ReplaceContents, + .Flush = (int32_t (*)(PP_Resource graphics_2d, struct PP_CompletionCallback callback))&Pnacl_M52_PPB_Graphics2D_Flush, + .SetScale = (PP_Bool (*)(PP_Resource resource, float scale))&Pnacl_M52_PPB_Graphics2D_SetScale, + .GetScale = (float (*)(PP_Resource resource))&Pnacl_M52_PPB_Graphics2D_GetScale, + .SetLayerTransform = (PP_Bool (*)(PP_Resource resource, float scale, const struct PP_Point* origin, const struct PP_Point* translate))&Pnacl_M52_PPB_Graphics2D_SetLayerTransform +}; + static const struct PPB_Graphics3D_1_0 Pnacl_Wrappers_PPB_Graphics3D_1_0 = { .GetAttribMaxValue = (int32_t (*)(PP_Resource instance, int32_t attribute, int32_t* value))&Pnacl_M15_PPB_Graphics3D_GetAttribMaxValue, .Create = (PP_Resource (*)(PP_Instance instance, PP_Resource share_context, const int32_t attrib_list[]))&Pnacl_M15_PPB_Graphics3D_Create, @@ -5230,6 +5329,14 @@ static const struct PPB_VideoEncoder_0_2 Pnacl_Wrappers_PPB_VideoEncoder_0_2 = { /* Not generating wrapper interface for PPB_View_1_2 */ +static const struct PPB_VpnProvider_0_1 Pnacl_Wrappers_PPB_VpnProvider_0_1 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M52_PPB_VpnProvider_Create, + .IsVpnProvider = (PP_Bool (*)(PP_Resource resource))&Pnacl_M52_PPB_VpnProvider_IsVpnProvider, + .Bind = (int32_t (*)(PP_Resource vpn_provider, struct PP_Var configuration_id, struct PP_Var configuration_name, struct PP_CompletionCallback callback))&Pnacl_M52_PPB_VpnProvider_Bind, + .SendPacket = (int32_t (*)(PP_Resource vpn_provider, struct PP_Var packet, struct PP_CompletionCallback callback))&Pnacl_M52_PPB_VpnProvider_SendPacket, + .ReceivePacket = (int32_t (*)(PP_Resource vpn_provider, struct PP_Var* packet, struct PP_CompletionCallback callback))&Pnacl_M52_PPB_VpnProvider_ReceivePacket +}; + static const struct PPB_WebSocket_1_0 Pnacl_Wrappers_PPB_WebSocket_1_0 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M18_PPB_WebSocket_Create, .IsWebSocket = (PP_Bool (*)(PP_Resource resource))&Pnacl_M18_PPB_WebSocket_IsWebSocket, @@ -5927,6 +6034,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_1 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_2 = { + .iface_macro = PPB_GRAPHICS_2D_INTERFACE_1_2, + .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_Graphics2D_1_2, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics3D_1_0 = { .iface_macro = PPB_GRAPHICS_3D_INTERFACE_1_0, .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_Graphics3D_1_0, @@ -6179,6 +6292,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoEncoder_0_2 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VpnProvider_0_1 = { + .iface_macro = PPB_VPNPROVIDER_INTERFACE_0_1, + .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_VpnProvider_0_1, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0 = { .iface_macro = PPB_WEBSOCKET_INTERFACE_1_0, .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_WebSocket_1_0, @@ -6524,6 +6643,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_FileSystem_1_0, &Pnacl_WrapperInfo_PPB_Graphics2D_1_0, &Pnacl_WrapperInfo_PPB_Graphics2D_1_1, + &Pnacl_WrapperInfo_PPB_Graphics2D_1_2, &Pnacl_WrapperInfo_PPB_Graphics3D_1_0, &Pnacl_WrapperInfo_PPB_HostResolver_1_0, &Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0, @@ -6566,6 +6686,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_VideoDecoder_1_1, &Pnacl_WrapperInfo_PPB_VideoEncoder_0_1, &Pnacl_WrapperInfo_PPB_VideoEncoder_0_2, + &Pnacl_WrapperInfo_PPB_VpnProvider_0_1, &Pnacl_WrapperInfo_PPB_WebSocket_1_0, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4, diff --git a/chromium/ppapi/ppapi_shared.gypi b/chromium/ppapi/ppapi_shared.gypi index 5a2cc933aa5..16407af853d 100644 --- a/chromium/ppapi/ppapi_shared.gypi +++ b/chromium/ppapi/ppapi_shared.gypi @@ -289,6 +289,8 @@ 'thunk/ppb_view_api.h', 'thunk/ppb_view_dev_thunk.cc', 'thunk/ppb_view_thunk.cc', + 'thunk/ppb_vpn_provider_api.h', + 'thunk/ppb_vpn_provider_thunk.cc', 'thunk/ppb_websocket_api.h', 'thunk/ppb_websocket_thunk.cc', 'thunk/ppb_x509_certificate_private_api.h', diff --git a/chromium/ppapi/ppapi_sources.gypi b/chromium/ppapi/ppapi_sources.gypi index 226383ff66f..674c868aee7 100644 --- a/chromium/ppapi/ppapi_sources.gypi +++ b/chromium/ppapi/ppapi_sources.gypi @@ -68,6 +68,7 @@ 'c/ppb_video_encoder.h', 'c/ppb_video_frame.h', 'c/ppb_view.h', + 'c/ppb_ppb_vpn_provider.h', 'c/ppb_websocket.h', 'c/ppp.h', 'c/ppp_graphics_3d.h', @@ -246,6 +247,8 @@ 'cpp/video_frame.h', 'cpp/view.cc', 'cpp/view.h', + 'cpp/vpn_provider.h', + 'cpp/vpn_provider.cc', 'cpp/websocket.cc', 'cpp/websocket.h', diff --git a/chromium/ppapi/proxy/audio_input_resource.cc b/chromium/ppapi/proxy/audio_input_resource.cc index 7d25a7190e4..cca80b76958 100644 --- a/chromium/ppapi/proxy/audio_input_resource.cc +++ b/chromium/ppapi/proxy/audio_input_resource.cc @@ -8,8 +8,8 @@ #include "base/logging.h" #include "base/numerics/safe_conversions.h" #include "ipc/ipc_platform_file.h" -#include "media/audio/audio_parameters.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" diff --git a/chromium/ppapi/proxy/graphics_2d_resource.cc b/chromium/ppapi/proxy/graphics_2d_resource.cc index 3b91a6a493b..8bfea9d57ea 100644 --- a/chromium/ppapi/proxy/graphics_2d_resource.cc +++ b/chromium/ppapi/proxy/graphics_2d_resource.cc @@ -113,6 +113,20 @@ float Graphics2DResource::GetScale() { return scale_; } +PP_Bool Graphics2DResource::SetLayerTransform(float scale, + const PP_Point* origin, + const PP_Point* translate) { + if (scale <= 0.0f) + return PP_FALSE; + // Adding the origin to the transform. + PP_FloatPoint translate_with_origin; + translate_with_origin.x = (1 - scale) * origin->x - translate->x; + translate_with_origin.y = (1 - scale) * origin->y - translate->y; + Post(RENDERER, + PpapiHostMsg_Graphics2D_SetLayerTransform(scale, translate_with_origin)); + return PP_TRUE; +} + int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { // If host is not even created, return failure immediately. This can happen // when failed to initialize (in constructor). diff --git a/chromium/ppapi/proxy/graphics_2d_resource.h b/chromium/ppapi/proxy/graphics_2d_resource.h index 7c8fb69b50b..3fa6b762bc7 100644 --- a/chromium/ppapi/proxy/graphics_2d_resource.h +++ b/chromium/ppapi/proxy/graphics_2d_resource.h @@ -42,6 +42,9 @@ class PPAPI_PROXY_EXPORT Graphics2DResource void ReplaceContents(PP_Resource image_data) override; PP_Bool SetScale(float scale) override; float GetScale() override; + PP_Bool SetLayerTransform(float scale, + const PP_Point* origin, + const PP_Point* translate) override; int32_t Flush(scoped_refptr<TrackedCallback> callback) override; bool ReadImageData(PP_Resource image, const PP_Point* top_left) override; diff --git a/chromium/ppapi/proxy/interface_list.cc b/chromium/ppapi/proxy/interface_list.cc index b2359742b95..d9445bd70cd 100644 --- a/chromium/ppapi/proxy/interface_list.cc +++ b/chromium/ppapi/proxy/interface_list.cc @@ -70,6 +70,7 @@ #include "ppapi/c/ppb_video_encoder.h" #include "ppapi/c/ppb_video_frame.h" #include "ppapi/c/ppb_view.h" +#include "ppapi/c/ppb_vpn_provider.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/private/ppb_camera_capabilities_private.h" #include "ppapi/c/private/ppb_camera_device_private.h" diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc index c96b44af556..77ef28217f9 100644 --- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc +++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc @@ -41,10 +41,6 @@ PpapiCommandBufferProxy::~PpapiCommandBufferProxy() { // deleted, closing the handle in this process. } -bool PpapiCommandBufferProxy::Initialize() { - return true; -} - gpu::CommandBuffer::State PpapiCommandBufferProxy::GetLastState() { ppapi::ProxyLock::AssertAcquiredDebugOnly(); return last_state_; @@ -179,11 +175,6 @@ void PpapiCommandBufferProxy::SetLock(base::Lock*) { NOTIMPLEMENTED(); } -bool PpapiCommandBufferProxy::IsGpuChannelLost() { - NOTIMPLEMENTED(); - return false; -} - void PpapiCommandBufferProxy::EnsureWorkVisible() { DCHECK_GE(flushed_fence_sync_release_, validated_fence_sync_release_); Send(new PpapiHostMsg_PPBGraphics3D_EnsureWorkVisible( @@ -241,6 +232,11 @@ void PpapiCommandBufferProxy::SignalQuery(uint32_t query, NOTREACHED(); } +void PpapiCommandBufferProxy::SetGpuControlClient(gpu::GpuControlClient*) { + // TODO(piman): The lost context callback skips past here and goes directly + // to the plugin instance. Make it more uniform and use the GpuControlClient. +} + gpu::Capabilities PpapiCommandBufferProxy::GetCapabilities() { return capabilities_; } diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h index cbc73ffa6e3..3cb7f423250 100644 --- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h +++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h @@ -41,7 +41,6 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, ~PpapiCommandBufferProxy() override; // gpu::CommandBuffer implementation: - bool Initialize() override; State GetLastState() override; int32_t GetLastToken() override; void Flush(int32_t put_offset) override; @@ -54,6 +53,7 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, void DestroyTransferBuffer(int32_t id) override; // gpu::GpuControl implementation: + void SetGpuControlClient(gpu::GpuControlClient*) override; gpu::Capabilities GetCapabilities() override; int32_t CreateImage(ClientBuffer buffer, size_t width, @@ -66,7 +66,6 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, unsigned usage) override; void SignalQuery(uint32_t query, const base::Closure& callback) override; void SetLock(base::Lock*) override; - bool IsGpuChannelLost() override; void EnsureWorkVisible() override; gpu::CommandBufferNamespace GetNamespaceID() const override; gpu::CommandBufferId GetCommandBufferID() const override; diff --git a/chromium/ppapi/proxy/ppapi_messages.cc b/chromium/ppapi/proxy/ppapi_messages.cc index 5cee1c78254..6ed361b2111 100644 --- a/chromium/ppapi/proxy/ppapi_messages.cc +++ b/chromium/ppapi/proxy/ppapi_messages.cc @@ -14,6 +14,12 @@ #include "ipc/struct_destructor_macros.h" #include "ppapi/proxy/ppapi_messages.h" +// Generate param traits size methods. +#include "ipc/param_traits_size_macros.h" +namespace IPC { +#include "ppapi/proxy/ppapi_messages.h" +} + // Generate param traits write methods. #include "ipc/param_traits_write_macros.h" namespace IPC { diff --git a/chromium/ppapi/proxy/ppapi_messages.h b/chromium/ppapi/proxy/ppapi_messages.h index a30c175840f..92d6f50c4ba 100644 --- a/chromium/ppapi/proxy/ppapi_messages.h +++ b/chromium/ppapi/proxy/ppapi_messages.h @@ -490,6 +490,8 @@ IPC_MESSAGE_CONTROL2(PpapiMsg_LoadPlugin, // Creates a channel to talk to a renderer. The plugin will respond with // PpapiHostMsg_ChannelCreated. +// If |renderer_pid| is base::kNullProcessId, this is a channel used by the +// browser itself. IPC_MESSAGE_CONTROL3(PpapiMsg_CreateChannel, base::ProcessId /* renderer_pid */, int /* renderer_child_id */, @@ -955,9 +957,9 @@ IPC_MESSAGE_CONTROL0(PpapiHostMsg_StartupInitializationComplete) // this message must be processed by ppapi/proxy/nacl_message_scanner.cc. IPC_SYNC_MESSAGE_CONTROL1_3(PpapiHostMsg_OpenResource, std::string /* key */, - ppapi::proxy::SerializedHandle /* fd */, uint64_t /* file_token_lo */, - uint64_t /* file_token_hi */) + uint64_t /* file_token_hi */, + ppapi::proxy::SerializedHandle /* fd */) // Logs the given message to the console of all instances. IPC_MESSAGE_CONTROL4(PpapiHostMsg_LogWithSource, @@ -1655,6 +1657,9 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_ReplaceContents, ppapi::HostResource /* image_data */) IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetScale, float /* scale */) +IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_SetLayerTransform, + float /* scale */, + PP_FloatPoint /* translate */) // Graphics2D, plugin -> host -> plugin IPC_MESSAGE_CONTROL0(PpapiHostMsg_Graphics2D_Flush) diff --git a/chromium/ppapi/proxy/ppapi_param_traits.cc b/chromium/ppapi/proxy/ppapi_param_traits.cc index 9d21eac1340..d55f57582d5 100644 --- a/chromium/ppapi/proxy/ppapi_param_traits.cc +++ b/chromium/ppapi/proxy/ppapi_param_traits.cc @@ -79,6 +79,11 @@ void WriteVectorWithoutCopy(base::Pickle* m, const std::vector<T>& p) { // PP_Bool --------------------------------------------------------------------- // static +void ParamTraits<PP_Bool>::GetSize(base::PickleSizer* s, const param_type& p) { + GetParamSize(s, PP_ToBool(p)); +} + +// static void ParamTraits<PP_Bool>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, PP_ToBool(p)); } @@ -151,6 +156,13 @@ void ParamTraits<PP_KeyInformation>::Log(const param_type& p, std::string* l) { // PP_NetAddress_Private ------------------------------------------------------- // static +void ParamTraits<PP_NetAddress_Private>::GetSize(base::PickleSizer* s, + const param_type& p) { + GetParamSize(s, p.size); + s->AddBytes(static_cast<int>(p.size)); +} + +// static void ParamTraits<PP_NetAddress_Private>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.size); @@ -186,6 +198,13 @@ void ParamTraits<PP_NetAddress_Private>::Log(const param_type& p, // HostResource ---------------------------------------------------------------- // static +void ParamTraits<ppapi::HostResource>::GetSize(base::PickleSizer* s, + const param_type& p) { + GetParamSize(s, p.instance()); + GetParamSize(s, p.host_resource()); +} + +// static void ParamTraits<ppapi::HostResource>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.instance()); @@ -253,6 +272,13 @@ void ParamTraits< std::vector<ppapi::proxy::SerializedVar> >::Log( // ppapi::PpapiPermissions ----------------------------------------------------- +// static +void ParamTraits<ppapi::PpapiPermissions>::GetSize(base::PickleSizer* s, + const param_type& p) { + GetParamSize(s, p.GetBits()); +} + +// static void ParamTraits<ppapi::PpapiPermissions>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.GetBits()); @@ -675,6 +701,13 @@ void ParamTraits<ppapi::SocketOptionData>::Log(const param_type& p, // ppapi::CompositorLayerData -------------------------------------------------- // static +void ParamTraits<ppapi::CompositorLayerData::Transform>::GetSize( + base::PickleSizer* s, const param_type& p) { + for (size_t i = 0; i < arraysize(p.matrix); i++) + GetParamSize(s, p.matrix[i]); +} + +// static void ParamTraits<ppapi::CompositorLayerData::Transform>::Write( base::Pickle* m, const param_type& p) { diff --git a/chromium/ppapi/proxy/ppapi_param_traits.h b/chromium/ppapi/proxy/ppapi_param_traits.h index 69965470b01..75d4529f4ca 100644 --- a/chromium/ppapi/proxy/ppapi_param_traits.h +++ b/chromium/ppapi/proxy/ppapi_param_traits.h @@ -49,6 +49,7 @@ namespace IPC { template<> struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> { typedef PP_Bool param_type; + static void GetSize(base::PickleSizer* s, const param_type& p); static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m, base::PickleIterator* iter, @@ -59,6 +60,7 @@ struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> { template <> struct PPAPI_PROXY_EXPORT ParamTraits<PP_NetAddress_Private> { typedef PP_NetAddress_Private param_type; + static void GetSize(base::PickleSizer* s, const param_type& p); static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m, base::PickleIterator* iter, @@ -142,6 +144,7 @@ struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedHandle> { template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::HostResource> { typedef ppapi::HostResource param_type; + static void GetSize(base::PickleSizer* s, const param_type& p); static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m, base::PickleIterator* iter, @@ -173,6 +176,7 @@ struct PPAPI_PROXY_EXPORT ParamTraits< template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PpapiPermissions> { typedef ppapi::PpapiPermissions param_type; + static void GetSize(base::PickleSizer* s, const param_type& p); static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m, base::PickleIterator* iter, @@ -225,6 +229,7 @@ struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::SocketOptionData> { template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::CompositorLayerData::Transform> { typedef ppapi::CompositorLayerData::Transform param_type; + static void GetSize(base::PickleSizer* s, const param_type& p); static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m, base::PickleIterator* iter, diff --git a/chromium/ppapi/proxy/ppapi_proxy_test.cc b/chromium/ppapi/proxy/ppapi_proxy_test.cc index 88bf5dba70a..fab1e0c7187 100644 --- a/chromium/ppapi/proxy/ppapi_proxy_test.cc +++ b/chromium/ppapi/proxy/ppapi_proxy_test.cc @@ -14,7 +14,7 @@ #include "base/process/process_handle.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "ipc/ipc_sync_channel.h" #include "ipc/message_filter.h" #include "ppapi/c/pp_errors.h" diff --git a/chromium/ppapi/proxy/ppb_image_data_proxy.cc b/chromium/ppapi/proxy/ppb_image_data_proxy.cc index 5e4ebe192a5..bde81b43fb6 100644 --- a/chromium/ppapi/proxy/ppb_image_data_proxy.cc +++ b/chromium/ppapi/proxy/ppb_image_data_proxy.cc @@ -392,9 +392,9 @@ void* PlatformImageData::Map() { const bool is_opaque = false; mapped_canvas_ = - skia::AdoptRef(transport_dib_->GetPlatformCanvas(desc_.size.width, - desc_.size.height, - is_opaque)); + sk_sp<SkCanvas>(transport_dib_->GetPlatformCanvas(desc_.size.width, + desc_.size.height, + is_opaque)); if (!mapped_canvas_.get()) return NULL; } diff --git a/chromium/ppapi/proxy/ppb_image_data_proxy.h b/chromium/ppapi/proxy/ppb_image_data_proxy.h index 0e2edb4cd26..2e5554d5708 100644 --- a/chromium/ppapi/proxy/ppb_image_data_proxy.h +++ b/chromium/ppapi/proxy/ppb_image_data_proxy.h @@ -29,7 +29,7 @@ #include "ppapi/thunk/ppb_image_data_api.h" #if !defined(OS_NACL) -#include "skia/ext/refptr.h" +#include "third_party/skia/include/core/SkRefCnt.h" #endif // !defined(OS_NACL) class TransportDIB; @@ -104,7 +104,7 @@ class PPAPI_PROXY_EXPORT PlatformImageData : public ImageData { std::unique_ptr<TransportDIB> transport_dib_; // Null when the image isn't mapped. - skia::RefPtr<SkCanvas> mapped_canvas_; + sk_sp<SkCanvas> mapped_canvas_; DISALLOW_COPY_AND_ASSIGN(PlatformImageData); }; diff --git a/chromium/ppapi/proxy/ppb_message_loop_proxy.cc b/chromium/ppapi/proxy/ppb_message_loop_proxy.cc index e05ec5cfd30..7f2fc337849 100644 --- a/chromium/ppapi/proxy/ppb_message_loop_proxy.cc +++ b/chromium/ppapi/proxy/ppb_message_loop_proxy.cc @@ -11,7 +11,7 @@ #include "base/bind.h" #include "base/compiler_specific.h" #include "base/location.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_message_loop.h" #include "ppapi/proxy/plugin_dispatcher.h" diff --git a/chromium/ppapi/proxy/resource_creation_proxy.cc b/chromium/ppapi/proxy/resource_creation_proxy.cc index 31b2cfd8461..a6a7d049ce7 100644 --- a/chromium/ppapi/proxy/resource_creation_proxy.cc +++ b/chromium/ppapi/proxy/resource_creation_proxy.cc @@ -409,6 +409,10 @@ PP_Resource ResourceCreationProxy::CreateVideoSource( return (new VideoSourceResource(GetConnection(), instance))->GetReference(); } +PP_Resource ResourceCreationProxy::CreateVpnProvider(PP_Instance instance) { + return 0; +} + PP_Resource ResourceCreationProxy::CreateWebSocket(PP_Instance instance) { return (new WebSocketResource(GetConnection(), instance))->GetReference(); } diff --git a/chromium/ppapi/proxy/resource_creation_proxy.h b/chromium/ppapi/proxy/resource_creation_proxy.h index 498c93c265d..302674566f8 100644 --- a/chromium/ppapi/proxy/resource_creation_proxy.h +++ b/chromium/ppapi/proxy/resource_creation_proxy.h @@ -160,6 +160,7 @@ class ResourceCreationProxy : public InterfaceProxy, PP_Resource CreateVideoDestination(PP_Instance instance) override; PP_Resource CreateVideoEncoder(PP_Instance instance) override; PP_Resource CreateVideoSource(PP_Instance instance) override; + PP_Resource CreateVpnProvider(PP_Instance instance) override; PP_Resource CreateWebSocket(PP_Instance instance) override; PP_Resource CreateX509CertificatePrivate(PP_Instance instance) override; #if !defined(OS_NACL) diff --git a/chromium/ppapi/shared_impl/ppapi_globals.cc b/chromium/ppapi/shared_impl/ppapi_globals.cc index 08cdbca34d9..b016c9c3712 100644 --- a/chromium/ppapi/shared_impl/ppapi_globals.cc +++ b/chromium/ppapi/shared_impl/ppapi_globals.cc @@ -7,8 +7,8 @@ #include "base/lazy_instance.h" // For testing purposes only. #include "base/logging.h" #include "base/single_thread_task_runner.h" -#include "base/thread_task_runner_handle.h" #include "base/threading/thread_local.h" // For testing purposes only. +#include "base/threading/thread_task_runner_handle.h" namespace ppapi { diff --git a/chromium/ppapi/shared_impl/ppb_audio_shared.cc b/chromium/ppapi/shared_impl/ppb_audio_shared.cc index 92dc3eccb1f..6ae632a298a 100644 --- a/chromium/ppapi/shared_impl/ppb_audio_shared.cc +++ b/chromium/ppapi/shared_impl/ppb_audio_shared.cc @@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/trace_event/trace_event.h" -#include "media/audio/audio_parameters.h" +#include "media/base/audio_parameters.h" #include "ppapi/nacl_irt/public/irt_ppapi.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/ppb_audio_config_shared.h" diff --git a/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.cc index 108b415feeb..af53bfb55c0 100644 --- a/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.cc +++ b/chromium/ppapi/shared_impl/ppb_graphics_3d_shared.cc @@ -7,6 +7,7 @@ #include "base/logging.h" #include "gpu/command_buffer/client/gles2_cmd_helper.h" #include "gpu/command_buffer/client/gles2_implementation.h" +#include "gpu/command_buffer/client/shared_memory_limits.h" #include "gpu/command_buffer/client/transfer_buffer.h" #include "gpu/command_buffer/common/sync_token.h" #include "ppapi/c/pp_errors.h" @@ -143,10 +144,9 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl( GetGpuControl())); if (!gles2_impl_->Initialize( - transfer_buffer_size, - kMinTransferBufferSize, - std::max(kMaxTransferBufferSize, transfer_buffer_size), - gpu::gles2::GLES2Implementation::kNoLimit)) { + transfer_buffer_size, kMinTransferBufferSize, + std::max(kMaxTransferBufferSize, transfer_buffer_size), + gpu::SharedMemoryLimits::kNoLimit)) { return false; } diff --git a/chromium/ppapi/shared_impl/resource.h b/chromium/ppapi/shared_impl/resource.h index f5a8b7926d5..8d30ed46d06 100644 --- a/chromium/ppapi/shared_impl/resource.h +++ b/chromium/ppapi/shared_impl/resource.h @@ -89,6 +89,7 @@ F(PPB_VideoLayer_API) \ F(PPB_VideoSource_Private_API) \ F(PPB_View_API) \ + F(PPB_VpnProvider_API) \ F(PPB_WebSocket_API) \ F(PPB_Widget_API) \ F(PPB_X509Certificate_Private_API) diff --git a/chromium/ppapi/shared_impl/tracked_callback.cc b/chromium/ppapi/shared_impl/tracked_callback.cc index c032a503ee8..8a689dd1d65 100644 --- a/chromium/ppapi/shared_impl/tracked_callback.cc +++ b/chromium/ppapi/shared_impl/tracked_callback.cc @@ -10,7 +10,7 @@ #include "base/logging.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/lock.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_message_loop.h" diff --git a/chromium/ppapi/thunk/BUILD.gn b/chromium/ppapi/thunk/BUILD.gn index d872f523505..258e0446494 100644 --- a/chromium/ppapi/thunk/BUILD.gn +++ b/chromium/ppapi/thunk/BUILD.gn @@ -138,6 +138,8 @@ source_set("thunk") { "ppb_view_api.h", "ppb_view_dev_thunk.cc", "ppb_view_thunk.cc", + "ppb_vpn_provider_api.h", + "ppb_vpn_provider_thunk.cc", "ppb_websocket_api.h", "ppb_websocket_thunk.cc", "ppb_x509_certificate_private_api.h", diff --git a/chromium/ppapi/thunk/interfaces_ppb_public_dev_channel.h b/chromium/ppapi/thunk/interfaces_ppb_public_dev_channel.h index 4dedf17a16d..64dd189921d 100644 --- a/chromium/ppapi/thunk/interfaces_ppb_public_dev_channel.h +++ b/chromium/ppapi/thunk/interfaces_ppb_public_dev_channel.h @@ -14,6 +14,7 @@ PROXIED_IFACE(PPB_COMPOSITORLAYER_INTERFACE_0_1, PPB_CompositorLayer_0_1) PROXIED_IFACE(PPB_COMPOSITORLAYER_INTERFACE_0_2, PPB_CompositorLayer_0_2) PROXIED_IFACE(PPB_VIDEODECODER_INTERFACE_0_1, PPB_VideoDecoder_0_1) PROXIED_IFACE(PPB_VIDEOENCODER_INTERFACE_0_1, PPB_VideoEncoder_0_1) +PROXIED_IFACE(PPB_VPNPROVIDER_INTERFACE_0_1, PPB_VpnProvider_0_1) // Note, PPB_TraceEvent is special. We don't want to actually make it stable, // but we want developers to be able to leverage it when running Chrome Dev or diff --git a/chromium/ppapi/thunk/interfaces_ppb_public_stable.h b/chromium/ppapi/thunk/interfaces_ppb_public_stable.h index 9a7ce0e872c..8725277da5b 100644 --- a/chromium/ppapi/thunk/interfaces_ppb_public_stable.h +++ b/chromium/ppapi/thunk/interfaces_ppb_public_stable.h @@ -60,6 +60,7 @@ PROXIED_IFACE(PPB_FILEIO_INTERFACE_1_0, PPB_FileIO_1_0) PROXIED_IFACE(PPB_FILEIO_INTERFACE_1_1, PPB_FileIO_1_1) PROXIED_IFACE(PPB_GRAPHICS_2D_INTERFACE_1_0, PPB_Graphics2D_1_0) PROXIED_IFACE(PPB_GRAPHICS_2D_INTERFACE_1_1, PPB_Graphics2D_1_1) +PROXIED_IFACE(PPB_GRAPHICS_2D_INTERFACE_1_2, PPB_Graphics2D_1_2) PROXIED_IFACE(PPB_HOSTRESOLVER_INTERFACE_1_0, PPB_HostResolver_1_0) PROXIED_IFACE(PPB_IME_INPUT_EVENT_INTERFACE_1_0, PPB_IMEInputEvent_1_0) PROXIED_IFACE(PPB_INPUT_EVENT_INTERFACE_1_0, PPB_InputEvent_1_0) diff --git a/chromium/ppapi/thunk/ppb_graphics_2d_api.h b/chromium/ppapi/thunk/ppb_graphics_2d_api.h index 164072fef38..de83e2dd27b 100644 --- a/chromium/ppapi/thunk/ppb_graphics_2d_api.h +++ b/chromium/ppapi/thunk/ppb_graphics_2d_api.h @@ -36,6 +36,9 @@ class PPAPI_THUNK_EXPORT PPB_Graphics2D_API { virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0; virtual PP_Bool SetScale(float scale) = 0; virtual float GetScale() = 0; + virtual PP_Bool SetLayerTransform(float scale, + const PP_Point* origin, + const PP_Point* translate) = 0; // Test only virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0; diff --git a/chromium/ppapi/thunk/ppb_graphics_2d_thunk.cc b/chromium/ppapi/thunk/ppb_graphics_2d_thunk.cc index 527b0aa80cc..af7349f3c4a 100644 --- a/chromium/ppapi/thunk/ppb_graphics_2d_thunk.cc +++ b/chromium/ppapi/thunk/ppb_graphics_2d_thunk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From ppb_graphics_2d.idl modified Wed Jan 27 17:10:16 2016. +// From ppb_graphics_2d.idl modified Fri Apr 15 15:37:20 2016. #include <stdint.h> #include <string.h> @@ -102,6 +102,17 @@ float GetScale(PP_Resource resource) { return enter.object()->GetScale(); } +PP_Bool SetLayerTransform(PP_Resource resource, + float scale, + const struct PP_Point* origin, + const struct PP_Point* translate) { + VLOG(4) << "PPB_Graphics2D::SetLayerTransform()"; + EnterResource<PPB_Graphics2D_API> enter(resource, true); + if (enter.failed()) + return PP_FALSE; + return enter.object()->SetLayerTransform(scale, origin, translate); +} + const PPB_Graphics2D_1_0 g_ppb_graphics2d_thunk_1_0 = { &Create, &IsGraphics2D, &Describe, &PaintImageData, &Scroll, &ReplaceContents, &Flush}; @@ -110,6 +121,11 @@ const PPB_Graphics2D_1_1 g_ppb_graphics2d_thunk_1_1 = { &Create, &IsGraphics2D, &Describe, &PaintImageData, &Scroll, &ReplaceContents, &Flush, &SetScale, &GetScale}; +const PPB_Graphics2D_1_2 g_ppb_graphics2d_thunk_1_2 = { + &Create, &IsGraphics2D, &Describe, &PaintImageData, + &Scroll, &ReplaceContents, &Flush, &SetScale, + &GetScale, &SetLayerTransform}; + } // namespace PPAPI_THUNK_EXPORT const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() { @@ -120,5 +136,9 @@ PPAPI_THUNK_EXPORT const PPB_Graphics2D_1_1* GetPPB_Graphics2D_1_1_Thunk() { return &g_ppb_graphics2d_thunk_1_1; } +PPAPI_THUNK_EXPORT const PPB_Graphics2D_1_2* GetPPB_Graphics2D_1_2_Thunk() { + return &g_ppb_graphics2d_thunk_1_2; +} + } // namespace thunk } // namespace ppapi diff --git a/chromium/ppapi/thunk/ppb_vpn_provider_api.h b/chromium/ppapi/thunk/ppb_vpn_provider_api.h new file mode 100644 index 00000000000..7153afb02c6 --- /dev/null +++ b/chromium/ppapi/thunk/ppb_vpn_provider_api.h @@ -0,0 +1,31 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_THUNK_PPB_VPNPROVIDER_API_H_ +#define PPAPI_THUNK_PPB_VPNPROVIDER_API_H_ + +#include "ppapi/thunk/ppapi_thunk_export.h" + +namespace ppapi { +namespace thunk { + +class PPAPI_THUNK_EXPORT PPB_VpnProvider_API { + public: + virtual ~PPB_VpnProvider_API() {} + + virtual int32_t Bind(const PP_Var& configuration_id, + const PP_Var& configuration_name, + const scoped_refptr<TrackedCallback>& callback) = 0; + virtual int32_t SendPacket( + const PP_Var& packet, + const scoped_refptr<TrackedCallback>& callback) = 0; + virtual int32_t ReceivePacket( + PP_Var* packet, + const scoped_refptr<TrackedCallback>& callback) = 0; +}; + +} // namespace thunk +} // namespace ppapi + +#endif // PPAPI_THUNK_PPB_VPNPROVIDER_API_H_ diff --git a/chromium/ppapi/thunk/ppb_vpn_provider_thunk.cc b/chromium/ppapi/thunk/ppb_vpn_provider_thunk.cc new file mode 100644 index 00000000000..ddb9280f720 --- /dev/null +++ b/chromium/ppapi/thunk/ppb_vpn_provider_thunk.cc @@ -0,0 +1,79 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// From ppb_vpn_provider.idl modified Fri May 6 20:38:30 2016. + +#include <stdint.h> + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_vpn_provider.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppapi_thunk_export.h" +#include "ppapi/thunk/ppb_vpn_provider_api.h" + +namespace ppapi { +namespace thunk { + +namespace { + +PP_Resource Create(PP_Instance instance) { + VLOG(4) << "PPB_VpnProvider::Create()"; + EnterResourceCreation enter(instance); + if (enter.failed()) + return 0; + return enter.functions()->CreateVpnProvider(instance); +} + +PP_Bool IsVpnProvider(PP_Resource resource) { + VLOG(4) << "PPB_VpnProvider::IsVpnProvider()"; + EnterResource<PPB_VpnProvider_API> enter(resource, false); + return PP_FromBool(enter.succeeded()); +} + +int32_t Bind(PP_Resource vpn_provider, + struct PP_Var configuration_id, + struct PP_Var configuration_name, + struct PP_CompletionCallback callback) { + VLOG(4) << "PPB_VpnProvider::Bind()"; + EnterResource<PPB_VpnProvider_API> enter(vpn_provider, callback, true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->Bind( + configuration_id, configuration_name, enter.callback())); +} + +int32_t SendPacket(PP_Resource vpn_provider, + struct PP_Var packet, + struct PP_CompletionCallback callback) { + VLOG(4) << "PPB_VpnProvider::SendPacket()"; + EnterResource<PPB_VpnProvider_API> enter(vpn_provider, callback, true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->SendPacket(packet, enter.callback())); +} + +int32_t ReceivePacket(PP_Resource vpn_provider, + struct PP_Var* packet, + struct PP_CompletionCallback callback) { + VLOG(4) << "PPB_VpnProvider::ReceivePacket()"; + EnterResource<PPB_VpnProvider_API> enter(vpn_provider, callback, true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult( + enter.object()->ReceivePacket(packet, enter.callback())); +} + +const PPB_VpnProvider_0_1 g_ppb_vpnprovider_thunk_0_1 = { + &Create, &IsVpnProvider, &Bind, &SendPacket, &ReceivePacket}; + +} // namespace + +PPAPI_THUNK_EXPORT const PPB_VpnProvider_0_1* GetPPB_VpnProvider_0_1_Thunk() { + return &g_ppb_vpnprovider_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 582d9a18648..5636b5f4315 100644 --- a/chromium/ppapi/thunk/resource_creation_api.h +++ b/chromium/ppapi/thunk/resource_creation_api.h @@ -179,6 +179,7 @@ class ResourceCreationAPI { virtual PP_Resource CreateVideoDestination(PP_Instance instance) = 0; virtual PP_Resource CreateVideoEncoder(PP_Instance instance) = 0; virtual PP_Resource CreateVideoSource(PP_Instance instance) = 0; + virtual PP_Resource CreateVpnProvider(PP_Instance instance) = 0; virtual PP_Resource CreateWebSocket(PP_Instance instance) = 0; virtual PP_Resource CreateX509CertificatePrivate(PP_Instance instance) = 0; #if !defined(OS_NACL) diff --git a/chromium/ppapi/utility/completion_callback_factory_thread_traits.h b/chromium/ppapi/utility/completion_callback_factory_thread_traits.h index a1dbc64e78e..ac0b31a75c2 100644 --- a/chromium/ppapi/utility/completion_callback_factory_thread_traits.h +++ b/chromium/ppapi/utility/completion_callback_factory_thread_traits.h @@ -85,7 +85,7 @@ class NonThreadSafeThreadTraits { /// Default constructor. In debug mode, this checks that the object is being /// created on the main thread. RefCount() : ref_(0) { -#ifndef NDEBUG +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) is_main_thread_ = Module::Get()->core()->IsMainThread(); #endif } @@ -113,7 +113,7 @@ class NonThreadSafeThreadTraits { private: int32_t ref_; -#ifndef NDEBUG +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) bool is_main_thread_; #endif }; @@ -126,7 +126,7 @@ class NonThreadSafeThreadTraits { class Lock { public: Lock() { -#ifndef NDEBUG +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) is_main_thread_ = Module::Get()->core()->IsMainThread(); lock_held_ = false; #endif @@ -139,7 +139,7 @@ class NonThreadSafeThreadTraits { /// Acquires the fake "lock". This does nothing except perform checks in /// debug mode. void Acquire() { -#ifndef NDEBUG +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) PP_DCHECK(!lock_held_); lock_held_ = true; #endif @@ -148,14 +148,14 @@ class NonThreadSafeThreadTraits { /// Releases the fake "lock". This does nothing except perform checks in /// debug mode. void Release() { -#ifndef NDEBUG +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) PP_DCHECK(lock_held_); lock_held_ = false; #endif } private: -#ifndef NDEBUG +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) bool is_main_thread_; bool lock_held_; #endif |