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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 433 |
434 if (parts_.get()) | 434 if (parts_.get()) |
435 parts_->PreMainMessageLoopRun(); | 435 parts_->PreMainMessageLoopRun(); |
436 | 436 |
437 // If the UI thread blocks, the whole UI is unresponsive. | 437 // If the UI thread blocks, the whole UI is unresponsive. |
438 // Do not allow disk IO from the UI thread. | 438 // Do not allow disk IO from the UI thread. |
439 base::ThreadRestrictions::SetIOAllowed(false); | 439 base::ThreadRestrictions::SetIOAllowed(false); |
440 | 440 |
441 BrowserThread::PostDelayedTask( | 441 BrowserThread::PostDelayedTask( |
442 BrowserThread::IO, FROM_HERE, base::Bind( | 442 BrowserThread::IO, FROM_HERE, base::Bind( |
443 base::IgnoreResult(&GpuProcessHost::GetForClient), | 443 base::IgnoreResult(&GpuProcessHost::Get), |
444 1, // Arbitrary non-0 (to cause sandboxing) client_id. | 444 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
445 content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP), | 445 content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP), |
446 // Arbitrary delay to avoid allow browser init precious CPU cycles. | 446 // Arbitrary delay to avoid allow browser init precious CPU cycles. |
447 base::TimeDelta::FromSeconds(5)); | 447 base::TimeDelta::FromSeconds(5)); |
448 } | 448 } |
449 | 449 |
450 void BrowserMainLoop::RunMainMessageLoopParts() { | 450 void BrowserMainLoop::RunMainMessageLoopParts() { |
451 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); | 451 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); |
452 | 452 |
453 bool ran_main_loop = false; | 453 bool ran_main_loop = false; |
454 if (parts_.get()) | 454 if (parts_.get()) |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 652 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
653 | 653 |
654 #if defined(OS_MACOSX) | 654 #if defined(OS_MACOSX) |
655 MessageLoopForUI::current()->Run(); | 655 MessageLoopForUI::current()->Run(); |
656 #else | 656 #else |
657 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 657 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
658 #endif | 658 #endif |
659 } | 659 } |
660 | 660 |
661 } // namespace content | 661 } // namespace content |
OLD | NEW |