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