| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/thread.h" | 9 #include "base/thread.h" |
| 10 #include "base/waitable_event.h" | 10 #include "base/waitable_event.h" |
| 11 #include "chrome/browser/browser_trial.h" | 11 #include "chrome/browser/browser_trial.h" |
| 12 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
| 13 #include "chrome/browser/debugger/debugger_wrapper.h" | 13 #include "chrome/browser/debugger/debugger_wrapper.h" |
| 14 #include "chrome/browser/google_url_tracker.h" | 14 #include "chrome/browser/google_url_tracker.h" |
| 15 #include "chrome/browser/metrics/metrics_service.h" | 15 #include "chrome/browser/metrics/metrics_service.h" |
| 16 #include "chrome/browser/net/dns_global.h" |
| 16 #include "chrome/browser/profile_manager.h" | 17 #include "chrome/browser/profile_manager.h" |
| 17 #include "chrome/browser/renderer_host/render_process_host.h" | 18 #include "chrome/browser/renderer_host/render_process_host.h" |
| 18 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 19 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 19 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 20 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 20 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/l10n_util.h" | 23 #include "chrome/common/l10n_util.h" |
| 23 #include "chrome/common/notification_service.h" | 24 #include "chrome/common/notification_service.h" |
| 24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/common/pref_service.h" | 26 #include "chrome/common/pref_service.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 if (resource_dispatcher_host_.get()) { | 168 if (resource_dispatcher_host_.get()) { |
| 168 // Need to tell Safe Browsing Service that the IO thread is going away | 169 // Need to tell Safe Browsing Service that the IO thread is going away |
| 169 // since it cached a pointer to it. | 170 // since it cached a pointer to it. |
| 170 if (resource_dispatcher_host()->safe_browsing_service()) | 171 if (resource_dispatcher_host()->safe_browsing_service()) |
| 171 resource_dispatcher_host()->safe_browsing_service()->ShutDown(); | 172 resource_dispatcher_host()->safe_browsing_service()->ShutDown(); |
| 172 | 173 |
| 173 // Cancel pending requests and prevent new requests. | 174 // Cancel pending requests and prevent new requests. |
| 174 resource_dispatcher_host()->Shutdown(); | 175 resource_dispatcher_host()->Shutdown(); |
| 175 } | 176 } |
| 176 | 177 |
| 178 // Shutdown DNS prefetching now to ensure that network stack objects |
| 179 // living on the IO thread get destroyed before the IO thread goes away. |
| 180 io_thread_->message_loop()->PostTask(FROM_HERE, |
| 181 NewRunnableFunction(chrome_browser_net::ShutdownDnsPrefetch)); |
| 182 |
| 177 // Need to stop io_thread_ before resource_dispatcher_host_, since | 183 // Need to stop io_thread_ before resource_dispatcher_host_, since |
| 178 // io_thread_ may still deref ResourceDispatcherHost and handle resource | 184 // io_thread_ may still deref ResourceDispatcherHost and handle resource |
| 179 // request before going away. | 185 // request before going away. |
| 180 io_thread_.reset(); | 186 io_thread_.reset(); |
| 181 | 187 |
| 182 // Clean up state that lives on the file_thread_ before it goes away. | 188 // Clean up state that lives on the file_thread_ before it goes away. |
| 183 if (resource_dispatcher_host_.get()) { | 189 if (resource_dispatcher_host_.get()) { |
| 184 resource_dispatcher_host()->download_file_manager()->Shutdown(); | 190 resource_dispatcher_host()->download_file_manager()->Shutdown(); |
| 185 resource_dispatcher_host()->save_file_manager()->Shutdown(); | 191 resource_dispatcher_host()->save_file_manager()->Shutdown(); |
| 186 } | 192 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // TODO(port): remove this completely, it has no business being here. | 386 // TODO(port): remove this completely, it has no business being here. |
| 381 #endif | 387 #endif |
| 382 } | 388 } |
| 383 | 389 |
| 384 void BrowserProcessImpl::CreateGoogleURLTracker() { | 390 void BrowserProcessImpl::CreateGoogleURLTracker() { |
| 385 DCHECK(google_url_tracker_.get() == NULL); | 391 DCHECK(google_url_tracker_.get() == NULL); |
| 386 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); | 392 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); |
| 387 google_url_tracker_.swap(google_url_tracker); | 393 google_url_tracker_.swap(google_url_tracker); |
| 388 } | 394 } |
| 389 | 395 |
| OLD | NEW |