Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1471)

Unified Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 137893002: Warm up EnumSystemLocalesEx() for Flash Player. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Lint Errors Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« AUTHORS ('K') | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6092f356e58dcda700933a6e7749a1f7deaf1265 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -56,6 +56,17 @@ extern sandbox::TargetServices* g_target_services;
extern void* g_target_services;
#endif
+#if defined(OS_WIN)
jschuh 2014/01/15 00:15:45 Move this function definition into the "#if define
Ye Liu 2014/01/15 07:59:54 Done.
+// Used by EnumSystemLocalesEx right below for warming up
+static BOOL CALLBACK EnumLocalesProcEx
+ (LPWSTR lpLocaleString, DWORD dwFlags, LPARAM lParam) {
jschuh 2014/01/15 00:15:45 Fix the indenting to comply with the style guide.
Ye Liu 2014/01/15 07:59:54 I change it to static BOOL CALLBACK EnumLocalesPr
+ return true;
+}
+
+typedef BOOL (WINAPI *PfnEnumSystemLocalesEx)
jschuh 2014/01/15 00:15:45 Move this typedef down to where you use it.
Ye Liu 2014/01/15 07:59:54 Done.
+ (LOCALE_ENUMPROCEX, DWORD, LPARAM, LPVOID);
+#endif
+
namespace content {
typedef int32_t (*InitializeBrokerFunc)
@@ -288,6 +299,19 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path,
base::win::OSInfo::GetInstance()->version() >=
base::win::VERSION_VISTA ) {
LoadLibrary(L"dxva2.dll");
+
+ // GetModuleHandleW doesn't require FreeLibrary() per MSDN.
jschuh 2014/01/15 00:15:45 You don't need the comment about GetModuleHandleW.
Ye Liu 2014/01/15 07:59:54 Done.
+ // Warm up EnumSystemLocalesEx() for Vista and above.
+ HMODULE hKernel32Dll = GetModuleHandleW(L"Kernel32.dll");
+ if (hKernel32Dll) {
jschuh 2014/01/15 00:15:45 There's no need need to check this. All Windows pr
Ye Liu 2014/01/15 07:59:54 Done.
+ PfnEnumSystemLocalesEx lfpEnumSystemLocalesEx;
+ lfpEnumSystemLocalesEx = (PfnEnumSystemLocalesEx) GetProcAddress(
jschuh 2014/01/15 00:15:45 assign in the initializer, rather than on a new li
Ye Liu 2014/01/15 07:59:54 Done.
+ hKernel32Dll, "EnumSystemLocalesEx");
jschuh 2014/01/15 00:15:45 indent at least four spaces for a continued line.
Ye Liu 2014/01/15 07:59:54 Done.
+
+ if (lfpEnumSystemLocalesEx) {
jschuh 2014/01/15 00:15:45 No braces needed for single line if.
Ye Liu 2014/01/15 07:59:54 Done.
+ lfpEnumSystemLocalesEx(EnumLocalesProcEx, 0, 0, 0);
+ }
+ }
}
// Cause advapi32 to load before the sandbox is turned on.
« AUTHORS ('K') | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698