| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // Send will flag state with lost context if IPC fails. | 158 // Send will flag state with lost context if IPC fails. |
| 159 if (last_state_.error == gpu::error::kNoError) { | 159 if (last_state_.error == gpu::error::kNoError) { |
| 160 gpu::CommandBuffer::State state; | 160 gpu::CommandBuffer::State state; |
| 161 if (Send(new GpuCommandBufferMsg_GetState(route_id_, &state))) | 161 if (Send(new GpuCommandBufferMsg_GetState(route_id_, &state))) |
| 162 OnUpdateState(state); | 162 OnUpdateState(state); |
| 163 } | 163 } |
| 164 | 164 |
| 165 return last_state_; | 165 return last_state_; |
| 166 } | 166 } |
| 167 | 167 |
| 168 gpu::CommandBuffer::State CommandBufferProxy::GetLastState() { | |
| 169 return last_state_; | |
| 170 } | |
| 171 | |
| 172 void CommandBufferProxy::Flush(int32 put_offset) { | 168 void CommandBufferProxy::Flush(int32 put_offset) { |
| 173 if (last_state_.error != gpu::error::kNoError) | 169 if (last_state_.error != gpu::error::kNoError) |
| 174 return; | 170 return; |
| 175 | 171 |
| 176 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, | 172 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, |
| 177 put_offset, | 173 put_offset, |
| 178 ++flush_count_)); | 174 ++flush_count_)); |
| 179 } | 175 } |
| 180 | 176 |
| 181 gpu::CommandBuffer::State CommandBufferProxy::FlushSync(int32 put_offset, | 177 gpu::CommandBuffer::State CommandBufferProxy::FlushSync(int32 put_offset, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 delete msg; | 433 delete msg; |
| 438 return false; | 434 return false; |
| 439 } | 435 } |
| 440 | 436 |
| 441 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { | 437 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { |
| 442 // Handle wraparound. It works as long as we don't have more than 2B state | 438 // Handle wraparound. It works as long as we don't have more than 2B state |
| 443 // updates in flight across which reordering occurs. | 439 // updates in flight across which reordering occurs. |
| 444 if (state.generation - last_state_.generation < 0x80000000U) | 440 if (state.generation - last_state_.generation < 0x80000000U) |
| 445 last_state_ = state; | 441 last_state_ = state; |
| 446 } | 442 } |
| OLD | NEW |