| 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/views/mus/surface_context_factory.h" | 5 #include "ui/views/mus/surface_context_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "cc/resources/shared_bitmap_manager.h" | 8 #include "cc/resources/shared_bitmap_manager.h" |
| 9 #include "cc/surfaces/surface_id_allocator.h" | 9 #include "cc/surfaces/surface_id_allocator.h" |
| 10 #include "services/ui/public/cpp/context_provider.h" | |
| 11 #include "services/ui/public/cpp/gpu/gpu.h" | 10 #include "services/ui/public/cpp/gpu/gpu.h" |
| 12 #include "services/ui/public/cpp/window.h" | 11 #include "services/ui/public/cpp/window.h" |
| 13 #include "services/ui/public/cpp/window_compositor_frame_sink.h" | 12 #include "services/ui/public/cpp/window_compositor_frame_sink.h" |
| 14 #include "ui/compositor/reflector.h" | 13 #include "ui/compositor/reflector.h" |
| 15 #include "ui/gl/gl_bindings.h" | 14 #include "ui/gl/gl_bindings.h" |
| 16 #include "ui/views/mus/native_widget_mus.h" | 15 #include "ui/views/mus/native_widget_mus.h" |
| 17 | 16 |
| 18 namespace views { | 17 namespace views { |
| 19 | 18 |
| 20 SurfaceContextFactory::SurfaceContextFactory(ui::Gpu* gpu) : gpu_(gpu) {} | 19 SurfaceContextFactory::SurfaceContextFactory(ui::Gpu* gpu) : gpu_(gpu) {} |
| 21 | 20 |
| 22 SurfaceContextFactory::~SurfaceContextFactory() {} | 21 SurfaceContextFactory::~SurfaceContextFactory() {} |
| 23 | 22 |
| 24 void SurfaceContextFactory::CreateCompositorFrameSink( | 23 void SurfaceContextFactory::CreateCompositorFrameSink( |
| 25 base::WeakPtr<ui::Compositor> compositor) { | 24 base::WeakPtr<ui::Compositor> compositor) { |
| 26 ui::Window* window = compositor->window(); | 25 ui::Window* window = compositor->window(); |
| 27 NativeWidgetMus* native_widget = NativeWidgetMus::GetForWindow(window); | 26 NativeWidgetMus* native_widget = NativeWidgetMus::GetForWindow(window); |
| 28 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type = | 27 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type = |
| 29 native_widget->compositor_frame_sink_type(); | 28 native_widget->compositor_frame_sink_type(); |
| 30 auto compositor_frame_sink = window->RequestCompositorFrameSink( | 29 auto compositor_frame_sink = window->RequestCompositorFrameSink( |
| 31 compositor_frame_sink_type, make_scoped_refptr(new ui::ContextProvider( | 30 compositor_frame_sink_type, |
| 32 gpu_->EstablishGpuChannelSync())), | 31 gpu_->CreateContextProvider(gpu_->EstablishGpuChannelSync()), |
| 33 gpu_->gpu_memory_buffer_manager()); | 32 gpu_->gpu_memory_buffer_manager()); |
| 34 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 33 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
| 35 } | 34 } |
| 36 | 35 |
| 37 scoped_refptr<cc::ContextProvider> | 36 scoped_refptr<cc::ContextProvider> |
| 38 SurfaceContextFactory::SharedMainThreadContextProvider() { | 37 SurfaceContextFactory::SharedMainThreadContextProvider() { |
| 39 // NOTIMPLEMENTED(); | 38 // NOTIMPLEMENTED(); |
| 40 return nullptr; | 39 return nullptr; |
| 41 } | 40 } |
| 42 | 41 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 gpu::GpuMemoryBufferManager* | 56 gpu::GpuMemoryBufferManager* |
| 58 SurfaceContextFactory::GetGpuMemoryBufferManager() { | 57 SurfaceContextFactory::GetGpuMemoryBufferManager() { |
| 59 return gpu_->gpu_memory_buffer_manager(); | 58 return gpu_->gpu_memory_buffer_manager(); |
| 60 } | 59 } |
| 61 | 60 |
| 62 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() { | 61 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() { |
| 63 return raster_thread_helper_.task_graph_runner(); | 62 return raster_thread_helper_.task_graph_runner(); |
| 64 } | 63 } |
| 65 | 64 |
| 66 } // namespace views | 65 } // namespace views |
| OLD | NEW |