| 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 20 matching lines...) Expand all Loading... |
| 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 WindowPortMus* window_port = WindowPortMus::Get(host->window()); |
| 40 DCHECK(window_port); | 40 DCHECK(window_port); |
| 41 window_port->RequestCompositorFrameSink( | 41 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink = |
| 42 gpu_->CreateContextProvider(std::move(gpu_channel)), | 42 window_port->RequestCompositorFrameSink( |
| 43 gpu_->gpu_memory_buffer_manager(), | 43 gpu_->CreateContextProvider(std::move(gpu_channel)), |
| 44 base::Bind(&MusContextFactory::OnCompositorFrameSinkAvailable, | 44 gpu_->gpu_memory_buffer_manager()); |
| 45 weak_ptr_factory_.GetWeakPtr(), compositor)); | |
| 46 } | |
| 47 | |
| 48 void MusContextFactory::OnCompositorFrameSinkAvailable( | |
| 49 base::WeakPtr<ui::Compositor> compositor, | |
| 50 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink) { | |
| 51 if (!compositor) | |
| 52 return; | |
| 53 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 45 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
| 54 } | 46 } |
| 55 | 47 |
| 56 void MusContextFactory::CreateCompositorFrameSink( | 48 void MusContextFactory::CreateCompositorFrameSink( |
| 57 base::WeakPtr<ui::Compositor> compositor) { | 49 base::WeakPtr<ui::Compositor> compositor) { |
| 58 gpu_->EstablishGpuChannel( | 50 gpu_->EstablishGpuChannel( |
| 59 base::Bind(&MusContextFactory::OnEstablishedGpuChannel, | 51 base::Bind(&MusContextFactory::OnEstablishedGpuChannel, |
| 60 weak_ptr_factory_.GetWeakPtr(), compositor)); | 52 weak_ptr_factory_.GetWeakPtr(), compositor)); |
| 61 } | 53 } |
| 62 | 54 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 80 | 72 |
| 81 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { | 73 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { |
| 82 return raster_thread_helper_.task_graph_runner(); | 74 return raster_thread_helper_.task_graph_runner(); |
| 83 } | 75 } |
| 84 | 76 |
| 85 const cc::RendererSettings& MusContextFactory::GetRendererSettings() const { | 77 const cc::RendererSettings& MusContextFactory::GetRendererSettings() const { |
| 86 return renderer_settings_; | 78 return renderer_settings_; |
| 87 } | 79 } |
| 88 | 80 |
| 89 } // namespace aura | 81 } // namespace aura |
| OLD | NEW |