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" | 10 #include "services/ui/public/cpp/context_provider.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 | 34 |
35 SurfaceContextFactory::~SurfaceContextFactory() {} | 35 SurfaceContextFactory::~SurfaceContextFactory() {} |
36 | 36 |
37 void SurfaceContextFactory::CreateCompositorFrameSink( | 37 void SurfaceContextFactory::CreateCompositorFrameSink( |
38 base::WeakPtr<ui::Compositor> compositor) { | 38 base::WeakPtr<ui::Compositor> compositor) { |
39 ui::Window* window = compositor->window(); | 39 ui::Window* window = compositor->window(); |
40 NativeWidgetMus* native_widget = NativeWidgetMus::GetForWindow(window); | 40 NativeWidgetMus* native_widget = NativeWidgetMus::GetForWindow(window); |
41 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type = | 41 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type = |
42 native_widget->compositor_frame_sink_type(); | 42 native_widget->compositor_frame_sink_type(); |
43 auto compositor_frame_sink = window->RequestCompositorFrameSink( | 43 auto compositor_frame_sink = window->RequestCompositorFrameSink( |
44 compositor_frame_sink_type, | 44 compositor_frame_sink_type, make_scoped_refptr(new ui::ContextProvider( |
45 make_scoped_refptr( | 45 gpu_service_->EstablishGpuChannelSync())), |
46 new ui::ContextProvider(gpu_service_->EstablishGpuChannelSync()))); | 46 GetGpuMemoryBufferManager()); |
danakj
2016/10/27 21:00:34
this could go to gpu_service_ right, do we need th
piman
2016/10/28 00:58:36
I changed to gpu_service_->gpu_memory_buffer_manag
danakj
2016/10/28 01:33:20
Was hoping the method could go away entirely but t
| |
47 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 47 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
48 } | 48 } |
49 | 49 |
50 std::unique_ptr<ui::Reflector> SurfaceContextFactory::CreateReflector( | 50 std::unique_ptr<ui::Reflector> SurfaceContextFactory::CreateReflector( |
51 ui::Compositor* mirroed_compositor, | 51 ui::Compositor* mirroed_compositor, |
52 ui::Layer* mirroring_layer) { | 52 ui::Layer* mirroring_layer) { |
53 // NOTIMPLEMENTED(); | 53 // NOTIMPLEMENTED(); |
54 return base::WrapUnique(new FakeReflector); | 54 return base::WrapUnique(new FakeReflector); |
55 } | 55 } |
56 | 56 |
(...skipping 14 matching lines...) Expand all Loading... | |
71 bool SurfaceContextFactory::DoesCreateTestContexts() { | 71 bool SurfaceContextFactory::DoesCreateTestContexts() { |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 uint32_t SurfaceContextFactory::GetImageTextureTarget(gfx::BufferFormat format, | 75 uint32_t SurfaceContextFactory::GetImageTextureTarget(gfx::BufferFormat format, |
76 gfx::BufferUsage usage) { | 76 gfx::BufferUsage usage) { |
77 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D. | 77 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D. |
78 return GL_TEXTURE_2D; | 78 return GL_TEXTURE_2D; |
79 } | 79 } |
80 | 80 |
81 cc::SharedBitmapManager* SurfaceContextFactory::GetSharedBitmapManager() { | |
82 // NOTIMPLEMENTED(); | |
83 return nullptr; | |
84 } | |
85 | |
86 gpu::GpuMemoryBufferManager* | 81 gpu::GpuMemoryBufferManager* |
87 SurfaceContextFactory::GetGpuMemoryBufferManager() { | 82 SurfaceContextFactory::GetGpuMemoryBufferManager() { |
88 return gpu_service_->gpu_memory_buffer_manager(); | 83 return gpu_service_->gpu_memory_buffer_manager(); |
89 } | 84 } |
90 | 85 |
91 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() { | 86 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() { |
92 return raster_thread_helper_.task_graph_runner(); | 87 return raster_thread_helper_.task_graph_runner(); |
93 } | 88 } |
94 | 89 |
95 cc::FrameSinkId SurfaceContextFactory::AllocateFrameSinkId() { | 90 cc::FrameSinkId SurfaceContextFactory::AllocateFrameSinkId() { |
96 return cc::FrameSinkId(0, next_sink_id_++); | 91 return cc::FrameSinkId(0, next_sink_id_++); |
97 } | 92 } |
98 | 93 |
99 cc::SurfaceManager* SurfaceContextFactory::GetSurfaceManager() { | 94 cc::SurfaceManager* SurfaceContextFactory::GetSurfaceManager() { |
100 return &surface_manager_; | 95 return &surface_manager_; |
101 } | 96 } |
102 | 97 |
103 void SurfaceContextFactory::SetDisplayVisible(ui::Compositor* compositor, | 98 void SurfaceContextFactory::SetDisplayVisible(ui::Compositor* compositor, |
104 bool visible) { | 99 bool visible) { |
105 // TODO(fsamuel): display[compositor]->SetVisible(visible); | 100 // TODO(fsamuel): display[compositor]->SetVisible(visible); |
106 } | 101 } |
107 | 102 |
108 void SurfaceContextFactory::ResizeDisplay(ui::Compositor* compositor, | 103 void SurfaceContextFactory::ResizeDisplay(ui::Compositor* compositor, |
109 const gfx::Size& size) { | 104 const gfx::Size& size) { |
110 // TODO(fsamuel): display[compositor]->Resize(size); | 105 // TODO(fsamuel): display[compositor]->Resize(size); |
111 } | 106 } |
112 | 107 |
113 } // namespace views | 108 } // namespace views |
OLD | NEW |