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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 #include "base/strings/string_number_conversions.h" | 79 #include "base/strings/string_number_conversions.h" |
80 #include "base/trace_event/trace_event_etw_export_win.h" | 80 #include "base/trace_event/trace_event_etw_export_win.h" |
81 #include "ui/base/win/atl_module.h" | 81 #include "ui/base/win/atl_module.h" |
82 #include "ui/gfx/win/dpi.h" | 82 #include "ui/gfx/win/dpi.h" |
83 #elif defined(OS_MACOSX) | 83 #elif defined(OS_MACOSX) |
84 #include "base/mac/scoped_nsautorelease_pool.h" | 84 #include "base/mac/scoped_nsautorelease_pool.h" |
85 #if !defined(OS_IOS) | 85 #if !defined(OS_IOS) |
86 #include "base/power_monitor/power_monitor_device_source.h" | 86 #include "base/power_monitor/power_monitor_device_source.h" |
87 #include "content/browser/mach_broker_mac.h" | 87 #include "content/browser/mach_broker_mac.h" |
| 88 #include "content/common/mac/io_surface_manager.h" |
88 #include "content/common/sandbox_init_mac.h" | 89 #include "content/common/sandbox_init_mac.h" |
89 #endif // !OS_IOS | 90 #endif // !OS_IOS |
90 #endif // OS_WIN | 91 #endif // OS_WIN |
91 | 92 |
92 #if defined(OS_POSIX) | 93 #if defined(OS_POSIX) |
93 #include <signal.h> | 94 #include <signal.h> |
94 | 95 |
95 #include "base/posix/global_descriptors.h" | 96 #include "base/posix/global_descriptors.h" |
96 #include "content/public/common/content_descriptors.h" | 97 #include "content/public/common/content_descriptors.h" |
97 | 98 |
(...skipping 20 matching lines...) Expand all Loading... |
118 extern int PluginMain(const content::MainFunctionParams&); | 119 extern int PluginMain(const content::MainFunctionParams&); |
119 #endif | 120 #endif |
120 extern int PpapiPluginMain(const MainFunctionParams&); | 121 extern int PpapiPluginMain(const MainFunctionParams&); |
121 extern int PpapiBrokerMain(const MainFunctionParams&); | 122 extern int PpapiBrokerMain(const MainFunctionParams&); |
122 #endif | 123 #endif |
123 extern int RendererMain(const content::MainFunctionParams&); | 124 extern int RendererMain(const content::MainFunctionParams&); |
124 extern int UtilityMain(const MainFunctionParams&); | 125 extern int UtilityMain(const MainFunctionParams&); |
125 } // namespace content | 126 } // namespace content |
126 | 127 |
127 namespace content { | 128 namespace content { |
| 129 namespace { |
| 130 |
| 131 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 132 class IOSurfaceManagerImpl : public IOSurfaceManager { |
| 133 public: |
| 134 IOSurfaceManagerImpl() {} |
| 135 |
| 136 // Overridden from IOSurfaceManager: |
| 137 bool RegisterIOSurface(int io_surface_id, |
| 138 int client_id, |
| 139 IOSurfaceRef io_surface) override { |
| 140 return MachBroker::ChildRegisterIOSurfaceWithParent( |
| 141 io_surface_id, client_id, IOSurfaceCreateMachPort(io_surface)); |
| 142 } |
| 143 void UnregisterIOSurface(int io_surface_id, int client_id) override { |
| 144 MachBroker::ChildUnregisterIOSurfaceWithParent(io_surface_id, client_id); |
| 145 } |
| 146 IOSurfaceRef AcquireIOSurface(int io_surface_id) override { |
| 147 return IOSurfaceLookupFromMachPort( |
| 148 MachBroker::ChildAcquireIOSurfaceFromParent(io_surface_id)); |
| 149 } |
| 150 |
| 151 private: |
| 152 DISALLOW_COPY_AND_ASSIGN(IOSurfaceManagerImpl); |
| 153 }; |
| 154 #endif |
| 155 |
| 156 } // namespace |
128 | 157 |
129 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 158 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
130 base::LazyInstance<ContentBrowserClient> | 159 base::LazyInstance<ContentBrowserClient> |
131 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; | 160 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; |
132 #endif // !CHROME_MULTIPLE_DLL_CHILD | 161 #endif // !CHROME_MULTIPLE_DLL_CHILD |
133 | 162 |
134 #if !defined(OS_IOS) && !defined(CHROME_MULTIPLE_DLL_BROWSER) | 163 #if !defined(OS_IOS) && !defined(CHROME_MULTIPLE_DLL_BROWSER) |
135 base::LazyInstance<ContentPluginClient> | 164 base::LazyInstance<ContentPluginClient> |
136 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 165 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
137 base::LazyInstance<ContentRendererClient> | 166 base::LazyInstance<ContentRendererClient> |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 if (process_type.empty() || | 683 if (process_type.empty() || |
655 (delegate_ && | 684 (delegate_ && |
656 delegate_->ProcessRegistersWithSystemProcess(process_type))) { | 685 delegate_->ProcessRegistersWithSystemProcess(process_type))) { |
657 base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); | 686 base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); |
658 } | 687 } |
659 | 688 |
660 if (!process_type.empty() && | 689 if (!process_type.empty() && |
661 (!delegate_ || delegate_->ShouldSendMachPort(process_type))) { | 690 (!delegate_ || delegate_->ShouldSendMachPort(process_type))) { |
662 MachBroker::ChildSendTaskPortToParent(); | 691 MachBroker::ChildSendTaskPortToParent(); |
663 } | 692 } |
| 693 |
| 694 IOSurfaceManager::InitInstance(new IOSurfaceManagerImpl); |
664 #elif defined(OS_WIN) | 695 #elif defined(OS_WIN) |
665 SetupCRT(command_line); | 696 SetupCRT(command_line); |
666 #endif | 697 #endif |
667 | 698 |
668 #if defined(OS_POSIX) | 699 #if defined(OS_POSIX) |
669 if (!process_type.empty()) { | 700 if (!process_type.empty()) { |
670 // When you hit Ctrl-C in a terminal running the browser | 701 // When you hit Ctrl-C in a terminal running the browser |
671 // process, a SIGINT is delivered to the entire process group. | 702 // process, a SIGINT is delivered to the entire process group. |
672 // When debugging the browser process via gdb, gdb catches the | 703 // When debugging the browser process via gdb, gdb catches the |
673 // SIGINT for the browser process (and dumps you back to the gdb | 704 // SIGINT for the browser process (and dumps you back to the gdb |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 873 |
843 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 874 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
844 }; | 875 }; |
845 | 876 |
846 // static | 877 // static |
847 ContentMainRunner* ContentMainRunner::Create() { | 878 ContentMainRunner* ContentMainRunner::Create() { |
848 return new ContentMainRunnerImpl(); | 879 return new ContentMainRunnerImpl(); |
849 } | 880 } |
850 | 881 |
851 } // namespace content | 882 } // namespace content |
OLD | NEW |