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 "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
8 #include "ppapi/proxy/ppapi_messages.h" | 8 #include "ppapi/proxy/ppapi_messages.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" |
11 #include "ppapi/shared_impl/proxy_lock.h" | 11 #include "ppapi/shared_impl/proxy_lock.h" |
12 | 12 |
13 namespace ppapi { | 13 namespace ppapi { |
14 namespace proxy { | 14 namespace proxy { |
15 | 15 |
16 PpapiCommandBufferProxy::PpapiCommandBufferProxy( | 16 PpapiCommandBufferProxy::PpapiCommandBufferProxy( |
17 const ppapi::HostResource& resource, | 17 const ppapi::HostResource& resource, |
18 PluginDispatcher* dispatcher, | 18 PluginDispatcher* dispatcher, |
19 const gpu::Capabilities& capabilities, | 19 const gpu::Capabilities& capabilities, |
20 const SerializedHandle& shared_state) | 20 const SerializedHandle& shared_state, |
21 : capabilities_(capabilities), | 21 uint64_t command_buffer_id) |
| 22 : command_buffer_id_(command_buffer_id), |
| 23 capabilities_(capabilities), |
22 resource_(resource), | 24 resource_(resource), |
23 dispatcher_(dispatcher) { | 25 dispatcher_(dispatcher) { |
24 shared_state_shm_.reset( | 26 shared_state_shm_.reset( |
25 new base::SharedMemory(shared_state.shmem(), false)); | 27 new base::SharedMemory(shared_state.shmem(), false)); |
26 shared_state_shm_->Map(shared_state.size()); | 28 shared_state_shm_->Map(shared_state.size()); |
27 InstanceData* data = dispatcher->GetInstanceData(resource.instance()); | 29 InstanceData* data = dispatcher->GetInstanceData(resource.instance()); |
28 flush_info_ = &data->flush_info_; | 30 flush_info_ = &data->flush_info_; |
29 } | 31 } |
30 | 32 |
31 PpapiCommandBufferProxy::~PpapiCommandBufferProxy() { | 33 PpapiCommandBufferProxy::~PpapiCommandBufferProxy() { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 172 |
171 void PpapiCommandBufferProxy::SetLock(base::Lock*) { | 173 void PpapiCommandBufferProxy::SetLock(base::Lock*) { |
172 NOTIMPLEMENTED(); | 174 NOTIMPLEMENTED(); |
173 } | 175 } |
174 | 176 |
175 bool PpapiCommandBufferProxy::IsGpuChannelLost() { | 177 bool PpapiCommandBufferProxy::IsGpuChannelLost() { |
176 NOTIMPLEMENTED(); | 178 NOTIMPLEMENTED(); |
177 return false; | 179 return false; |
178 } | 180 } |
179 | 181 |
| 182 gpu::CommandBufferNamespace PpapiCommandBufferProxy::GetNamespaceID() const { |
| 183 return gpu::CommandBufferNamespace::GPU_IO; |
| 184 } |
| 185 |
| 186 uint64_t PpapiCommandBufferProxy::GetCommandBufferID() const { |
| 187 return command_buffer_id_; |
| 188 } |
| 189 |
180 uint32 PpapiCommandBufferProxy::InsertSyncPoint() { | 190 uint32 PpapiCommandBufferProxy::InsertSyncPoint() { |
181 uint32 sync_point = 0; | 191 uint32 sync_point = 0; |
182 if (last_state_.error == gpu::error::kNoError) { | 192 if (last_state_.error == gpu::error::kNoError) { |
183 Send(new PpapiHostMsg_PPBGraphics3D_InsertSyncPoint( | 193 Send(new PpapiHostMsg_PPBGraphics3D_InsertSyncPoint( |
184 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &sync_point)); | 194 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &sync_point)); |
185 } | 195 } |
186 return sync_point; | 196 return sync_point; |
187 } | 197 } |
188 | 198 |
189 uint32 PpapiCommandBufferProxy::InsertFutureSyncPoint() { | 199 uint32 PpapiCommandBufferProxy::InsertFutureSyncPoint() { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // cached last_state_ with out-of-date data. | 304 // cached last_state_ with out-of-date data. |
295 message->set_unblock(true); | 305 message->set_unblock(true); |
296 Send(message); | 306 Send(message); |
297 | 307 |
298 flush_info_->flush_pending = false; | 308 flush_info_->flush_pending = false; |
299 flush_info_->resource.SetHostResource(0, 0); | 309 flush_info_->resource.SetHostResource(0, 0); |
300 } | 310 } |
301 | 311 |
302 } // namespace proxy | 312 } // namespace proxy |
303 } // namespace ppapi | 313 } // namespace ppapi |
OLD | NEW |