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/ppapi_plugin/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/crash_logging.h" | 10 #include "base/debug/crash_logging.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
| 46 #include "base/win/win_util.h" | 46 #include "base/win/win_util.h" |
| 47 #include "base/win/windows_version.h" | 47 #include "base/win/windows_version.h" |
| 48 #include "sandbox/win/src/sandbox.h" | 48 #include "sandbox/win/src/sandbox.h" |
| 49 #elif defined(OS_MACOSX) | 49 #elif defined(OS_MACOSX) |
| 50 #include "content/common/sandbox_init_mac.h" | 50 #include "content/common/sandbox_init_mac.h" |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
| 54 extern sandbox::TargetServices* g_target_services; | 54 extern sandbox::TargetServices* g_target_services; |
| 55 // Used by EnumSystemLocales for warming up | |
|
jschuh
2014/01/16 07:54:34
Add a blank line above this comment.
| |
| 56 static BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) { | |
| 57 return true; | |
| 58 } | |
| 55 #else | 59 #else |
| 56 extern void* g_target_services; | 60 extern void* g_target_services; |
| 57 #endif | 61 #endif |
| 58 | 62 |
| 59 namespace content { | 63 namespace content { |
| 60 | 64 |
| 61 typedef int32_t (*InitializeBrokerFunc) | 65 typedef int32_t (*InitializeBrokerFunc) |
| 62 (PP_ConnectInstance_Func* connect_instance_func); | 66 (PP_ConnectInstance_Func* connect_instance_func); |
| 63 | 67 |
| 64 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) | 68 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 base::win::SetAbortBehaviorForCrashReporting(); | 284 base::win::SetAbortBehaviorForCrashReporting(); |
| 281 | 285 |
| 282 // Once we lower the token the sandbox is locked down and no new modules | 286 // Once we lower the token the sandbox is locked down and no new modules |
| 283 // can be loaded. TODO(cpu): consider changing to the loading style of | 287 // can be loaded. TODO(cpu): consider changing to the loading style of |
| 284 // regular plugins. | 288 // regular plugins. |
| 285 if (g_target_services) { | 289 if (g_target_services) { |
| 286 // Let Flash load DRM before lockdown on Vista+. | 290 // Let Flash load DRM before lockdown on Vista+. |
| 287 if (permissions.HasPermission(ppapi::PERMISSION_FLASH) && | 291 if (permissions.HasPermission(ppapi::PERMISSION_FLASH) && |
| 288 base::win::OSInfo::GetInstance()->version() >= | 292 base::win::OSInfo::GetInstance()->version() >= |
| 289 base::win::VERSION_VISTA ) { | 293 base::win::VERSION_VISTA ) { |
| 290 LoadLibrary(L"dxva2.dll"); | 294 LoadLibrary(L"dxva2.dll"); |
| 291 } | 295 } |
| 292 | 296 |
| 293 // Cause advapi32 to load before the sandbox is turned on. | 297 // Cause advapi32 to load before the sandbox is turned on. |
| 294 unsigned int dummy_rand; | 298 unsigned int dummy_rand; |
| 295 rand_s(&dummy_rand); | 299 rand_s(&dummy_rand); |
| 296 // Warm up language subsystems before the sandbox is turned on. | 300 // Warm up language subsystems before the sandbox is turned on. |
| 297 ::GetUserDefaultLangID(); | 301 ::GetUserDefaultLangID(); |
| 298 ::GetUserDefaultLCID(); | 302 ::GetUserDefaultLCID(); |
| 299 | 303 |
| 304 if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) { | |
| 305 // Warm up system locales. | |
|
jschuh
2014/01/16 07:54:34
You don't need to manually load EnumSystemLocales.
| |
| 306 typedef BOOL (WINAPI *PfnEnumSystemLocales) (LOCALE_ENUMPROC, DWORD); | |
| 307 HMODULE hKernel32Dll = GetModuleHandleW(L"Kernel32.dll"); | |
| 308 PfnEnumSystemLocales lfpEnumSystemLocales = (PfnEnumSystemLocales) | |
| 309 GetProcAddress(hKernel32Dll, "EnumSystemLocalesW"); | |
| 310 | |
| 311 if (lfpEnumSystemLocales) | |
| 312 lfpEnumSystemLocales(EnumLocalesProc, LCID_INSTALLED); | |
| 313 } | |
| 314 | |
| 300 g_target_services->LowerToken(); | 315 g_target_services->LowerToken(); |
| 301 } | 316 } |
| 302 #endif | 317 #endif |
| 303 | 318 |
| 304 if (is_broker_) { | 319 if (is_broker_) { |
| 305 // Get the InitializeBroker function (required). | 320 // Get the InitializeBroker function (required). |
| 306 InitializeBrokerFunc init_broker = | 321 InitializeBrokerFunc init_broker = |
| 307 reinterpret_cast<InitializeBrokerFunc>( | 322 reinterpret_cast<InitializeBrokerFunc>( |
| 308 library.GetFunctionPointer("PPP_InitializeBroker")); | 323 library.GetFunctionPointer("PPP_InitializeBroker")); |
| 309 if (!init_broker) { | 324 if (!init_broker) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 histogram_name.str(), | 480 histogram_name.str(), |
| 466 1, | 481 1, |
| 467 LOAD_RESULT_MAX, | 482 LOAD_RESULT_MAX, |
| 468 LOAD_RESULT_MAX + 1, | 483 LOAD_RESULT_MAX + 1, |
| 469 base::HistogramBase::kUmaTargetedHistogramFlag); | 484 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 470 | 485 |
| 471 histogram->Add(result); | 486 histogram->Add(result); |
| 472 } | 487 } |
| 473 | 488 |
| 474 } // namespace content | 489 } // namespace content |
| OLD | NEW |