OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/proxy/ppapi_command_buffer_proxy.h" | 5 #include "ppapi/proxy/ppapi_command_buffer_proxy.h" |
6 | 6 |
7 #include "ppapi/proxy/ppapi_messages.h" | 7 #include "ppapi/proxy/ppapi_messages.h" |
8 #include "ppapi/proxy/proxy_channel.h" | 8 #include "ppapi/proxy/proxy_channel.h" |
9 #include "ppapi/shared_impl/api_id.h" | 9 #include "ppapi/shared_impl/api_id.h" |
10 #include "ppapi/shared_impl/host_resource.h" | 10 #include "ppapi/shared_impl/host_resource.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 void PpapiCommandBufferProxy::SetParseError(gpu::error::Error error) { | 220 void PpapiCommandBufferProxy::SetParseError(gpu::error::Error error) { |
221 NOTREACHED(); | 221 NOTREACHED(); |
222 } | 222 } |
223 | 223 |
224 void PpapiCommandBufferProxy::SetContextLostReason( | 224 void PpapiCommandBufferProxy::SetContextLostReason( |
225 gpu::error::ContextLostReason reason) { | 225 gpu::error::ContextLostReason reason) { |
226 NOTREACHED(); | 226 NOTREACHED(); |
227 } | 227 } |
228 | 228 |
| 229 uint32 PpapiCommandBufferProxy::InsertSyncPoint() { |
| 230 uint32 sync_point = 0; |
| 231 if (last_state_.error == gpu::error::kNoError) { |
| 232 Send(new PpapiHostMsg_PPBGraphics3D_InsertSyncPoint( |
| 233 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &sync_point)); |
| 234 } |
| 235 return sync_point; |
| 236 } |
| 237 |
229 bool PpapiCommandBufferProxy::Send(IPC::Message* msg) { | 238 bool PpapiCommandBufferProxy::Send(IPC::Message* msg) { |
230 DCHECK(last_state_.error == gpu::error::kNoError); | 239 DCHECK(last_state_.error == gpu::error::kNoError); |
231 | 240 |
232 if (channel_->Send(msg)) | 241 if (channel_->Send(msg)) |
233 return true; | 242 return true; |
234 | 243 |
235 last_state_.error = gpu::error::kLostContext; | 244 last_state_.error = gpu::error::kLostContext; |
236 return false; | 245 return false; |
237 } | 246 } |
238 | 247 |
239 void PpapiCommandBufferProxy::UpdateState( | 248 void PpapiCommandBufferProxy::UpdateState( |
240 const gpu::CommandBuffer::State& state, | 249 const gpu::CommandBuffer::State& state, |
241 bool success) { | 250 bool success) { |
242 // Handle wraparound. It works as long as we don't have more than 2B state | 251 // Handle wraparound. It works as long as we don't have more than 2B state |
243 // updates in flight across which reordering occurs. | 252 // updates in flight across which reordering occurs. |
244 if (success) { | 253 if (success) { |
245 if (state.generation - last_state_.generation < 0x80000000U) { | 254 if (state.generation - last_state_.generation < 0x80000000U) { |
246 last_state_ = state; | 255 last_state_ = state; |
247 } | 256 } |
248 } else { | 257 } else { |
249 last_state_.error = gpu::error::kLostContext; | 258 last_state_.error = gpu::error::kLostContext; |
250 ++last_state_.generation; | 259 ++last_state_.generation; |
251 } | 260 } |
252 } | 261 } |
253 | 262 |
254 } // namespace proxy | 263 } // namespace proxy |
255 } // namespace ppapi | 264 } // namespace ppapi |
OLD | NEW |