| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/browser/browser_main.h" |
| 6 | 6 |
| 7 #include "base/allocator/allocator_shim.h" | 7 #include "base/allocator/allocator_shim.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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 #endif | 157 #endif |
| 158 | 158 |
| 159 } // namespace | 159 } // namespace |
| 160 | 160 |
| 161 namespace content { | 161 namespace content { |
| 162 | 162 |
| 163 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters) | 163 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters) |
| 164 : parameters_(parameters), | 164 : parameters_(parameters), |
| 165 parsed_command_line_(parameters.command_line_), | 165 parsed_command_line_(parameters.command_line_), |
| 166 result_code_(content::RESULT_CODE_NORMAL_EXIT) { | 166 result_code_(content::RESULT_CODE_NORMAL_EXIT) { |
| 167 #if defined(OS_WIN) |
| 168 OleInitialize(NULL); |
| 169 #endif |
| 167 } | 170 } |
| 168 | 171 |
| 169 BrowserMainParts::~BrowserMainParts() { | 172 BrowserMainParts::~BrowserMainParts() { |
| 173 #if defined(OS_WIN) |
| 174 OleUninitialize(); |
| 175 #endif |
| 170 } | 176 } |
| 171 | 177 |
| 172 void BrowserMainParts::EarlyInitialization() { | 178 void BrowserMainParts::EarlyInitialization() { |
| 173 PreEarlyInitialization(); | 179 PreEarlyInitialization(); |
| 174 | 180 |
| 175 #if defined(OS_WIN) | 181 #if defined(OS_WIN) |
| 176 net::EnsureWinsockInit(); | 182 net::EnsureWinsockInit(); |
| 177 #endif | 183 #endif |
| 178 | 184 |
| 179 // Use NSS for SSL by default. | 185 // Use NSS for SSL by default. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 if (parsed_command_line().HasSwitch(switches::kEnableTcpFastOpen)) | 218 if (parsed_command_line().HasSwitch(switches::kEnableTcpFastOpen)) |
| 213 net::set_tcp_fastopen_enabled(true); | 219 net::set_tcp_fastopen_enabled(true); |
| 214 | 220 |
| 215 PostEarlyInitialization(); | 221 PostEarlyInitialization(); |
| 216 } | 222 } |
| 217 | 223 |
| 218 void BrowserMainParts::MainMessageLoopStart() { | 224 void BrowserMainParts::MainMessageLoopStart() { |
| 219 PreMainMessageLoopStart(); | 225 PreMainMessageLoopStart(); |
| 220 | 226 |
| 221 #if defined(OS_WIN) | 227 #if defined(OS_WIN) |
| 222 OleInitialize(NULL); | |
| 223 | |
| 224 // If we're running tests (ui_task is non-null), then the ResourceBundle | 228 // If we're running tests (ui_task is non-null), then the ResourceBundle |
| 225 // has already been initialized. | 229 // has already been initialized. |
| 226 if (!parameters().ui_task) { | 230 if (!parameters().ui_task) { |
| 227 // Override the configured locale with the user's preferred UI language. | 231 // Override the configured locale with the user's preferred UI language. |
| 228 l10n_util::OverrideLocaleWithUILanguageList(); | 232 l10n_util::OverrideLocaleWithUILanguageList(); |
| 229 } | 233 } |
| 230 #endif | 234 #endif |
| 231 | 235 |
| 232 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); | 236 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); |
| 233 | 237 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 base::win::ScopedCOMInitializer com_initializer; | 413 base::win::ScopedCOMInitializer com_initializer; |
| 410 #endif // OS_WIN | 414 #endif // OS_WIN |
| 411 | 415 |
| 412 base::StatisticsRecorder statistics; | 416 base::StatisticsRecorder statistics; |
| 413 | 417 |
| 414 parts->RunMainMessageLoopParts(); | 418 parts->RunMainMessageLoopParts(); |
| 415 | 419 |
| 416 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 420 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
| 417 return parts->result_code(); | 421 return parts->result_code(); |
| 418 } | 422 } |
| OLD | NEW |