| 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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 #include <algorithm> | 8 #include <algorithm> | 
| 9 #include <map> | 9 #include <map> | 
| 10 #include <utility> | 10 #include <utility> | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 28 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" | 
| 29 #include "build/build_config.h" | 29 #include "build/build_config.h" | 
| 30 #include "chrome/browser/chrome_browser_main.h" | 30 #include "chrome/browser/chrome_browser_main.h" | 
| 31 #include "chrome/browser/chrome_child_process_watcher.h" | 31 #include "chrome/browser/chrome_child_process_watcher.h" | 
| 32 #include "chrome/browser/chrome_content_browser_client.h" | 32 #include "chrome/browser/chrome_content_browser_client.h" | 
| 33 #include "chrome/browser/chrome_device_client.h" | 33 #include "chrome/browser/chrome_device_client.h" | 
| 34 #include "chrome/browser/chrome_notification_types.h" | 34 #include "chrome/browser/chrome_notification_types.h" | 
| 35 #include "chrome/browser/component_updater/chrome_component_updater_configurator
      .h" | 35 #include "chrome/browser/component_updater/chrome_component_updater_configurator
      .h" | 
| 36 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
      " | 36 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
      " | 
| 37 #include "chrome/browser/defaults.h" | 37 #include "chrome/browser/defaults.h" | 
|  | 38 #include "chrome/browser/devtools/devtools_auto_opener.h" | 
| 38 #include "chrome/browser/devtools/remote_debugging_server.h" | 39 #include "chrome/browser/devtools/remote_debugging_server.h" | 
| 39 #include "chrome/browser/download/download_request_limiter.h" | 40 #include "chrome/browser/download/download_request_limiter.h" | 
| 40 #include "chrome/browser/download/download_status_updater.h" | 41 #include "chrome/browser/download/download_status_updater.h" | 
| 41 #include "chrome/browser/gpu/gl_string_manager.h" | 42 #include "chrome/browser/gpu/gl_string_manager.h" | 
| 42 #include "chrome/browser/gpu/gpu_mode_manager.h" | 43 #include "chrome/browser/gpu/gpu_mode_manager.h" | 
| 43 #include "chrome/browser/icon_manager.h" | 44 #include "chrome/browser/icon_manager.h" | 
| 44 #include "chrome/browser/intranet_redirect_detector.h" | 45 #include "chrome/browser/intranet_redirect_detector.h" | 
| 45 #include "chrome/browser/io_thread.h" | 46 #include "chrome/browser/io_thread.h" | 
| 46 #include "chrome/browser/lifetime/application_lifetime.h" | 47 #include "chrome/browser/lifetime/application_lifetime.h" | 
| 47 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 48 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 279   // those things during teardown. | 280   // those things during teardown. | 
| 280   notification_ui_manager_.reset(); | 281   notification_ui_manager_.reset(); | 
| 281 | 282 | 
| 282   // The SupervisedUserWhitelistInstaller observes the ProfileInfoCache, so it | 283   // The SupervisedUserWhitelistInstaller observes the ProfileInfoCache, so it | 
| 283   // needs to be shut down before the ProfileManager. | 284   // needs to be shut down before the ProfileManager. | 
| 284   supervised_user_whitelist_installer_.reset(); | 285   supervised_user_whitelist_installer_.reset(); | 
| 285 | 286 | 
| 286 #if !defined(OS_ANDROID) | 287 #if !defined(OS_ANDROID) | 
| 287   // Debugger must be cleaned up before ProfileManager. | 288   // Debugger must be cleaned up before ProfileManager. | 
| 288   remote_debugging_server_.reset(); | 289   remote_debugging_server_.reset(); | 
|  | 290   devtools_auto_opener_.reset(); | 
| 289 #endif | 291 #endif | 
| 290 | 292 | 
| 291   // Need to clear profiles (download managers) before the io_thread_. | 293   // Need to clear profiles (download managers) before the io_thread_. | 
| 292   { | 294   { | 
| 293     TRACE_EVENT0("shutdown", | 295     TRACE_EVENT0("shutdown", | 
| 294                  "BrowserProcessImpl::StartTearDown:ProfileManager"); | 296                  "BrowserProcessImpl::StartTearDown:ProfileManager"); | 
| 295     // The desktop User Manager needs to be closed before the guest profile | 297     // The desktop User Manager needs to be closed before the guest profile | 
| 296     // can be destroyed. | 298     // can be destroyed. | 
| 297     UserManager::Hide(); | 299     UserManager::Hide(); | 
| 298     profile_manager_.reset(); | 300     profile_manager_.reset(); | 
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 681   DCHECK(CalledOnValidThread()); | 683   DCHECK(CalledOnValidThread()); | 
| 682 #if !defined(OS_ANDROID) | 684 #if !defined(OS_ANDROID) | 
| 683   // StartupBrowserCreator::LaunchBrowser can be run multiple times when browser | 685   // StartupBrowserCreator::LaunchBrowser can be run multiple times when browser | 
| 684   // is started with several profiles or existing browser process is reused. | 686   // is started with several profiles or existing browser process is reused. | 
| 685   if (!remote_debugging_server_.get()) { | 687   if (!remote_debugging_server_.get()) { | 
| 686     remote_debugging_server_.reset(new RemoteDebuggingServer(ip, port)); | 688     remote_debugging_server_.reset(new RemoteDebuggingServer(ip, port)); | 
| 687   } | 689   } | 
| 688 #endif | 690 #endif | 
| 689 } | 691 } | 
| 690 | 692 | 
|  | 693 void BrowserProcessImpl::CreateDevToolsAutoOpener() { | 
|  | 694   DCHECK(CalledOnValidThread()); | 
|  | 695 #if !defined(OS_ANDROID) | 
|  | 696   // StartupBrowserCreator::LaunchBrowser can be run multiple times when browser | 
|  | 697   // is started with several profiles or existing browser process is reused. | 
|  | 698   if (!devtools_auto_opener_.get()) | 
|  | 699     devtools_auto_opener_.reset(new DevToolsAutoOpener()); | 
|  | 700 #endif | 
|  | 701 } | 
|  | 702 | 
| 691 bool BrowserProcessImpl::IsShuttingDown() { | 703 bool BrowserProcessImpl::IsShuttingDown() { | 
| 692   DCHECK(CalledOnValidThread()); | 704   DCHECK(CalledOnValidThread()); | 
| 693   // TODO(crbug.com/560486): Fix the tests that make the check of | 705   // TODO(crbug.com/560486): Fix the tests that make the check of | 
| 694   // |tearing_down_| necessary here. | 706   // |tearing_down_| necessary here. | 
| 695   return (did_start_ && 0 == module_ref_count_) || tearing_down_; | 707   return (did_start_ && 0 == module_ref_count_) || tearing_down_; | 
| 696 } | 708 } | 
| 697 | 709 | 
| 698 printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { | 710 printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { | 
| 699   DCHECK(CalledOnValidThread()); | 711   DCHECK(CalledOnValidThread()); | 
| 700   return print_job_manager_.get(); | 712   return print_job_manager_.get(); | 
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1289 } | 1301 } | 
| 1290 | 1302 | 
| 1291 void BrowserProcessImpl::OnAutoupdateTimer() { | 1303 void BrowserProcessImpl::OnAutoupdateTimer() { | 
| 1292   if (CanAutorestartForUpdate()) { | 1304   if (CanAutorestartForUpdate()) { | 
| 1293     DLOG(WARNING) << "Detected update.  Restarting browser."; | 1305     DLOG(WARNING) << "Detected update.  Restarting browser."; | 
| 1294     RestartBackgroundInstance(); | 1306     RestartBackgroundInstance(); | 
| 1295   } | 1307   } | 
| 1296 } | 1308 } | 
| 1297 | 1309 | 
| 1298 #endif  // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1310 #endif  // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 
| OLD | NEW | 
|---|