| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 10 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
| 11 | 11 |
| 12 using ::base::SharedMemory; | 12 using ::base::SharedMemory; |
| 13 | 13 |
| 14 namespace gpu { | 14 namespace gpu { |
| 15 | 15 |
| 16 CommandBufferService::CommandBufferService() | 16 CommandBufferService::CommandBufferService() |
| 17 : ring_buffer_id_(-1), | 17 : ring_buffer_id_(-1), |
| 18 num_entries_(0), | 18 num_entries_(0), |
| 19 get_offset_(0), | 19 get_offset_(0), |
| 20 put_offset_(0), | 20 put_offset_(0), |
| 21 token_(0), | 21 token_(0), |
| 22 generation_(0), | 22 generation_(0), |
| 23 error_(error::kNoError) { | 23 error_(error::kNoError), |
| 24 context_lost_reason_(error::kUnknown) { |
| 24 // Element zero is always NULL. | 25 // Element zero is always NULL. |
| 25 registered_objects_.push_back(Buffer()); | 26 registered_objects_.push_back(Buffer()); |
| 26 } | 27 } |
| 27 | 28 |
| 28 CommandBufferService::~CommandBufferService() { | 29 CommandBufferService::~CommandBufferService() { |
| 29 for (size_t i = 0; i < registered_objects_.size(); ++i) { | 30 for (size_t i = 0; i < registered_objects_.size(); ++i) { |
| 30 if (registered_objects_[i].shared_memory) | 31 if (registered_objects_[i].shared_memory) |
| 31 delete registered_objects_[i].shared_memory; | 32 delete registered_objects_[i].shared_memory; |
| 32 } | 33 } |
| 33 } | 34 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 const GetBufferChangedCallback& callback) { | 239 const GetBufferChangedCallback& callback) { |
| 239 get_buffer_change_callback_ = callback; | 240 get_buffer_change_callback_ = callback; |
| 240 } | 241 } |
| 241 | 242 |
| 242 void CommandBufferService::SetParseErrorCallback( | 243 void CommandBufferService::SetParseErrorCallback( |
| 243 const base::Closure& callback) { | 244 const base::Closure& callback) { |
| 244 parse_error_callback_ = callback; | 245 parse_error_callback_ = callback; |
| 245 } | 246 } |
| 246 | 247 |
| 247 } // namespace gpu | 248 } // namespace gpu |
| OLD | NEW |