| 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 19 matching lines...) Expand all Loading... |
| 30 context_lost_reason_(error::kUnknown) { | 30 context_lost_reason_(error::kUnknown) { |
| 31 } | 31 } |
| 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::GetState() { | 40 CommandBufferService::State CommandBufferService::GetLastState() { |
| 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_; |
| 48 state.generation = ++generation_; | 48 state.generation = ++generation_; |
| 49 | 49 |
| 50 return state; | 50 return state; |
| 51 } | 51 } |
| 52 | 52 |
| 53 CommandBufferService::State CommandBufferService::GetLastState() { | |
| 54 return GetState(); | |
| 55 } | |
| 56 | |
| 57 int32 CommandBufferService::GetLastToken() { | 53 int32 CommandBufferService::GetLastToken() { |
| 58 return GetState().token; | 54 return GetLastState().token; |
| 59 } | 55 } |
| 60 | 56 |
| 61 void CommandBufferService::UpdateState() { | 57 void CommandBufferService::UpdateState() { |
| 62 if (shared_state_) { | 58 if (shared_state_) { |
| 63 CommandBufferService::State state = GetState(); | 59 CommandBufferService::State state = GetLastState(); |
| 64 shared_state_->Write(state); | 60 shared_state_->Write(state); |
| 65 } | 61 } |
| 66 } | 62 } |
| 67 | 63 |
| 68 void CommandBufferService::WaitForTokenInRange(int32 start, int32 end) { | 64 void CommandBufferService::WaitForTokenInRange(int32 start, int32 end) { |
| 69 DCHECK(error_ != error::kNoError || InRange(start, end, token_)); | 65 DCHECK(error_ != error::kNoError || InRange(start, end, token_)); |
| 70 } | 66 } |
| 71 | 67 |
| 72 void CommandBufferService::WaitForGetOffsetInRange(int32 start, int32 end) { | 68 void CommandBufferService::WaitForGetOffsetInRange(int32 start, int32 end) { |
| 73 DCHECK(error_ != error::kNoError || InRange(start, end, get_offset_)); | 69 DCHECK(error_ != error::kNoError || InRange(start, end, get_offset_)); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 const GetBufferChangedCallback& callback) { | 183 const GetBufferChangedCallback& callback) { |
| 188 get_buffer_change_callback_ = callback; | 184 get_buffer_change_callback_ = callback; |
| 189 } | 185 } |
| 190 | 186 |
| 191 void CommandBufferService::SetParseErrorCallback( | 187 void CommandBufferService::SetParseErrorCallback( |
| 192 const base::Closure& callback) { | 188 const base::Closure& callback) { |
| 193 parse_error_callback_ = callback; | 189 parse_error_callback_ = callback; |
| 194 } | 190 } |
| 195 | 191 |
| 196 } // namespace gpu | 192 } // namespace gpu |
| OLD | NEW |