OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/services/gles2/command_buffer_impl.h" | 5 #include "mojo/services/gles2/command_buffer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 | 9 |
10 #include "gpu/command_buffer/common/constants.h" | 10 #include "gpu/command_buffer/common/constants.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 uint32_t size) { | 145 uint32_t size) { |
146 bool read_only = false; | 146 bool read_only = false; |
147 base::SharedMemory shared_memory(transfer_buffer, read_only); | 147 base::SharedMemory shared_memory(transfer_buffer, read_only); |
148 command_buffer_->RegisterTransferBuffer(id, &shared_memory, size); | 148 command_buffer_->RegisterTransferBuffer(id, &shared_memory, size); |
149 } | 149 } |
150 | 150 |
151 void CommandBufferImpl::DestroyTransferBuffer(int32_t id) { | 151 void CommandBufferImpl::DestroyTransferBuffer(int32_t id) { |
152 command_buffer_->DestroyTransferBuffer(id); | 152 command_buffer_->DestroyTransferBuffer(id); |
153 } | 153 } |
154 | 154 |
155 void CommandBufferImpl::Echo() { client_->EchoAck(); } | 155 void CommandBufferImpl::Echo(const Callback<void()>& callback) { |
| 156 callback.Run(); |
| 157 } |
156 | 158 |
157 void CommandBufferImpl::RequestAnimationFrames() { | 159 void CommandBufferImpl::RequestAnimationFrames() { |
158 timer_.Start(FROM_HERE, | 160 timer_.Start(FROM_HERE, |
159 base::TimeDelta::FromMilliseconds(16), | 161 base::TimeDelta::FromMilliseconds(16), |
160 this, | 162 this, |
161 &CommandBufferImpl::DrawAnimationFrame); | 163 &CommandBufferImpl::DrawAnimationFrame); |
162 } | 164 } |
163 | 165 |
164 void CommandBufferImpl::CancelAnimationFrames() { timer_.Stop(); } | 166 void CommandBufferImpl::CancelAnimationFrames() { timer_.Stop(); } |
165 | 167 |
166 void CommandBufferImpl::OnParseError() { | 168 void CommandBufferImpl::OnParseError() { |
167 gpu::CommandBuffer::State state = command_buffer_->GetState(); | 169 gpu::CommandBuffer::State state = command_buffer_->GetState(); |
168 client_->LostContext(state.context_lost_reason); | 170 client_->LostContext(state.context_lost_reason); |
169 } | 171 } |
170 | 172 |
171 void CommandBufferImpl::DrawAnimationFrame() { client_->DrawAnimationFrame(); } | 173 void CommandBufferImpl::DrawAnimationFrame() { client_->DrawAnimationFrame(); } |
172 | 174 |
173 } // namespace services | 175 } // namespace services |
174 } // namespace mojo | 176 } // namespace mojo |
OLD | NEW |