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

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

Issue 2586323002: mus: Use ui::ContextProviderCommandBuffer. (Closed)
Patch Set: . Created 3 years, 12 months 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/views/mus/surface_context_factory.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"
9 #include "services/ui/public/cpp/gpu/gpu.h" 8 #include "services/ui/public/cpp/gpu/gpu.h"
10 #include "ui/aura/mus/window_port_mus.h" 9 #include "ui/aura/mus/window_port_mus.h"
11 #include "ui/aura/window_tree_host.h" 10 #include "ui/aura/window_tree_host.h"
12 #include "ui/gl/gl_bindings.h" 11 #include "ui/gl/gl_bindings.h"
13 12
14 namespace aura { 13 namespace aura {
15 14
16 MusContextFactory::MusContextFactory(ui::Gpu* gpu) : gpu_(gpu) {} 15 MusContextFactory::MusContextFactory(ui::Gpu* gpu)
16 : gpu_(gpu), weak_ptr_factory_(this) {}
17 17
18 MusContextFactory::~MusContextFactory() {} 18 MusContextFactory::~MusContextFactory() {}
19 19
20 void MusContextFactory::CreateCompositorFrameSink( 20 void MusContextFactory::OnEstablishedGpuChannel(
21 base::WeakPtr<ui::Compositor> compositor) { 21 base::WeakPtr<ui::Compositor> compositor,
22 scoped_refptr<gpu::GpuChannelHost> gpu_channel) {
23 if (!compositor)
24 return;
22 WindowTreeHost* host = 25 WindowTreeHost* host =
23 WindowTreeHost::GetForAcceleratedWidget(compositor->widget()); 26 WindowTreeHost::GetForAcceleratedWidget(compositor->widget());
24 WindowPortMus* window_port = WindowPortMus::Get(host->window()); 27 WindowPortMus* window_port = WindowPortMus::Get(host->window());
25 DCHECK(window_port); 28 DCHECK(window_port);
26 auto compositor_frame_sink = window_port->RequestCompositorFrameSink( 29 auto compositor_frame_sink = window_port->RequestCompositorFrameSink(
27 ui::mojom::CompositorFrameSinkType::DEFAULT, 30 ui::mojom::CompositorFrameSinkType::DEFAULT,
28 make_scoped_refptr( 31 gpu_->CreateContextProvider(std::move(gpu_channel)),
29 new ui::ContextProvider(gpu_->EstablishGpuChannelSync())),
30 gpu_->gpu_memory_buffer_manager()); 32 gpu_->gpu_memory_buffer_manager());
31 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); 33 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink));
32 } 34 }
33 35
36 void MusContextFactory::CreateCompositorFrameSink(
37 base::WeakPtr<ui::Compositor> compositor) {
38 gpu_->EstablishGpuChannel(
39 base::Bind(&MusContextFactory::OnEstablishedGpuChannel,
40 weak_ptr_factory_.GetWeakPtr(), compositor));
41 }
42
34 scoped_refptr<cc::ContextProvider> 43 scoped_refptr<cc::ContextProvider>
35 MusContextFactory::SharedMainThreadContextProvider() { 44 MusContextFactory::SharedMainThreadContextProvider() {
36 // NOTIMPLEMENTED(); 45 // NOTIMPLEMENTED();
37 return nullptr; 46 return nullptr;
38 } 47 }
39 48
40 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { 49 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) {
41 // NOTIMPLEMENTED(); 50 // NOTIMPLEMENTED();
42 } 51 }
43 52
44 bool MusContextFactory::DoesCreateTestContexts() { 53 bool MusContextFactory::DoesCreateTestContexts() {
45 return false; 54 return false;
46 } 55 }
47 56
48 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format, 57 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
49 gfx::BufferUsage usage) { 58 gfx::BufferUsage usage) {
50 // TODO(sad): http://crbug.com/675431 59 // TODO(sad): http://crbug.com/675431
51 return GL_TEXTURE_2D; 60 return GL_TEXTURE_2D;
52 } 61 }
53 62
54 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() { 63 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() {
55 return gpu_->gpu_memory_buffer_manager(); 64 return gpu_->gpu_memory_buffer_manager();
56 } 65 }
57 66
58 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { 67 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() {
59 return raster_thread_helper_.task_graph_runner(); 68 return raster_thread_helper_.task_graph_runner();
60 } 69 }
61 70
62 } // namespace aura 71 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/mus_context_factory.h ('k') | ui/views/mus/surface_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698