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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 } // namespace content | 341 } // namespace content |
342 | 342 |
343 // Main routine for running as the Browser process. | 343 // Main routine for running as the Browser process. |
344 int BrowserMain(const MainFunctionParams& parameters) { | 344 int BrowserMain(const MainFunctionParams& parameters) { |
345 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); | 345 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); |
346 | 346 |
347 scoped_ptr<content::BrowserMainParts> parts( | 347 scoped_ptr<content::BrowserMainParts> parts( |
348 content::GetContentClient()->browser()->CreateBrowserMainParts( | 348 content::GetContentClient()->browser()->CreateBrowserMainParts( |
349 parameters)); | 349 parameters)); |
| 350 if (!parts.get()) |
| 351 parts.reset(new content::BrowserMainParts(parameters)); |
350 | 352 |
351 parts->EarlyInitialization(); | 353 parts->EarlyInitialization(); |
352 | 354 |
353 // Must happen before we try to use a message loop or display any UI. | 355 // Must happen before we try to use a message loop or display any UI. |
354 parts->InitializeToolkit(); | 356 parts->InitializeToolkit(); |
355 | 357 |
356 parts->MainMessageLoopStart(); | 358 parts->MainMessageLoopStart(); |
357 | 359 |
358 // WARNING: If we get a WM_ENDSESSION, objects created on the stack here | 360 // WARNING: If we get a WM_ENDSESSION, objects created on the stack here |
359 // are NOT deleted. If you need something to run during WM_ENDSESSION add it | 361 // are NOT deleted. If you need something to run during WM_ENDSESSION add it |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 #endif // OS_WIN | 400 #endif // OS_WIN |
399 | 401 |
400 // Initialize histogram statistics gathering system. | 402 // Initialize histogram statistics gathering system. |
401 base::StatisticsRecorder statistics; | 403 base::StatisticsRecorder statistics; |
402 | 404 |
403 parts->RunMainMessageLoopParts(); | 405 parts->RunMainMessageLoopParts(); |
404 | 406 |
405 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 407 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
406 return parts->result_code(); | 408 return parts->result_code(); |
407 } | 409 } |
OLD | NEW |