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

Side by Side Diff: content/renderer/renderer_main_platform_delegate_win.cc

Issue 1847173002: Revert "Revert of Remove font cache code (patchset #3 id:40001 of https://codereview.chromium.org/1… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test expectations to rebaseline tests on Win10 Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « content/public/common/dwrite_font_platform_win.h ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/renderer_main_platform_delegate.h" 5 #include "content/renderer/renderer_main_platform_delegate.h"
6 6
7 #include <dwrite.h> 7 #include <dwrite.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/win/scoped_comptr.h" 13 #include "base/win/scoped_comptr.h"
14 #include "base/win/win_util.h" 14 #include "base/win/win_util.h"
15 #include "base/win/windows_version.h" 15 #include "base/win/windows_version.h"
16 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h" 16 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h"
17 #include "content/child/font_warmup_win.h" 17 #include "content/child/font_warmup_win.h"
18 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
19 #include "content/public/common/dwrite_font_platform_win.h"
20 #include "content/public/common/injection_test_win.h" 19 #include "content/public/common/injection_test_win.h"
21 #include "content/public/renderer/render_thread.h" 20 #include "content/public/renderer/render_thread.h"
22 #include "content/renderer/render_thread_impl.h" 21 #include "content/renderer/render_thread_impl.h"
23 #include "sandbox/win/src/sandbox.h" 22 #include "sandbox/win/src/sandbox.h"
24 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 23 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
25 #include "third_party/WebKit/public/web/win/WebFontRendering.h" 24 #include "third_party/WebKit/public/web/win/WebFontRendering.h"
26 #include "third_party/icu/source/i18n/unicode/timezone.h" 25 #include "third_party/icu/source/i18n/unicode/timezone.h"
27 #include "third_party/skia/include/ports/SkTypeface_win.h" 26 #include "third_party/skia/include/ports/SkTypeface_win.h"
28 #include "ui/gfx/win/direct_write.h" 27 #include "ui/gfx/win/direct_write.h"
29 #include "ui/gfx/win/dpi.h" 28 #include "ui/gfx/win/dpi.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (!no_sandbox) { 61 if (!no_sandbox) {
63 // ICU DateFormat class (used in base/time_format.cc) needs to get the 62 // ICU DateFormat class (used in base/time_format.cc) needs to get the
64 // Olson timezone ID by accessing the registry keys under 63 // Olson timezone ID by accessing the registry keys under
65 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. 64 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
66 // After TimeZone::createDefault is called once here, the timezone ID is 65 // After TimeZone::createDefault is called once here, the timezone ID is
67 // cached and there's no more need to access the registry. If the sandbox 66 // cached and there's no more need to access the registry. If the sandbox
68 // is disabled, we don't have to make this dummy call. 67 // is disabled, we don't have to make this dummy call.
69 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); 68 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
70 69
71 if (use_direct_write) { 70 if (use_direct_write) {
72 if (ShouldUseDirectWriteFontProxyFieldTrial()) 71 InitializeDWriteFontProxy();
73 InitializeDWriteFontProxy();
74 else
75 WarmupDirectWrite();
76 } else { 72 } else {
77 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); 73 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont);
78 } 74 }
79 } 75 }
80 blink::WebFontRendering::setUseDirectWrite(use_direct_write); 76 blink::WebFontRendering::setUseDirectWrite(use_direct_write);
81 blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale()); 77 blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale());
82 } 78 }
83 79
84 void RendererMainPlatformDelegate::PlatformUninitialize() { 80 void RendererMainPlatformDelegate::PlatformUninitialize() {
85 if (ShouldUseDirectWriteFontProxyFieldTrial()) 81 UninitializeDWriteFontProxy();
86 UninitializeDWriteFontProxy();
87 } 82 }
88 83
89 bool RendererMainPlatformDelegate::EnableSandbox() { 84 bool RendererMainPlatformDelegate::EnableSandbox() {
90 sandbox::TargetServices* target_services = 85 sandbox::TargetServices* target_services =
91 parameters_.sandbox_info->target_services; 86 parameters_.sandbox_info->target_services;
92 87
93 if (target_services) { 88 if (target_services) {
94 // Cause advapi32 to load before the sandbox is turned on. 89 // Cause advapi32 to load before the sandbox is turned on.
95 unsigned int dummy_rand; 90 unsigned int dummy_rand;
96 rand_s(&dummy_rand); 91 rand_s(&dummy_rand);
97 92
98 target_services->LowerToken(); 93 target_services->LowerToken();
99 return true; 94 return true;
100 } 95 }
101 return false; 96 return false;
102 } 97 }
103 98
104 } // namespace content 99 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/dwrite_font_platform_win.h ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698