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 EnumSystemLocalesEx right below for warming up | |
| 56 static BOOL CALLBACK EnumLocalesProcEx(LPWSTR lpLocaleString, DWORD dwFlags, | |
| 57 LPARAM lParam) { | |
| 58 return true; | |
| 59 } | |
| 60 | |
| 61 static BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) { | |
| 62 return true; | |
| 63 } | |
| 55 #else | 64 #else |
| 56 extern void* g_target_services; | 65 extern void* g_target_services; |
| 57 #endif | 66 #endif |
| 58 | 67 |
| 59 namespace content { | 68 namespace content { |
| 60 | 69 |
| 61 typedef int32_t (*InitializeBrokerFunc) | 70 typedef int32_t (*InitializeBrokerFunc) |
| 62 (PP_ConnectInstance_Func* connect_instance_func); | 71 (PP_ConnectInstance_Func* connect_instance_func); |
| 63 | 72 |
| 64 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) | 73 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 #if defined(OS_WIN) | 286 #if defined(OS_WIN) |
| 278 // If code subsequently tries to exit using abort(), force a crash (since | 287 // If code subsequently tries to exit using abort(), force a crash (since |
| 279 // otherwise these would be silent terminations and fly under the radar). | 288 // otherwise these would be silent terminations and fly under the radar). |
| 280 base::win::SetAbortBehaviorForCrashReporting(); | 289 base::win::SetAbortBehaviorForCrashReporting(); |
| 281 | 290 |
| 282 // Once we lower the token the sandbox is locked down and no new modules | 291 // 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 | 292 // can be loaded. TODO(cpu): consider changing to the loading style of |
| 284 // regular plugins. | 293 // regular plugins. |
| 285 if (g_target_services) { | 294 if (g_target_services) { |
| 286 // Let Flash load DRM before lockdown on Vista+. | 295 // Let Flash load DRM before lockdown on Vista+. |
| 287 if (permissions.HasPermission(ppapi::PERMISSION_FLASH) && | 296 if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) { |
| 288 base::win::OSInfo::GetInstance()->version() >= | 297 if (base::win::OSInfo::GetInstance()->version() >= |
| 289 base::win::VERSION_VISTA ) { | 298 base::win::VERSION_VISTA ) { |
| 290 LoadLibrary(L"dxva2.dll"); | 299 LoadLibrary(L"dxva2.dll"); |
| 300 | |
| 301 typedef BOOL (WINAPI *PfnEnumSystemLocalesEx) | |
| 302 (LOCALE_ENUMPROCEX, DWORD, LPARAM, LPVOID); | |
| 303 | |
| 304 // Warm up system locales for Vista and above. | |
| 305 HMODULE hKernel32Dll = GetModuleHandleW(L"Kernel32.dll"); | |
| 306 PfnEnumSystemLocalesEx lfpEnumSystemLocalesEx = (PfnEnumSystemLocalesEx) | |
| 307 GetProcAddress(hKernel32Dll, "EnumSystemLocalesEx"); | |
| 308 | |
| 309 if (lfpEnumSystemLocalesEx) | |
| 310 lfpEnumSystemLocalesEx(EnumLocalesProcEx, LOCALE_WINDOWS, 0, 0); | |
| 311 } else { | |
| 312 typedef BOOL (WINAPI *PfnEnumSystemLocales) (LOCALE_ENUMPROC, DWORD); | |
| 313 | |
| 314 // Warm up system locales for Win XP. | |
| 315 HMODULE hKernel32Dll = GetModuleHandleW(L"Kernel32.dll"); | |
| 316 PfnEnumSystemLocales lfpEnumSystemLocales = (PfnEnumSystemLocales) | |
| 317 GetProcAddress(hKernel32Dll, "EnumSystemLocalesW"); | |
|
jschuh
2014/01/15 21:16:01
EnumSystemLocales is supported in Win2k+, so let t
| |
| 318 | |
| 319 if (lfpEnumSystemLocales) | |
| 320 lfpEnumSystemLocales(EnumLocalesProc, LCID_INSTALLED); | |
| 321 } | |
| 291 } | 322 } |
| 292 | |
| 293 // Cause advapi32 to load before the sandbox is turned on. | 323 // Cause advapi32 to load before the sandbox is turned on. |
| 294 unsigned int dummy_rand; | 324 unsigned int dummy_rand; |
| 295 rand_s(&dummy_rand); | 325 rand_s(&dummy_rand); |
| 296 // Warm up language subsystems before the sandbox is turned on. | 326 // Warm up language subsystems before the sandbox is turned on. |
| 297 ::GetUserDefaultLangID(); | 327 ::GetUserDefaultLangID(); |
| 298 ::GetUserDefaultLCID(); | 328 ::GetUserDefaultLCID(); |
| 299 | 329 |
| 300 g_target_services->LowerToken(); | 330 g_target_services->LowerToken(); |
| 301 } | 331 } |
| 302 #endif | 332 #endif |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 histogram_name.str(), | 495 histogram_name.str(), |
| 466 1, | 496 1, |
| 467 LOAD_RESULT_MAX, | 497 LOAD_RESULT_MAX, |
| 468 LOAD_RESULT_MAX + 1, | 498 LOAD_RESULT_MAX + 1, |
| 469 base::HistogramBase::kUmaTargetedHistogramFlag); | 499 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 470 | 500 |
| 471 histogram->Add(result); | 501 histogram->Add(result); |
| 472 } | 502 } |
| 473 | 503 |
| 474 } // namespace content | 504 } // namespace content |
| OLD | NEW |