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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "base/process_util.h" | 40 #include "base/process_util.h" |
41 #include "base/scoped_nsautorelease_pool.h" | 41 #include "base/scoped_nsautorelease_pool.h" |
42 #include "base/stats_counters.h" | 42 #include "base/stats_counters.h" |
43 #include "base/stats_table.h" | 43 #include "base/stats_table.h" |
44 #include "base/string_util.h" | 44 #include "base/string_util.h" |
45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
46 #include "base/win_util.h" | 46 #include "base/win_util.h" |
47 #endif | 47 #endif |
48 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
49 #include "chrome/app/breakpad_mac.h" | 49 #include "chrome/app/breakpad_mac.h" |
| 50 #elif defined(OS_LINUX) |
| 51 #include "chrome/app/breakpad_linux.h" |
50 #endif | 52 #endif |
51 #include "chrome/app/scoped_ole_initializer.h" | 53 #include "chrome/app/scoped_ole_initializer.h" |
52 #include "chrome/browser/renderer_host/render_process_host.h" | 54 #include "chrome/browser/renderer_host/render_process_host.h" |
53 #include "chrome/common/chrome_constants.h" | 55 #include "chrome/common/chrome_constants.h" |
54 #include "chrome/common/chrome_counters.h" | 56 #include "chrome/common/chrome_counters.h" |
55 #include "chrome/common/chrome_paths.h" | 57 #include "chrome/common/chrome_paths.h" |
56 #include "chrome/common/chrome_switches.h" | 58 #include "chrome/common/chrome_switches.h" |
57 #include "chrome/common/logging_chrome.h" | 59 #include "chrome/common/logging_chrome.h" |
58 #include "chrome/common/main_function_params.h" | 60 #include "chrome/common/main_function_params.h" |
59 #include "chrome/common/sandbox_init_wrapper.h" | 61 #include "chrome/common/sandbox_init_wrapper.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 #endif | 297 #endif |
296 | 298 |
297 #if defined(OS_MACOSX) | 299 #if defined(OS_MACOSX) |
298 // Needs to be called after CommandLine::Init(). | 300 // Needs to be called after CommandLine::Init(). |
299 InitCrashProcessInfo(); | 301 InitCrashProcessInfo(); |
300 #endif | 302 #endif |
301 | 303 |
302 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 304 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
303 | 305 |
304 #if defined(OS_WIN) | 306 #if defined(OS_WIN) |
305 // Must do this before any other usage of command line! | 307 // Must do this before any other usage of command line! |
306 if (HasDeprecatedArguments(parsed_command_line.command_line_string())) | 308 if (HasDeprecatedArguments(parsed_command_line.command_line_string())) |
307 return 1; | 309 return 1; |
308 #endif | 310 #endif |
309 | 311 |
310 int browser_pid; | 312 int browser_pid; |
311 std::wstring process_type = | 313 std::wstring process_type = |
312 parsed_command_line.GetSwitchValue(switches::kProcessType); | 314 parsed_command_line.GetSwitchValue(switches::kProcessType); |
313 if (process_type.empty()) { | 315 if (process_type.empty()) { |
314 browser_pid = base::GetCurrentProcId(); | 316 browser_pid = base::GetCurrentProcId(); |
315 #if defined(OS_POSIX) | 317 #if defined(OS_POSIX) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 #if defined(OS_WIN) | 387 #if defined(OS_WIN) |
386 _Module.Init(NULL, instance); | 388 _Module.Init(NULL, instance); |
387 #endif | 389 #endif |
388 | 390 |
389 // Notice a user data directory override if any | 391 // Notice a user data directory override if any |
390 const std::wstring user_data_dir = | 392 const std::wstring user_data_dir = |
391 parsed_command_line.GetSwitchValue(switches::kUserDataDir); | 393 parsed_command_line.GetSwitchValue(switches::kUserDataDir); |
392 if (!user_data_dir.empty()) | 394 if (!user_data_dir.empty()) |
393 CHECK(PathService::Override(chrome::DIR_USER_DATA, user_data_dir)); | 395 CHECK(PathService::Override(chrome::DIR_USER_DATA, user_data_dir)); |
394 | 396 |
| 397 #if defined(OS_LINUX) |
| 398 // Needs to be called after we have chrome::DIR_USER_DATA. |
| 399 InitCrashReporter(); |
| 400 #endif |
| 401 |
395 #if defined(OS_POSIX) | 402 #if defined(OS_POSIX) |
396 // Bug 11776: we mistakenly created directories world-readable. | 403 // Bug 11776: we mistakenly created directories world-readable. |
397 // Fix old instances of these directories manually. | 404 // Fix old instances of these directories manually. |
398 // TODO(evanm): remove this code in a month or two. | 405 // TODO(evanm): remove this code in a month or two. |
399 if (user_data_dir.empty()) { | 406 if (user_data_dir.empty()) { |
400 FilePath fix_dir; | 407 FilePath fix_dir; |
401 CHECK(PathService::Get(chrome::DIR_USER_DATA, &fix_dir)); | 408 CHECK(PathService::Get(chrome::DIR_USER_DATA, &fix_dir)); |
402 struct stat statbuf; | 409 struct stat statbuf; |
403 CHECK(stat(fix_dir.value().c_str(), &statbuf) == 0); | 410 CHECK(stat(fix_dir.value().c_str(), &statbuf) == 0); |
404 if ((statbuf.st_mode & 0077) != 0) | 411 if ((statbuf.st_mode & 0077) != 0) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 _CrtDumpMemoryLeaks(); | 502 _CrtDumpMemoryLeaks(); |
496 #endif // _CRTDBG_MAP_ALLOC | 503 #endif // _CRTDBG_MAP_ALLOC |
497 | 504 |
498 _Module.Term(); | 505 _Module.Term(); |
499 #endif | 506 #endif |
500 | 507 |
501 logging::CleanupChromeLogging(); | 508 logging::CleanupChromeLogging(); |
502 | 509 |
503 return rv; | 510 return rv; |
504 } | 511 } |
OLD | NEW |