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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 // | 606 // |
607 // This check is done this late so there is already a call to | 607 // This check is done this late so there is already a call to |
608 // base::mac::IsBackgroundOnlyProcess(), so there is no change in | 608 // base::mac::IsBackgroundOnlyProcess(), so there is no change in |
609 // startup/initialization order. | 609 // startup/initialization order. |
610 | 610 |
611 // The helper's Info.plist marks it as a background only app. | 611 // The helper's Info.plist marks it as a background only app. |
612 if (base::mac::IsBackgroundOnlyProcess()) { | 612 if (base::mac::IsBackgroundOnlyProcess()) { |
613 CHECK(command_line.HasSwitch(switches::kProcessType) && | 613 CHECK(command_line.HasSwitch(switches::kProcessType) && |
614 !process_type.empty()) | 614 !process_type.empty()) |
615 << "Helper application requires --type."; | 615 << "Helper application requires --type."; |
616 | |
617 // In addition, some helper flavors only work with certain process types. | |
618 base::FilePath executable; | |
619 if (PathService::Get(base::FILE_EXE, &executable) && | |
620 executable.value().size() >= 3) { | |
621 std::string last_three = | |
622 executable.value().substr(executable.value().size() - 3); | |
623 | |
624 if (last_three == " EH") { | |
625 CHECK(process_type == switches::kPluginProcess || | |
626 process_type == switches::kUtilityProcess) | |
627 << "Executable-heap process requires --type=" | |
628 << switches::kPluginProcess << " or " | |
629 << switches::kUtilityProcess << ", saw " << process_type; | |
630 } else { | |
631 CHECK(process_type != switches::kPluginProcess) | |
632 << "Non-executable-heap PIE process is intolerant of --type=" | |
633 << switches::kPluginProcess; | |
634 } | |
635 } | |
636 } else { | 616 } else { |
637 CHECK(!command_line.HasSwitch(switches::kProcessType) && | 617 CHECK(!command_line.HasSwitch(switches::kProcessType) && |
638 process_type.empty()) | 618 process_type.empty()) |
639 << "Main application forbids --type, saw " << process_type; | 619 << "Main application forbids --type, saw " << process_type; |
640 } | 620 } |
641 } | 621 } |
642 #endif // defined(OS_MACOSX) | 622 #endif // defined(OS_MACOSX) |
643 | 623 |
644 void ChromeMainDelegate::PreSandboxStartup() { | 624 void ChromeMainDelegate::PreSandboxStartup() { |
645 const base::CommandLine& command_line = | 625 const base::CommandLine& command_line = |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 case version_info::Channel::CANARY: | 945 case version_info::Channel::CANARY: |
966 return true; | 946 return true; |
967 case version_info::Channel::DEV: | 947 case version_info::Channel::DEV: |
968 case version_info::Channel::BETA: | 948 case version_info::Channel::BETA: |
969 case version_info::Channel::STABLE: | 949 case version_info::Channel::STABLE: |
970 default: | 950 default: |
971 // Don't enable instrumentation. | 951 // Don't enable instrumentation. |
972 return false; | 952 return false; |
973 } | 953 } |
974 } | 954 } |
OLD | NEW |