OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // TODO(port): the ifdefs in here are a first step towards trying to determine | 5 // TODO(port): the ifdefs in here are a first step towards trying to determine |
6 // the correct abstraction for all the OS functionality required at this | 6 // the correct abstraction for all the OS functionality required at this |
7 // stage of process initialization. It should not be taken as a final | 7 // stage of process initialization. It should not be taken as a final |
8 // abstraction. | 8 // abstraction. |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 | 11 |
12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <atlbase.h> | 14 #include <atlbase.h> |
15 #include <atlapp.h> | 15 #include <atlapp.h> |
16 #include <malloc.h> | 16 #include <malloc.h> |
17 #include <new.h> | 17 #include <new.h> |
18 #elif defined(OS_POSIX) | 18 #elif defined(OS_POSIX) |
| 19 #include <locale.h> |
19 #include <signal.h> | 20 #include <signal.h> |
20 #include <sys/types.h> | 21 #include <sys/types.h> |
21 #include <sys/stat.h> | 22 #include <sys/stat.h> |
22 #include <unistd.h> | 23 #include <unistd.h> |
23 #endif | 24 #endif |
24 | 25 |
25 #if defined(OS_LINUX) | 26 #if defined(OS_LINUX) |
26 #include <gdk/gdk.h> | 27 #include <gdk/gdk.h> |
27 #include <glib.h> | 28 #include <glib.h> |
28 #include <gtk/gtk.h> | 29 #include <gtk/gtk.h> |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 #if defined(OS_POSIX) | 323 #if defined(OS_POSIX) |
323 base::GlobalDescriptors* g_fds = Singleton<base::GlobalDescriptors>::get(); | 324 base::GlobalDescriptors* g_fds = Singleton<base::GlobalDescriptors>::get(); |
324 g_fds->Set(kPrimaryIPCChannel, | 325 g_fds->Set(kPrimaryIPCChannel, |
325 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); | 326 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); |
326 #if defined(OS_LINUX) | 327 #if defined(OS_LINUX) |
327 g_fds->Set(kCrashDumpSignal, | 328 g_fds->Set(kCrashDumpSignal, |
328 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); | 329 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); |
329 #endif | 330 #endif |
330 #endif | 331 #endif |
331 | 332 |
| 333 #if defined(OS_POSIX) |
| 334 // Set C library locale to make sure CommandLine can parse argument values |
| 335 // in correct encoding. |
| 336 setlocale(LC_ALL, ""); |
| 337 #endif |
| 338 |
332 // Initialize the command line. | 339 // Initialize the command line. |
333 #if defined(OS_WIN) | 340 #if defined(OS_WIN) |
334 CommandLine::Init(0, NULL); | 341 CommandLine::Init(0, NULL); |
335 #else | 342 #else |
336 CommandLine::Init(argc, argv); | 343 CommandLine::Init(argc, argv); |
337 #endif | 344 #endif |
338 | 345 |
339 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 346 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
340 std::wstring process_type = | 347 std::wstring process_type = |
341 parsed_command_line.GetSwitchValue(switches::kProcessType); | 348 parsed_command_line.GetSwitchValue(switches::kProcessType); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 593 |
587 logging::CleanupChromeLogging(); | 594 logging::CleanupChromeLogging(); |
588 | 595 |
589 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) | 596 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) |
590 // TODO(mark): See the TODO(mark) above at InitCrashReporter. | 597 // TODO(mark): See the TODO(mark) above at InitCrashReporter. |
591 DestructCrashReporter(); | 598 DestructCrashReporter(); |
592 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD | 599 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD |
593 | 600 |
594 return rv; | 601 return rv; |
595 } | 602 } |
OLD | NEW |