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