| 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 323 |
| 324 if (!Send(new GpuChannelMsg_Echo(GpuCommandBufferMsg_EchoAck(route_id_)))) { | 324 if (!Send(new GpuChannelMsg_Echo(GpuCommandBufferMsg_EchoAck(route_id_)))) { |
| 325 return false; | 325 return false; |
| 326 } | 326 } |
| 327 | 327 |
| 328 echo_tasks_.push(callback); | 328 echo_tasks_.push(callback); |
| 329 | 329 |
| 330 return true; | 330 return true; |
| 331 } | 331 } |
| 332 | 332 |
| 333 bool CommandBufferProxy::SetSurfaceVisible(bool visible) { | 333 bool CommandBufferProxy::SetResourceUsage( |
| 334 if (last_state_.error != gpu::error::kNoError) { | 334 gfx::GLSurface::ResourceUsage resourceUsage) { |
| 335 if (last_state_.error != gpu::error::kNoError) |
| 335 return false; | 336 return false; |
| 336 } | |
| 337 | 337 |
| 338 return Send(new GpuCommandBufferMsg_SetSurfaceVisible(route_id_, visible)); | 338 return Send(new GpuCommandBufferMsg_SetResourceUsage( |
| 339 route_id_, resourceUsage)); |
| 339 } | 340 } |
| 340 | 341 |
| 341 | 342 |
| 342 bool CommandBufferProxy::SetParent(CommandBufferProxy* parent_command_buffer, | 343 bool CommandBufferProxy::SetParent(CommandBufferProxy* parent_command_buffer, |
| 343 uint32 parent_texture_id) { | 344 uint32 parent_texture_id) { |
| 344 if (last_state_.error != gpu::error::kNoError) | 345 if (last_state_.error != gpu::error::kNoError) |
| 345 return false; | 346 return false; |
| 346 | 347 |
| 347 bool result; | 348 bool result; |
| 348 if (parent_command_buffer) { | 349 if (parent_command_buffer) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 delete msg; | 414 delete msg; |
| 414 return false; | 415 return false; |
| 415 } | 416 } |
| 416 | 417 |
| 417 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { | 418 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { |
| 418 // Handle wraparound. It works as long as we don't have more than 2B state | 419 // Handle wraparound. It works as long as we don't have more than 2B state |
| 419 // updates in flight across which reordering occurs. | 420 // updates in flight across which reordering occurs. |
| 420 if (state.generation - last_state_.generation < 0x80000000U) | 421 if (state.generation - last_state_.generation < 0x80000000U) |
| 421 last_state_ = state; | 422 last_state_ = state; |
| 422 } | 423 } |
| OLD | NEW |