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 <set> | 10 #include <set> |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 | 225 |
| 226 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 226 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 227 #include "chrome/browser/first_run/upgrade_util.h" | 227 #include "chrome/browser/first_run/upgrade_util.h" |
| 228 #endif | 228 #endif |
| 229 | 229 |
| 230 #if !defined(DISABLE_NACL) | 230 #if !defined(DISABLE_NACL) |
| 231 #include "chrome/browser/component_updater/pnacl_component_installer.h" | 231 #include "chrome/browser/component_updater/pnacl_component_installer.h" |
| 232 #include "components/nacl/browser/nacl_process_host.h" | 232 #include "components/nacl/browser/nacl_process_host.h" |
| 233 #endif // !defined(DISABLE_NACL) | 233 #endif // !defined(DISABLE_NACL) |
| 234 | 234 |
| 235 #if BUILDFLAG(ENABLE_BACKGROUND) | |
| 236 #include "chrome/browser/background/background_mode_manager.h" | |
| 237 #endif // BUILDFLAG(ENABLE_BACKGROUND) | |
| 238 | |
| 235 #if defined(ENABLE_EXTENSIONS) | 239 #if defined(ENABLE_EXTENSIONS) |
| 236 #include "chrome/browser/extensions/startup_helper.h" | 240 #include "chrome/browser/extensions/startup_helper.h" |
| 237 #include "extensions/browser/extension_protocols.h" | 241 #include "extensions/browser/extension_protocols.h" |
| 238 #include "extensions/common/features/feature_provider.h" | 242 #include "extensions/common/features/feature_provider.h" |
| 239 #include "extensions/components/javascript_dialog_extensions_client/javascript_d ialog_extension_client_impl.h" | 243 #include "extensions/components/javascript_dialog_extensions_client/javascript_d ialog_extension_client_impl.h" |
| 240 #endif // defined(ENABLE_EXTENSIONS) | 244 #endif // defined(ENABLE_EXTENSIONS) |
| 241 | 245 |
| 242 #if defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) | 246 #if defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) |
| 243 #include "printing/printed_document.h" | 247 #include "printing/printed_document.h" |
| 244 #endif // defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) | 248 #endif // defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) |
| (...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2007 #endif // defined(SYZYASAN) | 2011 #endif // defined(SYZYASAN) |
| 2008 #endif // defined(OS_ANDROID) | 2012 #endif // defined(OS_ANDROID) |
| 2009 } | 2013 } |
| 2010 | 2014 |
| 2011 void ChromeBrowserMainParts::PostDestroyThreads() { | 2015 void ChromeBrowserMainParts::PostDestroyThreads() { |
| 2012 #if defined(OS_ANDROID) | 2016 #if defined(OS_ANDROID) |
| 2013 // On Android, there is no quit/exit. So the browser's main message loop will | 2017 // On Android, there is no quit/exit. So the browser's main message loop will |
| 2014 // not finish. | 2018 // not finish. |
| 2015 NOTREACHED(); | 2019 NOTREACHED(); |
| 2016 #else | 2020 #else |
| 2021 | |
| 2022 bool restart_in_background = false; | |
| 2023 | |
| 2024 #if BUILDFLAG(ENABLE_BACKGROUND) | |
| 2025 restart_in_background = BackgroundModeManager::ShouldRestartInBackground(); | |
|
sky
2016/07/06 16:55:33
Doesn't this only matter if restart_last_session_?
dgn
2016/07/22 15:18:09
Yes, made that explicit here.
| |
| 2026 #endif // BUILDFLAG(ENABLE_BACKGROUND) | |
| 2027 | |
| 2017 browser_process_->PostDestroyThreads(); | 2028 browser_process_->PostDestroyThreads(); |
| 2018 // browser_shutdown takes care of deleting browser_process, so we need to | 2029 // browser_shutdown takes care of deleting browser_process, so we need to |
| 2019 // release it. | 2030 // release it. |
| 2020 ignore_result(browser_process_.release()); | 2031 ignore_result(browser_process_.release()); |
| 2021 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_); | 2032 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_, |
| 2033 restart_in_background); | |
| 2022 master_prefs_.reset(); | 2034 master_prefs_.reset(); |
| 2023 process_singleton_.reset(); | 2035 process_singleton_.reset(); |
| 2024 device_event_log::Shutdown(); | 2036 device_event_log::Shutdown(); |
| 2025 | 2037 |
| 2026 // We need to do this check as late as possible, but due to modularity, this | 2038 // We need to do this check as late as possible, but due to modularity, this |
| 2027 // may be the last point in Chrome. This would be more effective if done at | 2039 // may be the last point in Chrome. This would be more effective if done at |
| 2028 // a higher level on the stack, so that it is impossible for an early return | 2040 // a higher level on the stack, so that it is impossible for an early return |
| 2029 // to bypass this code. Perhaps we need a *final* hook that is called on all | 2041 // to bypass this code. Perhaps we need a *final* hook that is called on all |
| 2030 // paths from content/browser/browser_main. | 2042 // paths from content/browser/browser_main. |
| 2031 CHECK(metrics::MetricsService::UmaMetricsProperlyShutdown()); | 2043 CHECK(metrics::MetricsService::UmaMetricsProperlyShutdown()); |
| 2032 | 2044 |
| 2033 #if defined(OS_CHROMEOS) | 2045 #if defined(OS_CHROMEOS) |
| 2034 chromeos::CrosSettings::Shutdown(); | 2046 chromeos::CrosSettings::Shutdown(); |
| 2035 #endif // defined(OS_CHROMEOS) | 2047 #endif // defined(OS_CHROMEOS) |
| 2036 #endif // defined(OS_ANDROID) | 2048 #endif // defined(OS_ANDROID) |
| 2037 } | 2049 } |
| 2038 | 2050 |
| 2039 // Public members: | 2051 // Public members: |
| 2040 | 2052 |
| 2041 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2053 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2042 chrome_extra_parts_.push_back(parts); | 2054 chrome_extra_parts_.push_back(parts); |
| 2043 } | 2055 } |
| OLD | NEW |