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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
11 #include "ppapi/shared_impl/api_id.h" | 11 #include "ppapi/shared_impl/api_id.h" |
12 #include "ppapi/shared_impl/host_resource.h" | 12 #include "ppapi/shared_impl/host_resource.h" |
13 #include "ppapi/shared_impl/proxy_lock.h" | 13 #include "ppapi/shared_impl/proxy_lock.h" |
14 | 14 |
15 namespace ppapi { | 15 namespace ppapi { |
16 namespace proxy { | 16 namespace proxy { |
17 | 17 |
18 PpapiCommandBufferProxy::PpapiCommandBufferProxy( | 18 PpapiCommandBufferProxy::PpapiCommandBufferProxy( |
19 const ppapi::HostResource& resource, | 19 const ppapi::HostResource& resource, |
20 PluginDispatcher* dispatcher, | 20 PluginDispatcher* dispatcher, |
21 const gpu::Capabilities& capabilities, | 21 const gpu::Capabilities& capabilities, |
22 const SerializedHandle& shared_state, | 22 const SerializedHandle& shared_state, |
23 uint64_t command_buffer_id) | 23 gpu::CommandBufferId command_buffer_id) |
24 : command_buffer_id_(command_buffer_id), | 24 : command_buffer_id_(command_buffer_id), |
25 capabilities_(capabilities), | 25 capabilities_(capabilities), |
26 resource_(resource), | 26 resource_(resource), |
27 dispatcher_(dispatcher), | 27 dispatcher_(dispatcher), |
28 next_fence_sync_release_(1), | 28 next_fence_sync_release_(1), |
29 pending_fence_sync_release_(0), | 29 pending_fence_sync_release_(0), |
30 flushed_fence_sync_release_(0), | 30 flushed_fence_sync_release_(0), |
31 validated_fence_sync_release_(0) { | 31 validated_fence_sync_release_(0) { |
32 shared_state_shm_.reset( | 32 shared_state_shm_.reset( |
33 new base::SharedMemory(shared_state.shmem(), false)); | 33 new base::SharedMemory(shared_state.shmem(), false)); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 DCHECK_GE(flushed_fence_sync_release_, validated_fence_sync_release_); | 188 DCHECK_GE(flushed_fence_sync_release_, validated_fence_sync_release_); |
189 Send(new PpapiHostMsg_PPBGraphics3D_EnsureWorkVisible( | 189 Send(new PpapiHostMsg_PPBGraphics3D_EnsureWorkVisible( |
190 ppapi::API_ID_PPB_GRAPHICS_3D, resource_)); | 190 ppapi::API_ID_PPB_GRAPHICS_3D, resource_)); |
191 validated_fence_sync_release_ = flushed_fence_sync_release_; | 191 validated_fence_sync_release_ = flushed_fence_sync_release_; |
192 } | 192 } |
193 | 193 |
194 gpu::CommandBufferNamespace PpapiCommandBufferProxy::GetNamespaceID() const { | 194 gpu::CommandBufferNamespace PpapiCommandBufferProxy::GetNamespaceID() const { |
195 return gpu::CommandBufferNamespace::GPU_IO; | 195 return gpu::CommandBufferNamespace::GPU_IO; |
196 } | 196 } |
197 | 197 |
198 uint64_t PpapiCommandBufferProxy::GetCommandBufferID() const { | 198 gpu::CommandBufferId PpapiCommandBufferProxy::GetCommandBufferID() const { |
199 return command_buffer_id_; | 199 return command_buffer_id_; |
200 } | 200 } |
201 | 201 |
202 uint64_t PpapiCommandBufferProxy::GenerateFenceSyncRelease() { | 202 uint64_t PpapiCommandBufferProxy::GenerateFenceSyncRelease() { |
203 return next_fence_sync_release_++; | 203 return next_fence_sync_release_++; |
204 } | 204 } |
205 | 205 |
206 bool PpapiCommandBufferProxy::IsFenceSyncRelease(uint64_t release) { | 206 bool PpapiCommandBufferProxy::IsFenceSyncRelease(uint64_t release) { |
207 return release != 0 && release < next_fence_sync_release_; | 207 return release != 0 && release < next_fence_sync_release_; |
208 } | 208 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 message->set_unblock(true); | 321 message->set_unblock(true); |
322 Send(message); | 322 Send(message); |
323 | 323 |
324 flush_info_->flush_pending = false; | 324 flush_info_->flush_pending = false; |
325 flush_info_->resource.SetHostResource(0, 0); | 325 flush_info_->resource.SetHostResource(0, 0); |
326 flushed_fence_sync_release_ = pending_fence_sync_release_; | 326 flushed_fence_sync_release_ = pending_fence_sync_release_; |
327 } | 327 } |
328 | 328 |
329 } // namespace proxy | 329 } // namespace proxy |
330 } // namespace ppapi | 330 } // namespace ppapi |
OLD | NEW |