| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 uint32 PpapiCommandBufferProxy::InsertSyncPoint() { | 224 uint32 PpapiCommandBufferProxy::InsertSyncPoint() { |
| 225 uint32 sync_point = 0; | 225 uint32 sync_point = 0; |
| 226 if (last_state_.error == gpu::error::kNoError) { | 226 if (last_state_.error == gpu::error::kNoError) { |
| 227 Send(new PpapiHostMsg_PPBGraphics3D_InsertSyncPoint( | 227 Send(new PpapiHostMsg_PPBGraphics3D_InsertSyncPoint( |
| 228 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &sync_point)); | 228 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &sync_point)); |
| 229 } | 229 } |
| 230 return sync_point; | 230 return sync_point; |
| 231 } | 231 } |
| 232 | 232 |
| 233 gfx::GpuMemoryBuffer* PpapiCommandBufferProxy::CreateGpuMemoryBuffer( |
| 234 size_t width, |
| 235 size_t height, |
| 236 unsigned internalformat, |
| 237 int32* id) { |
| 238 NOTREACHED(); |
| 239 return NULL; |
| 240 } |
| 241 |
| 242 void PpapiCommandBufferProxy::DestroyGpuMemoryBuffer(int32 id) { |
| 243 NOTREACHED(); |
| 244 } |
| 245 |
| 233 bool PpapiCommandBufferProxy::Send(IPC::Message* msg) { | 246 bool PpapiCommandBufferProxy::Send(IPC::Message* msg) { |
| 234 DCHECK(last_state_.error == gpu::error::kNoError); | 247 DCHECK(last_state_.error == gpu::error::kNoError); |
| 235 | 248 |
| 236 if (channel_->Send(msg)) | 249 if (channel_->Send(msg)) |
| 237 return true; | 250 return true; |
| 238 | 251 |
| 239 last_state_.error = gpu::error::kLostContext; | 252 last_state_.error = gpu::error::kLostContext; |
| 240 return false; | 253 return false; |
| 241 } | 254 } |
| 242 | 255 |
| 243 void PpapiCommandBufferProxy::UpdateState( | 256 void PpapiCommandBufferProxy::UpdateState( |
| 244 const gpu::CommandBuffer::State& state, | 257 const gpu::CommandBuffer::State& state, |
| 245 bool success) { | 258 bool success) { |
| 246 // Handle wraparound. It works as long as we don't have more than 2B state | 259 // Handle wraparound. It works as long as we don't have more than 2B state |
| 247 // updates in flight across which reordering occurs. | 260 // updates in flight across which reordering occurs. |
| 248 if (success) { | 261 if (success) { |
| 249 if (state.generation - last_state_.generation < 0x80000000U) { | 262 if (state.generation - last_state_.generation < 0x80000000U) { |
| 250 last_state_ = state; | 263 last_state_ = state; |
| 251 } | 264 } |
| 252 } else { | 265 } else { |
| 253 last_state_.error = gpu::error::kLostContext; | 266 last_state_.error = gpu::error::kLostContext; |
| 254 ++last_state_.generation; | 267 ++last_state_.generation; |
| 255 } | 268 } |
| 256 } | 269 } |
| 257 | 270 |
| 258 } // namespace proxy | 271 } // namespace proxy |
| 259 } // namespace ppapi | 272 } // namespace ppapi |
| OLD | NEW |