| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 CommandBufferService::~CommandBufferService() { | 33 CommandBufferService::~CommandBufferService() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool CommandBufferService::Initialize() { | 36 bool CommandBufferService::Initialize() { |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| 39 | 39 |
| 40 CommandBufferService::State CommandBufferService::GetLastState() { | 40 CommandBufferService::State CommandBufferService::GetLastState() { |
| 41 State state; | 41 State state; |
| 42 state.num_entries = num_entries_; | |
| 43 state.get_offset = get_offset_; | 42 state.get_offset = get_offset_; |
| 44 state.put_offset = put_offset_; | |
| 45 state.token = token_; | 43 state.token = token_; |
| 46 state.error = error_; | 44 state.error = error_; |
| 47 state.context_lost_reason = context_lost_reason_; | 45 state.context_lost_reason = context_lost_reason_; |
| 48 state.generation = ++generation_; | 46 state.generation = ++generation_; |
| 49 | 47 |
| 50 return state; | 48 return state; |
| 51 } | 49 } |
| 52 | 50 |
| 53 int32 CommandBufferService::GetLastToken() { | 51 int32 CommandBufferService::GetLastToken() { |
| 54 return GetLastState().token; | 52 return GetLastState().token; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 if (!parse_error_callback_.is_null()) | 165 if (!parse_error_callback_.is_null()) |
| 168 parse_error_callback_.Run(); | 166 parse_error_callback_.Run(); |
| 169 } | 167 } |
| 170 } | 168 } |
| 171 | 169 |
| 172 void CommandBufferService::SetContextLostReason( | 170 void CommandBufferService::SetContextLostReason( |
| 173 error::ContextLostReason reason) { | 171 error::ContextLostReason reason) { |
| 174 context_lost_reason_ = reason; | 172 context_lost_reason_ = reason; |
| 175 } | 173 } |
| 176 | 174 |
| 175 int32 CommandBufferService::GetPutOffset() { |
| 176 return put_offset_; |
| 177 } |
| 178 |
| 177 void CommandBufferService::SetPutOffsetChangeCallback( | 179 void CommandBufferService::SetPutOffsetChangeCallback( |
| 178 const base::Closure& callback) { | 180 const base::Closure& callback) { |
| 179 put_offset_change_callback_ = callback; | 181 put_offset_change_callback_ = callback; |
| 180 } | 182 } |
| 181 | 183 |
| 182 void CommandBufferService::SetGetBufferChangeCallback( | 184 void CommandBufferService::SetGetBufferChangeCallback( |
| 183 const GetBufferChangedCallback& callback) { | 185 const GetBufferChangedCallback& callback) { |
| 184 get_buffer_change_callback_ = callback; | 186 get_buffer_change_callback_ = callback; |
| 185 } | 187 } |
| 186 | 188 |
| 187 void CommandBufferService::SetParseErrorCallback( | 189 void CommandBufferService::SetParseErrorCallback( |
| 188 const base::Closure& callback) { | 190 const base::Closure& callback) { |
| 189 parse_error_callback_ = callback; | 191 parse_error_callback_ = callback; |
| 190 } | 192 } |
| 191 | 193 |
| 192 } // namespace gpu | 194 } // namespace gpu |
| OLD | NEW |