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/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 10 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 mailbox_manager, | 190 mailbox_manager, |
191 client_id, | 191 client_id, |
192 false, | 192 false, |
193 allow_future_sync_points)); | 193 allow_future_sync_points)); |
194 channel->Init(io_message_loop_.get(), shutdown_event_); | 194 channel->Init(io_message_loop_.get(), shutdown_event_); |
195 channel_handle.name = channel->GetChannelName(); | 195 channel_handle.name = channel->GetChannelName(); |
196 | 196 |
197 #if defined(OS_POSIX) | 197 #if defined(OS_POSIX) |
198 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so | 198 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so |
199 // that it gets closed after it has been sent. | 199 // that it gets closed after it has been sent. |
200 int renderer_fd = channel->TakeRendererFileDescriptor(); | 200 base::ScopedFD renderer_fd = channel->TakeRendererFileDescriptor(); |
201 DCHECK_NE(-1, renderer_fd); | 201 DCHECK(renderer_fd.is_valid()); |
202 channel_handle.socket = base::FileDescriptor(renderer_fd, true); | 202 channel_handle.socket = base::FileDescriptor(renderer_fd.Pass()); |
203 #endif | 203 #endif |
204 | 204 |
205 gpu_channels_.set(client_id, channel.Pass()); | 205 gpu_channels_.set(client_id, channel.Pass()); |
206 | 206 |
207 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); | 207 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); |
208 } | 208 } |
209 | 209 |
210 void GpuChannelManager::OnCloseChannel( | 210 void GpuChannelManager::OnCloseChannel( |
211 const IPC::ChannelHandle& channel_handle) { | 211 const IPC::ChannelHandle& channel_handle) { |
212 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); | 212 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 304 |
305 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 305 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
306 if (!default_offscreen_surface_.get()) { | 306 if (!default_offscreen_surface_.get()) { |
307 default_offscreen_surface_ = | 307 default_offscreen_surface_ = |
308 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); | 308 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); |
309 } | 309 } |
310 return default_offscreen_surface_.get(); | 310 return default_offscreen_surface_.get(); |
311 } | 311 } |
312 | 312 |
313 } // namespace content | 313 } // namespace content |
OLD | NEW |