Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: content/renderer/renderer_main_platform_delegate_win.cc

Issue 1557513002: Add logic to switch to DirectWrite font proxy via field trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extraneous namespace qualification Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698