OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } else if (thread_to_stop) { | 490 } else if (thread_to_stop) { |
491 thread_to_stop->reset(); | 491 thread_to_stop->reset(); |
492 } else { | 492 } else { |
493 NOTREACHED(); | 493 NOTREACHED(); |
494 } | 494 } |
495 | 495 |
496 if (parts_.get()) | 496 if (parts_.get()) |
497 parts_->PostStopThread(id); | 497 parts_->PostStopThread(id); |
498 } | 498 } |
499 | 499 |
| 500 // Close the blocking I/O pool after the other threads. Other threads such |
| 501 // as the I/O thread may need to schedule work like closing files or flushing |
| 502 // data during shutdown, so the blocking pool needs to be available. There |
| 503 // may also be slow operations pending that will blcok shutdown, so closing |
| 504 // it here (which will block until required operations are complete) gives |
| 505 // more head start for those operations to finish. |
| 506 BrowserThreadImpl::ShutdownThreadPool(); |
| 507 |
500 if (parts_.get()) | 508 if (parts_.get()) |
501 parts_->PostDestroyThreads(); | 509 parts_->PostDestroyThreads(); |
502 } | 510 } |
503 | 511 |
504 void BrowserMainLoop::InitializeMainThread() { | 512 void BrowserMainLoop::InitializeMainThread() { |
505 const char* kThreadName = "CrBrowserMain"; | 513 const char* kThreadName = "CrBrowserMain"; |
506 base::PlatformThread::SetName(kThreadName); | 514 base::PlatformThread::SetName(kThreadName); |
507 main_message_loop_->set_thread_name(kThreadName); | 515 main_message_loop_->set_thread_name(kThreadName); |
508 | 516 |
509 // Register the main thread by instantiating it, but don't call any methods. | 517 // Register the main thread by instantiating it, but don't call any methods. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 568 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
561 | 569 |
562 #if defined(OS_MACOSX) | 570 #if defined(OS_MACOSX) |
563 MessageLoopForUI::current()->Run(); | 571 MessageLoopForUI::current()->Run(); |
564 #else | 572 #else |
565 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 573 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
566 #endif | 574 #endif |
567 } | 575 } |
568 | 576 |
569 } // namespace content | 577 } // namespace content |
OLD | NEW |