Chromium Code Reviews| 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/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1639 if (extension_startup_helper.PackExtension(parsed_command_line())) | 1639 if (extension_startup_helper.PackExtension(parsed_command_line())) |
| 1640 return content::RESULT_CODE_NORMAL_EXIT; | 1640 return content::RESULT_CODE_NORMAL_EXIT; |
| 1641 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; | 1641 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; |
| 1642 } | 1642 } |
| 1643 | 1643 |
| 1644 // When another process is running, use that process instead of starting a | 1644 // When another process is running, use that process instead of starting a |
| 1645 // new one. NotifyOtherProcess will currently give the other process up to | 1645 // new one. NotifyOtherProcess will currently give the other process up to |
| 1646 // 20 seconds to respond. Note that this needs to be done before we attempt | 1646 // 20 seconds to respond. Note that this needs to be done before we attempt |
| 1647 // to read the profile. | 1647 // to read the profile. |
| 1648 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate(); | 1648 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate(); |
| 1649 UMA_HISTOGRAM_ENUMERATION("Chrome.ProcessSingleton.NotifyResult", | |
| 1650 notify_result_, | |
| 1651 ProcessSingleton::NUM_NOTIFY_RESULTS); | |
| 1649 switch (notify_result_) { | 1652 switch (notify_result_) { |
| 1650 case ProcessSingleton::PROCESS_NONE: | 1653 case ProcessSingleton::PROCESS_NONE: |
| 1651 // No process already running, fall through to starting a new one. | 1654 // No process already running, fall through to starting a new one. |
| 1652 g_browser_process->platform_part()->PlatformSpecificCommandLineProcessing( | 1655 g_browser_process->platform_part()->PlatformSpecificCommandLineProcessing( |
| 1653 *base::CommandLine::ForCurrentProcess()); | 1656 *base::CommandLine::ForCurrentProcess()); |
| 1654 break; | 1657 break; |
| 1655 | 1658 |
| 1656 case ProcessSingleton::PROCESS_NOTIFIED: | 1659 case ProcessSingleton::PROCESS_NOTIFIED: |
| 1657 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 1660 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 1658 // On POSIX systems, print a message notifying the process is running. | 1661 // On POSIX systems, print a message notifying the process is running. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1672 return chrome::RESULT_CODE_PROFILE_IN_USE; | 1675 return chrome::RESULT_CODE_PROFILE_IN_USE; |
| 1673 | 1676 |
| 1674 case ProcessSingleton::LOCK_ERROR: | 1677 case ProcessSingleton::LOCK_ERROR: |
| 1675 LOG(ERROR) << "Failed to create a ProcessSingleton for your profile " | 1678 LOG(ERROR) << "Failed to create a ProcessSingleton for your profile " |
| 1676 "directory. This means that running multiple instances " | 1679 "directory. This means that running multiple instances " |
| 1677 "would start multiple browser processes rather than " | 1680 "would start multiple browser processes rather than " |
| 1678 "opening a new window in the existing process. Aborting " | 1681 "opening a new window in the existing process. Aborting " |
| 1679 "now to avoid profile corruption."; | 1682 "now to avoid profile corruption."; |
| 1680 return chrome::RESULT_CODE_PROFILE_IN_USE; | 1683 return chrome::RESULT_CODE_PROFILE_IN_USE; |
| 1681 | 1684 |
| 1682 default: | 1685 case ProcessSingleton::NUM_NOTIFY_RESULTS: |
|
bcwhite
2016/10/07 16:17:44
Why this change?
gab
2016/10/07 16:34:14
Because it's better to enumerate all cases than to
bcwhite
2016/10/07 16:59:45
Acknowledged.
| |
| 1683 NOTREACHED(); | 1686 NOTREACHED(); |
| 1687 break; | |
| 1684 } | 1688 } |
| 1685 #endif // !defined(OS_ANDROID) | 1689 #endif // !defined(OS_ANDROID) |
| 1686 | 1690 |
| 1687 // Handle special early return paths (which couldn't be processed even earlier | 1691 // Handle special early return paths (which couldn't be processed even earlier |
| 1688 // as they require the process singleton to be held) first. | 1692 // as they require the process singleton to be held) first. |
| 1689 | 1693 |
| 1690 std::string try_chrome = | 1694 std::string try_chrome = |
| 1691 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); | 1695 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); |
| 1692 if (!try_chrome.empty()) { | 1696 if (!try_chrome.empty()) { |
| 1693 #if defined(OS_WIN) | 1697 #if defined(OS_WIN) |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2225 chromeos::CrosSettings::Shutdown(); | 2229 chromeos::CrosSettings::Shutdown(); |
| 2226 #endif // defined(OS_CHROMEOS) | 2230 #endif // defined(OS_CHROMEOS) |
| 2227 #endif // defined(OS_ANDROID) | 2231 #endif // defined(OS_ANDROID) |
| 2228 } | 2232 } |
| 2229 | 2233 |
| 2230 // Public members: | 2234 // Public members: |
| 2231 | 2235 |
| 2232 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2236 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2233 chrome_extra_parts_.push_back(parts); | 2237 chrome_extra_parts_.push_back(parts); |
| 2234 } | 2238 } |
| OLD | NEW |