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 <atlbase.h> | 13 #include <atlbase.h> |
14 #include <atlapp.h> | 14 #include <atlapp.h> |
15 #include <malloc.h> | 15 #include <malloc.h> |
16 #include <new.h> | 16 #include <new.h> |
17 #endif | 17 #endif |
18 | 18 |
| 19 #if defined(OS_LINUX) |
| 20 #include <gtk/gtk.h> |
| 21 #endif |
| 22 |
19 #include "base/at_exit.h" | 23 #include "base/at_exit.h" |
20 #include "base/command_line.h" | 24 #include "base/command_line.h" |
21 #include "base/icu_util.h" | 25 #include "base/icu_util.h" |
22 #include "base/message_loop.h" | 26 #include "base/message_loop.h" |
23 #include "base/path_service.h" | 27 #include "base/path_service.h" |
24 #include "base/process_util.h" | 28 #include "base/process_util.h" |
25 #include "base/scoped_nsautorelease_pool.h" | 29 #include "base/scoped_nsautorelease_pool.h" |
26 #include "base/stats_table.h" | 30 #include "base/stats_table.h" |
27 #include "base/string_util.h" | 31 #include "base/string_util.h" |
28 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // The exit manager is in charge of calling the dtors of singleton objects. | 200 // The exit manager is in charge of calling the dtors of singleton objects. |
197 base::AtExitManager exit_manager; | 201 base::AtExitManager exit_manager; |
198 | 202 |
199 // TODO(pinkerton): We need this pool here for all the objects created | 203 // TODO(pinkerton): We need this pool here for all the objects created |
200 // before we get to the UI event loop, but we don't want to leave them | 204 // before we get to the UI event loop, but we don't want to leave them |
201 // hanging around until the app quits. We should add a "flush" to the class | 205 // hanging around until the app quits. We should add a "flush" to the class |
202 // which just cycles the pool under the covers and then call that just | 206 // which just cycles the pool under the covers and then call that just |
203 // before we invoke the main UI loop near the bottom of this function. | 207 // before we invoke the main UI loop near the bottom of this function. |
204 base::ScopedNSAutoreleasePool autorelease_pool; | 208 base::ScopedNSAutoreleasePool autorelease_pool; |
205 | 209 |
| 210 #if defined(OS_LINUX) |
| 211 // gtk_init() can change |argc| and |argv| and thus must be called before |
| 212 // CommandLine::Init(). |
| 213 // TODO(estade): we should make a copy of |argv| instead of const_casting |
| 214 // it. |
| 215 gtk_init(&argc, const_cast<char***>(&argv)); |
| 216 #endif |
| 217 |
206 // Initialize the command line. | 218 // Initialize the command line. |
207 #if defined(OS_WIN) | 219 #if defined(OS_WIN) |
208 CommandLine::Init(0, NULL); | 220 CommandLine::Init(0, NULL); |
209 #else | 221 #else |
210 CommandLine::Init(argc, argv); | 222 CommandLine::Init(argc, argv); |
211 #endif | 223 #endif |
212 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 224 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
213 | 225 |
214 SetupCRT(parsed_command_line); | 226 SetupCRT(parsed_command_line); |
215 | 227 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 340 |
329 _Module.Term(); | 341 _Module.Term(); |
330 #endif | 342 #endif |
331 | 343 |
332 logging::CleanupChromeLogging(); | 344 logging::CleanupChromeLogging(); |
333 | 345 |
334 return rv; | 346 return rv; |
335 } | 347 } |
336 | 348 |
337 | 349 |
OLD | NEW |