Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: ui/aura/mus/mus_context_factory.cc

Issue 2563783002: ui + mus: Split ContextFactory into ContextFactory(Client) and ContextFactoryPrivate (Closed)
Patch Set: Updated Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "services/ui/public/cpp/context_provider.h" 8 #include "services/ui/public/cpp/context_provider.h"
9 #include "services/ui/public/cpp/gpu/gpu_service.h" 9 #include "services/ui/public/cpp/gpu/gpu_service.h"
10 #include "ui/aura/mus/window_port_mus.h" 10 #include "ui/aura/mus/window_port_mus.h"
11 #include "ui/aura/window_tree_host.h" 11 #include "ui/aura/window_tree_host.h"
12 #include "ui/compositor/reflector.h"
13 #include "ui/gl/gl_bindings.h" 12 #include "ui/gl/gl_bindings.h"
14 13
15 namespace aura { 14 namespace aura {
16 namespace { 15 namespace {
17 16
18 class FakeReflector : public ui::Reflector {
19 public:
20 FakeReflector() {}
21 ~FakeReflector() override {}
22 void OnMirroringCompositorResized() override {}
23 void AddMirroringLayer(ui::Layer* layer) override {}
24 void RemoveMirroringLayer(ui::Layer* layer) override {}
25 };
26 17
27 } // namespace 18 } // namespace
28 19
29 MusContextFactory::MusContextFactory(ui::GpuService* gpu_service) 20 MusContextFactory::MusContextFactory(ui::GpuService* gpu_service)
30 : next_sink_id_(1u), gpu_service_(gpu_service) {} 21 : gpu_service_(gpu_service) {}
31 22
32 MusContextFactory::~MusContextFactory() {} 23 MusContextFactory::~MusContextFactory() {}
33 24
34 void MusContextFactory::CreateCompositorFrameSink( 25 void MusContextFactory::CreateCompositorFrameSink(
35 base::WeakPtr<ui::Compositor> compositor) { 26 base::WeakPtr<ui::Compositor> compositor) {
36 WindowTreeHost* host = 27 WindowTreeHost* host =
37 WindowTreeHost::GetForAcceleratedWidget(compositor->widget()); 28 WindowTreeHost::GetForAcceleratedWidget(compositor->widget());
38 WindowPortMus* window_port = WindowPortMus::Get(host->window()); 29 WindowPortMus* window_port = WindowPortMus::Get(host->window());
39 DCHECK(window_port); 30 DCHECK(window_port);
40 auto compositor_frame_sink = window_port->RequestCompositorFrameSink( 31 auto compositor_frame_sink = window_port->RequestCompositorFrameSink(
41 ui::mojom::CompositorFrameSinkType::DEFAULT, 32 ui::mojom::CompositorFrameSinkType::DEFAULT,
42 make_scoped_refptr( 33 make_scoped_refptr(
43 new ui::ContextProvider(gpu_service_->EstablishGpuChannelSync())), 34 new ui::ContextProvider(gpu_service_->EstablishGpuChannelSync())),
44 gpu_service_->gpu_memory_buffer_manager()); 35 gpu_service_->gpu_memory_buffer_manager());
45 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); 36 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink));
46 } 37 }
47 38
48 std::unique_ptr<ui::Reflector> MusContextFactory::CreateReflector(
49 ui::Compositor* mirroed_compositor,
50 ui::Layer* mirroring_layer) {
51 // NOTIMPLEMENTED();
52 return base::WrapUnique(new FakeReflector);
53 }
54
55 void MusContextFactory::RemoveReflector(ui::Reflector* reflector) {
56 // NOTIMPLEMENTED();
57 }
58
59 scoped_refptr<cc::ContextProvider> 39 scoped_refptr<cc::ContextProvider>
60 MusContextFactory::SharedMainThreadContextProvider() { 40 MusContextFactory::SharedMainThreadContextProvider() {
61 // NOTIMPLEMENTED(); 41 // NOTIMPLEMENTED();
62 return nullptr; 42 return nullptr;
63 } 43 }
64 44
65 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { 45 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) {
66 // NOTIMPLEMENTED(); 46 // NOTIMPLEMENTED();
67 } 47 }
68 48
69 bool MusContextFactory::DoesCreateTestContexts() { 49 bool MusContextFactory::DoesCreateTestContexts() {
70 return false; 50 return false;
71 } 51 }
72 52
73 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format, 53 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
74 gfx::BufferUsage usage) { 54 gfx::BufferUsage usage) {
75 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D. 55 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D.
76 return GL_TEXTURE_2D; 56 return GL_TEXTURE_2D;
77 } 57 }
78 58
79 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() { 59 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() {
80 return gpu_service_->gpu_memory_buffer_manager(); 60 return gpu_service_->gpu_memory_buffer_manager();
81 } 61 }
82 62
83 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { 63 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() {
84 return raster_thread_helper_.task_graph_runner(); 64 return raster_thread_helper_.task_graph_runner();
85 } 65 }
86 66
87 cc::FrameSinkId MusContextFactory::AllocateFrameSinkId() {
88 return cc::FrameSinkId(0, next_sink_id_++);
89 }
90
91 cc::SurfaceManager* MusContextFactory::GetSurfaceManager() {
92 return &surface_manager_;
93 }
94
95 void MusContextFactory::SetDisplayVisible(ui::Compositor* compositor,
96 bool visible) {
97 // TODO(fsamuel): display[compositor]->SetVisible(visible);
98 }
99
100 void MusContextFactory::ResizeDisplay(ui::Compositor* compositor,
101 const gfx::Size& size) {
102 // TODO(fsamuel): display[compositor]->Resize(size);
103 }
104
105 } // namespace aura 67 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698