| 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" |
| 11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/system_monitor/system_monitor.h" | 13 #include "base/system_monitor/system_monitor.h" |
| 14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
| 16 #include "content/browser/content_browser_client.h" | 16 #include "content/browser/content_browser_client.h" |
| 17 #include "content/common/content_switches.h" | 17 #include "content/common/content_switches.h" |
| 18 #include "content/common/hi_res_timer_manager.h" | 18 #include "content/common/hi_res_timer_manager.h" |
| 19 #include "content/common/main_function_params.h" | 19 #include "content/common/main_function_params.h" |
| 20 #include "content/common/notification_service.h" |
| 20 #include "content/common/result_codes.h" | 21 #include "content/common/result_codes.h" |
| 21 #include "content/common/sandbox_policy.h" | 22 #include "content/common/sandbox_policy.h" |
| 22 #include "crypto/nss_util.h" | 23 #include "crypto/nss_util.h" |
| 23 #include "net/base/network_change_notifier.h" | 24 #include "net/base/network_change_notifier.h" |
| 24 #include "net/base/ssl_config_service.h" | 25 #include "net/base/ssl_config_service.h" |
| 25 #include "net/socket/client_socket_factory.h" | 26 #include "net/socket/client_socket_factory.h" |
| 26 #include "net/socket/tcp_client_socket.h" | 27 #include "net/socket/tcp_client_socket.h" |
| 27 | 28 |
| 28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 29 #include <windows.h> | 30 #include <windows.h> |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 338 |
| 338 void BrowserMainParts::ToolkitInitialized() { | 339 void BrowserMainParts::ToolkitInitialized() { |
| 339 } | 340 } |
| 340 | 341 |
| 341 } // namespace content | 342 } // namespace content |
| 342 | 343 |
| 343 // Main routine for running as the Browser process. | 344 // Main routine for running as the Browser process. |
| 344 int BrowserMain(const MainFunctionParams& parameters) { | 345 int BrowserMain(const MainFunctionParams& parameters) { |
| 345 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); | 346 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); |
| 346 | 347 |
| 348 NotificationService main_notification_service; |
| 349 |
| 347 scoped_ptr<content::BrowserMainParts> parts( | 350 scoped_ptr<content::BrowserMainParts> parts( |
| 348 content::GetContentClient()->browser()->CreateBrowserMainParts( | 351 content::GetContentClient()->browser()->CreateBrowserMainParts( |
| 349 parameters)); | 352 parameters)); |
| 350 if (!parts.get()) | 353 if (!parts.get()) |
| 351 parts.reset(new content::BrowserMainParts(parameters)); | 354 parts.reset(new content::BrowserMainParts(parameters)); |
| 352 | 355 |
| 353 parts->EarlyInitialization(); | 356 parts->EarlyInitialization(); |
| 354 | 357 |
| 355 // Must happen before we try to use a message loop or display any UI. | 358 // Must happen before we try to use a message loop or display any UI. |
| 356 parts->InitializeToolkit(); | 359 parts->InitializeToolkit(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 #endif | 395 #endif |
| 393 // The broker service initialization needs to run early because it will | 396 // The broker service initialization needs to run early because it will |
| 394 // initialize the sandbox broker, which requires the process to swap its | 397 // initialize the sandbox broker, which requires the process to swap its |
| 395 // window station. During this time all the UI will be broken. This has to | 398 // window station. During this time all the UI will be broken. This has to |
| 396 // run before threads and windows are created. | 399 // run before threads and windows are created. |
| 397 InitializeBrokerServices(parameters, parameters.command_line_); | 400 InitializeBrokerServices(parameters, parameters.command_line_); |
| 398 | 401 |
| 399 base::win::ScopedCOMInitializer com_initializer; | 402 base::win::ScopedCOMInitializer com_initializer; |
| 400 #endif // OS_WIN | 403 #endif // OS_WIN |
| 401 | 404 |
| 402 // Initialize histogram statistics gathering system. | |
| 403 base::StatisticsRecorder statistics; | 405 base::StatisticsRecorder statistics; |
| 404 | 406 |
| 405 parts->RunMainMessageLoopParts(); | 407 parts->RunMainMessageLoopParts(); |
| 406 | 408 |
| 407 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 409 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
| 408 return parts->result_code(); | 410 return parts->result_code(); |
| 409 } | 411 } |
| OLD | NEW |