| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 PpapiCommandBufferProxy::~PpapiCommandBufferProxy() { | 23 PpapiCommandBufferProxy::~PpapiCommandBufferProxy() { |
| 24 // gpu::Buffers are no longer referenced, allowing shared memory objects to be | 24 // gpu::Buffers are no longer referenced, allowing shared memory objects to be |
| 25 // deleted, closing the handle in this process. | 25 // deleted, closing the handle in this process. |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool PpapiCommandBufferProxy::Initialize() { | 28 bool PpapiCommandBufferProxy::Initialize() { |
| 29 return true; | 29 return true; |
| 30 } | 30 } |
| 31 | 31 |
| 32 gpu::CommandBuffer::State PpapiCommandBufferProxy::GetState() { | |
| 33 // Send will flag state with lost context if IPC fails. | |
| 34 if (last_state_.error == gpu::error::kNoError) { | |
| 35 gpu::CommandBuffer::State state; | |
| 36 bool success = false; | |
| 37 if (Send(new PpapiHostMsg_PPBGraphics3D_GetState( | |
| 38 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &state, &success))) { | |
| 39 UpdateState(state, success); | |
| 40 } | |
| 41 } | |
| 42 | |
| 43 return last_state_; | |
| 44 } | |
| 45 | |
| 46 gpu::CommandBuffer::State PpapiCommandBufferProxy::GetLastState() { | 32 gpu::CommandBuffer::State PpapiCommandBufferProxy::GetLastState() { |
| 47 ppapi::ProxyLock::AssertAcquiredDebugOnly(); | 33 ppapi::ProxyLock::AssertAcquiredDebugOnly(); |
| 48 return last_state_; | 34 return last_state_; |
| 49 } | 35 } |
| 50 | 36 |
| 51 int32 PpapiCommandBufferProxy::GetLastToken() { | 37 int32 PpapiCommandBufferProxy::GetLastToken() { |
| 52 ppapi::ProxyLock::AssertAcquiredDebugOnly(); | 38 ppapi::ProxyLock::AssertAcquiredDebugOnly(); |
| 53 return last_state_.token; | 39 return last_state_.token; |
| 54 } | 40 } |
| 55 | 41 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 last_state_ = state; | 210 last_state_ = state; |
| 225 } | 211 } |
| 226 } else { | 212 } else { |
| 227 last_state_.error = gpu::error::kLostContext; | 213 last_state_.error = gpu::error::kLostContext; |
| 228 ++last_state_.generation; | 214 ++last_state_.generation; |
| 229 } | 215 } |
| 230 } | 216 } |
| 231 | 217 |
| 232 } // namespace proxy | 218 } // namespace proxy |
| 233 } // namespace ppapi | 219 } // namespace ppapi |
| OLD | NEW |