| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 command_buffer_->SetGetBuffer(buffer); | 141 command_buffer_->SetGetBuffer(buffer); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void CommandBufferImpl::Flush(int32_t put_offset) { | 144 void CommandBufferImpl::Flush(int32_t put_offset) { |
| 145 command_buffer_->Flush(put_offset); | 145 command_buffer_->Flush(put_offset); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void CommandBufferImpl::MakeProgress(int32_t last_get_offset) { | 148 void CommandBufferImpl::MakeProgress(int32_t last_get_offset) { |
| 149 // TODO(piman): handle out-of-order. | 149 // TODO(piman): handle out-of-order. |
| 150 AllocationScope scope; | 150 AllocationScope scope; |
| 151 sync_client_->DidMakeProgress(command_buffer_->GetState()); | 151 sync_client_->DidMakeProgress(command_buffer_->GetLastState()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void CommandBufferImpl::RegisterTransferBuffer( | 154 void CommandBufferImpl::RegisterTransferBuffer( |
| 155 int32_t id, | 155 int32_t id, |
| 156 mojo::ScopedSharedBufferHandle transfer_buffer, | 156 mojo::ScopedSharedBufferHandle transfer_buffer, |
| 157 uint32_t size) { | 157 uint32_t size) { |
| 158 // Take ownership of the memory and map it into this process. | 158 // Take ownership of the memory and map it into this process. |
| 159 // This validates the size. | 159 // This validates the size. |
| 160 scoped_ptr<gpu::BufferBacking> backing( | 160 scoped_ptr<gpu::BufferBacking> backing( |
| 161 gles2::MojoBufferBacking::Create(transfer_buffer.Pass(), size)); | 161 gles2::MojoBufferBacking::Create(transfer_buffer.Pass(), size)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 177 void CommandBufferImpl::RequestAnimationFrames() { | 177 void CommandBufferImpl::RequestAnimationFrames() { |
| 178 timer_.Start(FROM_HERE, | 178 timer_.Start(FROM_HERE, |
| 179 base::TimeDelta::FromMilliseconds(16), | 179 base::TimeDelta::FromMilliseconds(16), |
| 180 this, | 180 this, |
| 181 &CommandBufferImpl::DrawAnimationFrame); | 181 &CommandBufferImpl::DrawAnimationFrame); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void CommandBufferImpl::CancelAnimationFrames() { timer_.Stop(); } | 184 void CommandBufferImpl::CancelAnimationFrames() { timer_.Stop(); } |
| 185 | 185 |
| 186 void CommandBufferImpl::OnParseError() { | 186 void CommandBufferImpl::OnParseError() { |
| 187 gpu::CommandBuffer::State state = command_buffer_->GetState(); | 187 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
| 188 client_->LostContext(state.context_lost_reason); | 188 client_->LostContext(state.context_lost_reason); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void CommandBufferImpl::DrawAnimationFrame() { client_->DrawAnimationFrame(); } | 191 void CommandBufferImpl::DrawAnimationFrame() { client_->DrawAnimationFrame(); } |
| 192 | 192 |
| 193 } // namespace services | 193 } // namespace services |
| 194 } // namespace mojo | 194 } // namespace mojo |
| OLD | NEW |