| 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 (*thread_to_start).reset(new BrowserProcessSubThread(id)); | 582 (*thread_to_start).reset(new BrowserProcessSubThread(id)); |
| 583 (*thread_to_start)->StartWithOptions(*options); | 583 (*thread_to_start)->StartWithOptions(*options); |
| 584 } else { | 584 } else { |
| 585 NOTREACHED(); | 585 NOTREACHED(); |
| 586 } | 586 } |
| 587 | 587 |
| 588 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); | 588 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); |
| 589 | 589 |
| 590 } | 590 } |
| 591 | 591 |
| 592 #if !defined(OS_IOS) |
| 593 indexed_db_thread_.reset(new base::Thread("IndexedDB")); |
| 594 indexed_db_thread_->Start(); |
| 595 #endif |
| 596 |
| 592 BrowserThreadsStarted(); | 597 BrowserThreadsStarted(); |
| 593 | 598 |
| 594 if (parts_) { | 599 if (parts_) { |
| 595 TRACE_EVENT0("startup", | 600 TRACE_EVENT0("startup", |
| 596 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); | 601 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); |
| 597 parts_->PreMainMessageLoopRun(); | 602 parts_->PreMainMessageLoopRun(); |
| 598 } | 603 } |
| 599 | 604 |
| 600 // If the UI thread blocks, the whole UI is unresponsive. | 605 // If the UI thread blocks, the whole UI is unresponsive. |
| 601 // Do not allow disk IO from the UI thread. | 606 // Do not allow disk IO from the UI thread. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 #if !defined(OS_IOS) | 735 #if !defined(OS_IOS) |
| 731 webkit_thread_.reset(); | 736 webkit_thread_.reset(); |
| 732 #endif | 737 #endif |
| 733 } else if (thread_to_stop) { | 738 } else if (thread_to_stop) { |
| 734 thread_to_stop->reset(); | 739 thread_to_stop->reset(); |
| 735 } else { | 740 } else { |
| 736 NOTREACHED(); | 741 NOTREACHED(); |
| 737 } | 742 } |
| 738 } | 743 } |
| 739 | 744 |
| 745 #if !defined(OS_IOS) |
| 746 indexed_db_thread_.reset(); |
| 747 #endif |
| 748 |
| 740 // Close the blocking I/O pool after the other threads. Other threads such | 749 // Close the blocking I/O pool after the other threads. Other threads such |
| 741 // as the I/O thread may need to schedule work like closing files or flushing | 750 // as the I/O thread may need to schedule work like closing files or flushing |
| 742 // data during shutdown, so the blocking pool needs to be available. There | 751 // data during shutdown, so the blocking pool needs to be available. There |
| 743 // may also be slow operations pending that will blcok shutdown, so closing | 752 // may also be slow operations pending that will blcok shutdown, so closing |
| 744 // it here (which will block until required operations are complete) gives | 753 // it here (which will block until required operations are complete) gives |
| 745 // more head start for those operations to finish. | 754 // more head start for those operations to finish. |
| 746 BrowserThreadImpl::ShutdownThreadPool(); | 755 BrowserThreadImpl::ShutdownThreadPool(); |
| 747 | 756 |
| 748 #if !defined(OS_IOS) | 757 #if !defined(OS_IOS) |
| 749 // Must happen after the IO thread is shutdown since this may be accessed from | 758 // Must happen after the IO thread is shutdown since this may be accessed from |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 if (parameters_.ui_task) | 918 if (parameters_.ui_task) |
| 910 base::MessageLoopForUI::current()->PostTask(FROM_HERE, | 919 base::MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 911 *parameters_.ui_task); | 920 *parameters_.ui_task); |
| 912 | 921 |
| 913 base::RunLoop run_loop; | 922 base::RunLoop run_loop; |
| 914 run_loop.Run(); | 923 run_loop.Run(); |
| 915 #endif | 924 #endif |
| 916 } | 925 } |
| 917 | 926 |
| 918 } // namespace content | 927 } // namespace content |
| OLD | NEW |