| 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/hi_res_timer_manager.h" | 10 #include "base/hi_res_timer_manager.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 // processes so this has to happen before stopping the IO thread. | 506 // processes so this has to happen before stopping the IO thread. |
| 507 GpuProcessHostUIShim::DestroyAll(); | 507 GpuProcessHostUIShim::DestroyAll(); |
| 508 | 508 |
| 509 // Cancel pending requests and prevent new requests. | 509 // Cancel pending requests and prevent new requests. |
| 510 if (resource_dispatcher_host_.get()) | 510 if (resource_dispatcher_host_.get()) |
| 511 resource_dispatcher_host_.get()->Shutdown(); | 511 resource_dispatcher_host_.get()->Shutdown(); |
| 512 | 512 |
| 513 #if defined(USE_AURA) | 513 #if defined(USE_AURA) |
| 514 ImageTransportFactory::Terminate(); | 514 ImageTransportFactory::Terminate(); |
| 515 #endif | 515 #endif |
| 516 BrowserGpuChannelHostFactory::Terminate(); | |
| 517 | 516 |
| 518 // The device monitors are using |system_monitor_| as dependency, so delete | 517 // The device monitors are using |system_monitor_| as dependency, so delete |
| 519 // them before |system_monitor_| goes away. | 518 // them before |system_monitor_| goes away. |
| 520 // On Mac and windows, the monitor needs to be destroyed on the same thread | 519 // On Mac and windows, the monitor needs to be destroyed on the same thread |
| 521 // as they were created. On Linux, the monitor will be deleted when IO thread | 520 // as they were created. On Linux, the monitor will be deleted when IO thread |
| 522 // goes away. | 521 // goes away. |
| 523 #if defined(OS_WIN) | 522 #if defined(OS_WIN) |
| 524 system_message_window_.reset(); | 523 system_message_window_.reset(); |
| 525 #elif defined(OS_MACOSX) | 524 #elif defined(OS_MACOSX) |
| 526 device_monitor_mac_.reset(); | 525 device_monitor_mac_.reset(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 610 |
| 612 // Close the blocking I/O pool after the other threads. Other threads such | 611 // Close the blocking I/O pool after the other threads. Other threads such |
| 613 // as the I/O thread may need to schedule work like closing files or flushing | 612 // as the I/O thread may need to schedule work like closing files or flushing |
| 614 // data during shutdown, so the blocking pool needs to be available. There | 613 // data during shutdown, so the blocking pool needs to be available. There |
| 615 // may also be slow operations pending that will blcok shutdown, so closing | 614 // may also be slow operations pending that will blcok shutdown, so closing |
| 616 // it here (which will block until required operations are complete) gives | 615 // it here (which will block until required operations are complete) gives |
| 617 // more head start for those operations to finish. | 616 // more head start for those operations to finish. |
| 618 BrowserThreadImpl::ShutdownThreadPool(); | 617 BrowserThreadImpl::ShutdownThreadPool(); |
| 619 | 618 |
| 620 #if !defined(OS_IOS) | 619 #if !defined(OS_IOS) |
| 620 // Must happen after the IO thread is shutdown since this may be accessed from |
| 621 // it. |
| 622 BrowserGpuChannelHostFactory::Terminate(); |
| 623 |
| 621 // Must happen after the I/O thread is shutdown since this class lives on the | 624 // Must happen after the I/O thread is shutdown since this class lives on the |
| 622 // I/O thread and isn't threadsafe. | 625 // I/O thread and isn't threadsafe. |
| 623 GamepadService::GetInstance()->Terminate(); | 626 GamepadService::GetInstance()->Terminate(); |
| 624 #endif // !defined(OS_IOS) | 627 #endif // !defined(OS_IOS) |
| 625 | 628 |
| 626 if (parts_.get()) | 629 if (parts_.get()) |
| 627 parts_->PostDestroyThreads(); | 630 parts_->PostDestroyThreads(); |
| 628 } | 631 } |
| 629 | 632 |
| 630 void BrowserMainLoop::InitializeMainThread() { | 633 void BrowserMainLoop::InitializeMainThread() { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 750 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 748 if (parameters_.ui_task) | 751 if (parameters_.ui_task) |
| 749 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 752 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
| 750 | 753 |
| 751 base::RunLoop run_loop; | 754 base::RunLoop run_loop; |
| 752 run_loop.Run(); | 755 run_loop.Run(); |
| 753 #endif | 756 #endif |
| 754 } | 757 } |
| 755 | 758 |
| 756 } // namespace content | 759 } // namespace content |
| OLD | NEW |