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/child/child_process.h" | 11 #include "content/child/child_process.h" |
| 12 #include "content/common/content_constants_internal.h" |
12 #include "content/common/sandbox_linux.h" | 13 #include "content/common/sandbox_linux.h" |
13 #include "content/ppapi_plugin/ppapi_thread.h" | 14 #include "content/ppapi_plugin/ppapi_thread.h" |
14 #include "content/public/common/content_client.h" | 15 #include "content/public/common/content_client.h" |
15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
16 #include "content/public/common/main_function_params.h" | 17 #include "content/public/common/main_function_params.h" |
17 #include "content/public/plugin/content_plugin_client.h" | 18 #include "content/public/plugin/content_plugin_client.h" |
18 #include "crypto/nss_util.h" | 19 #include "crypto/nss_util.h" |
19 #include "ppapi/proxy/proxy_module.h" | 20 #include "ppapi/proxy/proxy_module.h" |
20 #include "ui/base/ui_base_switches.h" | 21 #include "ui/base/ui_base_switches.h" |
21 | 22 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // ICU can accept "en-US" or "en_US", but POSIX wants "en_US". | 75 // ICU can accept "en-US" or "en_US", but POSIX wants "en_US". |
75 std::replace(locale.begin(), locale.end(), '-', '_'); | 76 std::replace(locale.begin(), locale.end(), '-', '_'); |
76 locale.append(".UTF-8"); | 77 locale.append(".UTF-8"); |
77 setlocale(LC_ALL, locale.c_str()); | 78 setlocale(LC_ALL, locale.c_str()); |
78 setenv("LANG", locale.c_str(), 0); | 79 setenv("LANG", locale.c_str(), 0); |
79 #endif | 80 #endif |
80 } | 81 } |
81 | 82 |
82 base::MessageLoop main_message_loop; | 83 base::MessageLoop main_message_loop; |
83 base::PlatformThread::SetName("CrPPAPIMain"); | 84 base::PlatformThread::SetName("CrPPAPIMain"); |
| 85 base::debug::TraceLog::GetInstance()->SetProcessName("PPAPI Process"); |
| 86 base::debug::TraceLog::GetInstance()->SetProcessSortIndex( |
| 87 kTraceEventPpapiProcessSortIndex); |
84 | 88 |
85 #if defined(OS_LINUX) && defined(USE_NSS) | 89 #if defined(OS_LINUX) && defined(USE_NSS) |
86 // Some out-of-process PPAPI plugins use NSS. | 90 // Some out-of-process PPAPI plugins use NSS. |
87 // NSS must be initialized before enabling the sandbox below. | 91 // NSS must be initialized before enabling the sandbox below. |
88 crypto::InitNSSSafely(); | 92 crypto::InitNSSSafely(); |
89 #endif | 93 #endif |
90 | 94 |
91 // Allow the embedder to perform any necessary per-process initialization | 95 // Allow the embedder to perform any necessary per-process initialization |
92 // before the sandbox is initialized. | 96 // before the sandbox is initialized. |
93 if (GetContentClient()->plugin()) | 97 if (GetContentClient()->plugin()) |
94 GetContentClient()->plugin()->PreSandboxInitialization(); | 98 GetContentClient()->plugin()->PreSandboxInitialization(); |
95 | 99 |
96 #if defined(OS_LINUX) | 100 #if defined(OS_LINUX) |
97 LinuxSandbox::InitializeSandbox(); | 101 LinuxSandbox::InitializeSandbox(); |
98 #endif | 102 #endif |
99 | 103 |
100 ChildProcess ppapi_process; | 104 ChildProcess ppapi_process; |
101 ppapi_process.set_main_thread( | 105 ppapi_process.set_main_thread( |
102 new PpapiThread(parameters.command_line, false)); // Not a broker. | 106 new PpapiThread(parameters.command_line, false)); // Not a broker. |
103 | 107 |
104 main_message_loop.Run(); | 108 main_message_loop.Run(); |
105 return 0; | 109 return 0; |
106 } | 110 } |
107 | 111 |
108 } // namespace content | 112 } // namespace content |
OLD | NEW |