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/metrics/statistics_recorder.h" | |
19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
20 #include "base/process/launch.h" | 21 #include "base/process/launch.h" |
21 #include "base/process/memory.h" | 22 #include "base/process/memory.h" |
22 #include "base/process/process_handle.h" | 23 #include "base/process/process_handle.h" |
23 #include "base/profiler/alternate_timer.h" | 24 #include "base/profiler/alternate_timer.h" |
24 #include "base/profiler/scoped_tracker.h" | 25 #include "base/profiler/scoped_tracker.h" |
25 #include "base/strings/string_number_conversions.h" | 26 #include "base/strings/string_number_conversions.h" |
26 #include "base/strings/string_util.h" | 27 #include "base/strings/string_util.h" |
27 #include "base/strings/stringprintf.h" | 28 #include "base/strings/stringprintf.h" |
28 #include "base/trace_event/trace_event.h" | 29 #include "base/trace_event/trace_event.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
441 | 442 |
442 static void ReleaseFreeMemoryThunk() { | 443 static void ReleaseFreeMemoryThunk() { |
443 MallocExtension::instance()->ReleaseFreeMemory(); | 444 MallocExtension::instance()->ReleaseFreeMemory(); |
444 } | 445 } |
445 #endif | 446 #endif |
446 | 447 |
447 int Initialize(const ContentMainParams& params) override { | 448 int Initialize(const ContentMainParams& params) override { |
448 ui_task_ = params.ui_task; | 449 ui_task_ = params.ui_task; |
449 | 450 |
450 base::EnableTerminationOnOutOfMemory(); | 451 base::EnableTerminationOnOutOfMemory(); |
452 | |
jochen (gone - plz use gerrit)
2015/05/07 15:03:19
revert?
oth
2015/05/08 09:21:53
Done.
| |
451 #if defined(OS_WIN) | 453 #if defined(OS_WIN) |
452 RegisterInvalidParamHandler(); | 454 RegisterInvalidParamHandler(); |
453 ui::win::CreateATLModuleIfNeeded(); | 455 ui::win::CreateATLModuleIfNeeded(); |
454 | 456 |
455 sandbox_info_ = *params.sandbox_info; | 457 sandbox_info_ = *params.sandbox_info; |
456 #else // !OS_WIN | 458 #else // !OS_WIN |
457 | 459 |
458 #if defined(OS_ANDROID) | 460 #if defined(OS_ANDROID) |
459 // See note at the initialization of ExitManager, below; basically, | 461 // See note at the initialization of ExitManager, below; basically, |
460 // only Android builds have the ctor/dtor handlers set up to use | 462 // only Android builds have the ctor/dtor handlers set up to use |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
697 auto icudata_region = g_fds->GetRegion(kAndroidICUDataDescriptor); | 699 auto icudata_region = g_fds->GetRegion(kAndroidICUDataDescriptor); |
698 CHECK(base::i18n::InitializeICUWithFileDescriptor(icudata_fd, | 700 CHECK(base::i18n::InitializeICUWithFileDescriptor(icudata_fd, |
699 icudata_region)); | 701 icudata_region)); |
700 } else { | 702 } else { |
701 CHECK(base::i18n::InitializeICU()); | 703 CHECK(base::i18n::InitializeICU()); |
702 } | 704 } |
703 #else | 705 #else |
704 CHECK(base::i18n::InitializeICU()); | 706 CHECK(base::i18n::InitializeICU()); |
705 #endif // OS_ANDROID | 707 #endif // OS_ANDROID |
706 | 708 |
709 base::StatisticsRecorder::Initialize(); | |
710 | |
707 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 711 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
708 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 712 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
709 #if !defined(OS_ANDROID) | 713 #if !defined(OS_ANDROID) |
710 // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared | 714 // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared |
711 // with child processes via file descriptors. On Android they are set in | 715 // with child processes via file descriptors. On Android they are set in |
712 // ChildProcessService::InternalInitChildProcess, otherwise set them here. | 716 // ChildProcessService::InternalInitChildProcess, otherwise set them here. |
713 if (command_line.HasSwitch(switches::kV8NativesPassedByFD)) { | 717 if (command_line.HasSwitch(switches::kV8NativesPassedByFD)) { |
714 g_fds->Set( | 718 g_fds->Set( |
715 kV8NativesDataDescriptor, | 719 kV8NativesDataDescriptor, |
716 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); | 720 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
842 | 846 |
843 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 847 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
844 }; | 848 }; |
845 | 849 |
846 // static | 850 // static |
847 ContentMainRunner* ContentMainRunner::Create() { | 851 ContentMainRunner* ContentMainRunner::Create() { |
848 return new ContentMainRunnerImpl(); | 852 return new ContentMainRunnerImpl(); |
849 } | 853 } |
850 | 854 |
851 } // namespace content | 855 } // namespace content |
OLD | NEW |