Implement skia sandbox callback


BUG=103032
TEST=none


Review URL: http://codereview.chromium.org/8566026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111400 0039d316-1c4b-4281-b951-d872f2087c98
parent cb1b5855
......@@ -9,7 +9,9 @@
#include "base/memory/scoped_ptr.h"
#include "content/common/injection_test_dll.h"
#include "content/public/common/content_switches.h"
#include "content/public/renderer/render_thread.h"
#include "sandbox/src/sandbox.h"
#include "skia/ext/skia_sandbox_support_win.h"
#include "unicode/timezone.h"
namespace {
......@@ -59,6 +61,14 @@ void EnableThemeSupportForRenderer(bool no_sandbox) {
}
}
// Windows-only skia sandbox support
void SkiaPreCacheFont(LOGFONT logfont) {
content::RenderThread* render_thread = content::RenderThread::Get();
if (render_thread) {
render_thread->PreCacheFont(logfont);
}
}
} // namespace
RendererMainPlatformDelegate::RendererMainPlatformDelegate(
......@@ -85,6 +95,7 @@ void RendererMainPlatformDelegate::PlatformInitialize() {
// cached and there's no more need to access the registry. If the sandbox
// is disabled, we don't have to make this dummy call.
scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
SetSkiaEnsureTypefaceAccessible(SkiaPreCacheFont);
}
}
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "skia_sandbox_support_win.h"
#include "SkFontHost.h"
#include "SkTypeface_win.h"
static SkiaEnsureTypefaceAccessible g_skia_ensure_typeface_accessible = NULL;
SK_API void SetSkiaEnsureTypefaceAccessible(SkiaEnsureTypefaceAccessible func) {
// This function is supposed to be called once in process life time.
SkASSERT(g_skia_ensure_typeface_accessible == NULL);
g_skia_ensure_typeface_accessible = func;
}
// static
void SkFontHost::EnsureTypefaceAccessible(const SkTypeface& typeface) {
if (g_skia_ensure_typeface_accessible) {
LOGFONT lf;
SkLOGFONTFromTypeface(&typeface, &lf);
g_skia_ensure_typeface_accessible(lf);
}
}
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKIA_EXT_SKIA_SANDBOX_SUPPORT_WIN_H_
#define SKIA_EXT_SKIA_SANDBOX_SUPPORT_WIN_H_
#pragma once
#include <windows.h>
#include "SkPreConfig.h"
typedef void (*SkiaEnsureTypefaceAccessible)(LOGFONT font);
SK_API void SetSkiaEnsureTypefaceAccessible(SkiaEnsureTypefaceAccessible func);
#endif // SKIA_EXT_SKIA_SANDBOX_SUPPORT_WIN_H_
......@@ -692,6 +692,8 @@
'ext/platform_device_mac.cc',
'ext/platform_device_win.cc',
'ext/SkMemory_new_handler.cpp',
'ext/skia_sandbox_support_win.h',
'ext/skia_sandbox_support_win.cc',
'ext/skia_utils_mac.mm',
'ext/skia_utils_mac.h',
'ext/skia_utils_win.cc',
......@@ -876,6 +878,7 @@
'sources!': [
'../third_party/skia/src/core/SkMMapStream.cpp',
'../third_party/skia/src/ports/SkTime_Unix.cpp',
'../third_party/skia/src/ports/SkFontHost_sandbox_none.cpp',
'ext/SkThread_chrome.cc',
],
'include_dirs': [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment