OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/app/content_main.h" | 5 #include "content/app/content_main.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 void CommonSubprocessInit(const std::string& process_type) { | 135 void CommonSubprocessInit(const std::string& process_type) { |
136 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
137 // HACK: Let Windows know that we have started. This is needed to suppress | 137 // HACK: Let Windows know that we have started. This is needed to suppress |
138 // the IDC_APPSTARTING cursor from being displayed for a prolonged period | 138 // the IDC_APPSTARTING cursor from being displayed for a prolonged period |
139 // while a subprocess is starting. | 139 // while a subprocess is starting. |
140 PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0); | 140 PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0); |
141 MSG msg; | 141 MSG msg; |
142 PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); | 142 PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); |
143 #endif | 143 #endif |
144 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 144 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
145 // Various things break when you're using a locale where the decimal | 145 // Various things break when you're using a locale where the decimal |
146 // separator isn't a period. See e.g. bugs 22782 and 39964. For | 146 // separator isn't a period. See e.g. bugs 22782 and 39964. For |
147 // all processes except the browser process (where we call system | 147 // all processes except the browser process (where we call system |
148 // APIs that may rely on the correct locale for formatting numbers | 148 // APIs that may rely on the correct locale for formatting numbers |
149 // when presenting them to the user), reset the locale for numeric | 149 // when presenting them to the user), reset the locale for numeric |
150 // formatting. | 150 // formatting. |
151 // Note that this is not correct for plugin processes -- they can | 151 // Note that this is not correct for plugin processes -- they can |
152 // surface UI -- but it's likely they get this wrong too so why not. | 152 // surface UI -- but it's likely they get this wrong too so why not. |
153 setlocale(LC_NUMERIC, "C"); | 153 setlocale(LC_NUMERIC, "C"); |
154 #endif | 154 #endif |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // process_util_linux.cc with the definition of | 301 // process_util_linux.cc with the definition of |
302 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a | 302 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a |
303 // dependency on TCMalloc. Really, we ought to have our allocator shim code | 303 // dependency on TCMalloc. Really, we ought to have our allocator shim code |
304 // implement this EnableTerminationOnOutOfMemory() function. Whateverz. This | 304 // implement this EnableTerminationOnOutOfMemory() function. Whateverz. This |
305 // works for now. | 305 // works for now. |
306 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | 306 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) |
307 // For tcmalloc, we need to tell it to behave like new. | 307 // For tcmalloc, we need to tell it to behave like new. |
308 tc_set_new_mode(1); | 308 tc_set_new_mode(1); |
309 #endif | 309 #endif |
310 | 310 |
| 311 #if !defined(OS_ANDROID) |
311 // Set C library locale to make sure CommandLine can parse argument values | 312 // Set C library locale to make sure CommandLine can parse argument values |
312 // in correct encoding. | 313 // in correct encoding. |
313 setlocale(LC_ALL, ""); | 314 setlocale(LC_ALL, ""); |
| 315 #endif |
314 | 316 |
315 SetupSignalHandlers(); | 317 SetupSignalHandlers(); |
316 | 318 |
317 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); | 319 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); |
318 g_fds->Set(kPrimaryIPCChannel, | 320 g_fds->Set(kPrimaryIPCChannel, |
319 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); | 321 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); |
320 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 322 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
321 g_fds->Set(kCrashDumpSignal, | 323 g_fds->Set(kCrashDumpSignal, |
322 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); | 324 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); |
323 #endif | 325 #endif |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 _CrtDumpMemoryLeaks(); | 463 _CrtDumpMemoryLeaks(); |
462 #endif // _CRTDBG_MAP_ALLOC | 464 #endif // _CRTDBG_MAP_ALLOC |
463 | 465 |
464 _Module.Term(); | 466 _Module.Term(); |
465 #endif // OS_WIN | 467 #endif // OS_WIN |
466 | 468 |
467 return exit_code; | 469 return exit_code; |
468 } | 470 } |
469 | 471 |
470 } // namespace content | 472 } // namespace content |
OLD | NEW |