| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/views/mus/surface_context_factory.h" | |
| 6 | |
| 7 #include "base/memory/ptr_util.h" | |
| 8 #include "cc/resources/shared_bitmap_manager.h" | |
| 9 #include "cc/surfaces/surface_id_allocator.h" | |
| 10 #include "services/ui/public/cpp/gpu/gpu.h" | |
| 11 #include "services/ui/public/cpp/window.h" | |
| 12 #include "services/ui/public/cpp/window_compositor_frame_sink.h" | |
| 13 #include "ui/compositor/reflector.h" | |
| 14 #include "ui/gl/gl_bindings.h" | |
| 15 #include "ui/views/mus/native_widget_mus.h" | |
| 16 | |
| 17 namespace views { | |
| 18 | |
| 19 SurfaceContextFactory::SurfaceContextFactory(ui::Gpu* gpu) : gpu_(gpu) {} | |
| 20 | |
| 21 SurfaceContextFactory::~SurfaceContextFactory() {} | |
| 22 | |
| 23 void SurfaceContextFactory::CreateCompositorFrameSink( | |
| 24 base::WeakPtr<ui::Compositor> compositor) { | |
| 25 ui::Window* window = compositor->window(); | |
| 26 NativeWidgetMus* native_widget = NativeWidgetMus::GetForWindow(window); | |
| 27 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type = | |
| 28 native_widget->compositor_frame_sink_type(); | |
| 29 auto compositor_frame_sink = window->RequestCompositorFrameSink( | |
| 30 compositor_frame_sink_type, | |
| 31 gpu_->CreateContextProvider(gpu_->EstablishGpuChannelSync()), | |
| 32 gpu_->gpu_memory_buffer_manager()); | |
| 33 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); | |
| 34 } | |
| 35 | |
| 36 scoped_refptr<cc::ContextProvider> | |
| 37 SurfaceContextFactory::SharedMainThreadContextProvider() { | |
| 38 // NOTIMPLEMENTED(); | |
| 39 return nullptr; | |
| 40 } | |
| 41 | |
| 42 void SurfaceContextFactory::RemoveCompositor(ui::Compositor* compositor) { | |
| 43 // NOTIMPLEMENTED(); | |
| 44 } | |
| 45 | |
| 46 bool SurfaceContextFactory::DoesCreateTestContexts() { | |
| 47 return false; | |
| 48 } | |
| 49 | |
| 50 uint32_t SurfaceContextFactory::GetImageTextureTarget(gfx::BufferFormat format, | |
| 51 gfx::BufferUsage usage) { | |
| 52 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D. | |
| 53 return GL_TEXTURE_2D; | |
| 54 } | |
| 55 | |
| 56 gpu::GpuMemoryBufferManager* | |
| 57 SurfaceContextFactory::GetGpuMemoryBufferManager() { | |
| 58 return gpu_->gpu_memory_buffer_manager(); | |
| 59 } | |
| 60 | |
| 61 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() { | |
| 62 return raster_thread_helper_.task_graph_runner(); | |
| 63 } | |
| 64 | |
| 65 } // namespace views | |
| OLD | NEW |