| 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 |
| 56 // Used by EnumSystemLocales for warming up. |
| 57 static BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) { |
| 58 return TRUE; |
| 59 } |
| 55 #else | 60 #else |
| 56 extern void* g_target_services; | 61 extern void* g_target_services; |
| 57 #endif | 62 #endif |
| 58 | 63 |
| 59 namespace content { | 64 namespace content { |
| 60 | 65 |
| 61 typedef int32_t (*InitializeBrokerFunc) | 66 typedef int32_t (*InitializeBrokerFunc) |
| 62 (PP_ConnectInstance_Func* connect_instance_func); | 67 (PP_ConnectInstance_Func* connect_instance_func); |
| 63 | 68 |
| 64 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) | 69 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 LoadLibrary(L"dxva2.dll"); | 295 LoadLibrary(L"dxva2.dll"); |
| 291 } | 296 } |
| 292 | 297 |
| 293 // Cause advapi32 to load before the sandbox is turned on. | 298 // Cause advapi32 to load before the sandbox is turned on. |
| 294 unsigned int dummy_rand; | 299 unsigned int dummy_rand; |
| 295 rand_s(&dummy_rand); | 300 rand_s(&dummy_rand); |
| 296 // Warm up language subsystems before the sandbox is turned on. | 301 // Warm up language subsystems before the sandbox is turned on. |
| 297 ::GetUserDefaultLangID(); | 302 ::GetUserDefaultLangID(); |
| 298 ::GetUserDefaultLCID(); | 303 ::GetUserDefaultLCID(); |
| 299 | 304 |
| 305 if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) { |
| 306 // Warm up system locales. |
| 307 EnumSystemLocalesW(EnumLocalesProc, LCID_INSTALLED); |
| 308 } |
| 309 |
| 300 g_target_services->LowerToken(); | 310 g_target_services->LowerToken(); |
| 301 } | 311 } |
| 302 #endif | 312 #endif |
| 303 | 313 |
| 304 if (is_broker_) { | 314 if (is_broker_) { |
| 305 // Get the InitializeBroker function (required). | 315 // Get the InitializeBroker function (required). |
| 306 InitializeBrokerFunc init_broker = | 316 InitializeBrokerFunc init_broker = |
| 307 reinterpret_cast<InitializeBrokerFunc>( | 317 reinterpret_cast<InitializeBrokerFunc>( |
| 308 library.GetFunctionPointer("PPP_InitializeBroker")); | 318 library.GetFunctionPointer("PPP_InitializeBroker")); |
| 309 if (!init_broker) { | 319 if (!init_broker) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 histogram_name.str(), | 475 histogram_name.str(), |
| 466 1, | 476 1, |
| 467 LOAD_RESULT_MAX, | 477 LOAD_RESULT_MAX, |
| 468 LOAD_RESULT_MAX + 1, | 478 LOAD_RESULT_MAX + 1, |
| 469 base::HistogramBase::kUmaTargetedHistogramFlag); | 479 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 470 | 480 |
| 471 histogram->Add(result); | 481 histogram->Add(result); |
| 472 } | 482 } |
| 473 | 483 |
| 474 } // namespace content | 484 } // namespace content |
| OLD | NEW |