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

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

Issue 11363008: Fix for 128506: Random Chinese/Japanese characters are missing in documents printed via the syst... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | skia/ext/vector_platform_device_emf_win.h » ('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 <signal.h> 7 #include <signal.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/string16.h"
12 #include "base/win/win_util.h" 13 #include "base/win/win_util.h"
13 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
14 #include "content/public/common/injection_test_win.h" 15 #include "content/public/common/injection_test_win.h"
15 #include "content/public/renderer/render_thread.h" 16 #include "content/public/renderer/render_thread.h"
17 #include "content/renderer/render_thread_impl.h"
16 #include "sandbox/win/src/sandbox.h" 18 #include "sandbox/win/src/sandbox.h"
17 #include "skia/ext/skia_sandbox_support_win.h" 19 #include "skia/ext/skia_sandbox_support_win.h"
20 #include "skia/ext/vector_platform_device_emf_win.h"
18 #include "unicode/timezone.h" 21 #include "unicode/timezone.h"
19 22
20 namespace content { 23 namespace content {
21 namespace { 24 namespace {
22 25
23 // Windows-only skia sandbox support 26 // Windows-only skia sandbox support
24 void SkiaPreCacheFont(const LOGFONT& logfont) { 27 void SkiaPreCacheFont(const LOGFONT& logfont) {
25 RenderThread* render_thread = RenderThread::Get(); 28 RenderThread* render_thread = RenderThread::Get();
26 if (render_thread) { 29 if (render_thread) {
27 render_thread->PreCacheFont(logfont); 30 render_thread->PreCacheFont(logfont);
28 } 31 }
29 } 32 }
30 33
34 void SkiaPreCacheFontCharacters(const LOGFONT& logfont,
35 const wchar_t* text,
36 unsigned int text_length) {
37 content::RenderThreadImpl* render_thread_impl =
38 content::RenderThreadImpl::current();
39 if (render_thread_impl) {
40 render_thread_impl->PreCacheFontCharacters(logfont,
41 string16(text, text_length));
42 }
43 }
44
31 void __cdecl ForceCrashOnSigAbort(int) { 45 void __cdecl ForceCrashOnSigAbort(int) {
32 *((int*)0) = 0x1337; 46 *((int*)0) = 0x1337;
33 } 47 }
34 48
35 void InitExitInterceptions() { 49 void InitExitInterceptions() {
36 // If code subsequently tries to exit using exit(), _exit(), abort(), or 50 // If code subsequently tries to exit using exit(), _exit(), abort(), or
37 // ExitProcess(), force a crash (since otherwise these would be silent 51 // ExitProcess(), force a crash (since otherwise these would be silent
38 // terminations and fly under the radar). 52 // terminations and fly under the radar).
39 base::win::SetShouldCrashOnProcessDetach(true); 53 base::win::SetShouldCrashOnProcessDetach(true);
40 54
(...skipping 30 matching lines...) Expand all
71 85
72 if (!no_sandbox) { 86 if (!no_sandbox) {
73 // ICU DateFormat class (used in base/time_format.cc) needs to get the 87 // ICU DateFormat class (used in base/time_format.cc) needs to get the
74 // Olson timezone ID by accessing the registry keys under 88 // Olson timezone ID by accessing the registry keys under
75 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. 89 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
76 // After TimeZone::createDefault is called once here, the timezone ID is 90 // After TimeZone::createDefault is called once here, the timezone ID is
77 // cached and there's no more need to access the registry. If the sandbox 91 // cached and there's no more need to access the registry. If the sandbox
78 // is disabled, we don't have to make this dummy call. 92 // is disabled, we don't have to make this dummy call.
79 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); 93 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
80 SetSkiaEnsureTypefaceAccessible(SkiaPreCacheFont); 94 SetSkiaEnsureTypefaceAccessible(SkiaPreCacheFont);
95 skia::SetSkiaEnsureTypefaceCharactersAccessible(
96 SkiaPreCacheFontCharacters);
81 } 97 }
82 } 98 }
83 99
84 void RendererMainPlatformDelegate::PlatformUninitialize() { 100 void RendererMainPlatformDelegate::PlatformUninitialize() {
85 // At this point we are shutting down in a normal code path, so undo our 101 // At this point we are shutting down in a normal code path, so undo our
86 // hack to crash on exit. 102 // hack to crash on exit.
87 base::win::SetShouldCrashOnProcessDetach(false); 103 base::win::SetShouldCrashOnProcessDetach(false);
88 } 104 }
89 105
90 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { 106 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (run_security_tests) { 152 if (run_security_tests) {
137 int test_count = 0; 153 int test_count = 0;
138 DVLOG(1) << "Running renderer security tests"; 154 DVLOG(1) << "Running renderer security tests";
139 BOOL result = run_security_tests(&test_count); 155 BOOL result = run_security_tests(&test_count);
140 CHECK(result) << "Test number " << test_count << " has failed."; 156 CHECK(result) << "Test number " << test_count << " has failed.";
141 } 157 }
142 } 158 }
143 } 159 }
144 160
145 } // namespace content 161 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | skia/ext/vector_platform_device_emf_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698