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

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

Powered by Google App Engine
This is Rietveld 408576698