| 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/public/app/content_main_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/debug/debugger.h" | 12 #include "base/debug/debugger.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/i18n/icu_util.h" | 14 #include "base/i18n/icu_util.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/process/launch.h" | 20 #include "base/process/launch.h" |
| 21 #include "base/process/memory.h" | 21 #include "base/process/memory.h" |
| 22 #include "base/process/process_handle.h" | 22 #include "base/process/process_handle.h" |
| 23 #include "base/profiler/alternate_timer.h" | 23 #include "base/profiler/alternate_timer.h" |
| 24 #include "base/profiler/scoped_tracker.h" |
| 24 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 25 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
| 26 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
| 27 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
| 28 #include "content/browser/browser_main.h" | 29 #include "content/browser/browser_main.h" |
| 29 #include "content/common/set_process_title.h" | 30 #include "content/common/set_process_title.h" |
| 30 #include "content/common/url_schemes.h" | 31 #include "content/common/url_schemes.h" |
| 31 #include "content/gpu/in_process_gpu_thread.h" | 32 #include "content/gpu/in_process_gpu_thread.h" |
| 32 #include "content/public/app/content_main.h" | 33 #include "content/public/app/content_main.h" |
| 33 #include "content/public/app/content_main_delegate.h" | 34 #include "content/public/app/content_main_delegate.h" |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 562 |
| 562 #if !defined(OS_WIN) | 563 #if !defined(OS_WIN) |
| 563 argc = params.argc; | 564 argc = params.argc; |
| 564 argv = params.argv; | 565 argv = params.argv; |
| 565 #endif | 566 #endif |
| 566 | 567 |
| 567 base::CommandLine::Init(argc, argv); | 568 base::CommandLine::Init(argc, argv); |
| 568 | 569 |
| 569 base::EnableTerminationOnHeapCorruption(); | 570 base::EnableTerminationOnHeapCorruption(); |
| 570 | 571 |
| 572 // TODO(yiyaoliu, vadimt): Remove this once crbug.com/453640 is fixed. |
| 573 // Enable profiler recording right after command line is initialized so that |
| 574 // browser startup can be instrumented. |
| 575 if (delegate_ && delegate_->ShouldEnableProfilerRecording()) |
| 576 tracked_objects::ScopedTracker::Enable(); |
| 577 |
| 571 #if !defined(OS_IOS) | 578 #if !defined(OS_IOS) |
| 572 SetProcessTitleFromCommandLine(argv); | 579 SetProcessTitleFromCommandLine(argv); |
| 573 #endif | 580 #endif |
| 574 #endif // !OS_ANDROID | 581 #endif // !OS_ANDROID |
| 575 | 582 |
| 576 int exit_code = 0; | 583 int exit_code = 0; |
| 577 if (delegate_ && delegate_->BasicStartupComplete(&exit_code)) | 584 if (delegate_ && delegate_->BasicStartupComplete(&exit_code)) |
| 578 return exit_code; | 585 return exit_code; |
| 579 | 586 |
| 580 completed_basic_startup_ = true; | 587 completed_basic_startup_ = true; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 | 833 |
| 827 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 834 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 828 }; | 835 }; |
| 829 | 836 |
| 830 // static | 837 // static |
| 831 ContentMainRunner* ContentMainRunner::Create() { | 838 ContentMainRunner* ContentMainRunner::Create() { |
| 832 return new ContentMainRunnerImpl(); | 839 return new ContentMainRunnerImpl(); |
| 833 } | 840 } |
| 834 | 841 |
| 835 } // namespace content | 842 } // namespace content |
| OLD | NEW |