| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
| 6 #include <windows.h> | 6 #include <windows.h> |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 gfx::PluginWindowHandle window, | 144 gfx::PluginWindowHandle window, |
| 145 int32 render_view_id, | 145 int32 render_view_id, |
| 146 const GPUCreateCommandBufferConfig& init_params, | 146 const GPUCreateCommandBufferConfig& init_params, |
| 147 int32* route_id) { | 147 int32* route_id) { |
| 148 *route_id = MSG_ROUTING_NONE; | 148 *route_id = MSG_ROUTING_NONE; |
| 149 content::GetContentClient()->SetActiveURL(init_params.active_url); | 149 content::GetContentClient()->SetActiveURL(init_params.active_url); |
| 150 | 150 |
| 151 #if defined(ENABLE_GPU) | 151 #if defined(ENABLE_GPU) |
| 152 *route_id = GenerateRouteID(); | 152 *route_id = GenerateRouteID(); |
| 153 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 153 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
| 154 this, window, NULL, gfx::Size(), disallowed_extensions_, | 154 this, window, gfx::Size(), disallowed_extensions_, |
| 155 init_params.allowed_extensions, | 155 init_params.allowed_extensions, |
| 156 init_params.attribs, 0, *route_id, renderer_id_, render_view_id, | 156 init_params.attribs, *route_id, renderer_id_, render_view_id, |
| 157 watchdog_)); | 157 watchdog_)); |
| 158 router_.AddRoute(*route_id, stub.get()); | 158 router_.AddRoute(*route_id, stub.get()); |
| 159 stubs_.AddWithID(stub.release(), *route_id); | 159 stubs_.AddWithID(stub.release(), *route_id); |
| 160 #endif // ENABLE_GPU | 160 #endif // ENABLE_GPU |
| 161 } | 161 } |
| 162 | 162 |
| 163 void GpuChannel::ViewResized(int32 command_buffer_route_id) { | 163 void GpuChannel::ViewResized(int32 command_buffer_route_id) { |
| 164 GpuCommandBufferStub* stub = stubs_.Lookup(command_buffer_route_id); | 164 GpuCommandBufferStub* stub = stubs_.Lookup(command_buffer_route_id); |
| 165 if (stub == NULL) | 165 if (stub == NULL) |
| 166 return; | 166 return; |
| 167 | 167 |
| 168 stub->ViewResized(); | 168 stub->ViewResized(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) { |
| 172 return stubs_.Lookup(route_id); |
| 173 } |
| 174 |
| 171 #if defined(OS_MACOSX) | 175 #if defined(OS_MACOSX) |
| 172 void GpuChannel::AcceleratedSurfaceBuffersSwapped( | 176 void GpuChannel::AcceleratedSurfaceBuffersSwapped( |
| 173 int32 route_id, uint64 swap_buffers_count) { | 177 int32 route_id, uint64 swap_buffers_count) { |
| 174 GpuCommandBufferStub* stub = stubs_.Lookup(route_id); | 178 GpuCommandBufferStub* stub = stubs_.Lookup(route_id); |
| 175 if (stub == NULL) | 179 if (stub == NULL) |
| 176 return; | 180 return; |
| 177 stub->AcceleratedSurfaceBuffersSwapped(swap_buffers_count); | 181 stub->AcceleratedSurfaceBuffersSwapped(swap_buffers_count); |
| 178 } | 182 } |
| 179 | 183 |
| 180 void GpuChannel::DestroyCommandBufferByViewId(int32 render_view_id) { | 184 void GpuChannel::DestroyCommandBufferByViewId(int32 render_view_id) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 void GpuChannel::OnInitialize(base::ProcessHandle renderer_process) { | 228 void GpuChannel::OnInitialize(base::ProcessHandle renderer_process) { |
| 225 // Initialize should only happen once. | 229 // Initialize should only happen once. |
| 226 DCHECK(!renderer_process_); | 230 DCHECK(!renderer_process_); |
| 227 | 231 |
| 228 // Verify that the renderer has passed its own process handle. | 232 // Verify that the renderer has passed its own process handle. |
| 229 if (base::GetProcId(renderer_process) == renderer_pid_) | 233 if (base::GetProcId(renderer_process) == renderer_pid_) |
| 230 renderer_process_ = renderer_process; | 234 renderer_process_ = renderer_process; |
| 231 } | 235 } |
| 232 | 236 |
| 233 void GpuChannel::OnCreateOffscreenCommandBuffer( | 237 void GpuChannel::OnCreateOffscreenCommandBuffer( |
| 234 int32 parent_route_id, | |
| 235 const gfx::Size& size, | 238 const gfx::Size& size, |
| 236 const GPUCreateCommandBufferConfig& init_params, | 239 const GPUCreateCommandBufferConfig& init_params, |
| 237 uint32 parent_texture_id, | |
| 238 int32* route_id) { | 240 int32* route_id) { |
| 239 content::GetContentClient()->SetActiveURL(init_params.active_url); | 241 content::GetContentClient()->SetActiveURL(init_params.active_url); |
| 240 #if defined(ENABLE_GPU) | 242 #if defined(ENABLE_GPU) |
| 241 *route_id = GenerateRouteID(); | 243 *route_id = GenerateRouteID(); |
| 242 GpuCommandBufferStub* parent_stub = NULL; | |
| 243 if (parent_route_id != 0) | |
| 244 parent_stub = stubs_.Lookup(parent_route_id); | |
| 245 | 244 |
| 246 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 245 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
| 247 this, | 246 this, |
| 248 gfx::kNullPluginWindow, | 247 gfx::kNullPluginWindow, |
| 249 parent_stub, | |
| 250 size, | 248 size, |
| 251 disallowed_extensions_, | 249 disallowed_extensions_, |
| 252 init_params.allowed_extensions, | 250 init_params.allowed_extensions, |
| 253 init_params.attribs, | 251 init_params.attribs, |
| 254 parent_texture_id, | |
| 255 *route_id, | 252 *route_id, |
| 256 0, 0, watchdog_)); | 253 0, 0, watchdog_)); |
| 257 router_.AddRoute(*route_id, stub.get()); | 254 router_.AddRoute(*route_id, stub.get()); |
| 258 stubs_.AddWithID(stub.release(), *route_id); | 255 stubs_.AddWithID(stub.release(), *route_id); |
| 259 TRACE_EVENT1("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer", | 256 TRACE_EVENT1("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer", |
| 260 "route_id", route_id); | 257 "route_id", route_id); |
| 261 #else | 258 #else |
| 262 *route_id = MSG_ROUTING_NONE; | 259 *route_id = MSG_ROUTING_NONE; |
| 263 #endif | 260 #endif |
| 264 } | 261 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 390 |
| 394 #if defined(OS_POSIX) | 391 #if defined(OS_POSIX) |
| 395 int GpuChannel::GetRendererFileDescriptor() { | 392 int GpuChannel::GetRendererFileDescriptor() { |
| 396 int fd = -1; | 393 int fd = -1; |
| 397 if (channel_.get()) { | 394 if (channel_.get()) { |
| 398 fd = channel_->GetClientFileDescriptor(); | 395 fd = channel_->GetClientFileDescriptor(); |
| 399 } | 396 } |
| 400 return fd; | 397 return fd; |
| 401 } | 398 } |
| 402 #endif // defined(OS_POSIX) | 399 #endif // defined(OS_POSIX) |
| OLD | NEW |