| 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 (*thread_to_start).reset(new BrowserProcessSubThread(id)); | 594 (*thread_to_start).reset(new BrowserProcessSubThread(id)); |
| 595 (*thread_to_start)->StartWithOptions(*options); | 595 (*thread_to_start)->StartWithOptions(*options); |
| 596 } else { | 596 } else { |
| 597 NOTREACHED(); | 597 NOTREACHED(); |
| 598 } | 598 } |
| 599 | 599 |
| 600 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); | 600 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); |
| 601 | 601 |
| 602 } | 602 } |
| 603 | 603 |
| 604 #if !defined(OS_IOS) |
| 605 indexed_db_thread_.reset(new base::Thread("IndexedDB")); |
| 606 indexed_db_thread_->Start(); |
| 607 #endif |
| 608 |
| 604 BrowserThreadsStarted(); | 609 BrowserThreadsStarted(); |
| 605 | 610 |
| 606 if (parts_) { | 611 if (parts_) { |
| 607 TRACE_EVENT0("startup", | 612 TRACE_EVENT0("startup", |
| 608 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); | 613 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); |
| 609 parts_->PreMainMessageLoopRun(); | 614 parts_->PreMainMessageLoopRun(); |
| 610 } | 615 } |
| 611 | 616 |
| 612 // If the UI thread blocks, the whole UI is unresponsive. | 617 // If the UI thread blocks, the whole UI is unresponsive. |
| 613 // Do not allow disk IO from the UI thread. | 618 // Do not allow disk IO from the UI thread. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 #if !defined(OS_IOS) | 747 #if !defined(OS_IOS) |
| 743 webkit_thread_.reset(); | 748 webkit_thread_.reset(); |
| 744 #endif | 749 #endif |
| 745 } else if (thread_to_stop) { | 750 } else if (thread_to_stop) { |
| 746 thread_to_stop->reset(); | 751 thread_to_stop->reset(); |
| 747 } else { | 752 } else { |
| 748 NOTREACHED(); | 753 NOTREACHED(); |
| 749 } | 754 } |
| 750 } | 755 } |
| 751 | 756 |
| 757 #if !defined(OS_IOS) |
| 758 indexed_db_thread_.reset(); |
| 759 #endif |
| 760 |
| 752 // Close the blocking I/O pool after the other threads. Other threads such | 761 // Close the blocking I/O pool after the other threads. Other threads such |
| 753 // as the I/O thread may need to schedule work like closing files or flushing | 762 // as the I/O thread may need to schedule work like closing files or flushing |
| 754 // data during shutdown, so the blocking pool needs to be available. There | 763 // data during shutdown, so the blocking pool needs to be available. There |
| 755 // may also be slow operations pending that will blcok shutdown, so closing | 764 // may also be slow operations pending that will blcok shutdown, so closing |
| 756 // it here (which will block until required operations are complete) gives | 765 // it here (which will block until required operations are complete) gives |
| 757 // more head start for those operations to finish. | 766 // more head start for those operations to finish. |
| 758 BrowserThreadImpl::ShutdownThreadPool(); | 767 BrowserThreadImpl::ShutdownThreadPool(); |
| 759 | 768 |
| 760 #if !defined(OS_IOS) | 769 #if !defined(OS_IOS) |
| 761 // Must happen after the IO thread is shutdown since this may be accessed from | 770 // 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... |
| 921 if (parameters_.ui_task) | 930 if (parameters_.ui_task) |
| 922 base::MessageLoopForUI::current()->PostTask(FROM_HERE, | 931 base::MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 923 *parameters_.ui_task); | 932 *parameters_.ui_task); |
| 924 | 933 |
| 925 base::RunLoop run_loop; | 934 base::RunLoop run_loop; |
| 926 run_loop.Run(); | 935 run_loop.Run(); |
| 927 #endif | 936 #endif |
| 928 } | 937 } |
| 929 | 938 |
| 930 } // namespace content | 939 } // namespace content |
| OLD | NEW |