| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 shared_state()->Initialize(); | 140 shared_state()->Initialize(); |
| 141 | 141 |
| 142 // This handle is owned by the GPU process and must be passed to it or it | 142 // This handle is owned by the GPU process and must be passed to it or it |
| 143 // will leak. In otherwords, do not early out on error between here and the | 143 // will leak. In otherwords, do not early out on error between here and the |
| 144 // sending of the Initialize IPC below. | 144 // sending of the Initialize IPC below. |
| 145 base::SharedMemoryHandle handle = | 145 base::SharedMemoryHandle handle = |
| 146 channel_->ShareToGpuProcess(shared_state_shm_->handle()); | 146 channel_->ShareToGpuProcess(shared_state_shm_->handle()); |
| 147 if (!base::SharedMemory::IsHandleValid(handle)) | 147 if (!base::SharedMemory::IsHandleValid(handle)) |
| 148 return false; | 148 return false; |
| 149 | 149 |
| 150 bool result; | 150 bool result = false; |
| 151 if (!Send(new GpuCommandBufferMsg_Initialize( | 151 if (!Send(new GpuCommandBufferMsg_Initialize( |
| 152 route_id_, handle, &result, &capabilities_))) { | 152 route_id_, handle, &result, &capabilities_))) { |
| 153 LOG(ERROR) << "Could not send GpuCommandBufferMsg_Initialize."; | 153 LOG(ERROR) << "Could not send GpuCommandBufferMsg_Initialize."; |
| 154 return false; | 154 return false; |
| 155 } | 155 } |
| 156 | 156 |
| 157 if (!result) { | 157 if (!result) { |
| 158 LOG(ERROR) << "Failed to initialize command buffer service."; | 158 LOG(ERROR) << "Failed to initialize command buffer service."; |
| 159 return false; | 159 return false; |
| 160 } | 160 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 370 } |
| 371 | 371 |
| 372 echo_tasks_.push(callback); | 372 echo_tasks_.push(callback); |
| 373 } | 373 } |
| 374 | 374 |
| 375 uint32 CommandBufferProxyImpl::CreateStreamTexture(uint32 texture_id) { | 375 uint32 CommandBufferProxyImpl::CreateStreamTexture(uint32 texture_id) { |
| 376 if (last_state_.error != gpu::error::kNoError) | 376 if (last_state_.error != gpu::error::kNoError) |
| 377 return 0; | 377 return 0; |
| 378 | 378 |
| 379 int32 stream_id = channel_->GenerateRouteID(); | 379 int32 stream_id = channel_->GenerateRouteID(); |
| 380 bool succeeded; | 380 bool succeeded = false; |
| 381 Send(new GpuCommandBufferMsg_CreateStreamTexture( | 381 Send(new GpuCommandBufferMsg_CreateStreamTexture( |
| 382 route_id_, texture_id, stream_id, &succeeded)); | 382 route_id_, texture_id, stream_id, &succeeded)); |
| 383 if (!succeeded) { | 383 if (!succeeded) { |
| 384 DLOG(ERROR) << "GpuCommandBufferMsg_CreateStreamTexture returned failure"; | 384 DLOG(ERROR) << "GpuCommandBufferMsg_CreateStreamTexture returned failure"; |
| 385 return 0; | 385 return 0; |
| 386 } | 386 } |
| 387 return stream_id; | 387 return stream_id; |
| 388 } | 388 } |
| 389 | 389 |
| 390 uint32 CommandBufferProxyImpl::InsertSyncPoint() { | 390 uint32 CommandBufferProxyImpl::InsertSyncPoint() { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 if (last_state_.error == gpu::error::kNoError) | 524 if (last_state_.error == gpu::error::kNoError) |
| 525 shared_state()->Read(&last_state_); | 525 shared_state()->Read(&last_state_); |
| 526 } | 526 } |
| 527 | 527 |
| 528 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { | 528 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { |
| 529 return reinterpret_cast<gpu::CommandBufferSharedState*>( | 529 return reinterpret_cast<gpu::CommandBufferSharedState*>( |
| 530 shared_state_shm_->memory()); | 530 shared_state_shm_->memory()); |
| 531 } | 531 } |
| 532 | 532 |
| 533 } // namespace content | 533 } // namespace content |
| OLD | NEW |