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/browser/browser_main.h" | 5 #include "content/browser/browser_main.h" |
6 | 6 |
7 #include "base/allocator/allocator_shim.h" | 7 #include "base/allocator/allocator_shim.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include <commctrl.h> | 32 #include <commctrl.h> |
33 #include <ole2.h> | 33 #include <ole2.h> |
34 #include <shellapi.h> | 34 #include <shellapi.h> |
35 | 35 |
36 #include "base/win/scoped_com_initializer.h" | 36 #include "base/win/scoped_com_initializer.h" |
37 #include "net/base/winsock_init.h" | 37 #include "net/base/winsock_init.h" |
38 #include "sandbox/src/sandbox.h" | 38 #include "sandbox/src/sandbox.h" |
39 #include "ui/base/l10n/l10n_util_win.h" | 39 #include "ui/base/l10n/l10n_util_win.h" |
40 #endif | 40 #endif |
41 | 41 |
42 #if defined(OS_LINUX) | 42 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
43 #include <glib-object.h> | 43 #include <glib-object.h> |
44 #endif | 44 #endif |
45 | 45 |
46 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
47 #include <dbus/dbus-glib.h> | 47 #include <dbus/dbus-glib.h> |
48 #endif | 48 #endif |
49 | 49 |
50 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 50 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
51 #include <sys/stat.h> | 51 #include <sys/stat.h> |
52 | 52 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 sandbox_cmd = sandbox_binary; | 102 sandbox_cmd = sandbox_binary; |
103 | 103 |
104 // Tickle the sandbox host and zygote host so they fork now. | 104 // Tickle the sandbox host and zygote host so they fork now. |
105 RenderSandboxHostLinux* shost = RenderSandboxHostLinux::GetInstance(); | 105 RenderSandboxHostLinux* shost = RenderSandboxHostLinux::GetInstance(); |
106 shost->Init(sandbox_cmd); | 106 shost->Init(sandbox_cmd); |
107 ZygoteHost* zhost = ZygoteHost::GetInstance(); | 107 ZygoteHost* zhost = ZygoteHost::GetInstance(); |
108 zhost->Init(sandbox_cmd); | 108 zhost->Init(sandbox_cmd); |
109 } | 109 } |
110 #endif | 110 #endif |
111 | 111 |
112 #if defined(OS_LINUX) | 112 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
113 static void GLibLogHandler(const gchar* log_domain, | 113 static void GLibLogHandler(const gchar* log_domain, |
114 GLogLevelFlags log_level, | 114 GLogLevelFlags log_level, |
115 const gchar* message, | 115 const gchar* message, |
116 gpointer userdata) { | 116 gpointer userdata) { |
117 if (!log_domain) | 117 if (!log_domain) |
118 log_domain = "<unknown>"; | 118 log_domain = "<unknown>"; |
119 if (!message) | 119 if (!message) |
120 message = "<no message>"; | 120 message = "<no message>"; |
121 | 121 |
122 if (strstr(message, "Loading IM context type") || | 122 if (strstr(message, "Loading IM context type") || |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // Register the main thread by instantiating it, but don't call any methods. | 281 // Register the main thread by instantiating it, but don't call any methods. |
282 main_thread_.reset(new BrowserThread(BrowserThread::UI, | 282 main_thread_.reset(new BrowserThread(BrowserThread::UI, |
283 MessageLoop::current())); | 283 MessageLoop::current())); |
284 } | 284 } |
285 | 285 |
286 void BrowserMainParts::InitializeToolkit() { | 286 void BrowserMainParts::InitializeToolkit() { |
287 // TODO(evan): this function is rather subtle, due to the variety | 287 // TODO(evan): this function is rather subtle, due to the variety |
288 // of intersecting ifdefs we have. To keep it easy to follow, there | 288 // of intersecting ifdefs we have. To keep it easy to follow, there |
289 // are no #else branches on any #ifs. | 289 // are no #else branches on any #ifs. |
290 | 290 |
291 #if defined(OS_LINUX) | 291 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
292 // We want to call g_thread_init(), but in some codepaths (tests) it | 292 // We want to call g_thread_init(), but in some codepaths (tests) it |
293 // is possible it has already been called. In older versions of | 293 // is possible it has already been called. In older versions of |
294 // GTK, it is an error to call g_thread_init twice; unfortunately, | 294 // GTK, it is an error to call g_thread_init twice; unfortunately, |
295 // the API to tell whether it has been called already was also only | 295 // the API to tell whether it has been called already was also only |
296 // added in a newer version of GTK! Thankfully, this non-intuitive | 296 // added in a newer version of GTK! Thankfully, this non-intuitive |
297 // check is actually equivalent and sufficient to work around the | 297 // check is actually equivalent and sufficient to work around the |
298 // error. | 298 // error. |
299 if (!g_thread_supported()) | 299 if (!g_thread_supported()) |
300 g_thread_init(NULL); | 300 g_thread_init(NULL); |
301 // Glib type system initialization. Needed at least for gconf, | 301 // Glib type system initialization. Needed at least for gconf, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 base::win::ScopedCOMInitializer com_initializer; | 432 base::win::ScopedCOMInitializer com_initializer; |
433 #endif // OS_WIN | 433 #endif // OS_WIN |
434 | 434 |
435 base::StatisticsRecorder statistics; | 435 base::StatisticsRecorder statistics; |
436 | 436 |
437 parts->RunMainMessageLoopParts(); | 437 parts->RunMainMessageLoopParts(); |
438 | 438 |
439 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 439 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
440 return parts->result_code(); | 440 return parts->result_code(); |
441 } | 441 } |
OLD | NEW |