| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 #endif | 420 #endif |
| 421 | 421 |
| 422 BrowserThreadsStarted(); | 422 BrowserThreadsStarted(); |
| 423 | 423 |
| 424 if (parts_.get()) | 424 if (parts_.get()) |
| 425 parts_->PreMainMessageLoopRun(); | 425 parts_->PreMainMessageLoopRun(); |
| 426 | 426 |
| 427 // If the UI thread blocks, the whole UI is unresponsive. | 427 // If the UI thread blocks, the whole UI is unresponsive. |
| 428 // Do not allow disk IO from the UI thread. | 428 // Do not allow disk IO from the UI thread. |
| 429 base::ThreadRestrictions::SetIOAllowed(false); | 429 base::ThreadRestrictions::SetIOAllowed(false); |
| 430 base::ThreadRestrictions::DisallowWaiting(); |
| 430 | 431 |
| 431 // When running the GPU thread in-process, avoid optimistically starting it | 432 // When running the GPU thread in-process, avoid optimistically starting it |
| 432 // since creating the GPU thread races against creation of the one-and-only | 433 // since creating the GPU thread races against creation of the one-and-only |
| 433 // ChildProcess instance which is created by the renderer thread. | 434 // ChildProcess instance which is created by the renderer thread. |
| 434 if (!parsed_command_line_.HasSwitch(switches::kSingleProcess) && | 435 if (!parsed_command_line_.HasSwitch(switches::kSingleProcess) && |
| 435 !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) { | 436 !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) { |
| 436 BrowserThread::PostDelayedTask( | 437 BrowserThread::PostDelayedTask( |
| 437 BrowserThread::IO, FROM_HERE, base::Bind( | 438 BrowserThread::IO, FROM_HERE, base::Bind( |
| 438 base::IgnoreResult(&GpuProcessHost::Get), | 439 base::IgnoreResult(&GpuProcessHost::Get), |
| 439 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 440 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 638 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
| 638 | 639 |
| 639 #if defined(OS_MACOSX) | 640 #if defined(OS_MACOSX) |
| 640 MessageLoopForUI::current()->Run(); | 641 MessageLoopForUI::current()->Run(); |
| 641 #else | 642 #else |
| 642 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 643 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
| 643 #endif | 644 #endif |
| 644 } | 645 } |
| 645 | 646 |
| 646 } // namespace content | 647 } // namespace content |
| OLD | NEW |