| 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 |
| 246 gfx::GLImage* PpapiCommandBufferProxy::GetImage(int32 id) { |
| 247 NOTREACHED(); |
| 248 return NULL; |
| 249 } |
| 250 |
| 233 bool PpapiCommandBufferProxy::Send(IPC::Message* msg) { | 251 bool PpapiCommandBufferProxy::Send(IPC::Message* msg) { |
| 234 DCHECK(last_state_.error == gpu::error::kNoError); | 252 DCHECK(last_state_.error == gpu::error::kNoError); |
| 235 | 253 |
| 236 if (channel_->Send(msg)) | 254 if (channel_->Send(msg)) |
| 237 return true; | 255 return true; |
| 238 | 256 |
| 239 last_state_.error = gpu::error::kLostContext; | 257 last_state_.error = gpu::error::kLostContext; |
| 240 return false; | 258 return false; |
| 241 } | 259 } |
| 242 | 260 |
| 243 void PpapiCommandBufferProxy::UpdateState( | 261 void PpapiCommandBufferProxy::UpdateState( |
| 244 const gpu::CommandBuffer::State& state, | 262 const gpu::CommandBuffer::State& state, |
| 245 bool success) { | 263 bool success) { |
| 246 // Handle wraparound. It works as long as we don't have more than 2B state | 264 // Handle wraparound. It works as long as we don't have more than 2B state |
| 247 // updates in flight across which reordering occurs. | 265 // updates in flight across which reordering occurs. |
| 248 if (success) { | 266 if (success) { |
| 249 if (state.generation - last_state_.generation < 0x80000000U) { | 267 if (state.generation - last_state_.generation < 0x80000000U) { |
| 250 last_state_ = state; | 268 last_state_ = state; |
| 251 } | 269 } |
| 252 } else { | 270 } else { |
| 253 last_state_.error = gpu::error::kLostContext; | 271 last_state_.error = gpu::error::kLostContext; |
| 254 ++last_state_.generation; | 272 ++last_state_.generation; |
| 255 } | 273 } |
| 256 } | 274 } |
| 257 | 275 |
| 258 } // namespace proxy | 276 } // namespace proxy |
| 259 } // namespace ppapi | 277 } // namespace ppapi |
| OLD | NEW |