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 | |
508 if (parts_.get()) | 500 if (parts_.get()) |
509 parts_->PostDestroyThreads(); | 501 parts_->PostDestroyThreads(); |
510 } | 502 } |
511 | 503 |
512 void BrowserMainLoop::InitializeMainThread() { | 504 void BrowserMainLoop::InitializeMainThread() { |
513 const char* kThreadName = "CrBrowserMain"; | 505 const char* kThreadName = "CrBrowserMain"; |
514 base::PlatformThread::SetName(kThreadName); | 506 base::PlatformThread::SetName(kThreadName); |
515 main_message_loop_->set_thread_name(kThreadName); | 507 main_message_loop_->set_thread_name(kThreadName); |
516 | 508 |
517 // Register the main thread by instantiating it, but don't call any methods. | 509 // 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... |
568 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 560 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
569 | 561 |
570 #if defined(OS_MACOSX) | 562 #if defined(OS_MACOSX) |
571 MessageLoopForUI::current()->Run(); | 563 MessageLoopForUI::current()->Run(); |
572 #else | 564 #else |
573 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 565 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
574 #endif | 566 #endif |
575 } | 567 } |
576 | 568 |
577 } // namespace content | 569 } // namespace content |
OLD | NEW |