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

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

Powered by Google App Engine
This is Rietveld 408576698