| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "blimp/client/support/compositor/compositor_dependencies_impl.h" | 5 #include "blimp/client/support/compositor/compositor_dependencies_impl.h" |
| 6 | 6 |
| 7 #include "blimp/client/support/compositor/blimp_context_provider.h" | 7 #include "blimp/client/support/compositor/blimp_context_provider.h" |
| 8 #include "blimp/client/support/compositor/blimp_gpu_memory_buffer_manager.h" | 8 #include "blimp/client/support/compositor/blimp_gpu_memory_buffer_manager.h" |
| 9 #include "blimp/client/support/compositor/blimp_layer_tree_settings.h" | 9 #include "blimp/client/support/compositor/blimp_layer_tree_settings.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| 11 #include "cc/surfaces/surface_manager.h" | 11 #include "cc/surfaces/surface_manager.h" |
| 12 #include "cc/trees/layer_tree_settings.h" | 12 #include "cc/trees/layer_tree_settings.h" |
| 13 #include "gpu/ipc/common/surface_handle.h" |
| 13 | 14 |
| 14 namespace blimp { | 15 namespace blimp { |
| 15 namespace client { | 16 namespace client { |
| 16 | 17 |
| 17 CompositorDependenciesImpl::CompositorDependenciesImpl() | 18 CompositorDependenciesImpl::CompositorDependenciesImpl() |
| 18 : gpu_memory_buffer_manager_( | 19 : gpu_memory_buffer_manager_( |
| 19 base::MakeUnique<BlimpGpuMemoryBufferManager>()), | 20 base::MakeUnique<BlimpGpuMemoryBufferManager>()), |
| 20 surface_manager_(base::MakeUnique<cc::SurfaceManager>()), | 21 surface_manager_(base::MakeUnique<cc::SurfaceManager>()), |
| 21 next_surface_id_(0) {} | 22 next_surface_id_(0) {} |
| 22 | 23 |
| 23 CompositorDependenciesImpl::~CompositorDependenciesImpl() = default; | 24 CompositorDependenciesImpl::~CompositorDependenciesImpl() = default; |
| 24 | 25 |
| 25 gpu::GpuMemoryBufferManager* | 26 gpu::GpuMemoryBufferManager* |
| 26 CompositorDependenciesImpl::GetGpuMemoryBufferManager() { | 27 CompositorDependenciesImpl::GetGpuMemoryBufferManager() { |
| 27 return gpu_memory_buffer_manager_.get(); | 28 return gpu_memory_buffer_manager_.get(); |
| 28 } | 29 } |
| 29 | 30 |
| 30 cc::SurfaceManager* CompositorDependenciesImpl::GetSurfaceManager() { | 31 cc::SurfaceManager* CompositorDependenciesImpl::GetSurfaceManager() { |
| 31 return surface_manager_.get(); | 32 return surface_manager_.get(); |
| 32 } | 33 } |
| 33 | 34 |
| 34 cc::FrameSinkId CompositorDependenciesImpl::AllocateFrameSinkId() { | 35 cc::FrameSinkId CompositorDependenciesImpl::AllocateFrameSinkId() { |
| 35 return cc::FrameSinkId(++next_surface_id_, 0 /* sink_id */); | 36 return cc::FrameSinkId(++next_surface_id_, 0 /* sink_id */); |
| 36 } | 37 } |
| 37 | 38 |
| 38 void CompositorDependenciesImpl::GetContextProviders( | 39 void CompositorDependenciesImpl::GetContextProviders( |
| 39 const CompositorDependencies::ContextProviderCallback& callback) { | 40 const CompositorDependencies::ContextProviderCallback& callback) { |
| 40 scoped_refptr<cc::ContextProvider> compositor_context = | 41 scoped_refptr<cc::ContextProvider> compositor_context = |
| 41 BlimpContextProvider::Create(gfx::kNullAcceleratedWidget, | 42 BlimpContextProvider::Create(gpu::kNullSurfaceHandle, |
| 42 gpu_memory_buffer_manager_.get()); | 43 gpu_memory_buffer_manager_.get()); |
| 43 | 44 |
| 44 // TODO(khushalsagar): Make a worker context and bind to the current thread. | 45 // TODO(khushalsagar): Make a worker context and bind to the current thread. |
| 45 callback.Run(compositor_context, nullptr); | 46 callback.Run(compositor_context, nullptr); |
| 46 } | 47 } |
| 47 | 48 |
| 48 } // namespace client | 49 } // namespace client |
| 49 } // namespace blimp | 50 } // namespace blimp |
| OLD | NEW |