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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 #else | 55 #else |
56 extern void* g_target_services; | 56 extern void* g_target_services; |
57 #endif | 57 #endif |
58 | 58 |
59 #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.
| |
60 // Used by EnumSystemLocalesEx right below for warming up | |
61 static BOOL CALLBACK EnumLocalesProcEx | |
62 (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
| |
63 return true; | |
64 } | |
65 | |
66 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.
| |
67 (LOCALE_ENUMPROCEX, DWORD, LPARAM, LPVOID); | |
68 #endif | |
69 | |
59 namespace content { | 70 namespace content { |
60 | 71 |
61 typedef int32_t (*InitializeBrokerFunc) | 72 typedef int32_t (*InitializeBrokerFunc) |
62 (PP_ConnectInstance_Func* connect_instance_func); | 73 (PP_ConnectInstance_Func* connect_instance_func); |
63 | 74 |
64 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) | 75 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) |
65 : is_broker_(is_broker), | 76 : is_broker_(is_broker), |
66 connect_instance_func_(NULL), | 77 connect_instance_func_(NULL), |
67 local_pp_module_( | 78 local_pp_module_( |
68 base::RandInt(0, std::numeric_limits<PP_Module>::max())), | 79 base::RandInt(0, std::numeric_limits<PP_Module>::max())), |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 | 292 |
282 // Once we lower the token the sandbox is locked down and no new modules | 293 // 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 | 294 // can be loaded. TODO(cpu): consider changing to the loading style of |
284 // regular plugins. | 295 // regular plugins. |
285 if (g_target_services) { | 296 if (g_target_services) { |
286 // Let Flash load DRM before lockdown on Vista+. | 297 // Let Flash load DRM before lockdown on Vista+. |
287 if (permissions.HasPermission(ppapi::PERMISSION_FLASH) && | 298 if (permissions.HasPermission(ppapi::PERMISSION_FLASH) && |
288 base::win::OSInfo::GetInstance()->version() >= | 299 base::win::OSInfo::GetInstance()->version() >= |
289 base::win::VERSION_VISTA ) { | 300 base::win::VERSION_VISTA ) { |
290 LoadLibrary(L"dxva2.dll"); | 301 LoadLibrary(L"dxva2.dll"); |
302 | |
303 // 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.
| |
304 // Warm up EnumSystemLocalesEx() for Vista and above. | |
305 HMODULE hKernel32Dll = GetModuleHandleW(L"Kernel32.dll"); | |
306 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.
| |
307 PfnEnumSystemLocalesEx lfpEnumSystemLocalesEx; | |
308 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.
| |
309 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.
| |
310 | |
311 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.
| |
312 lfpEnumSystemLocalesEx(EnumLocalesProcEx, 0, 0, 0); | |
313 } | |
314 } | |
291 } | 315 } |
292 | 316 |
293 // Cause advapi32 to load before the sandbox is turned on. | 317 // Cause advapi32 to load before the sandbox is turned on. |
294 unsigned int dummy_rand; | 318 unsigned int dummy_rand; |
295 rand_s(&dummy_rand); | 319 rand_s(&dummy_rand); |
296 // Warm up language subsystems before the sandbox is turned on. | 320 // Warm up language subsystems before the sandbox is turned on. |
297 ::GetUserDefaultLangID(); | 321 ::GetUserDefaultLangID(); |
298 ::GetUserDefaultLCID(); | 322 ::GetUserDefaultLCID(); |
299 | 323 |
300 g_target_services->LowerToken(); | 324 g_target_services->LowerToken(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
465 histogram_name.str(), | 489 histogram_name.str(), |
466 1, | 490 1, |
467 LOAD_RESULT_MAX, | 491 LOAD_RESULT_MAX, |
468 LOAD_RESULT_MAX + 1, | 492 LOAD_RESULT_MAX + 1, |
469 base::HistogramBase::kUmaTargetedHistogramFlag); | 493 base::HistogramBase::kUmaTargetedHistogramFlag); |
470 | 494 |
471 histogram->Add(result); | 495 histogram->Add(result); |
472 } | 496 } |
473 | 497 |
474 } // namespace content | 498 } // namespace content |
OLD | NEW |