| 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 "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 "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 11 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
| 12 #include "gpu/command_buffer/common/command_buffer_shared.h" | 12 #include "gpu/command_buffer/common/command_buffer_shared.h" |
| 13 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 13 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| 14 | 14 |
| 15 using ::base::SharedMemory; | 15 using ::base::SharedMemory; |
| 16 | 16 |
| 17 namespace gpu { | 17 namespace gpu { |
| 18 | 18 |
| 19 CommandBufferService::CommandBufferService() | 19 CommandBufferService::CommandBufferService( |
| 20 TransferBufferManagerInterface* transfer_buffer_manager) |
| 20 : ring_buffer_id_(-1), | 21 : ring_buffer_id_(-1), |
| 21 shared_state_(NULL), | 22 shared_state_(NULL), |
| 22 num_entries_(0), | 23 num_entries_(0), |
| 23 get_offset_(0), | 24 get_offset_(0), |
| 24 put_offset_(0), | 25 put_offset_(0), |
| 26 transfer_buffer_manager_(transfer_buffer_manager), |
| 25 token_(0), | 27 token_(0), |
| 26 generation_(0), | 28 generation_(0), |
| 27 error_(error::kNoError), | 29 error_(error::kNoError), |
| 28 context_lost_reason_(error::kUnknown) { | 30 context_lost_reason_(error::kUnknown) { |
| 29 } | 31 } |
| 30 | 32 |
| 31 CommandBufferService::~CommandBufferService() { | 33 CommandBufferService::~CommandBufferService() { |
| 32 } | 34 } |
| 33 | 35 |
| 34 bool CommandBufferService::Initialize() { | 36 bool CommandBufferService::Initialize() { |
| 35 TransferBufferManager* manager = new TransferBufferManager(); | 37 return true; |
| 36 transfer_buffer_manager_.reset(manager); | |
| 37 return manager->Initialize(); | |
| 38 } | 38 } |
| 39 | 39 |
| 40 CommandBufferService::State CommandBufferService::GetState() { | 40 CommandBufferService::State CommandBufferService::GetState() { |
| 41 State state; | 41 State state; |
| 42 state.num_entries = num_entries_; | 42 state.num_entries = num_entries_; |
| 43 state.get_offset = get_offset_; | 43 state.get_offset = get_offset_; |
| 44 state.put_offset = put_offset_; | 44 state.put_offset = put_offset_; |
| 45 state.token = token_; | 45 state.token = token_; |
| 46 state.error = error_; | 46 state.error = error_; |
| 47 state.context_lost_reason = context_lost_reason_; | 47 state.context_lost_reason = context_lost_reason_; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 const GetBufferChangedCallback& callback) { | 168 const GetBufferChangedCallback& callback) { |
| 169 get_buffer_change_callback_ = callback; | 169 get_buffer_change_callback_ = callback; |
| 170 } | 170 } |
| 171 | 171 |
| 172 void CommandBufferService::SetParseErrorCallback( | 172 void CommandBufferService::SetParseErrorCallback( |
| 173 const base::Closure& callback) { | 173 const base::Closure& callback) { |
| 174 parse_error_callback_ = callback; | 174 parse_error_callback_ = callback; |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace gpu | 177 } // namespace gpu |
| OLD | NEW |