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

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

Issue 2875753002: Implement aura::WindowPortMus::CreateCompositorFrameSink() (Closed)
Patch Set: WIP Created 3 years, 7 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
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/gpu/gpu.h" 8 #include "services/ui/public/cpp/gpu/gpu.h"
9 #include "ui/aura/mus/window_port_mus.h" 9 #include "ui/aura/mus/window_port_mus.h"
10 #include "ui/aura/window_tree_host.h" 10 #include "ui/aura/window_tree_host.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 void MusContextFactory::CreateCompositorFrameSink( 44 void MusContextFactory::CreateCompositorFrameSink(
45 base::WeakPtr<ui::Compositor> compositor) { 45 base::WeakPtr<ui::Compositor> compositor) {
46 gpu_->EstablishGpuChannel( 46 gpu_->EstablishGpuChannel(
47 base::Bind(&MusContextFactory::OnEstablishedGpuChannel, 47 base::Bind(&MusContextFactory::OnEstablishedGpuChannel,
48 weak_ptr_factory_.GetWeakPtr(), compositor)); 48 weak_ptr_factory_.GetWeakPtr(), compositor));
49 } 49 }
50 50
51 scoped_refptr<cc::ContextProvider> 51 scoped_refptr<cc::ContextProvider>
52 MusContextFactory::SharedMainThreadContextProvider() { 52 MusContextFactory::SharedMainThreadContextProvider() {
53 // NOTIMPLEMENTED(); 53 if (!shared_main_thread_context_provider_) {
Fady Samuel 2017/05/16 10:26:41 Maybe this can be a separate CL?
54 return nullptr; 54 // In this point, the gpu channel should be already established in gpu_,
55 // the gpu_->EstablishGpuChannelSync() just returns the gpu channel
56 // immediately.
57 scoped_refptr<gpu::GpuChannelHost> gpu_channel =
58 gpu_->EstablishGpuChannelSync();
59 shared_main_thread_context_provider_ =
60 gpu_->CreateContextProvider(std::move(gpu_channel));
61 if (!shared_main_thread_context_provider_->BindToCurrentThread())
62 shared_main_thread_context_provider_ = nullptr;
63 }
64 return shared_main_thread_context_provider_;
55 } 65 }
56 66
57 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { 67 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) {
58 // NOTIMPLEMENTED(); 68 // NOTIMPLEMENTED();
59 } 69 }
60 70
61 double MusContextFactory::GetRefreshRate() const { 71 double MusContextFactory::GetRefreshRate() const {
62 return 60.0; 72 return 60.0;
63 } 73 }
64 74
65 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format, 75 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
66 gfx::BufferUsage usage) { 76 gfx::BufferUsage usage) {
67 // TODO(sad): http://crbug.com/675431 77 // TODO(sad): http://crbug.com/675431
68 return GL_TEXTURE_2D; 78 return GL_TEXTURE_2D;
69 } 79 }
70 80
71 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() { 81 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() {
72 return gpu_->gpu_memory_buffer_manager(); 82 return gpu_->gpu_memory_buffer_manager();
73 } 83 }
74 84
75 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { 85 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() {
76 return raster_thread_helper_.task_graph_runner(); 86 return raster_thread_helper_.task_graph_runner();
77 } 87 }
78 88
79 } // namespace aura 89 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698