Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 16206002: Add more support for FreeBSD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.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/hi_res_timer_manager.h" 10 #include "base/hi_res_timer_manager.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include <commctrl.h> 67 #include <commctrl.h>
68 #include <shellapi.h> 68 #include <shellapi.h>
69 69
70 #include "base/win/text_services_message_filter.h" 70 #include "base/win/text_services_message_filter.h"
71 #include "content/browser/system_message_window_win.h" 71 #include "content/browser/system_message_window_win.h"
72 #include "content/common/sandbox_win.h" 72 #include "content/common/sandbox_win.h"
73 #include "net/base/winsock_init.h" 73 #include "net/base/winsock_init.h"
74 #include "ui/base/l10n/l10n_util_win.h" 74 #include "ui/base/l10n/l10n_util_win.h"
75 #endif 75 #endif
76 76
77 #if defined(OS_LINUX) || defined(OS_OPENBSD) 77 #if defined(OS_LINUX) || defined(OS_BSD)
78 #include <glib-object.h> 78 #include <glib-object.h>
79 #endif 79 #endif
80 80
81 #if defined(OS_LINUX) 81 #if defined(OS_LINUX)
82 #include "content/browser/device_monitor_linux.h" 82 #include "content/browser/device_monitor_linux.h"
83 #elif defined(OS_MACOSX) && !defined(OS_IOS) 83 #elif defined(OS_MACOSX) && !defined(OS_IOS)
84 #include "content/browser/device_monitor_mac.h" 84 #include "content/browser/device_monitor_mac.h"
85 #endif 85 #endif
86 86
87 #if defined(TOOLKIT_GTK) 87 #if defined(TOOLKIT_GTK)
88 #include "ui/gfx/gtk_util.h" 88 #include "ui/gfx/gtk_util.h"
89 #endif 89 #endif
90 90
91 #if defined(OS_POSIX) && !defined(OS_MACOSX) 91 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_BSD)
92 #include <sys/stat.h> 92 #include <sys/stat.h>
93 93
94 #include "base/process_util.h" 94 #include "base/process_util.h"
95 #include "content/browser/renderer_host/render_sandbox_host_linux.h" 95 #include "content/browser/renderer_host/render_sandbox_host_linux.h"
96 #include "content/browser/zygote_host/zygote_host_impl_linux.h" 96 #include "content/browser/zygote_host/zygote_host_impl_linux.h"
97 #endif 97 #endif
98 98
99 #if defined(USE_X11) 99 #if defined(USE_X11)
100 #include <X11/Xlib.h> 100 #include <X11/Xlib.h>
101 #endif 101 #endif
102 102
103 // One of the linux specific headers defines this as a macro. 103 // One of the linux specific headers defines this as a macro.
104 #ifdef DestroyAll 104 #ifdef DestroyAll
105 #undef DestroyAll 105 #undef DestroyAll
106 #endif 106 #endif
107 107
108 namespace content { 108 namespace content {
109 namespace { 109 namespace {
110 110
111 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 111 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \
112 !defined(OS_BSD)
Paweł Hajdan Jr. 2013/05/29 21:19:26 Could you explain why? I'd rather get sandbox to w
112 void SetupSandbox(const CommandLine& parsed_command_line) { 113 void SetupSandbox(const CommandLine& parsed_command_line) {
113 // TODO(evanm): move this into SandboxWrapper; I'm just trying to move this 114 // TODO(evanm): move this into SandboxWrapper; I'm just trying to move this
114 // code en masse out of chrome_main for now. 115 // code en masse out of chrome_main for now.
115 const char* sandbox_binary = NULL; 116 const char* sandbox_binary = NULL;
116 struct stat st; 117 struct stat st;
117 118
118 // In Chromium branded builds, developers can set an environment variable to 119 // In Chromium branded builds, developers can set an environment variable to
119 // use the development sandbox. See 120 // use the development sandbox. See
120 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment 121 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment
121 if (stat(base::kProcSelfExe, &st) == 0 && st.st_uid == getuid()) 122 if (stat(base::kProcSelfExe, &st) == 0 && st.st_uid == getuid())
122 sandbox_binary = getenv("CHROME_DEVEL_SANDBOX"); 123 sandbox_binary = getenv("CHROME_DEVEL_SANDBOX");
123 124
124 #if defined(LINUX_SANDBOX_PATH) 125 #if defined(LINUX_SANDBOX_PATH)
125 if (!sandbox_binary) 126 if (!sandbox_binary)
126 sandbox_binary = LINUX_SANDBOX_PATH; 127 sandbox_binary = LINUX_SANDBOX_PATH;
127 #endif 128 #endif
128 129
129 std::string sandbox_cmd; 130 std::string sandbox_cmd;
130 if (sandbox_binary && !parsed_command_line.HasSwitch(switches::kNoSandbox)) 131 if (sandbox_binary && !parsed_command_line.HasSwitch(switches::kNoSandbox))
131 sandbox_cmd = sandbox_binary; 132 sandbox_cmd = sandbox_binary;
132 133
133 // Tickle the sandbox host and zygote host so they fork now. 134 // Tickle the sandbox host and zygote host so they fork now.
134 RenderSandboxHostLinux::GetInstance()->Init(sandbox_cmd); 135 RenderSandboxHostLinux::GetInstance()->Init(sandbox_cmd);
135 ZygoteHostImpl::GetInstance()->Init(sandbox_cmd); 136 ZygoteHostImpl::GetInstance()->Init(sandbox_cmd);
136 } 137 }
137 #endif 138 #endif
138 139
139 #if defined(OS_LINUX) || defined(OS_OPENBSD) 140 #if defined(OS_LINUX) || defined(OS_BSD)
140 static void GLibLogHandler(const gchar* log_domain, 141 static void GLibLogHandler(const gchar* log_domain,
141 GLogLevelFlags log_level, 142 GLogLevelFlags log_level,
142 const gchar* message, 143 const gchar* message,
143 gpointer userdata) { 144 gpointer userdata) {
144 if (!log_domain) 145 if (!log_domain)
145 log_domain = "<unknown>"; 146 log_domain = "<unknown>";
146 if (!message) 147 if (!message)
147 message = "<no message>"; 148 message = "<no message>";
148 149
149 if (strstr(message, "Loading IM context type") || 150 if (strstr(message, "Loading IM context type") ||
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 320
320 #if defined(OS_WIN) 321 #if defined(OS_WIN)
321 net::EnsureWinsockInit(); 322 net::EnsureWinsockInit();
322 #endif 323 #endif
323 324
324 #if !defined(USE_OPENSSL) 325 #if !defined(USE_OPENSSL)
325 // We want to be sure to init NSPR on the main thread. 326 // We want to be sure to init NSPR on the main thread.
326 crypto::EnsureNSPRInit(); 327 crypto::EnsureNSPRInit();
327 #endif // !defined(USE_OPENSSL) 328 #endif // !defined(USE_OPENSSL)
328 329
329 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 330 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \
331 !defined(OS_BSD)
330 SetupSandbox(parsed_command_line_); 332 SetupSandbox(parsed_command_line_);
331 #endif 333 #endif
332 334
333 if (parsed_command_line_.HasSwitch(switches::kEnableSSLCachedInfo)) 335 if (parsed_command_line_.HasSwitch(switches::kEnableSSLCachedInfo))
334 net::SSLConfigService::EnableCachedInfo(); 336 net::SSLConfigService::EnableCachedInfo();
335 337
336 #if !defined(OS_IOS) 338 #if !defined(OS_IOS)
337 if (parsed_command_line_.HasSwitch(switches::kRendererProcessLimit)) { 339 if (parsed_command_line_.HasSwitch(switches::kRendererProcessLimit)) {
338 std::string limit_string = parsed_command_line_.GetSwitchValueASCII( 340 std::string limit_string = parsed_command_line_.GetSwitchValueASCII(
339 switches::kRendererProcessLimit); 341 switches::kRendererProcessLimit);
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 #endif // !defined(OS_IOS) 815 #endif // !defined(OS_IOS)
814 } 816 }
815 817
816 void BrowserMainLoop::InitializeToolkit() { 818 void BrowserMainLoop::InitializeToolkit() {
817 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit") 819 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit")
818 // TODO(evan): this function is rather subtle, due to the variety 820 // TODO(evan): this function is rather subtle, due to the variety
819 // of intersecting ifdefs we have. To keep it easy to follow, there 821 // of intersecting ifdefs we have. To keep it easy to follow, there
820 // are no #else branches on any #ifs. 822 // are no #else branches on any #ifs.
821 // TODO(stevenjb): Move platform specific code into platform specific Parts 823 // TODO(stevenjb): Move platform specific code into platform specific Parts
822 // (Need to add InitializeToolkit stage to BrowserParts). 824 // (Need to add InitializeToolkit stage to BrowserParts).
823 #if defined(OS_LINUX) || defined(OS_OPENBSD) 825 #if defined(OS_LINUX) || defined(OS_BSD)
824 // g_type_init will be deprecated in 2.36. 2.35 is the development 826 // g_type_init will be deprecated in 2.36. 2.35 is the development
825 // version for 2.36, hence do not call g_type_init starting 2.35. 827 // version for 2.36, hence do not call g_type_init starting 2.35.
826 // http://developer.gnome.org/gobject/unstable/gobject-Type-Information.html#g -type-init 828 // http://developer.gnome.org/gobject/unstable/gobject-Type-Information.html#g -type-init
827 #if !GLIB_CHECK_VERSION(2, 35, 0) 829 #if !GLIB_CHECK_VERSION(2, 35, 0)
828 // Glib type system initialization. Needed at least for gconf, 830 // Glib type system initialization. Needed at least for gconf,
829 // used in net/proxy/proxy_config_service_linux.cc. Most likely 831 // used in net/proxy/proxy_config_service_linux.cc. Most likely
830 // this is superfluous as gtk_init() ought to do this. It's 832 // this is superfluous as gtk_init() ought to do this. It's
831 // definitely harmless, so retained as a reminder of this 833 // definitely harmless, so retained as a reminder of this
832 // requirement for gconf. 834 // requirement for gconf.
833 g_type_init(); 835 g_type_init();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 if (parameters_.ui_task) 870 if (parameters_.ui_task)
869 base::MessageLoopForUI::current()->PostTask(FROM_HERE, 871 base::MessageLoopForUI::current()->PostTask(FROM_HERE,
870 *parameters_.ui_task); 872 *parameters_.ui_task);
871 873
872 base::RunLoop run_loop; 874 base::RunLoop run_loop;
873 run_loop.Run(); 875 run_loop.Run();
874 #endif 876 #endif
875 } 877 }
876 878
877 } // namespace content 879 } // namespace content
OLDNEW
« no previous file with comments | « chrome/renderer/pepper/ppb_pdf_impl.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698