Chromium Code Reviews| 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/aura/mus/mus_context_factory.h" | 5 #include "ui/aura/mus/mus_context_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | |
| 7 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "cc/base/switches.h" | |
| 8 #include "services/ui/public/cpp/gpu/gpu.h" | 10 #include "services/ui/public/cpp/gpu/gpu.h" |
| 9 #include "ui/aura/mus/window_port_mus.h" | 11 #include "ui/aura/mus/window_port_mus.h" |
| 10 #include "ui/aura/window_tree_host.h" | 12 #include "ui/aura/window_tree_host.h" |
| 13 #include "ui/compositor/compositor_switches.h" | |
| 14 #include "ui/compositor/compositor_util.h" | |
| 15 #include "ui/display/display_switches.h" | |
| 16 #include "ui/gfx/switches.h" | |
| 11 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
| 12 | 18 |
| 13 namespace aura { | 19 namespace aura { |
| 14 | 20 |
| 21 // uint32_t Helper(gfx::BufferUsage) | |
|
danakj
2017/05/11 20:10:16
unintended?
Alex Z.
2017/05/12 14:12:36
It's removed.
| |
| 22 | |
| 15 MusContextFactory::MusContextFactory(ui::Gpu* gpu) | 23 MusContextFactory::MusContextFactory(ui::Gpu* gpu) |
| 16 : gpu_(gpu), weak_ptr_factory_(this) {} | 24 : gpu_(gpu), weak_ptr_factory_(this) { |
| 25 ui::InitializeRendererSettings( | |
| 26 base::Bind( | |
| 27 [](gfx::BufferFormat format, gfx::BufferUsage usage) -> uint32_t { | |
| 28 // TODO(sad): http://crbug.com/675431 | |
| 29 return GL_TEXTURE_2D; | |
| 30 }), | |
| 31 &renderer_settings_); | |
| 32 } | |
| 17 | 33 |
| 18 MusContextFactory::~MusContextFactory() {} | 34 MusContextFactory::~MusContextFactory() {} |
| 19 | 35 |
| 20 void MusContextFactory::OnEstablishedGpuChannel( | 36 void MusContextFactory::OnEstablishedGpuChannel( |
| 21 base::WeakPtr<ui::Compositor> compositor, | 37 base::WeakPtr<ui::Compositor> compositor, |
| 22 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { | 38 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { |
| 23 if (!compositor) | 39 if (!compositor) |
| 24 return; | 40 return; |
| 25 WindowTreeHost* host = | 41 WindowTreeHost* host = |
| 26 WindowTreeHost::GetForAcceleratedWidget(compositor->widget()); | 42 WindowTreeHost::GetForAcceleratedWidget(compositor->widget()); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 55 } | 71 } |
| 56 | 72 |
| 57 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { | 73 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { |
| 58 // NOTIMPLEMENTED(); | 74 // NOTIMPLEMENTED(); |
| 59 } | 75 } |
| 60 | 76 |
| 61 double MusContextFactory::GetRefreshRate() const { | 77 double MusContextFactory::GetRefreshRate() const { |
| 62 return 60.0; | 78 return 60.0; |
| 63 } | 79 } |
| 64 | 80 |
| 65 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format, | |
| 66 gfx::BufferUsage usage) { | |
| 67 // TODO(sad): http://crbug.com/675431 | |
| 68 return GL_TEXTURE_2D; | |
| 69 } | |
| 70 | |
| 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 |
| 89 const cc::RendererSettings& MusContextFactory::GetRendererSettings() const { | |
| 90 return renderer_settings_; | |
| 91 } | |
| 92 | |
| 79 } // namespace aura | 93 } // namespace aura |
| OLD | NEW |