| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 gpu::error::ContextLostReason reason) { | 342 gpu::error::ContextLostReason reason) { |
| 343 // Not implemented in proxy. | 343 // Not implemented in proxy. |
| 344 NOTREACHED(); | 344 NOTREACHED(); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void CommandBufferProxy::OnSwapBuffers() { | 347 void CommandBufferProxy::OnSwapBuffers() { |
| 348 if (swap_buffers_callback_.get()) | 348 if (swap_buffers_callback_.get()) |
| 349 swap_buffers_callback_->Run(); | 349 swap_buffers_callback_->Run(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 bool CommandBufferProxy::MapExternalResource( | |
| 353 gpu::resource_type::ResourceType resource_type, | |
| 354 uint32 resource_source_id, | |
| 355 CommandBufferProxy* source_command_buffer, | |
| 356 uint32 resource_dest_id) { | |
| 357 if (last_state_.error != gpu::error::kNoError) | |
| 358 return false; | |
| 359 | |
| 360 if (!Send(new GpuCommandBufferMsg_MapExternalResource( | |
| 361 route_id_, | |
| 362 resource_type, | |
| 363 resource_source_id, | |
| 364 source_command_buffer ? | |
| 365 source_command_buffer->route_id() : MSG_ROUTING_NONE, | |
| 366 resource_dest_id))) { | |
| 367 return false; | |
| 368 } | |
| 369 | |
| 370 return true; | |
| 371 } | |
| 372 | |
| 373 bool CommandBufferProxy::SetParent(CommandBufferProxy* parent_command_buffer, | 352 bool CommandBufferProxy::SetParent(CommandBufferProxy* parent_command_buffer, |
| 374 uint32 parent_texture_id) { | 353 uint32 parent_texture_id) { |
| 375 if (last_state_.error != gpu::error::kNoError) | 354 if (last_state_.error != gpu::error::kNoError) |
| 376 return false; | 355 return false; |
| 377 | 356 |
| 378 bool result; | 357 bool result; |
| 379 if (parent_command_buffer) { | 358 if (parent_command_buffer) { |
| 380 if (!Send(new GpuCommandBufferMsg_SetParent( | 359 if (!Send(new GpuCommandBufferMsg_SetParent( |
| 381 route_id_, | 360 route_id_, |
| 382 parent_command_buffer->route_id_, | 361 parent_command_buffer->route_id_, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 delete msg; | 436 delete msg; |
| 458 return false; | 437 return false; |
| 459 } | 438 } |
| 460 | 439 |
| 461 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { | 440 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { |
| 462 // Handle wraparound. It works as long as we don't have more than 2B state | 441 // Handle wraparound. It works as long as we don't have more than 2B state |
| 463 // updates in flight across which reordering occurs. | 442 // updates in flight across which reordering occurs. |
| 464 if (state.generation - last_state_.generation < 0x80000000U) | 443 if (state.generation - last_state_.generation < 0x80000000U) |
| 465 last_state_ = state; | 444 last_state_ = state; |
| 466 } | 445 } |
| OLD | NEW |