| 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 "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/pending_task.h" | 14 #include "base/pending_task.h" |
| 15 #include "base/power_monitor/power_monitor.h" | 15 #include "base/power_monitor/power_monitor.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/system_monitor/system_monitor.h" | 18 #include "base/system_monitor/system_monitor.h" |
| 19 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
| 20 #include "base/timer/hi_res_timer_manager.h" | 20 #include "base/timer/hi_res_timer_manager.h" |
| 21 #include "content/browser/browser_thread_impl.h" | 21 #include "content/browser/browser_thread_impl.h" |
| 22 #include "content/browser/device_orientation/device_motion_service.h" |
| 22 #include "content/browser/download/save_file_manager.h" | 23 #include "content/browser/download/save_file_manager.h" |
| 23 #include "content/browser/gamepad/gamepad_service.h" | 24 #include "content/browser/gamepad/gamepad_service.h" |
| 24 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 25 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 25 #include "content/browser/gpu/gpu_data_manager_impl.h" | 26 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 26 #include "content/browser/gpu/gpu_process_host.h" | 27 #include "content/browser/gpu/gpu_process_host.h" |
| 27 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 28 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 28 #include "content/browser/histogram_synchronizer.h" | 29 #include "content/browser/histogram_synchronizer.h" |
| 29 #include "content/browser/in_process_webkit/webkit_thread.h" | 30 #include "content/browser/in_process_webkit/webkit_thread.h" |
| 30 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 31 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 31 #include "content/browser/net/browser_online_state_observer.h" | 32 #include "content/browser/net/browser_online_state_observer.h" |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 BrowserThreadImpl::ShutdownThreadPool(); | 769 BrowserThreadImpl::ShutdownThreadPool(); |
| 769 | 770 |
| 770 #if !defined(OS_IOS) | 771 #if !defined(OS_IOS) |
| 771 // Must happen after the IO thread is shutdown since this may be accessed from | 772 // Must happen after the IO thread is shutdown since this may be accessed from |
| 772 // it. | 773 // it. |
| 773 BrowserGpuChannelHostFactory::Terminate(); | 774 BrowserGpuChannelHostFactory::Terminate(); |
| 774 | 775 |
| 775 // Must happen after the I/O thread is shutdown since this class lives on the | 776 // Must happen after the I/O thread is shutdown since this class lives on the |
| 776 // I/O thread and isn't threadsafe. | 777 // I/O thread and isn't threadsafe. |
| 777 GamepadService::GetInstance()->Terminate(); | 778 GamepadService::GetInstance()->Terminate(); |
| 779 DeviceMotionService::GetInstance()->Shutdown(); |
| 778 | 780 |
| 779 URLDataManager::DeleteDataSources(); | 781 URLDataManager::DeleteDataSources(); |
| 780 #endif // !defined(OS_IOS) | 782 #endif // !defined(OS_IOS) |
| 781 | 783 |
| 782 if (parts_) | 784 if (parts_) |
| 783 parts_->PostDestroyThreads(); | 785 parts_->PostDestroyThreads(); |
| 784 } | 786 } |
| 785 | 787 |
| 786 void BrowserMainLoop::InitializeMainThread() { | 788 void BrowserMainLoop::InitializeMainThread() { |
| 787 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeMainThread") | 789 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeMainThread") |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 if (parameters_.ui_task) | 933 if (parameters_.ui_task) |
| 932 base::MessageLoopForUI::current()->PostTask(FROM_HERE, | 934 base::MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 933 *parameters_.ui_task); | 935 *parameters_.ui_task); |
| 934 | 936 |
| 935 base::RunLoop run_loop; | 937 base::RunLoop run_loop; |
| 936 run_loop.Run(); | 938 run_loop.Run(); |
| 937 #endif | 939 #endif |
| 938 } | 940 } |
| 939 | 941 |
| 940 } // namespace content | 942 } // namespace content |
| OLD | NEW |