Chromium Code Reviews| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/win/win_util.h" | 11 #include "base/win/win_util.h" |
| 12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 13 #include "content/public/common/injection_test_win.h" | 13 #include "content/public/common/injection_test_win.h" |
| 14 #include "content/public/renderer/render_thread.h" | 14 #include "content/public/renderer/render_thread.h" |
| 15 #include "content/renderer/render_thread_impl.h" | 15 #include "content/renderer/render_thread_impl.h" |
| 16 #include "sandbox/win/src/sandbox.h" | 16 #include "sandbox/win/src/sandbox.h" |
| 17 #include "skia/ext/vector_platform_device_emf_win.h" | 17 #include "skia/ext/vector_platform_device_emf_win.h" |
| 18 #include "third_party/icu/public/i18n/unicode/timezone.h" | 18 #include "third_party/icu/public/i18n/unicode/timezone.h" |
| 19 #include "third_party/skia/include/ports/SkTypeface_win.h" | 19 #include "third_party/skia/include/ports/SkTypeface_win.h" |
| 20 | 20 |
| 21 #ifdef ENABLE_VTUNE_JIT_INTERFACE | |
| 22 #include "v8/src/third_party/vtune/v8-vtune.h" | |
| 23 #endif | |
| 24 | |
| 21 namespace content { | 25 namespace content { |
| 22 namespace { | 26 namespace { |
| 23 | 27 |
| 24 // Windows-only skia sandbox support | 28 // Windows-only skia sandbox support |
| 25 void SkiaPreCacheFont(const LOGFONT& logfont) { | 29 void SkiaPreCacheFont(const LOGFONT& logfont) { |
| 26 RenderThread* render_thread = RenderThread::Get(); | 30 RenderThread* render_thread = RenderThread::Get(); |
| 27 if (render_thread) { | 31 if (render_thread) { |
| 28 render_thread->PreCacheFont(logfont); | 32 render_thread->PreCacheFont(logfont); |
| 29 } | 33 } |
| 30 } | 34 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 // Install a check that we're not creating windows in the renderer. See | 76 // Install a check that we're not creating windows in the renderer. See |
| 73 // http://crbug.com/230122 for background. TODO(scottmg): Ideally this would | 77 // http://crbug.com/230122 for background. TODO(scottmg): Ideally this would |
| 74 // check all threads in the renderer, but it currently only checks the main | 78 // check all threads in the renderer, but it currently only checks the main |
| 75 // thread. | 79 // thread. |
| 76 PCHECK( | 80 PCHECK( |
| 77 SetWindowsHookEx(WH_CBT, WindowsHookCBT, NULL, ::GetCurrentThreadId())); | 81 SetWindowsHookEx(WH_CBT, WindowsHookCBT, NULL, ::GetCurrentThreadId())); |
| 78 #endif // !NDEBUG | 82 #endif // !NDEBUG |
| 79 | 83 |
| 80 InitExitInterceptions(); | 84 InitExitInterceptions(); |
| 81 | 85 |
| 86 const CommandLine& command_line = parameters_.command_line; | |
| 87 | |
| 88 #ifdef ENABLE_VTUNE_JIT_INTERFACE | |
| 89 // If --enable-vtune-support flag is added. | |
|
Avi (use Gerrit)
2013/05/07 03:04:04
pointless comment
| |
| 90 if (ommand_line.HasSwitch(switches::kEnableVtune)) { | |
|
Avi (use Gerrit)
2013/05/07 03:04:04
no {} if there is only one line
Also, this is a t
| |
| 91 vTune::InitilizeVtuneForV8(); | |
| 92 } | |
| 93 #endif | |
| 94 | |
| 82 // Be mindful of what resources you acquire here. They can be used by | 95 // Be mindful of what resources you acquire here. They can be used by |
| 83 // malicious code if the renderer gets compromised. | 96 // malicious code if the renderer gets compromised. |
| 84 const CommandLine& command_line = parameters_.command_line; | |
| 85 bool no_sandbox = command_line.HasSwitch(switches::kNoSandbox); | 97 bool no_sandbox = command_line.HasSwitch(switches::kNoSandbox); |
| 86 | 98 |
| 87 if (!no_sandbox) { | 99 if (!no_sandbox) { |
| 88 // ICU DateFormat class (used in base/time_format.cc) needs to get the | 100 // ICU DateFormat class (used in base/time_format.cc) needs to get the |
| 89 // Olson timezone ID by accessing the registry keys under | 101 // Olson timezone ID by accessing the registry keys under |
| 90 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. | 102 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. |
| 91 // After TimeZone::createDefault is called once here, the timezone ID is | 103 // After TimeZone::createDefault is called once here, the timezone ID is |
| 92 // cached and there's no more need to access the registry. If the sandbox | 104 // cached and there's no more need to access the registry. If the sandbox |
| 93 // is disabled, we don't have to make this dummy call. | 105 // is disabled, we don't have to make this dummy call. |
| 94 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 106 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 if (run_security_tests) { | 165 if (run_security_tests) { |
| 154 int test_count = 0; | 166 int test_count = 0; |
| 155 DVLOG(1) << "Running renderer security tests"; | 167 DVLOG(1) << "Running renderer security tests"; |
| 156 BOOL result = run_security_tests(&test_count); | 168 BOOL result = run_security_tests(&test_count); |
| 157 CHECK(result) << "Test number " << test_count << " has failed."; | 169 CHECK(result) << "Test number " << test_count << " has failed."; |
| 158 } | 170 } |
| 159 } | 171 } |
| 160 } | 172 } |
| 161 | 173 |
| 162 } // namespace content | 174 } // namespace content |
| OLD | NEW |