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 | |
yzshen1
2014/01/16 17:26:28
nit:
- please add a blank line above this comment.
| |
56 static BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) { | |
57 return true; | |
yzshen1
2014/01/16 17:26:28
For consistency, it is better to use TRUE since th
| |
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"); |
yzshen1
2014/01/16 17:26:28
Wrong indent. it should be two spaces less. (The p
| |
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. | |
306 EnumSystemLocalesW(EnumLocalesProc, LCID_INSTALLED); | |
307 } | |
308 | |
300 g_target_services->LowerToken(); | 309 g_target_services->LowerToken(); |
301 } | 310 } |
302 #endif | 311 #endif |
303 | 312 |
304 if (is_broker_) { | 313 if (is_broker_) { |
305 // Get the InitializeBroker function (required). | 314 // Get the InitializeBroker function (required). |
306 InitializeBrokerFunc init_broker = | 315 InitializeBrokerFunc init_broker = |
307 reinterpret_cast<InitializeBrokerFunc>( | 316 reinterpret_cast<InitializeBrokerFunc>( |
308 library.GetFunctionPointer("PPP_InitializeBroker")); | 317 library.GetFunctionPointer("PPP_InitializeBroker")); |
309 if (!init_broker) { | 318 if (!init_broker) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
465 histogram_name.str(), | 474 histogram_name.str(), |
466 1, | 475 1, |
467 LOAD_RESULT_MAX, | 476 LOAD_RESULT_MAX, |
468 LOAD_RESULT_MAX + 1, | 477 LOAD_RESULT_MAX + 1, |
469 base::HistogramBase::kUmaTargetedHistogramFlag); | 478 base::HistogramBase::kUmaTargetedHistogramFlag); |
470 | 479 |
471 histogram->Add(result); | 480 histogram->Add(result); |
472 } | 481 } |
473 | 482 |
474 } // namespace content | 483 } // namespace content |
OLD | NEW |