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