| 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 PpapiCommandBufferProxy::~PpapiCommandBufferProxy() { | 22 PpapiCommandBufferProxy::~PpapiCommandBufferProxy() { |
| 23 // Delete all the locally cached shared memory objects, closing the handle | 23 // Delete all the locally cached shared memory objects, closing the handle |
| 24 // in this process. | 24 // in this process. |
| 25 for (TransferBufferMap::iterator it = transfer_buffers_.begin(); | 25 for (TransferBufferMap::iterator it = transfer_buffers_.begin(); |
| 26 it != transfer_buffers_.end(); ++it) { | 26 it != transfer_buffers_.end(); ++it) { |
| 27 delete it->second.shared_memory; | 27 delete it->second.shared_memory; |
| 28 it->second.shared_memory = NULL; | 28 it->second.shared_memory = NULL; |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 void PpapiCommandBufferProxy::SetChannelErrorCallback( | |
| 33 const base::Closure& callback) { | |
| 34 channel_error_callback_ = callback; | |
| 35 } | |
| 36 | |
| 37 void PpapiCommandBufferProxy::ReportChannelError() { | 32 void PpapiCommandBufferProxy::ReportChannelError() { |
| 38 if (!channel_error_callback_.is_null()) { | 33 if (!channel_error_callback_.is_null()) { |
| 39 channel_error_callback_.Run(); | 34 channel_error_callback_.Run(); |
| 40 channel_error_callback_.Reset(); | 35 channel_error_callback_.Reset(); |
| 41 } | 36 } |
| 42 } | 37 } |
| 43 | 38 |
| 39 int PpapiCommandBufferProxy::GetRouteID() const { |
| 40 NOTIMPLEMENTED(); |
| 41 return 0; |
| 42 } |
| 43 |
| 44 bool PpapiCommandBufferProxy::Echo(const base::Closure& callback) { |
| 45 NOTIMPLEMENTED(); |
| 46 return false; |
| 47 } |
| 48 |
| 49 bool PpapiCommandBufferProxy::SetSurfaceVisible(bool visible) { |
| 50 NOTIMPLEMENTED(); |
| 51 return true; |
| 52 } |
| 53 |
| 54 bool PpapiCommandBufferProxy::DiscardBackbuffer() { |
| 55 NOTIMPLEMENTED(); |
| 56 return true; |
| 57 } |
| 58 |
| 59 bool PpapiCommandBufferProxy::EnsureBackbuffer() { |
| 60 NOTIMPLEMENTED(); |
| 61 return true; |
| 62 } |
| 63 |
| 64 void PpapiCommandBufferProxy::SetMemoryAllocationChangedCallback( |
| 65 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& |
| 66 callback) { |
| 67 NOTIMPLEMENTED(); |
| 68 } |
| 69 |
| 70 bool PpapiCommandBufferProxy::SetParent( |
| 71 CommandBufferProxy* parent_command_buffer, |
| 72 uint32 parent_texture_id) { |
| 73 // TODO(fsamuel): Need a proper implementation of this to support offscreen |
| 74 // contexts in the guest renderer (WebGL, canvas, etc). |
| 75 NOTIMPLEMENTED(); |
| 76 return false; |
| 77 } |
| 78 |
| 79 void PpapiCommandBufferProxy::SetChannelErrorCallback( |
| 80 const base::Closure& callback) { |
| 81 channel_error_callback_ = callback; |
| 82 } |
| 83 |
| 84 void PpapiCommandBufferProxy::SetNotifyRepaintTask( |
| 85 const base::Closure& callback) { |
| 86 NOTIMPLEMENTED(); |
| 87 } |
| 88 |
| 89 void PpapiCommandBufferProxy::SetOnConsoleMessageCallback( |
| 90 const GpuConsoleMessageCallback& callback) { |
| 91 NOTIMPLEMENTED(); |
| 92 } |
| 93 |
| 44 bool PpapiCommandBufferProxy::Initialize() { | 94 bool PpapiCommandBufferProxy::Initialize() { |
| 45 return Send(new PpapiHostMsg_PPBGraphics3D_InitCommandBuffer( | 95 return Send(new PpapiHostMsg_PPBGraphics3D_InitCommandBuffer( |
| 46 ppapi::API_ID_PPB_GRAPHICS_3D, resource_)); | 96 ppapi::API_ID_PPB_GRAPHICS_3D, resource_)); |
| 47 } | 97 } |
| 48 | 98 |
| 49 gpu::CommandBuffer::State PpapiCommandBufferProxy::GetState() { | 99 gpu::CommandBuffer::State PpapiCommandBufferProxy::GetState() { |
| 50 // Send will flag state with lost context if IPC fails. | 100 // Send will flag state with lost context if IPC fails. |
| 51 if (last_state_.error == gpu::error::kNoError) { | 101 if (last_state_.error == gpu::error::kNoError) { |
| 52 gpu::CommandBuffer::State state; | 102 gpu::CommandBuffer::State state; |
| 53 if (Send(new PpapiHostMsg_PPBGraphics3D_GetState( | 103 if (Send(new PpapiHostMsg_PPBGraphics3D_GetState( |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 const gpu::CommandBuffer::State& state) { | 263 const gpu::CommandBuffer::State& state) { |
| 214 // 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 |
| 215 // updates in flight across which reordering occurs. | 265 // updates in flight across which reordering occurs. |
| 216 if (state.generation - last_state_.generation < 0x80000000U) | 266 if (state.generation - last_state_.generation < 0x80000000U) |
| 217 last_state_ = state; | 267 last_state_ = state; |
| 218 } | 268 } |
| 219 | 269 |
| 220 } // namespace proxy | 270 } // namespace proxy |
| 221 } // namespace ppapi | 271 } // namespace ppapi |
| 222 | 272 |
| OLD | NEW |