| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "content/public/common/content_paths.h" | 48 #include "content/public/common/content_paths.h" |
| 49 #include "content/public/common/content_switches.h" | 49 #include "content/public/common/content_switches.h" |
| 50 #include "extensions/common/constants.h" | 50 #include "extensions/common/constants.h" |
| 51 #include "ui/base/resource/resource_bundle.h" | 51 #include "ui/base/resource/resource_bundle.h" |
| 52 #include "ui/base/ui_base_switches.h" | 52 #include "ui/base/ui_base_switches.h" |
| 53 | 53 |
| 54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
| 55 #include <atlbase.h> | 55 #include <atlbase.h> |
| 56 #include <malloc.h> | 56 #include <malloc.h> |
| 57 #include <algorithm> | 57 #include <algorithm> |
| 58 #include "base/debug/close_handle_hook_win.h" | 58 #include "chrome/app/close_handle_hook_win.h" |
| 59 #include "chrome/common/child_process_logging.h" | 59 #include "chrome/common/child_process_logging.h" |
| 60 #include "chrome/common/v8_breakpad_support_win.h" | 60 #include "chrome/common/v8_breakpad_support_win.h" |
| 61 #include "components/crash/content/app/crashpad.h" | 61 #include "components/crash/content/app/crashpad.h" |
| 62 #include "sandbox/win/src/sandbox.h" | 62 #include "sandbox/win/src/sandbox.h" |
| 63 #include "ui/base/resource/resource_bundle_win.h" | 63 #include "ui/base/resource/resource_bundle_win.h" |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 #if defined(OS_MACOSX) | 66 #if defined(OS_MACOSX) |
| 67 #include "base/mac/foundation_util.h" | 67 #include "base/mac/foundation_util.h" |
| 68 #include "chrome/app/chrome_main_mac.h" | 68 #include "chrome/app/chrome_main_mac.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 #endif | 492 #endif |
| 493 #endif // OS_POSIX | 493 #endif // OS_POSIX |
| 494 | 494 |
| 495 #if defined(OS_WIN) | 495 #if defined(OS_WIN) |
| 496 // Must do this before any other usage of command line! | 496 // Must do this before any other usage of command line! |
| 497 if (HasDeprecatedArguments(command_line.GetCommandLineString())) { | 497 if (HasDeprecatedArguments(command_line.GetCommandLineString())) { |
| 498 *exit_code = 1; | 498 *exit_code = 1; |
| 499 return true; | 499 return true; |
| 500 } | 500 } |
| 501 | 501 |
| 502 // Handle verifier is enabled on 32-bit only, and only in Debug builds or | 502 InstallHandleHooks(); |
| 503 // Release builds running on Dev or Canary channels. | 503 #endif |
| 504 bool handle_verifier_enabled = false; | |
| 505 #if !defined(ARCH_CPU_X86_64) | |
| 506 #if defined(NDEBUG) | |
| 507 version_info::Channel channel = chrome::GetChannel(); | |
| 508 if (channel == version_info::Channel::CANARY || | |
| 509 channel == version_info::Channel::DEV) { | |
| 510 handle_verifier_enabled = true; | |
| 511 } | |
| 512 #else | |
| 513 // Always enabled in Debug. | |
| 514 handle_verifier_enabled = true; | |
| 515 #endif // NDEBUG | |
| 516 #endif // ARCH_CPU_X86_64 | |
| 517 | |
| 518 if (!handle_verifier_enabled || !base::debug::InstallHandleHooks()) | |
| 519 base::win::DisableHandleVerifier(); | |
| 520 #endif // OS_WIN | |
| 521 | 504 |
| 522 chrome::RegisterPathProvider(); | 505 chrome::RegisterPathProvider(); |
| 523 #if defined(OS_CHROMEOS) | 506 #if defined(OS_CHROMEOS) |
| 524 chromeos::RegisterPathProvider(); | 507 chromeos::RegisterPathProvider(); |
| 525 #endif | 508 #endif |
| 526 #if !defined(DISABLE_NACL) && defined(OS_LINUX) | 509 #if !defined(DISABLE_NACL) && defined(OS_LINUX) |
| 527 nacl::RegisterPathProvider(); | 510 nacl::RegisterPathProvider(); |
| 528 #endif | 511 #endif |
| 529 | 512 |
| 530 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( | 513 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 if (SubprocessNeedsResourceBundle(process_type)) | 882 if (SubprocessNeedsResourceBundle(process_type)) |
| 900 ResourceBundle::CleanupSharedInstance(); | 883 ResourceBundle::CleanupSharedInstance(); |
| 901 #if !defined(OS_ANDROID) | 884 #if !defined(OS_ANDROID) |
| 902 logging::CleanupChromeLogging(); | 885 logging::CleanupChromeLogging(); |
| 903 #else | 886 #else |
| 904 // Android doesn't use InitChromeLogging, so we close the log file manually. | 887 // Android doesn't use InitChromeLogging, so we close the log file manually. |
| 905 logging::CloseLogFile(); | 888 logging::CloseLogFile(); |
| 906 #endif // !defined(OS_ANDROID) | 889 #endif // !defined(OS_ANDROID) |
| 907 | 890 |
| 908 #if defined(OS_WIN) | 891 #if defined(OS_WIN) |
| 909 base::debug::RemoveHandleHooks(); | 892 RemoveHandleHooks(); |
| 910 #endif | 893 #endif |
| 911 } | 894 } |
| 912 | 895 |
| 913 #if defined(OS_MACOSX) | 896 #if defined(OS_MACOSX) |
| 914 bool ChromeMainDelegate::ProcessRegistersWithSystemProcess( | 897 bool ChromeMainDelegate::ProcessRegistersWithSystemProcess( |
| 915 const std::string& process_type) { | 898 const std::string& process_type) { |
| 916 #if defined(DISABLE_NACL) | 899 #if defined(DISABLE_NACL) |
| 917 return false; | 900 return false; |
| 918 #else | 901 #else |
| 919 return process_type == switches::kNaClLoaderProcess; | 902 return process_type == switches::kNaClLoaderProcess; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 case version_info::Channel::CANARY: | 988 case version_info::Channel::CANARY: |
| 1006 return true; | 989 return true; |
| 1007 case version_info::Channel::DEV: | 990 case version_info::Channel::DEV: |
| 1008 case version_info::Channel::BETA: | 991 case version_info::Channel::BETA: |
| 1009 case version_info::Channel::STABLE: | 992 case version_info::Channel::STABLE: |
| 1010 default: | 993 default: |
| 1011 // Don't enable instrumentation. | 994 // Don't enable instrumentation. |
| 1012 return false; | 995 return false; |
| 1013 } | 996 } |
| 1014 } | 997 } |
| OLD | NEW |