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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 *completed_main_message_loop = true; | 401 *completed_main_message_loop = true; |
402 | 402 |
403 ShutdownThreadsAndCleanUp(); | 403 ShutdownThreadsAndCleanUp(); |
404 } | 404 } |
405 | 405 |
406 void BrowserMainLoop::ShutdownThreadsAndCleanUp() { | 406 void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
407 // Teardown may start in PostMainMessageLoopRun, and during teardown we | 407 // Teardown may start in PostMainMessageLoopRun, and during teardown we |
408 // need to be able to perform IO. | 408 // need to be able to perform IO. |
409 base::ThreadRestrictions::SetIOAllowed(true); | 409 base::ThreadRestrictions::SetIOAllowed(true); |
410 BrowserThread::PostTask( | 410 BrowserThread::PostTask( |
411 BrowserThread::IO, | 411 BrowserThread::IO, FROM_HERE, |
412 FROM_HERE, | |
413 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 412 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
414 true)); | 413 true)); |
415 | 414 |
416 if (parts_.get()) | 415 if (parts_.get()) |
417 parts_->PostMainMessageLoopRun(); | 416 parts_->PostMainMessageLoopRun(); |
418 | 417 |
419 // Must be size_t so we can subtract from it. | 418 // Must be size_t so we can subtract from it. |
420 for (size_t thread_id = BrowserThread::ID_COUNT - 1; | 419 for (size_t thread_id = BrowserThread::ID_COUNT - 1; |
421 thread_id >= (BrowserThread::UI + 1); | 420 thread_id >= (BrowserThread::UI + 1); |
422 --thread_id) { | 421 --thread_id) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 559 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
561 | 560 |
562 #if defined(OS_MACOSX) | 561 #if defined(OS_MACOSX) |
563 MessageLoopForUI::current()->Run(); | 562 MessageLoopForUI::current()->Run(); |
564 #else | 563 #else |
565 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 564 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
566 #endif | 565 #endif |
567 } | 566 } |
568 | 567 |
569 } // namespace content | 568 } // namespace content |
OLD | NEW |