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

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: Restore mash 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
« no previous file with comments | « ui/aura/mus/mus_context_factory.h ('k') | ui/aura/test/aura_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 9 #include "services/ui/public/cpp/gpu/gpu.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::Gpu* gpu) 20 MusContextFactory::MusContextFactory(ui::Gpu* gpu) : gpu_(gpu) {}
30 : next_sink_id_(1u), gpu_(gpu) {}
31 21
32 MusContextFactory::~MusContextFactory() {} 22 MusContextFactory::~MusContextFactory() {}
33 23
34 void MusContextFactory::CreateCompositorFrameSink( 24 void MusContextFactory::CreateCompositorFrameSink(
35 base::WeakPtr<ui::Compositor> compositor) { 25 base::WeakPtr<ui::Compositor> compositor) {
36 WindowTreeHost* host = 26 WindowTreeHost* host =
37 WindowTreeHost::GetForAcceleratedWidget(compositor->widget()); 27 WindowTreeHost::GetForAcceleratedWidget(compositor->widget());
38 WindowPortMus* window_port = WindowPortMus::Get(host->window()); 28 WindowPortMus* window_port = WindowPortMus::Get(host->window());
39 DCHECK(window_port); 29 DCHECK(window_port);
40 auto compositor_frame_sink = window_port->RequestCompositorFrameSink( 30 auto compositor_frame_sink = window_port->RequestCompositorFrameSink(
41 ui::mojom::CompositorFrameSinkType::DEFAULT, 31 ui::mojom::CompositorFrameSinkType::DEFAULT,
42 make_scoped_refptr( 32 make_scoped_refptr(
43 new ui::ContextProvider(gpu_->EstablishGpuChannelSync())), 33 new ui::ContextProvider(gpu_->EstablishGpuChannelSync())),
44 gpu_->gpu_memory_buffer_manager()); 34 gpu_->gpu_memory_buffer_manager());
45 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); 35 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink));
46 } 36 }
47 37
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> 38 scoped_refptr<cc::ContextProvider>
60 MusContextFactory::SharedMainThreadContextProvider() { 39 MusContextFactory::SharedMainThreadContextProvider() {
61 // NOTIMPLEMENTED(); 40 // NOTIMPLEMENTED();
62 return nullptr; 41 return nullptr;
63 } 42 }
64 43
65 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { 44 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) {
66 // NOTIMPLEMENTED(); 45 // NOTIMPLEMENTED();
67 } 46 }
68 47
69 bool MusContextFactory::DoesCreateTestContexts() { 48 bool MusContextFactory::DoesCreateTestContexts() {
70 return false; 49 return false;
71 } 50 }
72 51
73 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format, 52 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
74 gfx::BufferUsage usage) { 53 gfx::BufferUsage usage) {
75 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D. 54 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D.
76 return GL_TEXTURE_2D; 55 return GL_TEXTURE_2D;
77 } 56 }
78 57
79 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() { 58 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() {
80 return gpu_->gpu_memory_buffer_manager(); 59 return gpu_->gpu_memory_buffer_manager();
81 } 60 }
82 61
83 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { 62 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() {
84 return raster_thread_helper_.task_graph_runner(); 63 return raster_thread_helper_.task_graph_runner();
85 } 64 }
86 65
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 66 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/mus_context_factory.h ('k') | ui/aura/test/aura_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698