Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/allocator/allocator_check.h" | 13 #include "base/allocator/allocator_check.h" |
| 14 #include "base/allocator/allocator_extension.h" | 14 #include "base/allocator/allocator_extension.h" |
| 15 #include "base/at_exit.h" | 15 #include "base/at_exit.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/debug/debugger.h" | 17 #include "base/debug/debugger.h" |
| 18 #include "base/debug/stack_trace.h" | 18 #include "base/debug/stack_trace.h" |
| 19 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/i18n/icu_util.h" | 20 #include "base/i18n/icu_util.h" |
| 21 #include "base/lazy_instance.h" | 21 #include "base/lazy_instance.h" |
| 22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/macros.h" | 23 #include "base/macros.h" |
| 24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
| 25 #include "base/memory/scoped_vector.h" | 25 #include "base/memory/scoped_vector.h" |
| 26 #include "base/metrics/histogram_base.h" | |
| 26 #include "base/metrics/statistics_recorder.h" | 27 #include "base/metrics/statistics_recorder.h" |
| 27 #include "base/path_service.h" | 28 #include "base/path_service.h" |
| 28 #include "base/process/launch.h" | 29 #include "base/process/launch.h" |
| 29 #include "base/process/memory.h" | 30 #include "base/process/memory.h" |
| 30 #include "base/process/process_handle.h" | 31 #include "base/process/process_handle.h" |
| 31 #include "base/profiler/scoped_tracker.h" | 32 #include "base/profiler/scoped_tracker.h" |
| 32 #include "base/strings/string_number_conversions.h" | 33 #include "base/strings/string_number_conversions.h" |
| 34 #include "base/strings/string_piece.h" | |
| 33 #include "base/strings/string_util.h" | 35 #include "base/strings/string_util.h" |
| 34 #include "base/strings/stringprintf.h" | 36 #include "base/strings/stringprintf.h" |
| 35 #include "base/trace_event/trace_event.h" | 37 #include "base/trace_event/trace_event.h" |
| 36 #include "build/build_config.h" | 38 #include "build/build_config.h" |
| 37 #include "components/tracing/trace_config_file.h" | 39 #include "components/tracing/trace_config_file.h" |
| 38 #include "components/tracing/trace_to_console.h" | 40 #include "components/tracing/trace_to_console.h" |
| 39 #include "components/tracing/tracing_switches.h" | 41 #include "components/tracing/tracing_switches.h" |
| 40 #include "content/browser/browser_main.h" | 42 #include "content/browser/browser_main.h" |
| 41 #include "content/common/set_process_title.h" | 43 #include "content/common/set_process_title.h" |
| 42 #include "content/common/url_schemes.h" | 44 #include "content/common/url_schemes.h" |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 } | 747 } |
| 746 | 748 |
| 747 int Run() override { | 749 int Run() override { |
| 748 DCHECK(is_initialized_); | 750 DCHECK(is_initialized_); |
| 749 DCHECK(!is_shutdown_); | 751 DCHECK(!is_shutdown_); |
| 750 const base::CommandLine& command_line = | 752 const base::CommandLine& command_line = |
| 751 *base::CommandLine::ForCurrentProcess(); | 753 *base::CommandLine::ForCurrentProcess(); |
| 752 std::string process_type = | 754 std::string process_type = |
| 753 command_line.GetSwitchValueASCII(switches::kProcessType); | 755 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 754 | 756 |
| 757 base::StringPiece report_type = process_type; | |
| 758 if (report_type.empty()) | |
| 759 report_type = "browser"; | |
|
Alexei Svitkine (slow)
2016/03/01 16:41:34
Is this really "browser"? Seems like this is assum
bcwhite
2016/03/02 19:14:19
If the process is called without a "--type=" param
| |
| 760 base::HistogramBase::EnableCreationReportHistogram(report_type); | |
| 761 | |
| 755 MainFunctionParams main_params(command_line); | 762 MainFunctionParams main_params(command_line); |
| 756 main_params.ui_task = ui_task_; | 763 main_params.ui_task = ui_task_; |
| 757 #if defined(OS_WIN) | 764 #if defined(OS_WIN) |
| 758 main_params.sandbox_info = &sandbox_info_; | 765 main_params.sandbox_info = &sandbox_info_; |
| 759 #elif defined(OS_MACOSX) | 766 #elif defined(OS_MACOSX) |
| 760 main_params.autorelease_pool = autorelease_pool_.get(); | 767 main_params.autorelease_pool = autorelease_pool_.get(); |
| 761 #endif | 768 #endif |
| 762 | 769 |
| 763 #if !defined(OS_IOS) | 770 #if !defined(OS_IOS) |
| 764 return RunNamedProcessTypeMain(process_type, main_params, delegate_); | 771 return RunNamedProcessTypeMain(process_type, main_params, delegate_); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 823 | 830 |
| 824 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 831 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 825 }; | 832 }; |
| 826 | 833 |
| 827 // static | 834 // static |
| 828 ContentMainRunner* ContentMainRunner::Create() { | 835 ContentMainRunner* ContentMainRunner::Create() { |
| 829 return new ContentMainRunnerImpl(); | 836 return new ContentMainRunnerImpl(); |
| 830 } | 837 } |
| 831 | 838 |
| 832 } // namespace content | 839 } // namespace content |
| OLD | NEW |