| 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/compositor_frame_sink.h" | 10 #include "services/ui/public/cpp/compositor_frame_sink.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 FakeReflector() {} | 22 FakeReflector() {} |
| 23 ~FakeReflector() override {} | 23 ~FakeReflector() override {} |
| 24 void OnMirroringCompositorResized() override {} | 24 void OnMirroringCompositorResized() override {} |
| 25 void AddMirroringLayer(ui::Layer* layer) override {} | 25 void AddMirroringLayer(ui::Layer* layer) override {} |
| 26 void RemoveMirroringLayer(ui::Layer* layer) override {} | 26 void RemoveMirroringLayer(ui::Layer* layer) override {} |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 SurfaceContextFactory::SurfaceContextFactory(ui::GpuService* gpu_service) | 31 SurfaceContextFactory::SurfaceContextFactory(ui::GpuService* gpu_service) |
| 32 : next_surface_id_namespace_(1u), gpu_service_(gpu_service) {} | 32 : surface_manager_(nullptr), |
| 33 next_surface_id_namespace_(1u), |
| 34 gpu_service_(gpu_service) {} |
| 33 | 35 |
| 34 SurfaceContextFactory::~SurfaceContextFactory() {} | 36 SurfaceContextFactory::~SurfaceContextFactory() {} |
| 35 | 37 |
| 36 void SurfaceContextFactory::CreateCompositorFrameSink( | 38 void SurfaceContextFactory::CreateCompositorFrameSink( |
| 37 base::WeakPtr<ui::Compositor> compositor) { | 39 base::WeakPtr<ui::Compositor> compositor) { |
| 38 ui::Window* window = compositor->window(); | 40 ui::Window* window = compositor->window(); |
| 39 NativeWidgetMus* native_widget = NativeWidgetMus::GetForWindow(window); | 41 NativeWidgetMus* native_widget = NativeWidgetMus::GetForWindow(window); |
| 40 ui::mojom::SurfaceType surface_type = native_widget->surface_type(); | 42 ui::mojom::SurfaceType surface_type = native_widget->surface_type(); |
| 41 auto compositor_frame_sink = base::MakeUnique<ui::CompositorFrameSink>( | 43 auto compositor_frame_sink = base::MakeUnique<ui::CompositorFrameSink>( |
| 42 gpu_service_->EstablishGpuChannelSync(), | 44 gpu_service_->EstablishGpuChannelSync(), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 84 |
| 83 gpu::GpuMemoryBufferManager* | 85 gpu::GpuMemoryBufferManager* |
| 84 SurfaceContextFactory::GetGpuMemoryBufferManager() { | 86 SurfaceContextFactory::GetGpuMemoryBufferManager() { |
| 85 return gpu_service_->gpu_memory_buffer_manager(); | 87 return gpu_service_->gpu_memory_buffer_manager(); |
| 86 } | 88 } |
| 87 | 89 |
| 88 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() { | 90 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() { |
| 89 return raster_thread_helper_.task_graph_runner(); | 91 return raster_thread_helper_.task_graph_runner(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 uint32_t SurfaceContextFactory::AllocateSurfaceClientId() { | 94 cc::FrameSinkId SurfaceContextFactory::AllocateFrameSinkId() { |
| 93 return next_surface_id_namespace_++; | 95 return cc::FrameSinkId(next_surface_id_namespace_++, 0); |
| 94 } | 96 } |
| 95 | 97 |
| 96 cc::SurfaceManager* SurfaceContextFactory::GetSurfaceManager() { | 98 cc::SurfaceManager* SurfaceContextFactory::GetSurfaceManager() { |
| 97 return &surface_manager_; | 99 return &surface_manager_; |
| 98 } | 100 } |
| 99 | 101 |
| 100 void SurfaceContextFactory::SetDisplayVisible(ui::Compositor* compositor, | 102 void SurfaceContextFactory::SetDisplayVisible(ui::Compositor* compositor, |
| 101 bool visible) { | 103 bool visible) { |
| 102 // TODO(fsamuel): display[compositor]->SetVisible(visible); | 104 // TODO(fsamuel): display[compositor]->SetVisible(visible); |
| 103 } | 105 } |
| 104 | 106 |
| 105 void SurfaceContextFactory::ResizeDisplay(ui::Compositor* compositor, | 107 void SurfaceContextFactory::ResizeDisplay(ui::Compositor* compositor, |
| 106 const gfx::Size& size) { | 108 const gfx::Size& size) { |
| 107 // TODO(fsamuel): display[compositor]->Resize(size); | 109 // TODO(fsamuel): display[compositor]->Resize(size); |
| 108 } | 110 } |
| 109 | 111 |
| 110 } // namespace views | 112 } // namespace views |
| OLD | NEW |