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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 TraceControllerImpl::GetInstance()->InitStartupTracing( | 429 TraceControllerImpl::GetInstance()->InitStartupTracing( |
430 parsed_command_line_); | 430 parsed_command_line_); |
431 } | 431 } |
432 | 432 |
433 { | 433 { |
434 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:OnlineStateObserver") | 434 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:OnlineStateObserver") |
435 online_state_observer_.reset(new BrowserOnlineStateObserver); | 435 online_state_observer_.reset(new BrowserOnlineStateObserver); |
436 } | 436 } |
437 #endif // !defined(OS_IOS) | 437 #endif // !defined(OS_IOS) |
438 | 438 |
439 #if defined(ENABLE_PLUGINS) | |
440 // Prior to any processing happening on the io thread, we create the | |
441 // plugin service as it is predominantly used from the io thread, | |
442 // but must be created on the main thread. The service ctor is | |
443 // inexpensive and does not invoke the io_thread() accessor. | |
444 { | |
445 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:PluginService") | |
446 PluginService::GetInstance()->Init(); | |
447 } | |
448 #endif | |
449 | |
450 #if defined(OS_WIN) | 439 #if defined(OS_WIN) |
451 system_message_window_.reset(new SystemMessageWindowWin); | 440 system_message_window_.reset(new SystemMessageWindowWin); |
452 | 441 |
453 if (base::win::IsTSFAwareRequired()) { | 442 if (base::win::IsTSFAwareRequired()) { |
454 // Create a TSF message filter for the message loop. MessageLoop takes | 443 // Create a TSF message filter for the message loop. MessageLoop takes |
455 // ownership of the filter. | 444 // ownership of the filter. |
456 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( | 445 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( |
457 new base::win::TextServicesMessageFilter); | 446 new base::win::TextServicesMessageFilter); |
458 if (tsf_message_filter->Init()) { | 447 if (tsf_message_filter->Init()) { |
459 base::MessageLoopForUI::current()->SetMessageFilter( | 448 base::MessageLoopForUI::current()->SetMessageFilter( |
(...skipping 21 matching lines...) Expand all Loading... |
481 memory_observer_.reset(new MemoryObserver()); | 470 memory_observer_.reset(new MemoryObserver()); |
482 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); | 471 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); |
483 } | 472 } |
484 } | 473 } |
485 | 474 |
486 void BrowserMainLoop::CreateThreads() { | 475 void BrowserMainLoop::CreateThreads() { |
487 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads") | 476 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads") |
488 | 477 |
489 if (parts_) { | 478 if (parts_) { |
490 TRACE_EVENT0("startup", | 479 TRACE_EVENT0("startup", |
491 "BrowserMainLoop::MainMessageLoopStart:PreCreateThreads"); | 480 "BrowserMainLoop::CreateThreads:PreCreateThreads"); |
492 result_code_ = parts_->PreCreateThreads(); | 481 result_code_ = parts_->PreCreateThreads(); |
493 } | 482 } |
494 | 483 |
| 484 #if defined(ENABLE_PLUGINS) |
| 485 // Prior to any processing happening on the io thread, we create the |
| 486 // plugin service as it is predominantly used from the io thread, |
| 487 // but must be created on the main thread. The service ctor is |
| 488 // inexpensive and does not invoke the io_thread() accessor. |
| 489 { |
| 490 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService") |
| 491 PluginService::GetInstance()->Init(); |
| 492 } |
| 493 #endif |
| 494 |
495 #if !defined(OS_IOS) && (!defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)) | 495 #if !defined(OS_IOS) && (!defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)) |
496 // Single-process is an unsupported and not fully tested mode, so | 496 // Single-process is an unsupported and not fully tested mode, so |
497 // don't enable it for official Chrome builds (except on Android). | 497 // don't enable it for official Chrome builds (except on Android). |
498 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) | 498 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) |
499 RenderProcessHost::SetRunRendererInProcess(true); | 499 RenderProcessHost::SetRunRendererInProcess(true); |
500 #endif | 500 #endif |
501 | 501 |
502 if (result_code_ > 0) | 502 if (result_code_ > 0) |
503 return; | 503 return; |
504 | 504 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 if (parameters_.ui_task) | 917 if (parameters_.ui_task) |
918 base::MessageLoopForUI::current()->PostTask(FROM_HERE, | 918 base::MessageLoopForUI::current()->PostTask(FROM_HERE, |
919 *parameters_.ui_task); | 919 *parameters_.ui_task); |
920 | 920 |
921 base::RunLoop run_loop; | 921 base::RunLoop run_loop; |
922 run_loop.Run(); | 922 run_loop.Run(); |
923 #endif | 923 #endif |
924 } | 924 } |
925 | 925 |
926 } // namespace content | 926 } // namespace content |
OLD | NEW |