| 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 28 matching lines...) Expand all Loading... |
| 39 ppapi::ProxyLock::AssertAcquiredDebugOnly(); | 39 ppapi::ProxyLock::AssertAcquiredDebugOnly(); |
| 40 return last_state_; | 40 return last_state_; |
| 41 } | 41 } |
| 42 | 42 |
| 43 int32 PpapiCommandBufferProxy::GetLastToken() { | 43 int32 PpapiCommandBufferProxy::GetLastToken() { |
| 44 ppapi::ProxyLock::AssertAcquiredDebugOnly(); | 44 ppapi::ProxyLock::AssertAcquiredDebugOnly(); |
| 45 TryUpdateState(); | 45 TryUpdateState(); |
| 46 return last_state_.token; | 46 return last_state_.token; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void PpapiCommandBufferProxy::Flush(int32 put_offset) { | 49 void PpapiCommandBufferProxy::Flush(int32 put_offset, |
| 50 const std::vector<uint32>& sync_points) { |
| 50 if (last_state_.error != gpu::error::kNoError) | 51 if (last_state_.error != gpu::error::kNoError) |
| 51 return; | 52 return; |
| 52 | 53 |
| 53 IPC::Message* message = new PpapiHostMsg_PPBGraphics3D_AsyncFlush( | 54 IPC::Message* message = new PpapiHostMsg_PPBGraphics3D_AsyncFlush( |
| 54 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, put_offset); | 55 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, put_offset, sync_points); |
| 55 | 56 |
| 56 // Do not let a synchronous flush hold up this message. If this handler is | 57 // Do not let a synchronous flush hold up this message. If this handler is |
| 57 // deferred until after the synchronous flush completes, it will overwrite the | 58 // deferred until after the synchronous flush completes, it will overwrite the |
| 58 // cached last_state_ with out-of-date data. | 59 // cached last_state_ with out-of-date data. |
| 59 message->set_unblock(true); | 60 message->set_unblock(true); |
| 60 Send(message); | 61 Send(message); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void PpapiCommandBufferProxy::WaitForTokenInRange(int32 start, int32 end) { | 64 void PpapiCommandBufferProxy::WaitForTokenInRange(int32 start, int32 end) { |
| 64 TryUpdateState(); | 65 TryUpdateState(); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 shared_state()->Read(&last_state_); | 250 shared_state()->Read(&last_state_); |
| 250 } | 251 } |
| 251 | 252 |
| 252 gpu::CommandBufferSharedState* PpapiCommandBufferProxy::shared_state() const { | 253 gpu::CommandBufferSharedState* PpapiCommandBufferProxy::shared_state() const { |
| 253 return reinterpret_cast<gpu::CommandBufferSharedState*>( | 254 return reinterpret_cast<gpu::CommandBufferSharedState*>( |
| 254 shared_state_shm_->memory()); | 255 shared_state_shm_->memory()); |
| 255 } | 256 } |
| 256 | 257 |
| 257 } // namespace proxy | 258 } // namespace proxy |
| 258 } // namespace ppapi | 259 } // namespace ppapi |
| OLD | NEW |