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 |
352 bool CommandBufferProxy::SetParent(CommandBufferProxy* parent_command_buffer, | 373 bool CommandBufferProxy::SetParent(CommandBufferProxy* parent_command_buffer, |
353 uint32 parent_texture_id) { | 374 uint32 parent_texture_id) { |
354 if (last_state_.error != gpu::error::kNoError) | 375 if (last_state_.error != gpu::error::kNoError) |
355 return false; | 376 return false; |
356 | 377 |
357 bool result; | 378 bool result; |
358 if (parent_command_buffer) { | 379 if (parent_command_buffer) { |
359 if (!Send(new GpuCommandBufferMsg_SetParent( | 380 if (!Send(new GpuCommandBufferMsg_SetParent( |
360 route_id_, | 381 route_id_, |
361 parent_command_buffer->route_id_, | 382 parent_command_buffer->route_id_, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 delete msg; | 457 delete msg; |
437 return false; | 458 return false; |
438 } | 459 } |
439 | 460 |
440 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { | 461 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { |
441 // Handle wraparound. It works as long as we don't have more than 2B state | 462 // Handle wraparound. It works as long as we don't have more than 2B state |
442 // updates in flight across which reordering occurs. | 463 // updates in flight across which reordering occurs. |
443 if (state.generation - last_state_.generation < 0x80000000U) | 464 if (state.generation - last_state_.generation < 0x80000000U) |
444 last_state_ = state; | 465 last_state_ = state; |
445 } | 466 } |
OLD | NEW |