| 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 <signal.h> | 19 #include <signal.h> |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 #if defined(OS_LINUX) | 22 #if defined(OS_LINUX) |
| 23 #include <gdk/gdk.h> |
| 24 #include <glib.h> |
| 25 #include <gtk/gtk.h> |
| 23 #include <string.h> | 26 #include <string.h> |
| 24 #include <gtk/gtk.h> | |
| 25 #endif | 27 #endif |
| 26 | 28 |
| 27 #include "base/at_exit.h" | 29 #include "base/at_exit.h" |
| 28 #include "base/command_line.h" | 30 #include "base/command_line.h" |
| 29 #include "base/debug_util.h" | 31 #include "base/debug_util.h" |
| 30 #include "base/icu_util.h" | 32 #include "base/icu_util.h" |
| 31 #include "base/message_loop.h" | 33 #include "base/message_loop.h" |
| 32 #include "base/path_service.h" | 34 #include "base/path_service.h" |
| 33 #include "base/process_util.h" | 35 #include "base/process_util.h" |
| 34 #include "base/scoped_nsautorelease_pool.h" | 36 #include "base/scoped_nsautorelease_pool.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } else if (process_type == switches::kPluginProcess) { | 418 } else if (process_type == switches::kPluginProcess) { |
| 417 #if defined(OS_WIN) | 419 #if defined(OS_WIN) |
| 418 rv = PluginMain(main_params); | 420 rv = PluginMain(main_params); |
| 419 #endif | 421 #endif |
| 420 } else if (process_type == switches::kWorkerProcess) { | 422 } else if (process_type == switches::kWorkerProcess) { |
| 421 #if defined(OS_WIN) | 423 #if defined(OS_WIN) |
| 422 rv = WorkerMain(main_params); | 424 rv = WorkerMain(main_params); |
| 423 #endif | 425 #endif |
| 424 } else if (process_type.empty()) { | 426 } else if (process_type.empty()) { |
| 425 #if defined(OS_LINUX) | 427 #if defined(OS_LINUX) |
| 428 // Glib/GDK type system and threading initializations. Needed at |
| 429 // least for gconf usage in net/proxy/proxy_config_service_linux.cc. |
| 430 // TODO(sdoyon): confirm whether gconf truly needs this. If so, |
| 431 // the GTK main loop (message pump) must also be made to call |
| 432 // gdk_threads_enter/leave(). Similar issue with the clipboard |
| 433 // (estade@ deanm@). |
| 434 g_type_init(); |
| 435 g_thread_init(NULL); |
| 436 gdk_threads_init(); |
| 426 // gtk_init() can change |argc| and |argv|, but nobody else uses them. | 437 // gtk_init() can change |argc| and |argv|, but nobody else uses them. |
| 427 gtk_init(&argc, const_cast<char***>(&argv)); | 438 gtk_init(&argc, const_cast<char***>(&argv)); |
| 428 SetUpGLibLogHandler(); | 439 SetUpGLibLogHandler(); |
| 429 #endif | 440 #endif |
| 430 | 441 |
| 431 ScopedOleInitializer ole_initializer; | 442 ScopedOleInitializer ole_initializer; |
| 432 rv = BrowserMain(main_params); | 443 rv = BrowserMain(main_params); |
| 433 } else { | 444 } else { |
| 434 NOTREACHED() << "Unknown process type"; | 445 NOTREACHED() << "Unknown process type"; |
| 435 } | 446 } |
| 436 | 447 |
| 437 if (!process_type.empty()) { | 448 if (!process_type.empty()) { |
| 438 ResourceBundle::CleanupSharedInstance(); | 449 ResourceBundle::CleanupSharedInstance(); |
| 439 } | 450 } |
| 440 | 451 |
| 441 #if defined(OS_WIN) | 452 #if defined(OS_WIN) |
| 442 #ifdef _CRTDBG_MAP_ALLOC | 453 #ifdef _CRTDBG_MAP_ALLOC |
| 443 _CrtDumpMemoryLeaks(); | 454 _CrtDumpMemoryLeaks(); |
| 444 #endif // _CRTDBG_MAP_ALLOC | 455 #endif // _CRTDBG_MAP_ALLOC |
| 445 | 456 |
| 446 _Module.Term(); | 457 _Module.Term(); |
| 447 #endif | 458 #endif |
| 448 | 459 |
| 449 logging::CleanupChromeLogging(); | 460 logging::CleanupChromeLogging(); |
| 450 | 461 |
| 451 return rv; | 462 return rv; |
| 452 } | 463 } |
| OLD | NEW |