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

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

Issue 1845063002: Revert of Remove font cache code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
19 #include "content/public/common/injection_test_win.h" 20 #include "content/public/common/injection_test_win.h"
20 #include "content/public/renderer/render_thread.h" 21 #include "content/public/renderer/render_thread.h"
21 #include "content/renderer/render_thread_impl.h" 22 #include "content/renderer/render_thread_impl.h"
22 #include "sandbox/win/src/sandbox.h" 23 #include "sandbox/win/src/sandbox.h"
23 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 24 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
24 #include "third_party/WebKit/public/web/win/WebFontRendering.h" 25 #include "third_party/WebKit/public/web/win/WebFontRendering.h"
25 #include "third_party/icu/source/i18n/unicode/timezone.h" 26 #include "third_party/icu/source/i18n/unicode/timezone.h"
26 #include "third_party/skia/include/ports/SkTypeface_win.h" 27 #include "third_party/skia/include/ports/SkTypeface_win.h"
27 #include "ui/gfx/win/direct_write.h" 28 #include "ui/gfx/win/direct_write.h"
28 #include "ui/gfx/win/dpi.h" 29 #include "ui/gfx/win/dpi.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (!no_sandbox) { 68 if (!no_sandbox) {
68 // ICU DateFormat class (used in base/time_format.cc) needs to get the 69 // ICU DateFormat class (used in base/time_format.cc) needs to get the
69 // Olson timezone ID by accessing the registry keys under 70 // Olson timezone ID by accessing the registry keys under
70 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. 71 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
71 // After TimeZone::createDefault is called once here, the timezone ID is 72 // After TimeZone::createDefault is called once here, the timezone ID is
72 // cached and there's no more need to access the registry. If the sandbox 73 // cached and there's no more need to access the registry. If the sandbox
73 // is disabled, we don't have to make this dummy call. 74 // is disabled, we don't have to make this dummy call.
74 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); 75 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
75 76
76 if (use_direct_write) { 77 if (use_direct_write) {
77 InitializeDWriteFontProxy(base::Bind(&GetRenderThreadSender)); 78 if (ShouldUseDirectWriteFontProxyFieldTrial())
79 InitializeDWriteFontProxy(base::Bind(&GetRenderThreadSender));
80 else
81 WarmupDirectWrite();
78 } else { 82 } else {
79 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); 83 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont);
80 } 84 }
81 } 85 }
82 blink::WebFontRendering::setUseDirectWrite(use_direct_write); 86 blink::WebFontRendering::setUseDirectWrite(use_direct_write);
83 blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale()); 87 blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale());
84 } 88 }
85 89
86 void RendererMainPlatformDelegate::PlatformUninitialize() { 90 void RendererMainPlatformDelegate::PlatformUninitialize() {
87 UninitializeDWriteFontProxy(); 91 if (ShouldUseDirectWriteFontProxyFieldTrial())
92 UninitializeDWriteFontProxy();
88 } 93 }
89 94
90 bool RendererMainPlatformDelegate::EnableSandbox() { 95 bool RendererMainPlatformDelegate::EnableSandbox() {
91 sandbox::TargetServices* target_services = 96 sandbox::TargetServices* target_services =
92 parameters_.sandbox_info->target_services; 97 parameters_.sandbox_info->target_services;
93 98
94 if (target_services) { 99 if (target_services) {
95 // Cause advapi32 to load before the sandbox is turned on. 100 // Cause advapi32 to load before the sandbox is turned on.
96 unsigned int dummy_rand; 101 unsigned int dummy_rand;
97 rand_s(&dummy_rand); 102 rand_s(&dummy_rand);
98 103
99 target_services->LowerToken(); 104 target_services->LowerToken();
100 return true; 105 return true;
101 } 106 }
102 return false; 107 return false;
103 } 108 }
104 109
105 } // namespace content 110 } // 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