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

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

Powered by Google App Engine
This is Rietveld 408576698