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