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 #include "content/renderer/gpu/command_buffer_proxy.h" | 5 #include "content/renderer/gpu/command_buffer_proxy.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 gpu::error::Error error) { | 325 gpu::error::Error error) { |
326 // Not implemented in proxy. | 326 // Not implemented in proxy. |
327 NOTREACHED(); | 327 NOTREACHED(); |
328 } | 328 } |
329 | 329 |
330 void CommandBufferProxy::OnSwapBuffers() { | 330 void CommandBufferProxy::OnSwapBuffers() { |
331 if (swap_buffers_callback_.get()) | 331 if (swap_buffers_callback_.get()) |
332 swap_buffers_callback_->Run(); | 332 swap_buffers_callback_->Run(); |
333 } | 333 } |
334 | 334 |
| 335 bool CommandBufferProxy::SetParent(CommandBufferProxy* parent_command_buffer, |
| 336 uint32 parent_texture_id) { |
| 337 if (last_state_.error != gpu::error::kNoError) |
| 338 return false; |
| 339 |
| 340 bool result; |
| 341 if (parent_command_buffer) { |
| 342 if (!Send(new GpuCommandBufferMsg_SetParent( |
| 343 route_id_, |
| 344 parent_command_buffer->route_id_, |
| 345 parent_texture_id, |
| 346 &result))) { |
| 347 return false; |
| 348 } |
| 349 } else { |
| 350 if (!Send(new GpuCommandBufferMsg_SetParent( |
| 351 route_id_, |
| 352 MSG_ROUTING_NONE, |
| 353 0, |
| 354 &result))) { |
| 355 return false; |
| 356 } |
| 357 } |
| 358 |
| 359 return result; |
| 360 } |
| 361 |
335 void CommandBufferProxy::SetSwapBuffersCallback(Callback0::Type* callback) { | 362 void CommandBufferProxy::SetSwapBuffersCallback(Callback0::Type* callback) { |
336 swap_buffers_callback_.reset(callback); | 363 swap_buffers_callback_.reset(callback); |
337 } | 364 } |
338 | 365 |
339 void CommandBufferProxy::ResizeOffscreenFrameBuffer(const gfx::Size& size) { | 366 void CommandBufferProxy::ResizeOffscreenFrameBuffer(const gfx::Size& size) { |
340 if (last_state_.error != gpu::error::kNoError) | 367 if (last_state_.error != gpu::error::kNoError) |
341 return; | 368 return; |
342 | 369 |
343 Send(new GpuCommandBufferMsg_ResizeOffscreenFrameBuffer(route_id_, size)); | 370 Send(new GpuCommandBufferMsg_ResizeOffscreenFrameBuffer(route_id_, size)); |
344 } | 371 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 delete msg; | 404 delete msg; |
378 return false; | 405 return false; |
379 } | 406 } |
380 | 407 |
381 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { | 408 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { |
382 // Handle wraparound. It works as long as we don't have more than 2B state | 409 // Handle wraparound. It works as long as we don't have more than 2B state |
383 // updates in flight across which reordering occurs. | 410 // updates in flight across which reordering occurs. |
384 if (state.generation - last_state_.generation < 0x80000000U) | 411 if (state.generation - last_state_.generation < 0x80000000U) |
385 last_state_ = state; | 412 last_state_ = state; |
386 } | 413 } |
OLD | NEW |