| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Send will flag state with lost context if IPC fails. | 151 // Send will flag state with lost context if IPC fails. |
| 152 if (last_state_.error == gpu::error::kNoError) { | 152 if (last_state_.error == gpu::error::kNoError) { |
| 153 gpu::CommandBuffer::State state; | 153 gpu::CommandBuffer::State state; |
| 154 if (Send(new GpuCommandBufferMsg_GetState(route_id_, &state))) | 154 if (Send(new GpuCommandBufferMsg_GetState(route_id_, &state))) |
| 155 OnUpdateState(state); | 155 OnUpdateState(state); |
| 156 } | 156 } |
| 157 | 157 |
| 158 return last_state_; | 158 return last_state_; |
| 159 } | 159 } |
| 160 | 160 |
| 161 gpu::CommandBuffer::State CommandBufferProxy::GetLastState() { |
| 162 return last_state_; |
| 163 } |
| 164 |
| 161 void CommandBufferProxy::Flush(int32 put_offset) { | 165 void CommandBufferProxy::Flush(int32 put_offset) { |
| 162 if (last_state_.error != gpu::error::kNoError) | 166 if (last_state_.error != gpu::error::kNoError) |
| 163 return; | 167 return; |
| 164 | 168 |
| 165 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, | 169 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, |
| 166 put_offset, | 170 put_offset, |
| 167 ++flush_count_)); | 171 ++flush_count_)); |
| 168 } | 172 } |
| 169 | 173 |
| 170 gpu::CommandBuffer::State CommandBufferProxy::FlushSync(int32 put_offset, | 174 gpu::CommandBuffer::State CommandBufferProxy::FlushSync(int32 put_offset, |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 delete msg; | 408 delete msg; |
| 405 return false; | 409 return false; |
| 406 } | 410 } |
| 407 | 411 |
| 408 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { | 412 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { |
| 409 // Handle wraparound. It works as long as we don't have more than 2B state | 413 // Handle wraparound. It works as long as we don't have more than 2B state |
| 410 // updates in flight across which reordering occurs. | 414 // updates in flight across which reordering occurs. |
| 411 if (state.generation - last_state_.generation < 0x80000000U) | 415 if (state.generation - last_state_.generation < 0x80000000U) |
| 412 last_state_ = state; | 416 last_state_ = state; |
| 413 } | 417 } |
| OLD | NEW |