| OLD | NEW |
| 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 "sandbox/win/src/sandbox.h" | 16 #include "sandbox/win/src/sandbox.h" |
| 17 #include "skia/ext/skia_sandbox_support_win.h" | 17 #include "skia/ext/skia_sandbox_support_win.h" |
| 18 #include "unicode/timezone.h" | 18 #include "unicode/timezone.h" |
| 19 | 19 |
| 20 namespace content { |
| 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 RenderThread* render_thread = 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 |
| 30 void __cdecl ForceCrashOnSigAbort(int) { | 31 void __cdecl ForceCrashOnSigAbort(int) { |
| 31 *((int*)0) = 0x1337; | 32 *((int*)0) = 0x1337; |
| 32 } | 33 } |
| 33 | 34 |
| 34 void InitExitInterceptions() { | 35 void InitExitInterceptions() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 | 46 |
| 46 // Set a SIGABRT handler for good measure. We will crash even if the default | 47 // Set a SIGABRT handler for good measure. We will crash even if the default |
| 47 // is left in place, however this allows us to crash earlier. And it also | 48 // is left in place, however this allows us to crash earlier. And it also |
| 48 // lets us crash in response to code which might directly call raise(SIGABRT) | 49 // lets us crash in response to code which might directly call raise(SIGABRT) |
| 49 signal(SIGABRT, ForceCrashOnSigAbort); | 50 signal(SIGABRT, ForceCrashOnSigAbort); |
| 50 } | 51 } |
| 51 | 52 |
| 52 } // namespace | 53 } // namespace |
| 53 | 54 |
| 54 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 55 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
| 55 const content::MainFunctionParams& parameters) | 56 const MainFunctionParams& parameters) |
| 56 : parameters_(parameters), | 57 : parameters_(parameters), |
| 57 sandbox_test_module_(NULL) { | 58 sandbox_test_module_(NULL) { |
| 58 } | 59 } |
| 59 | 60 |
| 60 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { | 61 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { |
| 61 } | 62 } |
| 62 | 63 |
| 63 void RendererMainPlatformDelegate::PlatformInitialize() { | 64 void RendererMainPlatformDelegate::PlatformInitialize() { |
| 64 InitExitInterceptions(); | 65 InitExitInterceptions(); |
| 65 | 66 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 kRenderTestCall)); | 134 kRenderTestCall)); |
| 134 DCHECK(run_security_tests); | 135 DCHECK(run_security_tests); |
| 135 if (run_security_tests) { | 136 if (run_security_tests) { |
| 136 int test_count = 0; | 137 int test_count = 0; |
| 137 DVLOG(1) << "Running renderer security tests"; | 138 DVLOG(1) << "Running renderer security tests"; |
| 138 BOOL result = run_security_tests(&test_count); | 139 BOOL result = run_security_tests(&test_count); |
| 139 CHECK(result) << "Test number " << test_count << " has failed."; | 140 CHECK(result) << "Test number " << test_count << " has failed."; |
| 140 } | 141 } |
| 141 } | 142 } |
| 142 } | 143 } |
| 144 |
| 145 } // namespace content |
| OLD | NEW |