| 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 <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 print_job_manager_->OnQuit(); | 153 print_job_manager_->OnQuit(); |
| 154 print_job_manager_.reset(); | 154 print_job_manager_.reset(); |
| 155 #endif | 155 #endif |
| 156 | 156 |
| 157 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); | 157 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); |
| 158 | 158 |
| 159 g_browser_process = NULL; | 159 g_browser_process = NULL; |
| 160 } | 160 } |
| 161 | 161 |
| 162 void BrowserProcessImpl::StartTearDown() { | 162 void BrowserProcessImpl::StartTearDown() { |
| 163 #if defined(ENABLE_AUTOMATION) |
| 163 // Delete the AutomationProviderList before NotificationService, | 164 // Delete the AutomationProviderList before NotificationService, |
| 164 // since it may try to unregister notifications | 165 // since it may try to unregister notifications |
| 165 // Both NotificationService and AutomationProvider are singleton instances in | 166 // Both NotificationService and AutomationProvider are singleton instances in |
| 166 // the BrowserProcess. Since AutomationProvider may have some active | 167 // the BrowserProcess. Since AutomationProvider may have some active |
| 167 // notification observers, it is essential that it gets destroyed before the | 168 // notification observers, it is essential that it gets destroyed before the |
| 168 // NotificationService. NotificationService won't be destroyed until after | 169 // NotificationService. NotificationService won't be destroyed until after |
| 169 // this destructor is run. | 170 // this destructor is run. |
| 170 automation_provider_list_.reset(); | 171 automation_provider_list_.reset(); |
| 172 #endif |
| 171 | 173 |
| 172 // We need to shutdown the SdchDictionaryFetcher as it regularly holds | 174 // We need to shutdown the SdchDictionaryFetcher as it regularly holds |
| 173 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do | 175 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do |
| 174 // a PostDelayedTask onto the IO thread. This shutdown call will both discard | 176 // a PostDelayedTask onto the IO thread. This shutdown call will both discard |
| 175 // any pending URLFetchers, and avoid creating any more. | 177 // any pending URLFetchers, and avoid creating any more. |
| 176 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 178 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 177 base::Bind(&SdchDictionaryFetcher::Shutdown)); | 179 base::Bind(&SdchDictionaryFetcher::Shutdown)); |
| 178 | 180 |
| 179 // We need to destroy the MetricsService, GoogleURLTracker, | 181 // We need to destroy the MetricsService, GoogleURLTracker, |
| 180 // IntranetRedirectDetector, and SafeBrowsing ClientSideDetectionService | 182 // IntranetRedirectDetector, and SafeBrowsing ClientSideDetectionService |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 CreateIconManager(); | 430 CreateIconManager(); |
| 429 return icon_manager_.get(); | 431 return icon_manager_.get(); |
| 430 } | 432 } |
| 431 | 433 |
| 432 ThumbnailGenerator* BrowserProcessImpl::GetThumbnailGenerator() { | 434 ThumbnailGenerator* BrowserProcessImpl::GetThumbnailGenerator() { |
| 433 return thumbnail_generator_.get(); | 435 return thumbnail_generator_.get(); |
| 434 } | 436 } |
| 435 | 437 |
| 436 AutomationProviderList* BrowserProcessImpl::GetAutomationProviderList() { | 438 AutomationProviderList* BrowserProcessImpl::GetAutomationProviderList() { |
| 437 DCHECK(CalledOnValidThread()); | 439 DCHECK(CalledOnValidThread()); |
| 440 #if defined(ENABLE_AUTOMATION) |
| 438 if (automation_provider_list_.get() == NULL) | 441 if (automation_provider_list_.get() == NULL) |
| 439 automation_provider_list_.reset(new AutomationProviderList()); | 442 automation_provider_list_.reset(new AutomationProviderList()); |
| 440 return automation_provider_list_.get(); | 443 return automation_provider_list_.get(); |
| 444 #else |
| 445 return NULL; |
| 446 #endif |
| 441 } | 447 } |
| 442 | 448 |
| 443 void BrowserProcessImpl::InitDevToolsHttpProtocolHandler( | 449 void BrowserProcessImpl::InitDevToolsHttpProtocolHandler( |
| 444 Profile* profile, | 450 Profile* profile, |
| 445 const std::string& ip, | 451 const std::string& ip, |
| 446 int port, | 452 int port, |
| 447 const std::string& frontend_url) { | 453 const std::string& frontend_url) { |
| 448 DCHECK(CalledOnValidThread()); | 454 DCHECK(CalledOnValidThread()); |
| 449 remote_debugging_server_.reset( | 455 remote_debugging_server_.reset( |
| 450 new RemoteDebuggingServer(profile, ip, port, frontend_url)); | 456 new RemoteDebuggingServer(profile, ip, port, frontend_url)); |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 } | 900 } |
| 895 | 901 |
| 896 void BrowserProcessImpl::OnAutoupdateTimer() { | 902 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 897 if (CanAutorestartForUpdate()) { | 903 if (CanAutorestartForUpdate()) { |
| 898 DLOG(WARNING) << "Detected update. Restarting browser."; | 904 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 899 RestartBackgroundInstance(); | 905 RestartBackgroundInstance(); |
| 900 } | 906 } |
| 901 } | 907 } |
| 902 | 908 |
| 903 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 909 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |