Chromium Code Reviews| Index: content/ppapi_plugin/ppapi_thread.cc |
| diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc |
| index 5ed1873cce87364ef7a0aeb231b58a3bebd2cf44..4fcf11adc7202c591ff82d8da10c9a9a2ad58f17 100644 |
| --- a/content/ppapi_plugin/ppapi_thread.cc |
| +++ b/content/ppapi_plugin/ppapi_thread.cc |
| @@ -52,6 +52,15 @@ |
| #if defined(OS_WIN) |
| extern sandbox::TargetServices* g_target_services; |
| +// Used by EnumSystemLocalesEx right below for warming up |
| +static BOOL CALLBACK EnumLocalesProcEx(LPWSTR lpLocaleString, DWORD dwFlags, |
| + LPARAM lParam) { |
| + return true; |
| +} |
| + |
| +static BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) { |
| + return true; |
| +} |
| #else |
| extern void* g_target_services; |
| #endif |
| @@ -284,12 +293,33 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path, |
| // regular plugins. |
| if (g_target_services) { |
| // Let Flash load DRM before lockdown on Vista+. |
| - if (permissions.HasPermission(ppapi::PERMISSION_FLASH) && |
| - base::win::OSInfo::GetInstance()->version() >= |
| - base::win::VERSION_VISTA ) { |
| - LoadLibrary(L"dxva2.dll"); |
| + if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) { |
| + if (base::win::OSInfo::GetInstance()->version() >= |
| + base::win::VERSION_VISTA ) { |
| + LoadLibrary(L"dxva2.dll"); |
| + |
| + typedef BOOL (WINAPI *PfnEnumSystemLocalesEx) |
| + (LOCALE_ENUMPROCEX, DWORD, LPARAM, LPVOID); |
| + |
| + // Warm up system locales for Vista and above. |
| + HMODULE hKernel32Dll = GetModuleHandleW(L"Kernel32.dll"); |
| + PfnEnumSystemLocalesEx lfpEnumSystemLocalesEx = (PfnEnumSystemLocalesEx) |
| + GetProcAddress(hKernel32Dll, "EnumSystemLocalesEx"); |
| + |
| + if (lfpEnumSystemLocalesEx) |
| + lfpEnumSystemLocalesEx(EnumLocalesProcEx, LOCALE_WINDOWS, 0, 0); |
| + } else { |
| + typedef BOOL (WINAPI *PfnEnumSystemLocales) (LOCALE_ENUMPROC, DWORD); |
| + |
| + // Warm up system locales for Win XP. |
| + HMODULE hKernel32Dll = GetModuleHandleW(L"Kernel32.dll"); |
| + PfnEnumSystemLocales lfpEnumSystemLocales = (PfnEnumSystemLocales) |
| + GetProcAddress(hKernel32Dll, "EnumSystemLocalesW"); |
|
jschuh
2014/01/15 21:16:01
EnumSystemLocales is supported in Win2k+, so let t
|
| + |
| + if (lfpEnumSystemLocales) |
| + lfpEnumSystemLocales(EnumLocalesProc, LCID_INSTALLED); |
| + } |
| } |
| - |
| // Cause advapi32 to load before the sandbox is turned on. |
| unsigned int dummy_rand; |
| rand_s(&dummy_rand); |