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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "content/public/common/sandbox_init.h" | 42 #include "content/public/common/sandbox_init.h" |
43 #include "content/renderer/in_process_renderer_thread.h" | 43 #include "content/renderer/in_process_renderer_thread.h" |
44 #include "content/utility/in_process_utility_thread.h" | 44 #include "content/utility/in_process_utility_thread.h" |
45 #include "crypto/nss_util.h" | 45 #include "crypto/nss_util.h" |
46 #include "ipc/ipc_descriptors.h" | 46 #include "ipc/ipc_descriptors.h" |
47 #include "ipc/ipc_switches.h" | 47 #include "ipc/ipc_switches.h" |
48 #include "media/base/media.h" | 48 #include "media/base/media.h" |
49 #include "sandbox/win/src/sandbox_types.h" | 49 #include "sandbox/win/src/sandbox_types.h" |
50 #include "ui/base/ui_base_paths.h" | 50 #include "ui/base/ui_base_paths.h" |
51 #include "ui/base/ui_base_switches.h" | 51 #include "ui/base/ui_base_switches.h" |
52 #include "ui/gfx/win/dpi.h" | |
53 | 52 |
54 #if defined(USE_TCMALLOC) | 53 #if defined(USE_TCMALLOC) |
55 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | 54 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
56 #if defined(TYPE_PROFILING) | 55 #if defined(TYPE_PROFILING) |
57 #include "base/allocator/type_profiler.h" | 56 #include "base/allocator/type_profiler.h" |
58 #include "base/allocator/type_profiler_tcmalloc.h" | 57 #include "base/allocator/type_profiler_tcmalloc.h" |
59 #endif | 58 #endif |
60 #endif | 59 #endif |
61 | 60 |
62 #if !defined(OS_IOS) | 61 #if !defined(OS_IOS) |
63 #include "content/app/mojo/mojo_init.h" | 62 #include "content/app/mojo/mojo_init.h" |
64 #include "content/browser/gpu/gpu_process_host.h" | 63 #include "content/browser/gpu/gpu_process_host.h" |
65 #include "content/browser/renderer_host/render_process_host_impl.h" | 64 #include "content/browser/renderer_host/render_process_host_impl.h" |
66 #include "content/browser/utility_process_host_impl.h" | 65 #include "content/browser/utility_process_host_impl.h" |
67 #include "content/public/plugin/content_plugin_client.h" | 66 #include "content/public/plugin/content_plugin_client.h" |
68 #include "content/public/renderer/content_renderer_client.h" | 67 #include "content/public/renderer/content_renderer_client.h" |
69 #include "content/public/utility/content_utility_client.h" | 68 #include "content/public/utility/content_utility_client.h" |
70 #endif | 69 #endif |
71 | 70 |
72 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
73 #include <atlbase.h> | 72 #include <atlbase.h> |
74 #include <atlapp.h> | 73 #include <atlapp.h> |
75 #include <malloc.h> | 74 #include <malloc.h> |
76 #include <cstring> | 75 #include <cstring> |
| 76 |
| 77 #include "base/strings/string_number_conversions.h" |
| 78 #include "ui/base/win/dpi_setup.h" |
| 79 #include "ui/gfx/win/dpi.h" |
77 #elif defined(OS_MACOSX) | 80 #elif defined(OS_MACOSX) |
78 #include "base/mac/scoped_nsautorelease_pool.h" | 81 #include "base/mac/scoped_nsautorelease_pool.h" |
79 #if !defined(OS_IOS) | 82 #if !defined(OS_IOS) |
80 #include "base/power_monitor/power_monitor_device_source.h" | 83 #include "base/power_monitor/power_monitor_device_source.h" |
81 #include "content/browser/mach_broker_mac.h" | 84 #include "content/browser/mach_broker_mac.h" |
82 #include "content/common/sandbox_init_mac.h" | 85 #include "content/common/sandbox_init_mac.h" |
83 #endif // !OS_IOS | 86 #endif // !OS_IOS |
84 #endif // OS_WIN | 87 #endif // OS_WIN |
85 | 88 |
86 #if defined(OS_POSIX) | 89 #if defined(OS_POSIX) |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 } | 654 } |
652 | 655 |
653 if (!process_type.empty() && | 656 if (!process_type.empty() && |
654 (!delegate_ || delegate_->ShouldSendMachPort(process_type))) { | 657 (!delegate_ || delegate_->ShouldSendMachPort(process_type))) { |
655 MachBroker::ChildSendTaskPortToParent(); | 658 MachBroker::ChildSendTaskPortToParent(); |
656 } | 659 } |
657 #elif defined(OS_WIN) | 660 #elif defined(OS_WIN) |
658 if (command_line.HasSwitch(switches::kEnableHighResolutionTime)) | 661 if (command_line.HasSwitch(switches::kEnableHighResolutionTime)) |
659 base::TimeTicks::SetNowIsHighResNowIfSupported(); | 662 base::TimeTicks::SetNowIsHighResNowIfSupported(); |
660 | 663 |
| 664 bool init_device_scale_factor = true; |
| 665 if (command_line.HasSwitch(switches::kDeviceScaleFactor)) { |
| 666 std::string scale_factor_string = command_line.GetSwitchValueASCII( |
| 667 switches::kDeviceScaleFactor); |
| 668 double scale_factor = 0; |
| 669 if (base::StringToDouble(scale_factor_string, &scale_factor)) { |
| 670 init_device_scale_factor = false; |
| 671 gfx::InitDeviceScaleFactor(scale_factor); |
| 672 } |
| 673 } |
| 674 if (init_device_scale_factor) |
| 675 ui::win::InitDeviceScaleFactor(); |
| 676 |
661 SetupCRT(command_line); | 677 SetupCRT(command_line); |
662 #endif | 678 #endif |
663 | 679 |
664 #if defined(OS_POSIX) | 680 #if defined(OS_POSIX) |
665 if (!process_type.empty()) { | 681 if (!process_type.empty()) { |
666 // When you hit Ctrl-C in a terminal running the browser | 682 // When you hit Ctrl-C in a terminal running the browser |
667 // process, a SIGINT is delivered to the entire process group. | 683 // process, a SIGINT is delivered to the entire process group. |
668 // When debugging the browser process via gdb, gdb catches the | 684 // When debugging the browser process via gdb, gdb catches the |
669 // SIGINT for the browser process (and dumps you back to the gdb | 685 // SIGINT for the browser process (and dumps you back to the gdb |
670 // console) but doesn't for the child processes, killing them. | 686 // console) but doesn't for the child processes, killing them. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 | 816 |
801 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 817 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
802 }; | 818 }; |
803 | 819 |
804 // static | 820 // static |
805 ContentMainRunner* ContentMainRunner::Create() { | 821 ContentMainRunner* ContentMainRunner::Create() { |
806 return new ContentMainRunnerImpl(); | 822 return new ContentMainRunnerImpl(); |
807 } | 823 } |
808 | 824 |
809 } // namespace content | 825 } // namespace content |
OLD | NEW |