Skip to content

Commit

Permalink
Set up font precaching in ppapi process
Browse files Browse the repository at this point in the history
Without this GetOutlineTextMetrics fails in
third_party/skia/src/ports/SkFontHost_win.cpp resulting in garbage
font data being returned to Flash.

R=brettw@chromium.org, cpu@chromium.org
TBR=piman@chromium.org
BUG=308632

Review URL: https://codereview.chromium.org/118083004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241916 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
scottmg@chromium.org committed Dec 19, 2013
1 parent 7ba8d32 commit 030a480
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions content/ppapi_plugin/ppapi_plugin_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
#include "content/public/common/main_function_params.h"
#include "content/public/plugin/content_plugin_client.h"
#include "crypto/nss_util.h"
#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/proxy_module.h"
#include "ui/base/ui_base_switches.h"

#if defined(OS_WIN)
#include "sandbox/win/src/sandbox.h"
#include "third_party/skia/include/ports/SkTypeface_win.h"
#endif

#if defined(OS_LINUX)
Expand All @@ -40,6 +42,18 @@ void* g_target_services = 0;

namespace content {

namespace {

#if defined(OS_WIN)
// Windows-only skia sandbox support
void SkiaPreCacheFont(const LOGFONT& logfont) {
ppapi::proxy::PluginGlobals::Get()->PreCacheFontForFlash(
reinterpret_cast<const void*>(&logfont));
}
#endif

} // namespace

// Main function for starting the PPAPI plugin process.
int PpapiPluginMain(const MainFunctionParams& parameters) {
const CommandLine& command_line = parameters.command_line;
Expand Down Expand Up @@ -105,6 +119,10 @@ int PpapiPluginMain(const MainFunctionParams& parameters) {
ppapi_process.set_main_thread(
new PpapiThread(parameters.command_line, false)); // Not a broker.

#if defined(OS_WIN)
SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont);
#endif

main_message_loop.Run();
return 0;
}
Expand Down

0 comments on commit 030a480

Please sign in to comment.