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

Side by Side Diff: content/test/layouttest_support.cc

Issue 1432123002: Switch to direct write font proxy and remove the font cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dwfontsplit
Patch Set: Move functions into anon namespace and minor renames. Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/test/layouttest_support.h" 5 #include "content/public/test/layouttest_support.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "components/test_runner/test_common.h" 10 #include "components/test_runner/test_common.h"
(...skipping 19 matching lines...) Expand all
30 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" 30 #include "third_party/WebKit/public/platform/WebBatteryStatus.h"
31 #include "third_party/WebKit/public/platform/WebGamepads.h" 31 #include "third_party/WebKit/public/platform/WebGamepads.h"
32 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionData.h" 32 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionData.h"
33 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationData.h" 33 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationData.h"
34 #include "third_party/WebKit/public/web/WebHistoryItem.h" 34 #include "third_party/WebKit/public/web/WebHistoryItem.h"
35 #include "third_party/WebKit/public/web/WebView.h" 35 #include "third_party/WebKit/public/web/WebView.h"
36 36
37 #if defined(OS_MACOSX) 37 #if defined(OS_MACOSX)
38 #include "content/browser/frame_host/popup_menu_helper_mac.h" 38 #include "content/browser/frame_host/popup_menu_helper_mac.h"
39 #elif defined(OS_WIN) 39 #elif defined(OS_WIN)
40 #include "content/common/font_warmup_win.h"
41 #include "third_party/WebKit/public/web/win/WebFontRendering.h" 40 #include "third_party/WebKit/public/web/win/WebFontRendering.h"
42 #include "third_party/skia/include/ports/SkFontMgr.h" 41 #include "third_party/skia/include/ports/SkFontMgr.h"
42 #include "third_party/skia/include/ports/SkTypeface_win.h"
43 #include "ui/gfx/win/direct_write.h" 43 #include "ui/gfx/win/direct_write.h"
44 #endif 44 #endif
45 45
46 using blink::WebBatteryStatus; 46 using blink::WebBatteryStatus;
47 using blink::WebDeviceMotionData; 47 using blink::WebDeviceMotionData;
48 using blink::WebDeviceOrientationData; 48 using blink::WebDeviceOrientationData;
49 using blink::WebGamepad; 49 using blink::WebGamepad;
50 using blink::WebGamepads; 50 using blink::WebGamepads;
51 using blink::WebRect; 51 using blink::WebRect;
52 using blink::WebSize; 52 using blink::WebSize;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 typedef test_runner::WebFrameTestProxy< 84 typedef test_runner::WebFrameTestProxy<
85 RenderFrameImpl, const RenderFrameImpl::CreateParams&> FrameProxy; 85 RenderFrameImpl, const RenderFrameImpl::CreateParams&> FrameProxy;
86 86
87 FrameProxy* render_frame_proxy = new FrameProxy(params); 87 FrameProxy* render_frame_proxy = new FrameProxy(params);
88 render_frame_proxy->set_base_proxy(GetWebTestProxyBase(params.render_view)); 88 render_frame_proxy->set_base_proxy(GetWebTestProxyBase(params.render_view));
89 89
90 return render_frame_proxy; 90 return render_frame_proxy;
91 } 91 }
92 92
93 #if defined(OS_WIN) 93 #if defined(OS_WIN)
94 void DoPreSandboxWarmupForTypeface(SkTypeface* typeface) {
ananta 2015/12/09 23:14:28 Why do we need this now?
Ilya Kulshin 2015/12/15 00:05:57 I thought it was needed at some point, but looks l
95 SkPaint paint_warmup;
96 paint_warmup.setTypeface(typeface);
97 wchar_t glyph = L'S';
98 paint_warmup.measureText(&glyph, sizeof(glyph));
99 }
100
94 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer 101 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer
95 // side-loading, support kRegisterFontFiles to allow access to additional fonts. 102 // side-loading, support kRegisterFontFiles to allow access to additional fonts.
96 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) { 103 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) {
97 RenderThreadImpl::current()->EnsureWebKitInitialized(); 104 RenderThreadImpl::current()->EnsureWebKitInitialized();
98 std::vector<std::string> files = switches::GetSideloadFontFiles(); 105 std::vector<std::string> files = switches::GetSideloadFontFiles();
99 for (std::vector<std::string>::const_iterator i(files.begin()); 106 for (std::vector<std::string>::const_iterator i(files.begin());
100 i != files.end(); 107 i != files.end();
101 ++i) { 108 ++i) {
102 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); 109 SkTypeface* typeface = fontmgr->createFromFile(i->c_str());
103 DoPreSandboxWarmupForTypeface(typeface); 110 DoPreSandboxWarmupForTypeface(typeface);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 RenderThreadImpl::current() 172 RenderThreadImpl::current()
166 ->blink_platform_impl() 173 ->blink_platform_impl()
167 ->MockBatteryStatusChangedForTesting(status); 174 ->MockBatteryStatusChangedForTesting(status);
168 } 175 }
169 176
170 void EnableRendererLayoutTestMode() { 177 void EnableRendererLayoutTestMode() {
171 RenderThreadImpl::current()->set_layout_test_mode(true); 178 RenderThreadImpl::current()->set_layout_test_mode(true);
172 179
173 #if defined(OS_WIN) 180 #if defined(OS_WIN)
174 if (gfx::win::ShouldUseDirectWrite()) 181 if (gfx::win::ShouldUseDirectWrite())
175 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr()); 182 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite());
176 #endif 183 #endif
177 } 184 }
178 185
179 void EnableBrowserLayoutTestMode() { 186 void EnableBrowserLayoutTestMode() {
180 #if defined(OS_MACOSX) 187 #if defined(OS_MACOSX)
181 ImageTransportSurface::SetAllowOSMesaForTesting(true); 188 ImageTransportSurface::SetAllowOSMesaForTesting(true);
182 PopupMenuHelper::DontShowPopupMenuForTesting(); 189 PopupMenuHelper::DontShowPopupMenuForTesting();
183 #endif 190 #endif
184 RenderWidgetHostImpl::DisableResizeAckCheckForTesting(); 191 RenderWidgetHostImpl::DisableResizeAckCheckForTesting();
185 } 192 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 result.append( 458 result.append(
452 DumpHistoryItem(entry->root_history_node(), 459 DumpHistoryItem(entry->root_history_node(),
453 8, 460 8,
454 index == current_index)); 461 index == current_index));
455 } 462 }
456 result.append("===============================================\n"); 463 result.append("===============================================\n");
457 return result; 464 return result;
458 } 465 }
459 466
460 } // namespace content 467 } // namespace content
OLDNEW
« content/common/font_warmup_win.cc ('K') | « content/renderer/renderer_main_platform_delegate_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698