| 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 #include "webkit/common/resource_type.h" | 154 #include "webkit/common/resource_type.h" |
| 155 | 155 |
| 156 #if defined(OS_ANDROID) | 156 #if defined(OS_ANDROID) |
| 157 #include "content/browser/media/android/browser_demuxer_android.h" | 157 #include "content/browser/media/android/browser_demuxer_android.h" |
| 158 #include "content/browser/renderer_host/compositor_impl_android.h" | 158 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 159 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" | 159 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" |
| 160 #endif | 160 #endif |
| 161 | 161 |
| 162 #if defined(OS_MACOSX) | 162 #if defined(OS_MACOSX) |
| 163 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" | 163 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" |
| 164 #include "ui/gl/io_surface_support_mac.h" | |
| 165 #endif | 164 #endif |
| 166 | 165 |
| 167 #if defined(OS_WIN) | 166 #if defined(OS_WIN) |
| 168 #include "base/win/scoped_com_initializer.h" | 167 #include "base/win/scoped_com_initializer.h" |
| 169 #include "content/common/font_cache_dispatcher_win.h" | 168 #include "content/common/font_cache_dispatcher_win.h" |
| 170 #include "content/common/sandbox_win.h" | 169 #include "content/common/sandbox_win.h" |
| 171 #endif | 170 #endif |
| 172 | 171 |
| 173 #if defined(ENABLE_WEBRTC) | 172 #if defined(ENABLE_WEBRTC) |
| 174 #include "content/browser/media/webrtc_internals.h" | 173 #include "content/browser/media/webrtc_internals.h" |
| (...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle()); | 2163 GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle()); |
| 2165 return; | 2164 return; |
| 2166 } | 2165 } |
| 2167 | 2166 |
| 2168 #if defined(OS_MACOSX) | 2167 #if defined(OS_MACOSX) |
| 2169 // TODO(reveman): This should be moved to | 2168 // TODO(reveman): This should be moved to |
| 2170 // GpuMemoryBufferImpl::AllocateForChildProcess and | 2169 // GpuMemoryBufferImpl::AllocateForChildProcess and |
| 2171 // GpuMemoryBufferImplIOSurface. crbug.com/325045, crbug.com/323304 | 2170 // GpuMemoryBufferImplIOSurface. crbug.com/325045, crbug.com/323304 |
| 2172 if (GpuMemoryBufferImplIOSurface::IsConfigurationSupported(internalformat, | 2171 if (GpuMemoryBufferImplIOSurface::IsConfigurationSupported(internalformat, |
| 2173 usage)) { | 2172 usage)) { |
| 2174 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); | 2173 base::ScopedCFTypeRef<CFMutableDictionaryRef> properties; |
| 2175 if (io_surface_support) { | 2174 properties.reset( |
| 2176 base::ScopedCFTypeRef<CFMutableDictionaryRef> properties; | 2175 CFDictionaryCreateMutable(kCFAllocatorDefault, |
| 2177 properties.reset( | 2176 0, |
| 2178 CFDictionaryCreateMutable(kCFAllocatorDefault, | 2177 &kCFTypeDictionaryKeyCallBacks, |
| 2179 0, | 2178 &kCFTypeDictionaryValueCallBacks)); |
| 2180 &kCFTypeDictionaryKeyCallBacks, | 2179 AddIntegerValue(properties, kIOSurfaceWidth, width); |
| 2181 &kCFTypeDictionaryValueCallBacks)); | 2180 AddIntegerValue(properties, kIOSurfaceHeight, height); |
| 2182 AddIntegerValue( | 2181 AddIntegerValue(properties, |
| 2183 properties, io_surface_support->GetKIOSurfaceWidth(), width); | 2182 kIOSurfaceBytesPerElement, |
| 2184 AddIntegerValue( | 2183 GpuMemoryBufferImpl::BytesPerPixel(internalformat)); |
| 2185 properties, io_surface_support->GetKIOSurfaceHeight(), height); | 2184 AddIntegerValue( |
| 2186 AddIntegerValue(properties, | 2185 properties, |
| 2187 io_surface_support->GetKIOSurfaceBytesPerElement(), | 2186 kIOSurfacePixelFormat, |
| 2188 GpuMemoryBufferImpl::BytesPerPixel(internalformat)); | 2187 GpuMemoryBufferImplIOSurface::PixelFormat(internalformat)); |
| 2189 AddIntegerValue( | 2188 // TODO(reveman): Remove this when using a mach_port_t to transfer |
| 2190 properties, | 2189 // IOSurface to renderer process. crbug.com/323304 |
| 2191 io_surface_support->GetKIOSurfacePixelFormat(), | 2190 AddBooleanValue( |
| 2192 GpuMemoryBufferImplIOSurface::PixelFormat(internalformat)); | 2191 properties, kIOSurfaceIsGlobal, true); |
| 2193 // TODO(reveman): Remove this when using a mach_port_t to transfer | |
| 2194 // IOSurface to renderer process. crbug.com/323304 | |
| 2195 AddBooleanValue( | |
| 2196 properties, io_surface_support->GetKIOSurfaceIsGlobal(), true); | |
| 2197 | 2192 |
| 2198 base::ScopedCFTypeRef<CFTypeRef> io_surface( | 2193 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(IOSurfaceCreate(properties)); |
| 2199 io_surface_support->IOSurfaceCreate(properties)); | 2194 if (io_surface) { |
| 2200 if (io_surface) { | 2195 gfx::GpuMemoryBufferHandle handle; |
| 2201 gfx::GpuMemoryBufferHandle handle; | 2196 handle.type = gfx::IO_SURFACE_BUFFER; |
| 2202 handle.type = gfx::IO_SURFACE_BUFFER; | 2197 handle.io_surface_id = IOSurfaceGetID(io_surface); |
| 2203 handle.io_surface_id = io_surface_support->IOSurfaceGetID(io_surface); | |
| 2204 | 2198 |
| 2205 // TODO(reveman): This makes the assumption that the renderer will | 2199 // TODO(reveman): This makes the assumption that the renderer will |
| 2206 // grab a reference to the surface before sending another message. | 2200 // grab a reference to the surface before sending another message. |
| 2207 // crbug.com/325045 | 2201 // crbug.com/325045 |
| 2208 last_io_surface_ = io_surface; | 2202 last_io_surface_ = io_surface; |
| 2209 GpuMemoryBufferAllocated(reply, handle); | 2203 GpuMemoryBufferAllocated(reply, handle); |
| 2210 return; | 2204 return; |
| 2211 } | |
| 2212 } | 2205 } |
| 2213 } | 2206 } |
| 2214 #endif | 2207 #endif |
| 2215 | 2208 |
| 2216 #if defined(OS_ANDROID) | 2209 #if defined(OS_ANDROID) |
| 2217 // TODO(reveman): This should be moved to | 2210 // TODO(reveman): This should be moved to |
| 2218 // GpuMemoryBufferImpl::AllocateForChildProcess and | 2211 // GpuMemoryBufferImpl::AllocateForChildProcess and |
| 2219 // GpuMemoryBufferImplSurfaceTexture when adding support for out-of-process | 2212 // GpuMemoryBufferImplSurfaceTexture when adding support for out-of-process |
| 2220 // GPU service. crbug.com/368716 | 2213 // GPU service. crbug.com/368716 |
| 2221 if (GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported( | 2214 if (GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2248 void RenderProcessHostImpl::GpuMemoryBufferAllocated( | 2241 void RenderProcessHostImpl::GpuMemoryBufferAllocated( |
| 2249 IPC::Message* reply, | 2242 IPC::Message* reply, |
| 2250 const gfx::GpuMemoryBufferHandle& handle) { | 2243 const gfx::GpuMemoryBufferHandle& handle) { |
| 2251 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2244 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2252 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, | 2245 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, |
| 2253 handle); | 2246 handle); |
| 2254 Send(reply); | 2247 Send(reply); |
| 2255 } | 2248 } |
| 2256 | 2249 |
| 2257 } // namespace content | 2250 } // namespace content |
| OLD | NEW |