Index: content/renderer/renderer_main_platform_delegate_win.cc |
diff --git a/content/renderer/renderer_main_platform_delegate_win.cc b/content/renderer/renderer_main_platform_delegate_win.cc |
index 675961da16ca60e94ab6d7135f398a0053e78303..ae7e7e47f4b0e421ac90bc333d917e96e28d39d9 100644 |
--- a/content/renderer/renderer_main_platform_delegate_win.cc |
+++ b/content/renderer/renderer_main_platform_delegate_win.cc |
@@ -4,6 +4,8 @@ |
#include "content/renderer/renderer_main_platform_delegate.h" |
+#include <dwrite.h> |
+ |
#include "base/command_line.h" |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
@@ -11,8 +13,10 @@ |
#include "base/win/scoped_comptr.h" |
#include "base/win/win_util.h" |
#include "base/win/windows_version.h" |
+#include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h" |
#include "content/common/font_warmup_win.h" |
#include "content/public/common/content_switches.h" |
+#include "content/public/common/dwrite_font_platform_win.h" |
#include "content/public/common/injection_test_win.h" |
#include "content/public/renderer/render_thread.h" |
#include "content/renderer/render_thread_impl.h" |
@@ -24,8 +28,6 @@ |
#include "ui/gfx/win/direct_write.h" |
#include "ui/gfx/win/dpi.h" |
-#include <dwrite.h> |
- |
namespace content { |
namespace { |
@@ -38,6 +40,12 @@ void SkiaPreCacheFont(const LOGFONT& logfont) { |
} |
} |
+// Helper function to cast RenderThread to IPC::Sender so we can Bind() |
+// it. |
+IPC::Sender* GetRenderThreadSender() { |
+ return RenderThread::Get(); |
+} |
+ |
} // namespace |
RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
@@ -67,7 +75,10 @@ void RendererMainPlatformDelegate::PlatformInitialize() { |
scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
if (use_direct_write) { |
- WarmupDirectWrite(); |
+ if (ShouldUseDirectWriteFontProxyFieldTrial()) |
+ InitializeDWriteFontProxy(base::Bind(&GetRenderThreadSender)); |
+ else |
+ WarmupDirectWrite(); |
} else { |
SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); |
} |
@@ -77,6 +88,8 @@ void RendererMainPlatformDelegate::PlatformInitialize() { |
} |
void RendererMainPlatformDelegate::PlatformUninitialize() { |
+ if (ShouldUseDirectWriteFontProxyFieldTrial()) |
+ UninitializeDWriteFontProxy(); |
} |
bool RendererMainPlatformDelegate::EnableSandbox() { |