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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "base/strings/stringprintf.h" | 29 #include "base/strings/stringprintf.h" |
30 #include "base/trace_event/trace_event.h" | 30 #include "base/trace_event/trace_event.h" |
31 #include "components/tracing/trace_config_file.h" | 31 #include "components/tracing/trace_config_file.h" |
32 #include "components/tracing/tracing_switches.h" | 32 #include "components/tracing/tracing_switches.h" |
33 #include "content/browser/browser_main.h" | 33 #include "content/browser/browser_main.h" |
34 #include "content/common/set_process_title.h" | 34 #include "content/common/set_process_title.h" |
35 #include "content/common/url_schemes.h" | 35 #include "content/common/url_schemes.h" |
36 #include "content/gpu/in_process_gpu_thread.h" | 36 #include "content/gpu/in_process_gpu_thread.h" |
37 #include "content/public/app/content_main.h" | 37 #include "content/public/app/content_main.h" |
38 #include "content/public/app/content_main_delegate.h" | 38 #include "content/public/app/content_main_delegate.h" |
39 #include "content/public/app/startup_helper_win.h" | |
40 #include "content/public/browser/content_browser_client.h" | 39 #include "content/public/browser/content_browser_client.h" |
41 #include "content/public/common/content_client.h" | 40 #include "content/public/common/content_client.h" |
42 #include "content/public/common/content_constants.h" | 41 #include "content/public/common/content_constants.h" |
43 #include "content/public/common/content_paths.h" | 42 #include "content/public/common/content_paths.h" |
44 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
45 #include "content/public/common/main_function_params.h" | 44 #include "content/public/common/main_function_params.h" |
46 #include "content/public/common/sandbox_init.h" | 45 #include "content/public/common/sandbox_init.h" |
47 #include "content/renderer/in_process_renderer_thread.h" | 46 #include "content/renderer/in_process_renderer_thread.h" |
48 #include "content/utility/in_process_utility_thread.h" | 47 #include "content/utility/in_process_utility_thread.h" |
49 #include "ipc/ipc_descriptors.h" | 48 #include "ipc/ipc_descriptors.h" |
(...skipping 20 matching lines...) Expand all Loading... |
70 #include "content/public/renderer/content_renderer_client.h" | 69 #include "content/public/renderer/content_renderer_client.h" |
71 #include "content/public/utility/content_utility_client.h" | 70 #include "content/public/utility/content_utility_client.h" |
72 #endif | 71 #endif |
73 | 72 |
74 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
75 #include <malloc.h> | 74 #include <malloc.h> |
76 #include <cstring> | 75 #include <cstring> |
77 | 76 |
78 #include "base/strings/string_number_conversions.h" | 77 #include "base/strings/string_number_conversions.h" |
79 #include "base/trace_event/trace_event_etw_export_win.h" | 78 #include "base/trace_event/trace_event_etw_export_win.h" |
| 79 #include "base/win/process_startup_helper.h" |
80 #include "ui/base/win/atl_module.h" | 80 #include "ui/base/win/atl_module.h" |
81 #include "ui/gfx/win/dpi.h" | 81 #include "ui/gfx/win/dpi.h" |
82 #elif defined(OS_MACOSX) | 82 #elif defined(OS_MACOSX) |
83 #include "base/mac/scoped_nsautorelease_pool.h" | 83 #include "base/mac/scoped_nsautorelease_pool.h" |
84 #if !defined(OS_IOS) | 84 #if !defined(OS_IOS) |
85 #include "base/power_monitor/power_monitor_device_source.h" | 85 #include "base/power_monitor/power_monitor_device_source.h" |
86 #include "content/app/mac/mac_init.h" | 86 #include "content/app/mac/mac_init.h" |
87 #include "content/browser/browser_io_surface_manager_mac.h" | 87 #include "content/browser/browser_io_surface_manager_mac.h" |
88 #include "content/browser/mach_broker_mac.h" | 88 #include "content/browser/mach_broker_mac.h" |
89 #include "content/child/child_io_surface_manager_mac.h" | 89 #include "content/child/child_io_surface_manager_mac.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 static void ReleaseFreeMemoryThunk() { | 436 static void ReleaseFreeMemoryThunk() { |
437 MallocExtension::instance()->ReleaseFreeMemory(); | 437 MallocExtension::instance()->ReleaseFreeMemory(); |
438 } | 438 } |
439 #endif | 439 #endif |
440 | 440 |
441 int Initialize(const ContentMainParams& params) override { | 441 int Initialize(const ContentMainParams& params) override { |
442 ui_task_ = params.ui_task; | 442 ui_task_ = params.ui_task; |
443 | 443 |
444 base::EnableTerminationOnOutOfMemory(); | 444 base::EnableTerminationOnOutOfMemory(); |
445 #if defined(OS_WIN) | 445 #if defined(OS_WIN) |
446 RegisterInvalidParamHandler(); | 446 base::win::RegisterInvalidParamHandler(); |
447 ui::win::CreateATLModuleIfNeeded(); | 447 ui::win::CreateATLModuleIfNeeded(); |
448 | 448 |
449 sandbox_info_ = *params.sandbox_info; | 449 sandbox_info_ = *params.sandbox_info; |
450 #else // !OS_WIN | 450 #else // !OS_WIN |
451 | 451 |
452 #if defined(OS_ANDROID) | 452 #if defined(OS_ANDROID) |
453 // See note at the initialization of ExitManager, below; basically, | 453 // See note at the initialization of ExitManager, below; basically, |
454 // only Android builds have the ctor/dtor handlers set up to use | 454 // only Android builds have the ctor/dtor handlers set up to use |
455 // TRACE_EVENT right away. | 455 // TRACE_EVENT right away. |
456 TRACE_EVENT0("startup", "ContentMainRunnerImpl::Initialize"); | 456 TRACE_EVENT0("startup", "ContentMainRunnerImpl::Initialize"); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 process_type == switches::kGpuProcess)) { | 662 process_type == switches::kGpuProcess)) { |
663 base::mac::ScopedMachSendRight service_port = | 663 base::mac::ScopedMachSendRight service_port = |
664 BrowserIOSurfaceManager::LookupServicePort(getppid()); | 664 BrowserIOSurfaceManager::LookupServicePort(getppid()); |
665 if (service_port.is_valid()) { | 665 if (service_port.is_valid()) { |
666 ChildIOSurfaceManager::GetInstance()->set_service_port( | 666 ChildIOSurfaceManager::GetInstance()->set_service_port( |
667 service_port.release()); | 667 service_port.release()); |
668 IOSurfaceManager::SetInstance(ChildIOSurfaceManager::GetInstance()); | 668 IOSurfaceManager::SetInstance(ChildIOSurfaceManager::GetInstance()); |
669 } | 669 } |
670 } | 670 } |
671 #elif defined(OS_WIN) | 671 #elif defined(OS_WIN) |
672 SetupCRT(command_line); | 672 base::win::SetupCRT(command_line); |
673 #endif | 673 #endif |
674 | 674 |
675 #if defined(OS_POSIX) | 675 #if defined(OS_POSIX) |
676 if (!process_type.empty()) { | 676 if (!process_type.empty()) { |
677 // When you hit Ctrl-C in a terminal running the browser | 677 // When you hit Ctrl-C in a terminal running the browser |
678 // process, a SIGINT is delivered to the entire process group. | 678 // process, a SIGINT is delivered to the entire process group. |
679 // When debugging the browser process via gdb, gdb catches the | 679 // When debugging the browser process via gdb, gdb catches the |
680 // SIGINT for the browser process (and dumps you back to the gdb | 680 // SIGINT for the browser process (and dumps you back to the gdb |
681 // console) but doesn't for the child processes, killing them. | 681 // console) but doesn't for the child processes, killing them. |
682 // The fix is to have child processes ignore SIGINT; they'll die | 682 // The fix is to have child processes ignore SIGINT; they'll die |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 857 |
858 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 858 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
859 }; | 859 }; |
860 | 860 |
861 // static | 861 // static |
862 ContentMainRunner* ContentMainRunner::Create() { | 862 ContentMainRunner* ContentMainRunner::Create() { |
863 return new ContentMainRunnerImpl(); | 863 return new ContentMainRunnerImpl(); |
864 } | 864 } |
865 | 865 |
866 } // namespace content | 866 } // namespace content |
OLD | NEW |