summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorxzhang <xzhang@adobe.com>2015-11-02 14:42:54 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-02 22:43:47 +0000
commiteca2b40dd6ffacdf9e1772e5d18c3623d71b2946 (patch)
tree153b204500127d4ee051fd3d076b9c5e6b818fc0 /ppapi
parent537726002122ef050257948da5bd8e1b977ff8aa (diff)
downloadchromium_src-eca2b40dd6ffacdf9e1772e5d18c3623d71b2946.zip
chromium_src-eca2b40dd6ffacdf9e1772e5d18c3623d71b2946.tar.gz
chromium_src-eca2b40dd6ffacdf9e1772e5d18c3623d71b2946.tar.bz2
Enable pp::flash::FontFile support on Windows
Part 1: Added Windows implementation using Skia for PepperFlashFontFileHost. This patch adds a simple Windows implementation of PepperFlashFontFileHost using Skia to access the font data. By implementing this PepperFlash can remove some use cases of GDI to support Win32k lockdown. AUTHOR=forshaw@google.com Part 2: To support win32k lockdown, Pepper flash needs to switch Win GDI font calls to pp::flash::FontFile PPAPI. This API was only supported on Linux, and it is supported on Windows starting from M48. Considering backward compatibility, we still need to fallback to GDI calls for Chrome versions where Win32k lockdown is not available yet. We add a new version of PB_Flash_FontFile interface: PPB_FLASH_FONTFILE_INTERFACE_0_2 This new version does not change any API, its availability shows that pp::flash:FontFile is supported for Windows, and Pepper flash can use it to decide whether it should call pp::flash:FontFile API or fall back to Win GDI calls. AUTHOR=xzhang@adobe.com BUG=523278 R=bbudge@chromium.org, raymes@chromium.org, forshaw@google.com Review URL: https://codereview.chromium.org/1416643002 Cr-Commit-Position: refs/heads/master@{#357457}
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/private/ppb_flash_font_file.idl12
-rw-r--r--ppapi/c/private/ppb_flash_font_file.h25
-rw-r--r--ppapi/cpp/private/flash_font_file.cc25
-rw-r--r--ppapi/cpp/private/flash_font_file.h3
-rw-r--r--ppapi/thunk/interfaces_ppb_private_flash.h2
-rw-r--r--ppapi/thunk/ppb_flash_font_file_thunk.cc37
6 files changed, 86 insertions, 18 deletions
diff --git a/ppapi/api/private/ppb_flash_font_file.idl b/ppapi/api/private/ppb_flash_font_file.idl
index b7c39b4..b921d18 100644
--- a/ppapi/api/private/ppb_flash_font_file.idl
+++ b/ppapi/api/private/ppb_flash_font_file.idl
@@ -7,8 +7,11 @@
* This file contains the <code>PPB_Flash_FontFile</code> interface.
*/
+[generate_thunk]
+
label Chrome {
- M24 = 0.1
+ M24 = 0.1,
+ M48 = 0.2
};
interface PPB_Flash_FontFile {
@@ -36,5 +39,12 @@ interface PPB_Flash_FontFile {
[in] uint32_t table,
[out] mem_t output,
[out] uint32_t output_length);
+
+ /**
+ * Returns whether <code>PPB_Flash_FontFile</code> is supported on Windows.
+ */
+ [version=0.2]
+ PP_Bool IsSupportedForWindows();
+
};
diff --git a/ppapi/c/private/ppb_flash_font_file.h b/ppapi/c/private/ppb_flash_font_file.h
index f50818e..a1cc786 100644
--- a/ppapi/c/private/ppb_flash_font_file.h
+++ b/ppapi/c/private/ppb_flash_font_file.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_flash_font_file.idl modified Thu Dec 13 10:56:15 2012. */
+/* From private/ppb_flash_font_file.idl modified Fri Oct 23 10:34:57 2015. */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_FONT_FILE_H_
#define PPAPI_C_PRIVATE_PPB_FLASH_FONT_FILE_H_
@@ -18,7 +18,8 @@
#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
#define PPB_FLASH_FONTFILE_INTERFACE_0_1 "PPB_Flash_FontFile;0.1"
-#define PPB_FLASH_FONTFILE_INTERFACE PPB_FLASH_FONTFILE_INTERFACE_0_1
+#define PPB_FLASH_FONTFILE_INTERFACE_0_2 "PPB_Flash_FontFile;0.2"
+#define PPB_FLASH_FONTFILE_INTERFACE PPB_FLASH_FONTFILE_INTERFACE_0_2
/**
* @file
@@ -30,7 +31,7 @@
* @addtogroup Interfaces
* @{
*/
-struct PPB_Flash_FontFile_0_1 {
+struct PPB_Flash_FontFile_0_2 {
/* Returns a resource identifying a font file corresponding to the given font
* request after applying the browser-specific fallback.
*/
@@ -52,9 +53,25 @@ struct PPB_Flash_FontFile_0_1 {
uint32_t table,
void* output,
uint32_t* output_length);
+ /**
+ * Returns whether <code>PPB_Flash_FontFile</code> is supported on Windows.
+ */
+ PP_Bool (*IsSupportedForWindows)(void);
};
-typedef struct PPB_Flash_FontFile_0_1 PPB_Flash_FontFile;
+typedef struct PPB_Flash_FontFile_0_2 PPB_Flash_FontFile;
+
+struct PPB_Flash_FontFile_0_1 {
+ PP_Resource (*Create)(
+ PP_Instance instance,
+ const struct PP_BrowserFont_Trusted_Description* description,
+ PP_PrivateFontCharset charset);
+ PP_Bool (*IsFlashFontFile)(PP_Resource resource);
+ PP_Bool (*GetFontTable)(PP_Resource font_file,
+ uint32_t table,
+ void* output,
+ uint32_t* output_length);
+};
/**
* @}
*/
diff --git a/ppapi/cpp/private/flash_font_file.cc b/ppapi/cpp/private/flash_font_file.cc
index 573d9dc..30a5f66 100644
--- a/ppapi/cpp/private/flash_font_file.cc
+++ b/ppapi/cpp/private/flash_font_file.cc
@@ -17,6 +17,10 @@ template <> const char* interface_name<PPB_Flash_FontFile_0_1>() {
return PPB_FLASH_FONTFILE_INTERFACE_0_1;
}
+template <> const char* interface_name<PPB_Flash_FontFile_0_2>() {
+ return PPB_FLASH_FONTFILE_INTERFACE_0_2;
+}
+
} // namespace
namespace flash {
@@ -27,7 +31,11 @@ FontFile::FontFile() {
FontFile::FontFile(const InstanceHandle& instance,
const PP_BrowserFont_Trusted_Description* description,
PP_PrivateFontCharset charset) {
- if (has_interface<PPB_Flash_FontFile_0_1>()) {
+ if (has_interface<PPB_Flash_FontFile_0_2>()) {
+ PassRefFromConstructor(get_interface<PPB_Flash_FontFile_0_2>()->Create(
+ instance.pp_instance(), description, charset));
+ }
+ else if (has_interface<PPB_Flash_FontFile_0_1>()) {
PassRefFromConstructor(get_interface<PPB_Flash_FontFile_0_1>()->Create(
instance.pp_instance(), description, charset));
}
@@ -38,13 +46,24 @@ FontFile::~FontFile() {
// static
bool FontFile::IsAvailable() {
- return has_interface<PPB_Flash_FontFile_0_1>();
+ return (has_interface<PPB_Flash_FontFile_0_2>() ||
+ has_interface<PPB_Flash_FontFile_0_1>());
+}
+
+bool FontFile::IsSupportedForWindows() {
+ if (has_interface<PPB_Flash_FontFile_0_2>())
+ return !!get_interface<PPB_Flash_FontFile_0_2>()->IsSupportedForWindows();
+ return false;
}
bool FontFile::GetFontTable(uint32_t table,
void* output,
uint32_t* output_length) {
- if (has_interface<PPB_Flash_FontFile_0_1>()) {
+ if (has_interface<PPB_Flash_FontFile_0_2>()) {
+ return !!get_interface<PPB_Flash_FontFile_0_2>()->
+ GetFontTable(pp_resource(), table, output, output_length);
+ }
+ else if (has_interface<PPB_Flash_FontFile_0_1>()) {
return !!get_interface<PPB_Flash_FontFile_0_1>()->
GetFontTable(pp_resource(), table, output, output_length);
}
diff --git a/ppapi/cpp/private/flash_font_file.h b/ppapi/cpp/private/flash_font_file.h
index 053fca2..ea1671c 100644
--- a/ppapi/cpp/private/flash_font_file.h
+++ b/ppapi/cpp/private/flash_font_file.h
@@ -28,6 +28,9 @@ class FontFile : public Resource {
// Returns true if the required interface is available.
static bool IsAvailable();
+ // Returns true if this interface is supported for Windows.
+ bool IsSupportedForWindows();
+
bool GetFontTable(uint32_t table, void* output, uint32_t* output_length);
};
diff --git a/ppapi/thunk/interfaces_ppb_private_flash.h b/ppapi/thunk/interfaces_ppb_private_flash.h
index 8957526..b334742 100644
--- a/ppapi/thunk/interfaces_ppb_private_flash.h
+++ b/ppapi/thunk/interfaces_ppb_private_flash.h
@@ -37,6 +37,8 @@ PROXIED_IFACE(PPB_FLASH_DRM_INTERFACE_1_1,
PROXIED_IFACE(PPB_FLASH_FONTFILE_INTERFACE_0_1,
PPB_Flash_FontFile_0_1)
+PROXIED_IFACE(PPB_FLASH_FONTFILE_INTERFACE_0_2,
+ PPB_Flash_FontFile_0_2)
PROXIED_IFACE(PPB_FLASH_MENU_INTERFACE_0_2,
PPB_Flash_Menu_0_2)
diff --git a/ppapi/thunk/ppb_flash_font_file_thunk.cc b/ppapi/thunk/ppb_flash_font_file_thunk.cc
index 3a07365..aaa81fa 100644
--- a/ppapi/thunk/ppb_flash_font_file_thunk.cc
+++ b/ppapi/thunk/ppb_flash_font_file_thunk.cc
@@ -2,11 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// From private/ppb_flash_font_file.idl modified Thu Oct 22 22:02:40 2015.
+
+#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_flash_font_file.h"
+#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
#include "ppapi/thunk/ppb_flash_font_file_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
@@ -14,8 +17,9 @@ namespace thunk {
namespace {
PP_Resource Create(PP_Instance instance,
- const PP_BrowserFont_Trusted_Description* description,
+ const struct PP_BrowserFont_Trusted_Description* description,
PP_PrivateFontCharset charset) {
+ VLOG(4) << "PPB_Flash_FontFile::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -23,6 +27,7 @@ PP_Resource Create(PP_Instance instance,
}
PP_Bool IsFlashFontFile(PP_Resource resource) {
+ VLOG(4) << "PPB_Flash_FontFile::IsFlashFontFile()";
EnterResource<PPB_Flash_FontFile_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
@@ -31,22 +36,34 @@ PP_Bool GetFontTable(PP_Resource font_file,
uint32_t table,
void* output,
uint32_t* output_length) {
+ VLOG(4) << "PPB_Flash_FontFile::GetFontTable()";
EnterResource<PPB_Flash_FontFile_API> enter(font_file, true);
if (enter.failed())
return PP_FALSE;
return enter.object()->GetFontTable(table, output, output_length);
}
-const PPB_Flash_FontFile g_ppb_flash_fontfile_thunk = {
- &Create,
- &IsFlashFontFile,
- &GetFontTable
-};
+PP_Bool IsSupportedForWindows(void) {
+ VLOG(4) << "PPB_Flash_FontFile::IsSupportedForWindows()";
+ return PP_TRUE;
+}
+
+const PPB_Flash_FontFile_0_1 g_ppb_flash_fontfile_thunk_0_1 = {
+ &Create, &IsFlashFontFile, &GetFontTable};
+
+const PPB_Flash_FontFile_0_2 g_ppb_flash_fontfile_thunk_0_2 = {
+ &Create, &IsFlashFontFile, &GetFontTable, &IsSupportedForWindows};
} // namespace
-const PPB_Flash_FontFile_0_1* GetPPB_Flash_FontFile_0_1_Thunk() {
- return &g_ppb_flash_fontfile_thunk;
+PPAPI_THUNK_EXPORT const PPB_Flash_FontFile_0_1*
+GetPPB_Flash_FontFile_0_1_Thunk() {
+ return &g_ppb_flash_fontfile_thunk_0_1;
+}
+
+PPAPI_THUNK_EXPORT const PPB_Flash_FontFile_0_2*
+GetPPB_Flash_FontFile_0_2_Thunk() {
+ return &g_ppb_flash_fontfile_thunk_0_2;
}
} // namespace thunk