| 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" |
| 11 #include "gpu/command_buffer/service/command_buffer_service.h" | 11 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 12 #include "gpu/command_buffer/service/context_group.h" | 12 #include "gpu/command_buffer/service/context_group.h" |
| 13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 14 #include "gpu/command_buffer/service/gpu_control_service.h" | 14 #include "gpu/command_buffer/service/gpu_control_service.h" |
| 15 #include "gpu/command_buffer/service/gpu_scheduler.h" | 15 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 16 #include "gpu/command_buffer/service/image_manager.h" | 16 #include "gpu/command_buffer/service/image_manager.h" |
| 17 #include "gpu/command_buffer/service/mailbox_manager.h" | 17 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 18 #include "gpu/command_buffer/service/memory_tracking.h" | 18 #include "gpu/command_buffer/service/memory_tracking.h" |
| 19 #include "mojo/public/cpp/bindings/allocation_scope.h" | |
| 20 #include "mojo/services/gles2/command_buffer_type_conversions.h" | 19 #include "mojo/services/gles2/command_buffer_type_conversions.h" |
| 21 #include "mojo/services/gles2/mojo_buffer_backing.h" | 20 #include "mojo/services/gles2/mojo_buffer_backing.h" |
| 22 #include "ui/gl/gl_context.h" | 21 #include "ui/gl/gl_context.h" |
| 23 #include "ui/gl/gl_surface.h" | 22 #include "ui/gl/gl_surface.h" |
| 24 | 23 |
| 25 namespace mojo { | 24 namespace mojo { |
| 26 namespace services { | 25 namespace services { |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| 29 | 28 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void CommandBufferImpl::SetGetBuffer(int32_t buffer) { | 144 void CommandBufferImpl::SetGetBuffer(int32_t buffer) { |
| 146 command_buffer_->SetGetBuffer(buffer); | 145 command_buffer_->SetGetBuffer(buffer); |
| 147 } | 146 } |
| 148 | 147 |
| 149 void CommandBufferImpl::Flush(int32_t put_offset) { | 148 void CommandBufferImpl::Flush(int32_t put_offset) { |
| 150 command_buffer_->Flush(put_offset); | 149 command_buffer_->Flush(put_offset); |
| 151 } | 150 } |
| 152 | 151 |
| 153 void CommandBufferImpl::MakeProgress(int32_t last_get_offset) { | 152 void CommandBufferImpl::MakeProgress(int32_t last_get_offset) { |
| 154 // TODO(piman): handle out-of-order. | 153 // TODO(piman): handle out-of-order. |
| 155 AllocationScope scope; | 154 sync_client_->DidMakeProgress( |
| 156 sync_client_->DidMakeProgress(command_buffer_->GetLastState()); | 155 CommandBufferState::From(command_buffer_->GetLastState())); |
| 157 } | 156 } |
| 158 | 157 |
| 159 void CommandBufferImpl::RegisterTransferBuffer( | 158 void CommandBufferImpl::RegisterTransferBuffer( |
| 160 int32_t id, | 159 int32_t id, |
| 161 mojo::ScopedSharedBufferHandle transfer_buffer, | 160 mojo::ScopedSharedBufferHandle transfer_buffer, |
| 162 uint32_t size) { | 161 uint32_t size) { |
| 163 // Take ownership of the memory and map it into this process. | 162 // Take ownership of the memory and map it into this process. |
| 164 // This validates the size. | 163 // This validates the size. |
| 165 scoped_ptr<gpu::BufferBacking> backing( | 164 scoped_ptr<gpu::BufferBacking> backing( |
| 166 gles2::MojoBufferBacking::Create(transfer_buffer.Pass(), size)); | 165 gles2::MojoBufferBacking::Create(transfer_buffer.Pass(), size)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 190 | 189 |
| 191 void CommandBufferImpl::OnParseError() { | 190 void CommandBufferImpl::OnParseError() { |
| 192 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); | 191 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
| 193 client()->LostContext(state.context_lost_reason); | 192 client()->LostContext(state.context_lost_reason); |
| 194 } | 193 } |
| 195 | 194 |
| 196 void CommandBufferImpl::DrawAnimationFrame() { client()->DrawAnimationFrame(); } | 195 void CommandBufferImpl::DrawAnimationFrame() { client()->DrawAnimationFrame(); } |
| 197 | 196 |
| 198 } // namespace services | 197 } // namespace services |
| 199 } // namespace mojo | 198 } // namespace mojo |
| OLD | NEW |