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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 512 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
513 trace_memory_controller_.reset(new base::debug::TraceMemoryController( | 513 trace_memory_controller_.reset(new base::debug::TraceMemoryController( |
514 base::MessageLoop::current()->message_loop_proxy(), | 514 base::MessageLoop::current()->message_loop_proxy(), |
515 ::HeapProfilerWithPseudoStackStart, | 515 ::HeapProfilerWithPseudoStackStart, |
516 ::HeapProfilerStop, | 516 ::HeapProfilerStop, |
517 ::GetHeapProfile)); | 517 ::GetHeapProfile)); |
518 #endif | 518 #endif |
519 } | 519 } |
520 | 520 |
521 int BrowserMainLoop::PreCreateThreads() { | 521 int BrowserMainLoop::PreCreateThreads() { |
522 | |
523 if (parts_) { | 522 if (parts_) { |
524 TRACE_EVENT0("startup", | 523 TRACE_EVENT0("startup", |
525 "BrowserMainLoop::CreateThreads:PreCreateThreads"); | 524 "BrowserMainLoop::CreateThreads:PreCreateThreads"); |
526 result_code_ = parts_->PreCreateThreads(); | 525 result_code_ = parts_->PreCreateThreads(); |
527 } | 526 } |
528 | 527 |
529 #if defined(ENABLE_PLUGINS) | 528 #if defined(ENABLE_PLUGINS) |
530 // Prior to any processing happening on the io thread, we create the | 529 // Prior to any processing happening on the io thread, we create the |
531 // plugin service as it is predominantly used from the io thread, | 530 // plugin service as it is predominantly used from the io thread, |
532 // but must be created on the main thread. The service ctor is | 531 // but must be created on the main thread. The service ctor is |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); | 672 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
674 | 673 |
675 if (thread_to_start) { | 674 if (thread_to_start) { |
676 (*thread_to_start).reset(new BrowserProcessSubThread(id)); | 675 (*thread_to_start).reset(new BrowserProcessSubThread(id)); |
677 (*thread_to_start)->StartWithOptions(*options); | 676 (*thread_to_start)->StartWithOptions(*options); |
678 } else { | 677 } else { |
679 NOTREACHED(); | 678 NOTREACHED(); |
680 } | 679 } |
681 | 680 |
682 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); | 681 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); |
683 | |
684 } | 682 } |
685 created_threads_ = true; | 683 created_threads_ = true; |
686 return result_code_; | 684 return result_code_; |
687 } | 685 } |
688 | 686 |
689 int BrowserMainLoop::PreMainMessageLoopRun() { | 687 int BrowserMainLoop::PreMainMessageLoopRun() { |
690 if (parts_) { | 688 if (parts_) { |
691 TRACE_EVENT0("startup", | 689 TRACE_EVENT0("startup", |
692 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); | 690 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); |
693 parts_->PreMainMessageLoopRun(); | 691 parts_->PreMainMessageLoopRun(); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 | 1051 |
1054 bool BrowserMainLoop::InitializeToolkit() { | 1052 bool BrowserMainLoop::InitializeToolkit() { |
1055 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); | 1053 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); |
1056 // TODO(evan): this function is rather subtle, due to the variety | 1054 // TODO(evan): this function is rather subtle, due to the variety |
1057 // of intersecting ifdefs we have. To keep it easy to follow, there | 1055 // of intersecting ifdefs we have. To keep it easy to follow, there |
1058 // are no #else branches on any #ifs. | 1056 // are no #else branches on any #ifs. |
1059 // TODO(stevenjb): Move platform specific code into platform specific Parts | 1057 // TODO(stevenjb): Move platform specific code into platform specific Parts |
1060 // (Need to add InitializeToolkit stage to BrowserParts). | 1058 // (Need to add InitializeToolkit stage to BrowserParts). |
1061 // See also GTK setup in EarlyInitialization, above, and associated comments. | 1059 // See also GTK setup in EarlyInitialization, above, and associated comments. |
1062 | 1060 |
1063 #if defined(TOOLKIT_GTK) | |
1064 // It is important for this to happen before the first run dialog, as it | |
1065 // styles the dialog as well. | |
1066 gfx::InitRCStyles(); | |
1067 #endif | |
1068 | |
1069 #if defined(OS_WIN) | 1061 #if defined(OS_WIN) |
1070 // Init common control sex. | 1062 // Init common control sex. |
1071 INITCOMMONCONTROLSEX config; | 1063 INITCOMMONCONTROLSEX config; |
1072 config.dwSize = sizeof(config); | 1064 config.dwSize = sizeof(config); |
1073 config.dwICC = ICC_WIN95_CLASSES; | 1065 config.dwICC = ICC_WIN95_CLASSES; |
1074 if (!InitCommonControlsEx(&config)) | 1066 if (!InitCommonControlsEx(&config)) |
1075 PLOG(FATAL); | 1067 PLOG(FATAL); |
1076 #endif | 1068 #endif |
1077 | 1069 |
1078 #if defined(USE_AURA) | 1070 #if defined(USE_AURA) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 base::TimeDelta::FromSeconds(delay_secs)); | 1136 base::TimeDelta::FromSeconds(delay_secs)); |
1145 } | 1137 } |
1146 | 1138 |
1147 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { | 1139 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { |
1148 is_tracing_startup_ = false; | 1140 is_tracing_startup_ = false; |
1149 TracingController::GetInstance()->DisableRecording( | 1141 TracingController::GetInstance()->DisableRecording( |
1150 trace_file, base::Bind(&OnStoppedStartupTracing)); | 1142 trace_file, base::Bind(&OnStoppedStartupTracing)); |
1151 } | 1143 } |
1152 | 1144 |
1153 } // namespace content | 1145 } // namespace content |
OLD | NEW |