| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "o3d/gpu_plugin/command_buffer.h" | 5 #include "o3d/gpu_plugin/command_buffer.h" |
| 6 | 6 |
| 7 namespace o3d { | 7 namespace o3d { |
| 8 namespace gpu_plugin { | 8 namespace gpu_plugin { |
| 9 | 9 |
| 10 CommandBuffer::CommandBuffer(NPP npp) | 10 CommandBuffer::CommandBuffer(NPP npp) |
| 11 : npp_(npp), | 11 : npp_(npp), |
| 12 size_(0), | 12 size_(0), |
| 13 get_offset_(0), | 13 get_offset_(0), |
| 14 put_offset_(0) { | 14 put_offset_(0), |
| 15 token_(0), |
| 16 error_(ERROR_NO_ERROR) { |
| 15 // Element zero is always NULL. | 17 // Element zero is always NULL. |
| 16 registered_objects_.push_back(NPObjectPointer<NPObject>()); | 18 registered_objects_.push_back(NPObjectPointer<NPObject>()); |
| 17 } | 19 } |
| 18 | 20 |
| 19 CommandBuffer::~CommandBuffer() { | 21 CommandBuffer::~CommandBuffer() { |
| 20 } | 22 } |
| 21 | 23 |
| 22 bool CommandBuffer::Initialize(int32 size) { | 24 bool CommandBuffer::Initialize(int32 size) { |
| 23 if (shared_memory_.Get()) | 25 if (shared_memory_.Get()) |
| 24 return false; | 26 return false; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 147 } |
| 146 } | 148 } |
| 147 | 149 |
| 148 NPObjectPointer<NPObject> CommandBuffer::GetRegisteredObject(int32 handle) { | 150 NPObjectPointer<NPObject> CommandBuffer::GetRegisteredObject(int32 handle) { |
| 149 DCHECK_GE(handle, 0); | 151 DCHECK_GE(handle, 0); |
| 150 DCHECK_LT(static_cast<size_t>(handle), registered_objects_.size()); | 152 DCHECK_LT(static_cast<size_t>(handle), registered_objects_.size()); |
| 151 | 153 |
| 152 return registered_objects_[handle]; | 154 return registered_objects_[handle]; |
| 153 } | 155 } |
| 154 | 156 |
| 157 int32 CommandBuffer::ResetError() { |
| 158 int32 last_error = error_; |
| 159 error_ = ERROR_NO_ERROR; |
| 160 return last_error; |
| 161 } |
| 162 |
| 155 } // namespace gpu_plugin | 163 } // namespace gpu_plugin |
| 156 } // namespace o3d | 164 } // namespace o3d |
| OLD | NEW |