| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/hi_res_timer_manager.h" | 10 #include "base/hi_res_timer_manager.h" |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 497 } |
| 498 | 498 |
| 499 BrowserThreadsStarted(); | 499 BrowserThreadsStarted(); |
| 500 | 500 |
| 501 if (parts_.get()) | 501 if (parts_.get()) |
| 502 parts_->PreMainMessageLoopRun(); | 502 parts_->PreMainMessageLoopRun(); |
| 503 | 503 |
| 504 // If the UI thread blocks, the whole UI is unresponsive. | 504 // If the UI thread blocks, the whole UI is unresponsive. |
| 505 // Do not allow disk IO from the UI thread. | 505 // Do not allow disk IO from the UI thread. |
| 506 base::ThreadRestrictions::SetIOAllowed(false); | 506 base::ThreadRestrictions::SetIOAllowed(false); |
| 507 base::ThreadRestrictions::DisallowWaiting(); | 507 // base::ThreadRestrictions::DisallowWaiting(); |
| 508 } | 508 } |
| 509 | 509 |
| 510 void BrowserMainLoop::RunMainMessageLoopParts() { | 510 void BrowserMainLoop::RunMainMessageLoopParts() { |
| 511 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); | 511 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); |
| 512 | 512 |
| 513 bool ran_main_loop = false; | 513 bool ran_main_loop = false; |
| 514 if (parts_.get()) | 514 if (parts_.get()) |
| 515 ran_main_loop = parts_->MainMessageLoopRun(&result_code_); | 515 ran_main_loop = parts_->MainMessageLoopRun(&result_code_); |
| 516 | 516 |
| 517 if (!ran_main_loop) | 517 if (!ran_main_loop) |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 810 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 811 if (parameters_.ui_task) | 811 if (parameters_.ui_task) |
| 812 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 812 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
| 813 | 813 |
| 814 base::RunLoop run_loop; | 814 base::RunLoop run_loop; |
| 815 run_loop.Run(); | 815 run_loop.Run(); |
| 816 #endif | 816 #endif |
| 817 } | 817 } |
| 818 | 818 |
| 819 } // namespace content | 819 } // namespace content |
| OLD | NEW |