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

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

Issue 1296223005: Continuing changes for lpc proxy Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/render_font_warmup_win.h" 5 #include "content/public/renderer/render_font_warmup_win.h"
6 6
7 #include <dwrite.h> 7 #include <dwrite.h>
8 8
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 DCHECK(patched == 0); 115 DCHECK(patched == 0);
116 116
117 patched = g_iat_patch_open_service.Patch(L"dwrite.dll", 117 patched = g_iat_patch_open_service.Patch(L"dwrite.dll",
118 service_provider_dll, "OpenServiceW", OpenServiceWPatch); 118 service_provider_dll, "OpenServiceW", OpenServiceWPatch);
119 DCHECK(patched == 0); 119 DCHECK(patched == 0);
120 120
121 patched = g_iat_patch_start_service.Patch(L"dwrite.dll", 121 patched = g_iat_patch_start_service.Patch(L"dwrite.dll",
122 service_provider_dll, "StartServiceW", StartServiceWPatch); 122 service_provider_dll, "StartServiceW", StartServiceWPatch);
123 DCHECK(patched == 0); 123 DCHECK(patched == 0);
124 124
125 patched = g_iat_patch_nt_connect_port.Patch(L"dwrite.dll", 125 // patched = g_iat_patch_nt_connect_port.Patch(L"dwrite.dll",
126 "ntdll.dll", "NtAlpcConnectPort", NtALpcConnectPortPatch); 126 // "ntdll.dll", "NtAlpcConnectPort", NtALpcConnectPortPatch);
127 DCHECK(patched == 0); 127 // DCHECK(patched == 0);
128 } 128 }
129 129
130 // Windows-only DirectWrite support. These warm up the DirectWrite paths 130 // Windows-only DirectWrite support. These warm up the DirectWrite paths
131 // before sandbox lock down to allow Skia access to the Font Manager service. 131 // before sandbox lock down to allow Skia access to the Font Manager service.
132 void CreateDirectWriteFactory(IDWriteFactory** factory) { 132 void CreateDirectWriteFactory(IDWriteFactory** factory) {
133 typedef decltype(DWriteCreateFactory)* DWriteCreateFactoryProc; 133 typedef decltype(DWriteCreateFactory)* DWriteCreateFactoryProc;
134 HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll"); 134 HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll");
135 // TODO(scottmg): Temporary code to track crash in http://crbug.com/387867. 135 // TODO(scottmg): Temporary code to track crash in http://crbug.com/387867.
136 if (!dwrite_dll) { 136 if (!dwrite_dll) {
137 DWORD load_library_get_last_error = GetLastError(); 137 DWORD load_library_get_last_error = GetLastError();
138 base::debug::Alias(&dwrite_dll); 138 base::debug::Alias(&dwrite_dll);
139 base::debug::Alias(&load_library_get_last_error); 139 base::debug::Alias(&load_library_get_last_error);
140 CHECK(false); 140 CHECK(false);
141 } 141 }
142 142
143 PatchServiceManagerCalls(); 143 // PatchServiceManagerCalls();
144 144
145 DWriteCreateFactoryProc dwrite_create_factory_proc = 145 DWriteCreateFactoryProc dwrite_create_factory_proc =
146 reinterpret_cast<DWriteCreateFactoryProc>( 146 reinterpret_cast<DWriteCreateFactoryProc>(
147 GetProcAddress(dwrite_dll, "DWriteCreateFactory")); 147 GetProcAddress(dwrite_dll, "DWriteCreateFactory"));
148 // TODO(scottmg): Temporary code to track crash in http://crbug.com/387867. 148 // TODO(scottmg): Temporary code to track crash in http://crbug.com/387867.
149 if (!dwrite_create_factory_proc) { 149 if (!dwrite_create_factory_proc) {
150 DWORD get_proc_address_get_last_error = GetLastError(); 150 DWORD get_proc_address_get_last_error = GetLastError();
151 base::debug::Alias(&dwrite_create_factory_proc); 151 base::debug::Alias(&dwrite_create_factory_proc);
152 base::debug::Alias(&get_proc_address_get_last_error); 152 base::debug::Alias(&get_proc_address_get_last_error);
153 CHECK(false); 153 CHECK(false);
(...skipping 27 matching lines...) Expand all
181 181
182 void DoPreSandboxWarmupForTypeface(SkTypeface* typeface) { 182 void DoPreSandboxWarmupForTypeface(SkTypeface* typeface) {
183 SkPaint paint_warmup; 183 SkPaint paint_warmup;
184 paint_warmup.setTypeface(typeface); 184 paint_warmup.setTypeface(typeface);
185 wchar_t glyph = L'S'; 185 wchar_t glyph = L'S';
186 paint_warmup.measureText(&glyph, 2); 186 paint_warmup.measureText(&glyph, 2);
187 } 187 }
188 188
189 SkFontMgr* GetPreSandboxWarmupFontMgr() { 189 SkFontMgr* GetPreSandboxWarmupFontMgr() {
190 if (!g_warmup_fontmgr) { 190 if (!g_warmup_fontmgr) {
191 IDWriteFactory* factory; 191 // PatchServiceManagerCalls();
192 CreateDirectWriteFactory(&factory); 192 // IDWriteFactory* factory;
193 // CreateDirectWriteFactory(&factory);
193 194
194 GetCustomFontCollection(factory); 195 // GetCustomFontCollection(factory);
195 196
196 PatchDWriteFactory(factory); 197 // PatchDWriteFactory(factory);
197 198
198 blink::WebFontRendering::setDirectWriteFactory(factory); 199 blink::WebFontRendering::setDirectWriteFactory(NULL/*factory*/);
199 g_warmup_fontmgr = SkFontMgr_New_DirectWrite(factory); 200 g_warmup_fontmgr = SkFontMgr_New_DirectWrite(NULL/*factory*/);
200 } 201 }
201 return g_warmup_fontmgr; 202 return g_warmup_fontmgr;
202 } 203 }
203 204
205 void InitializeDirectWrite() {
206 PatchServiceManagerCalls();
207 }
208
204 } // namespace content 209 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/render_font_warmup_win.h ('k') | content/renderer/renderer_main_platform_delegate_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698