OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/aura/mus/mus_context_factory.h" | 5 #include "ui/aura/mus/mus_context_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "cc/base/switches.h" | 9 #include "cc/base/switches.h" |
10 #include "services/ui/public/cpp/gpu/gpu.h" | 10 #include "services/ui/public/cpp/gpu/gpu.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 MusContextFactory::~MusContextFactory() {} | 30 MusContextFactory::~MusContextFactory() {} |
31 | 31 |
32 void MusContextFactory::OnEstablishedGpuChannel( | 32 void MusContextFactory::OnEstablishedGpuChannel( |
33 base::WeakPtr<ui::Compositor> compositor, | 33 base::WeakPtr<ui::Compositor> compositor, |
34 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { | 34 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { |
35 if (!compositor) | 35 if (!compositor) |
36 return; | 36 return; |
37 WindowTreeHost* host = | 37 WindowTreeHost* host = |
38 WindowTreeHost::GetForAcceleratedWidget(compositor->widget()); | 38 WindowTreeHost::GetForAcceleratedWidget(compositor->widget()); |
39 WindowPortMus* window_port = WindowPortMus::Get(host->window()); | 39 WindowPort* window_port = WindowPortMus::Get(host->window()); |
40 DCHECK(window_port); | 40 DCHECK(window_port); |
41 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink = | 41 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink = |
42 window_port->RequestCompositorFrameSink( | 42 window_port->CreateCompositorFrameSink( |
43 gpu_->CreateContextProvider(std::move(gpu_channel)), | 43 gpu_->CreateContextProvider(std::move(gpu_channel)), |
44 gpu_->gpu_memory_buffer_manager()); | 44 gpu_->gpu_memory_buffer_manager()); |
45 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 45 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
46 } | 46 } |
47 | 47 |
48 void MusContextFactory::CreateCompositorFrameSink( | 48 void MusContextFactory::CreateCompositorFrameSink( |
49 base::WeakPtr<ui::Compositor> compositor) { | 49 base::WeakPtr<ui::Compositor> compositor) { |
50 gpu_->EstablishGpuChannel( | 50 gpu_->EstablishGpuChannel( |
51 base::Bind(&MusContextFactory::OnEstablishedGpuChannel, | 51 base::Bind(&MusContextFactory::OnEstablishedGpuChannel, |
52 weak_ptr_factory_.GetWeakPtr(), compositor)); | 52 weak_ptr_factory_.GetWeakPtr(), compositor)); |
(...skipping 26 matching lines...) Expand all Loading... |
79 | 79 |
80 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { | 80 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { |
81 return raster_thread_helper_.task_graph_runner(); | 81 return raster_thread_helper_.task_graph_runner(); |
82 } | 82 } |
83 | 83 |
84 const cc::RendererSettings& MusContextFactory::GetRendererSettings() const { | 84 const cc::RendererSettings& MusContextFactory::GetRendererSettings() const { |
85 return renderer_settings_; | 85 return renderer_settings_; |
86 } | 86 } |
87 | 87 |
88 } // namespace aura | 88 } // namespace aura |
OLD | NEW |