| 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 "content/common/gpu/client/command_buffer_proxy_impl.h" | 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 if (!result) { | 156 if (!result) { |
| 157 LOG(ERROR) << "Failed to initialize command buffer service."; | 157 LOG(ERROR) << "Failed to initialize command buffer service."; |
| 158 return false; | 158 return false; |
| 159 } | 159 } |
| 160 | 160 |
| 161 capabilities_.map_image = true; | 161 capabilities_.map_image = true; |
| 162 | 162 |
| 163 return true; | 163 return true; |
| 164 } | 164 } |
| 165 | 165 |
| 166 gpu::CommandBuffer::State CommandBufferProxyImpl::GetState() { | |
| 167 // Send will flag state with lost context if IPC fails. | |
| 168 if (last_state_.error == gpu::error::kNoError) { | |
| 169 gpu::CommandBuffer::State state; | |
| 170 if (Send(new GpuCommandBufferMsg_GetState(route_id_, &state))) | |
| 171 OnUpdateState(state); | |
| 172 } | |
| 173 | |
| 174 TryUpdateState(); | |
| 175 return last_state_; | |
| 176 } | |
| 177 | |
| 178 gpu::CommandBuffer::State CommandBufferProxyImpl::GetLastState() { | 166 gpu::CommandBuffer::State CommandBufferProxyImpl::GetLastState() { |
| 179 return last_state_; | 167 return last_state_; |
| 180 } | 168 } |
| 181 | 169 |
| 182 int32 CommandBufferProxyImpl::GetLastToken() { | 170 int32 CommandBufferProxyImpl::GetLastToken() { |
| 183 TryUpdateState(); | 171 TryUpdateState(); |
| 184 return last_state_.token; | 172 return last_state_.token; |
| 185 } | 173 } |
| 186 | 174 |
| 187 void CommandBufferProxyImpl::Flush(int32 put_offset) { | 175 void CommandBufferProxyImpl::Flush(int32 put_offset) { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 if (last_state_.error == gpu::error::kNoError) | 512 if (last_state_.error == gpu::error::kNoError) |
| 525 shared_state()->Read(&last_state_); | 513 shared_state()->Read(&last_state_); |
| 526 } | 514 } |
| 527 | 515 |
| 528 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { | 516 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { |
| 529 return reinterpret_cast<gpu::CommandBufferSharedState*>( | 517 return reinterpret_cast<gpu::CommandBufferSharedState*>( |
| 530 shared_state_shm_->memory()); | 518 shared_state_shm_->memory()); |
| 531 } | 519 } |
| 532 | 520 |
| 533 } // namespace content | 521 } // namespace content |
| OLD | NEW |