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" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/threading/sequenced_worker_pool.h" | |
jam
2012/03/01 06:13:02
not needed?
Ami GONE FROM CHROMIUM
2012/03/01 16:03:59
Done.
| |
15 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
16 #include "content/browser/browser_thread_impl.h" | 17 #include "content/browser/browser_thread_impl.h" |
17 #include "content/browser/download/download_file_manager.h" | 18 #include "content/browser/download/download_file_manager.h" |
18 #include "content/browser/download/save_file_manager.h" | 19 #include "content/browser/download/save_file_manager.h" |
19 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 20 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
21 #include "content/browser/gpu/gpu_process_host.h" | |
20 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 22 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
21 #include "content/browser/in_process_webkit/webkit_thread.h" | 23 #include "content/browser/in_process_webkit/webkit_thread.h" |
22 #include "content/browser/plugin_service_impl.h" | 24 #include "content/browser/plugin_service_impl.h" |
23 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 25 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
24 #include "content/browser/trace_controller.h" | 26 #include "content/browser/trace_controller.h" |
25 #include "content/common/hi_res_timer_manager.h" | 27 #include "content/common/hi_res_timer_manager.h" |
26 #include "content/common/sandbox_policy.h" | 28 #include "content/common/sandbox_policy.h" |
27 #include "content/public/browser/browser_main_parts.h" | 29 #include "content/public/browser/browser_main_parts.h" |
28 #include "content/public/browser/browser_shutdown.h" | 30 #include "content/public/browser/browser_shutdown.h" |
29 #include "content/public/browser/content_browser_client.h" | 31 #include "content/public/browser/content_browser_client.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 #endif | 424 #endif |
423 | 425 |
424 BrowserThreadsStarted(); | 426 BrowserThreadsStarted(); |
425 | 427 |
426 if (parts_.get()) | 428 if (parts_.get()) |
427 parts_->PreMainMessageLoopRun(); | 429 parts_->PreMainMessageLoopRun(); |
428 | 430 |
429 // If the UI thread blocks, the whole UI is unresponsive. | 431 // If the UI thread blocks, the whole UI is unresponsive. |
430 // Do not allow disk IO from the UI thread. | 432 // Do not allow disk IO from the UI thread. |
431 base::ThreadRestrictions::SetIOAllowed(false); | 433 base::ThreadRestrictions::SetIOAllowed(false); |
434 | |
435 BrowserThread::PostDelayedTask( | |
436 BrowserThread::IO, FROM_HERE, base::Bind( | |
437 base::IgnoreResult(&GpuProcessHost::GetForClient), | |
438 1, // Arbitrary non-0 (to cause sandboxing) client_id. | |
apatrick_chromium
2012/03/01 00:26:21
I had a plan at some point to have a pool of GPU p
| |
439 content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP), | |
440 // Arbitrary delay to avoid allow browser init precious CPU cycles. | |
441 base::TimeDelta::FromSeconds(5)); | |
432 } | 442 } |
433 | 443 |
434 void BrowserMainLoop::RunMainMessageLoopParts() { | 444 void BrowserMainLoop::RunMainMessageLoopParts() { |
435 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); | 445 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); |
436 | 446 |
437 bool ran_main_loop = false; | 447 bool ran_main_loop = false; |
438 if (parts_.get()) | 448 if (parts_.get()) |
439 ran_main_loop = parts_->MainMessageLoopRun(&result_code_); | 449 ran_main_loop = parts_->MainMessageLoopRun(&result_code_); |
440 | 450 |
441 if (!ran_main_loop) | 451 if (!ran_main_loop) |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 638 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
629 | 639 |
630 #if defined(OS_MACOSX) | 640 #if defined(OS_MACOSX) |
631 MessageLoopForUI::current()->Run(); | 641 MessageLoopForUI::current()->Run(); |
632 #else | 642 #else |
633 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 643 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
634 #endif | 644 #endif |
635 } | 645 } |
636 | 646 |
637 } // namespace content | 647 } // namespace content |
OLD | NEW |