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" |
| 11 #include "ppapi/shared_impl/proxy_lock.h" |
11 | 12 |
12 namespace ppapi { | 13 namespace ppapi { |
13 namespace proxy { | 14 namespace proxy { |
14 | 15 |
15 PpapiCommandBufferProxy::PpapiCommandBufferProxy( | 16 PpapiCommandBufferProxy::PpapiCommandBufferProxy( |
16 const ppapi::HostResource& resource, | 17 const ppapi::HostResource& resource, |
17 ProxyChannel* channel) | 18 ProxyChannel* channel) |
18 : resource_(resource), | 19 : resource_(resource), |
19 channel_(channel) { | 20 channel_(channel) { |
20 } | 21 } |
(...skipping 20 matching lines...) Expand all Loading... |
41 if (Send(new PpapiHostMsg_PPBGraphics3D_GetState( | 42 if (Send(new PpapiHostMsg_PPBGraphics3D_GetState( |
42 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &state, &success))) { | 43 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &state, &success))) { |
43 UpdateState(state, success); | 44 UpdateState(state, success); |
44 } | 45 } |
45 } | 46 } |
46 | 47 |
47 return last_state_; | 48 return last_state_; |
48 } | 49 } |
49 | 50 |
50 gpu::CommandBuffer::State PpapiCommandBufferProxy::GetLastState() { | 51 gpu::CommandBuffer::State PpapiCommandBufferProxy::GetLastState() { |
51 // Note: The locking command buffer wrapper does not take a global lock before | 52 ppapi::ProxyLock::AssertAcquiredDebugOnly(); |
52 // calling this function. | |
53 return last_state_; | 53 return last_state_; |
54 } | 54 } |
55 | 55 |
56 int32 PpapiCommandBufferProxy::GetLastToken() { | 56 int32 PpapiCommandBufferProxy::GetLastToken() { |
57 // Note: The locking command buffer wrapper does not take a global lock before | 57 ppapi::ProxyLock::AssertAcquiredDebugOnly(); |
58 // calling this function. | |
59 return last_state_.token; | 58 return last_state_.token; |
60 } | 59 } |
61 | 60 |
62 void PpapiCommandBufferProxy::Flush(int32 put_offset) { | 61 void PpapiCommandBufferProxy::Flush(int32 put_offset) { |
63 if (last_state_.error != gpu::error::kNoError) | 62 if (last_state_.error != gpu::error::kNoError) |
64 return; | 63 return; |
65 | 64 |
66 IPC::Message* message = new PpapiHostMsg_PPBGraphics3D_AsyncFlush( | 65 IPC::Message* message = new PpapiHostMsg_PPBGraphics3D_AsyncFlush( |
67 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, put_offset); | 66 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, put_offset); |
68 | 67 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 last_state_ = state; | 240 last_state_ = state; |
242 } | 241 } |
243 } else { | 242 } else { |
244 last_state_.error = gpu::error::kLostContext; | 243 last_state_.error = gpu::error::kLostContext; |
245 ++last_state_.generation; | 244 ++last_state_.generation; |
246 } | 245 } |
247 } | 246 } |
248 | 247 |
249 } // namespace proxy | 248 } // namespace proxy |
250 } // namespace ppapi | 249 } // namespace ppapi |
OLD | NEW |