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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 493 |
494 if (id == BrowserThread::WEBKIT_DEPRECATED) { | 494 if (id == BrowserThread::WEBKIT_DEPRECATED) { |
495 webkit_thread_.reset(); | 495 webkit_thread_.reset(); |
496 } else if (thread_to_stop) { | 496 } else if (thread_to_stop) { |
497 thread_to_stop->reset(); | 497 thread_to_stop->reset(); |
498 } else { | 498 } else { |
499 NOTREACHED(); | 499 NOTREACHED(); |
500 } | 500 } |
501 } | 501 } |
502 | 502 |
| 503 // Close the blocking I/O pool after the other threads. Other threads such |
| 504 // as the I/O thread may need to schedule work like closing files or flushing |
| 505 // data during shutdown, so the blocking pool needs to be available. There |
| 506 // may also be slow operations pending that will blcok shutdown, so closing |
| 507 // it here (which will block until required operations are complete) gives |
| 508 // more head start for those operations to finish. |
| 509 BrowserThreadImpl::ShutdownThreadPool(); |
| 510 |
503 if (parts_.get()) | 511 if (parts_.get()) |
504 parts_->PostDestroyThreads(); | 512 parts_->PostDestroyThreads(); |
505 } | 513 } |
506 | 514 |
507 void BrowserMainLoop::InitializeMainThread() { | 515 void BrowserMainLoop::InitializeMainThread() { |
508 const char* kThreadName = "CrBrowserMain"; | 516 const char* kThreadName = "CrBrowserMain"; |
509 base::PlatformThread::SetName(kThreadName); | 517 base::PlatformThread::SetName(kThreadName); |
510 main_message_loop_->set_thread_name(kThreadName); | 518 main_message_loop_->set_thread_name(kThreadName); |
511 | 519 |
512 // Register the main thread by instantiating it, but don't call any methods. | 520 // Register the main thread by instantiating it, but don't call any methods. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 577 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
570 | 578 |
571 #if defined(OS_MACOSX) | 579 #if defined(OS_MACOSX) |
572 MessageLoopForUI::current()->Run(); | 580 MessageLoopForUI::current()->Run(); |
573 #else | 581 #else |
574 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 582 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
575 #endif | 583 #endif |
576 } | 584 } |
577 | 585 |
578 } // namespace content | 586 } // namespace content |
OLD | NEW |