OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "gpu/command_buffer/service/command_buffer_service.h" | 5 #include "gpu/command_buffer/service/command_buffer_service.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 9 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 void CommandBufferService::SetGetOffset(int32 get_offset) { | 78 void CommandBufferService::SetGetOffset(int32 get_offset) { |
79 DCHECK(get_offset >= 0 && get_offset < size_); | 79 DCHECK(get_offset >= 0 && get_offset < size_); |
80 get_offset_ = get_offset; | 80 get_offset_ = get_offset; |
81 } | 81 } |
82 | 82 |
83 int32 CommandBufferService::GetPutOffset() { | 83 int32 CommandBufferService::GetPutOffset() { |
84 return put_offset_; | 84 return put_offset_; |
85 } | 85 } |
86 | 86 |
87 void CommandBufferService::SetPutOffsetChangeCallback( | |
88 Callback0::Type* callback) { | |
89 put_offset_change_callback_.reset(callback); | |
90 } | |
91 | |
92 int32 CommandBufferService::CreateTransferBuffer(size_t size) { | 87 int32 CommandBufferService::CreateTransferBuffer(size_t size) { |
93 linked_ptr<SharedMemory> buffer(new SharedMemory); | 88 linked_ptr<SharedMemory> buffer(new SharedMemory); |
94 if (!buffer->Create(std::wstring(), false, false, size)) | 89 if (!buffer->Create(std::wstring(), false, false, size)) |
95 return -1; | 90 return -1; |
96 | 91 |
97 if (unused_registered_object_elements_.empty()) { | 92 if (unused_registered_object_elements_.empty()) { |
98 // Check we haven't exceeded the range that fits in a 32-bit integer. | 93 // Check we haven't exceeded the range that fits in a 32-bit integer. |
99 if (registered_objects_.size() > std::numeric_limits<uint32>::max()) | 94 if (registered_objects_.size() > std::numeric_limits<uint32>::max()) |
100 return -1; | 95 return -1; |
101 | 96 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 171 } |
177 | 172 |
178 bool CommandBufferService::GetErrorStatus() { | 173 bool CommandBufferService::GetErrorStatus() { |
179 return error_status_; | 174 return error_status_; |
180 } | 175 } |
181 | 176 |
182 void CommandBufferService::RaiseErrorStatus() { | 177 void CommandBufferService::RaiseErrorStatus() { |
183 error_status_ = true; | 178 error_status_ = true; |
184 } | 179 } |
185 | 180 |
| 181 void CommandBufferService::SetPutOffsetChangeCallback( |
| 182 Callback0::Type* callback) { |
| 183 put_offset_change_callback_.reset(callback); |
| 184 } |
| 185 |
186 } // namespace gpu | 186 } // namespace gpu |
OLD | NEW |