Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 | 57 |
| 58 #if defined(OS_POSIX) | 58 #if defined(OS_POSIX) |
| 59 // TODO(port): get rid of this include. It's used just to provide declarations | 59 // TODO(port): get rid of this include. It's used just to provide declarations |
| 60 // and stub definitions for classes we encouter during the porting effort. | 60 // and stub definitions for classes we encouter during the porting effort. |
| 61 #include "chrome/common/temp_scaffolding_stubs.h" | 61 #include "chrome/common/temp_scaffolding_stubs.h" |
| 62 #include <signal.h> | 62 #include <signal.h> |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 #if defined(OS_LINUX) | 65 #if defined(OS_LINUX) |
| 66 #include "chrome/app/breakpad_linux.h" | 66 #include "chrome/app/breakpad_linux.h" |
| 67 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h" | |
| 67 #endif | 68 #endif |
| 68 | 69 |
| 69 // TODO(port): several win-only methods have been pulled out of this, but | 70 // TODO(port): several win-only methods have been pulled out of this, but |
| 70 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 71 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
| 71 // other platforms. For now, it's just a stub. This is a serious work in | 72 // other platforms. For now, it's just a stub. This is a serious work in |
| 72 // progress and should not be taken as an indication of a real refactoring. | 73 // progress and should not be taken as an indication of a real refactoring. |
| 73 | 74 |
| 74 #if defined(OS_WIN) | 75 #if defined(OS_WIN) |
| 75 | 76 |
| 76 #include <windows.h> | 77 #include <windows.h> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 } | 212 } |
| 212 #else | 213 #else |
| 213 // TODO(cpu): implement first run experience for other platforms. | 214 // TODO(cpu): implement first run experience for other platforms. |
| 214 void AddFirstRunNewTabs(BrowserInit* browser_init, | 215 void AddFirstRunNewTabs(BrowserInit* browser_init, |
| 215 const std::vector<std::wstring>& new_tabs) { | 216 const std::vector<std::wstring>& new_tabs) { |
| 216 } | 217 } |
| 217 #endif | 218 #endif |
| 218 | 219 |
| 219 } // namespace | 220 } // namespace |
| 220 | 221 |
| 222 extern void SkiaFontConfigUseDirectImplementation(); | |
| 223 | |
| 221 // Main routine for running as the Browser process. | 224 // Main routine for running as the Browser process. |
| 222 int BrowserMain(const MainFunctionParams& parameters) { | 225 int BrowserMain(const MainFunctionParams& parameters) { |
| 223 const CommandLine& parsed_command_line = parameters.command_line_; | 226 const CommandLine& parsed_command_line = parameters.command_line_; |
| 224 base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; | 227 base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; |
| 225 | 228 |
| 226 // WARNING: If we get a WM_ENDSESSION objects created on the stack here | 229 // WARNING: If we get a WM_ENDSESSION objects created on the stack here |
| 227 // are NOT deleted. If you need something to run during WM_ENDSESSION add it | 230 // are NOT deleted. If you need something to run during WM_ENDSESSION add it |
| 228 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. | 231 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. |
| 229 | 232 |
| 230 // TODO(beng, brettw): someday, break this out into sub functions with well | 233 // TODO(beng, brettw): someday, break this out into sub functions with well |
| 231 // defined roles (e.g. pre/post-profile startup, etc). | 234 // defined roles (e.g. pre/post-profile startup, etc). |
| 232 | 235 |
| 233 #ifdef TRACK_ALL_TASK_OBJECTS | 236 #ifdef TRACK_ALL_TASK_OBJECTS |
| 234 // Start tracking the creation and deletion of Task instance. | 237 // Start tracking the creation and deletion of Task instance. |
| 235 // This construction MUST be done before main_message_loop, so that it is | 238 // This construction MUST be done before main_message_loop, so that it is |
| 236 // destroyed after the main_message_loop. | 239 // destroyed after the main_message_loop. |
| 237 tracked_objects::AutoTracking tracking_objects; | 240 tracked_objects::AutoTracking tracking_objects; |
| 238 #endif | 241 #endif |
| 239 | 242 |
| 240 #if defined(OS_POSIX) | 243 #if defined(OS_POSIX) |
| 241 // We need to accept SIGCHLD, even though our handler is a no-op because | 244 // We need to accept SIGCHLD, even though our handler is a no-op because |
| 242 // otherwise we cannot wait on children. (According to POSIX 2001.) | 245 // otherwise we cannot wait on children. (According to POSIX 2001.) |
| 243 struct sigaction action; | 246 struct sigaction action; |
| 244 memset(&action, 0, sizeof(action)); | 247 memset(&action, 0, sizeof(action)); |
| 245 action.sa_handler = SIGCHLDHandler; | 248 action.sa_handler = SIGCHLDHandler; |
| 246 CHECK(sigaction(SIGCHLD, &action, NULL) == 0); | 249 CHECK(sigaction(SIGCHLD, &action, NULL) == 0); |
| 247 #endif | 250 #endif |
| 248 | 251 |
| 252 #if defined(OS_LINUX) | |
| 253 EnableCrashDumping(); | |
|
Evan Martin
2009/05/29 22:23:03
I think this needs to be conditional on the opt-in
| |
| 254 | |
|
agl
2009/05/29 22:26:59
Thanks. That was an artifact of merging. There sho
| |
| 255 if (parsed_command_line.HasSwitch(switches::kLinuxSandbox)) { | |
| 256 // Construct the sandbox host on the UI thread. | |
| 257 Singleton<RenderSandboxHostLinux>::get(); | |
| 258 } | |
| 259 // Configure Skia in this process to use fontconfig directly. | |
| 260 SkiaFontConfigUseDirectImplementation(); | |
| 261 #endif | |
| 262 | |
| 249 // Do platform-specific things (such as finishing initializing Cocoa) | 263 // Do platform-specific things (such as finishing initializing Cocoa) |
| 250 // prior to instantiating the message loop. This could be turned into a | 264 // prior to instantiating the message loop. This could be turned into a |
| 251 // broadcast notification. | 265 // broadcast notification. |
| 252 Platform::WillInitializeMainMessageLoop(parsed_command_line); | 266 Platform::WillInitializeMainMessageLoop(parsed_command_line); |
| 253 | 267 |
| 254 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 268 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
| 255 | 269 |
| 256 // Initialize the SystemMonitor | 270 // Initialize the SystemMonitor |
| 257 base::SystemMonitor::Start(); | 271 base::SystemMonitor::Start(); |
| 258 #if defined(OS_WIN) | 272 #if defined(OS_WIN) |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 737 if (metrics) | 751 if (metrics) |
| 738 metrics->Stop(); | 752 metrics->Stop(); |
| 739 | 753 |
| 740 // browser_shutdown takes care of deleting browser_process, so we need to | 754 // browser_shutdown takes care of deleting browser_process, so we need to |
| 741 // release it. | 755 // release it. |
| 742 browser_process.release(); | 756 browser_process.release(); |
| 743 browser_shutdown::Shutdown(); | 757 browser_shutdown::Shutdown(); |
| 744 | 758 |
| 745 return result_code; | 759 return result_code; |
| 746 } | 760 } |
| OLD | NEW |