| OLD | NEW |
| 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 "chrome/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "components/startup_metric_utils/startup_metric_utils.h" | 39 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 40 #include "content/public/common/content_client.h" | 40 #include "content/public/common/content_client.h" |
| 41 #include "content/public/common/content_paths.h" | 41 #include "content/public/common/content_paths.h" |
| 42 #include "extensions/common/constants.h" | 42 #include "extensions/common/constants.h" |
| 43 #include "ui/base/ui_base_switches.h" | 43 #include "ui/base/ui_base_switches.h" |
| 44 | 44 |
| 45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
| 46 #include <atlbase.h> | 46 #include <atlbase.h> |
| 47 #include <malloc.h> | 47 #include <malloc.h> |
| 48 #include <algorithm> | 48 #include <algorithm> |
| 49 #include "chrome/app/close_handle_hook_win.h" |
| 49 #include "chrome/common/child_process_logging.h" | 50 #include "chrome/common/child_process_logging.h" |
| 50 #include "chrome/common/terminate_on_heap_corruption_experiment_win.h" | 51 #include "chrome/common/terminate_on_heap_corruption_experiment_win.h" |
| 51 #include "sandbox/win/src/sandbox.h" | 52 #include "sandbox/win/src/sandbox.h" |
| 52 #include "ui/base/resource/resource_bundle_win.h" | 53 #include "ui/base/resource/resource_bundle_win.h" |
| 53 #endif | 54 #endif |
| 54 | 55 |
| 55 #if defined(OS_MACOSX) | 56 #if defined(OS_MACOSX) |
| 56 #include "base/mac/mac_util.h" | 57 #include "base/mac/mac_util.h" |
| 57 #include "base/mac/os_crash_dumps.h" | 58 #include "base/mac/os_crash_dumps.h" |
| 58 #include "chrome/app/chrome_main_mac.h" | 59 #include "chrome/app/chrome_main_mac.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 HandleHelpSwitches(command_line); | 412 HandleHelpSwitches(command_line); |
| 412 #endif | 413 #endif |
| 413 #endif // OS_POSIX | 414 #endif // OS_POSIX |
| 414 | 415 |
| 415 #if defined(OS_WIN) | 416 #if defined(OS_WIN) |
| 416 // Must do this before any other usage of command line! | 417 // Must do this before any other usage of command line! |
| 417 if (HasDeprecatedArguments(command_line.GetCommandLineString())) { | 418 if (HasDeprecatedArguments(command_line.GetCommandLineString())) { |
| 418 *exit_code = 1; | 419 *exit_code = 1; |
| 419 return true; | 420 return true; |
| 420 } | 421 } |
| 422 |
| 423 InstallCloseHandleHooks(); |
| 421 #endif | 424 #endif |
| 422 | 425 |
| 423 chrome::RegisterPathProvider(); | 426 chrome::RegisterPathProvider(); |
| 424 #if defined(OS_CHROMEOS) | 427 #if defined(OS_CHROMEOS) |
| 425 chromeos::RegisterPathProvider(); | 428 chromeos::RegisterPathProvider(); |
| 426 #endif | 429 #endif |
| 427 #if !defined(DISABLE_NACL) && defined(OS_LINUX) | 430 #if !defined(DISABLE_NACL) && defined(OS_LINUX) |
| 428 nacl::RegisterPathProvider(); | 431 nacl::RegisterPathProvider(); |
| 429 #endif | 432 #endif |
| 430 | 433 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 | 835 |
| 833 void ChromeMainDelegate::ProcessExiting(const std::string& process_type) { | 836 void ChromeMainDelegate::ProcessExiting(const std::string& process_type) { |
| 834 if (SubprocessNeedsResourceBundle(process_type)) | 837 if (SubprocessNeedsResourceBundle(process_type)) |
| 835 ResourceBundle::CleanupSharedInstance(); | 838 ResourceBundle::CleanupSharedInstance(); |
| 836 #if !defined(OS_ANDROID) | 839 #if !defined(OS_ANDROID) |
| 837 logging::CleanupChromeLogging(); | 840 logging::CleanupChromeLogging(); |
| 838 #else | 841 #else |
| 839 // Android doesn't use InitChromeLogging, so we close the log file manually. | 842 // Android doesn't use InitChromeLogging, so we close the log file manually. |
| 840 logging::CloseLogFile(); | 843 logging::CloseLogFile(); |
| 841 #endif // !defined(OS_ANDROID) | 844 #endif // !defined(OS_ANDROID) |
| 845 |
| 846 #if defined(OS_WIN) |
| 847 RemoveCloseHandleHooks(); |
| 848 #endif |
| 842 } | 849 } |
| 843 | 850 |
| 844 #if defined(OS_MACOSX) | 851 #if defined(OS_MACOSX) |
| 845 bool ChromeMainDelegate::ProcessRegistersWithSystemProcess( | 852 bool ChromeMainDelegate::ProcessRegistersWithSystemProcess( |
| 846 const std::string& process_type) { | 853 const std::string& process_type) { |
| 847 #if defined(DISABLE_NACL) | 854 #if defined(DISABLE_NACL) |
| 848 return false; | 855 return false; |
| 849 #else | 856 #else |
| 850 return process_type == switches::kNaClLoaderProcess; | 857 return process_type == switches::kNaClLoaderProcess; |
| 851 #endif | 858 #endif |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 } | 934 } |
| 928 | 935 |
| 929 content::ContentUtilityClient* | 936 content::ContentUtilityClient* |
| 930 ChromeMainDelegate::CreateContentUtilityClient() { | 937 ChromeMainDelegate::CreateContentUtilityClient() { |
| 931 #if defined(CHROME_MULTIPLE_DLL_BROWSER) | 938 #if defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 932 return NULL; | 939 return NULL; |
| 933 #else | 940 #else |
| 934 return g_chrome_content_utility_client.Pointer(); | 941 return g_chrome_content_utility_client.Pointer(); |
| 935 #endif | 942 #endif |
| 936 } | 943 } |
| OLD | NEW |