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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/debug/debugger.h" | 6 #include "base/debug/debugger.h" |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "content/common/child_process.h" | 11 #include "content/common/child_process.h" |
12 #include "content/ppapi_plugin/ppapi_thread.h" | 12 #include "content/ppapi_plugin/ppapi_thread.h" |
13 #include "content/public/common/content_client.h" | 13 #include "content/public/common/content_client.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "content/public/common/main_function_params.h" | 15 #include "content/public/common/main_function_params.h" |
16 #include "content/public/plugin/content_plugin_client.h" | 16 #include "content/public/plugin/content_plugin_client.h" |
| 17 #include "crypto/nss_util.h" |
17 #include "ppapi/proxy/proxy_module.h" | 18 #include "ppapi/proxy/proxy_module.h" |
18 #include "ui/base/ui_base_switches.h" | 19 #include "ui/base/ui_base_switches.h" |
19 | 20 |
20 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
21 #include "sandbox/win/src/sandbox.h" | 22 #include "sandbox/win/src/sandbox.h" |
22 #endif | 23 #endif |
23 | 24 |
24 #if defined(OS_LINUX) | 25 #if defined(OS_LINUX) |
25 #include "content/public/common/sandbox_init.h" | 26 #include "content/public/common/sandbox_init.h" |
26 #endif | 27 #endif |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 std::replace(locale.begin(), locale.end(), '-', '_'); | 74 std::replace(locale.begin(), locale.end(), '-', '_'); |
74 locale.append(".UTF-8"); | 75 locale.append(".UTF-8"); |
75 setlocale(LC_ALL, locale.c_str()); | 76 setlocale(LC_ALL, locale.c_str()); |
76 setenv("LANG", locale.c_str(), 0); | 77 setenv("LANG", locale.c_str(), 0); |
77 #endif | 78 #endif |
78 } | 79 } |
79 | 80 |
80 MessageLoop main_message_loop; | 81 MessageLoop main_message_loop; |
81 base::PlatformThread::SetName("CrPPAPIMain"); | 82 base::PlatformThread::SetName("CrPPAPIMain"); |
82 | 83 |
| 84 #if defined(OS_LINUX) && defined(USE_NSS) |
| 85 // Some out-of-process PPAPI plugins use NSS. |
| 86 // NSS must be initialized before enabling the sandbox below. |
| 87 crypto::WarmUpNSSSafely(); |
| 88 #endif |
| 89 |
83 // Allow the embedder to perform any necessary per-process initialization | 90 // Allow the embedder to perform any necessary per-process initialization |
84 // before the sandbox is initialized. | 91 // before the sandbox is initialized. |
85 if (GetContentClient()->plugin()) | 92 if (GetContentClient()->plugin()) |
86 GetContentClient()->plugin()->PreSandboxInitialization(); | 93 GetContentClient()->plugin()->PreSandboxInitialization(); |
87 | 94 |
88 #if defined(OS_LINUX) | 95 #if defined(OS_LINUX) |
89 InitializeSandbox(); | 96 InitializeSandbox(); |
90 #endif | 97 #endif |
91 | 98 |
92 ChildProcess ppapi_process; | 99 ChildProcess ppapi_process; |
93 ppapi_process.set_main_thread( | 100 ppapi_process.set_main_thread( |
94 new PpapiThread(parameters.command_line, false)); // Not a broker. | 101 new PpapiThread(parameters.command_line, false)); // Not a broker. |
95 | 102 |
96 main_message_loop.Run(); | 103 main_message_loop.Run(); |
97 return 0; | 104 return 0; |
98 } | 105 } |
99 | 106 |
100 } // namespace content | 107 } // namespace content |
OLD | NEW |