| 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/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 Loading... |
| 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_) { |
| 54 return nullptr; | 54 scoped_refptr<gpu::GpuChannelHost> gpu_channel = |
| 55 gpu_->EstablishGpuChannelSync(); |
| 56 shared_main_thread_context_provider_ = |
| 57 gpu_->CreateContextProvider(gpu_channel); |
| 58 if (!shared_main_thread_context_provider_->BindToCurrentThread()) |
| 59 shared_main_thread_context_provider_ = nullptr; |
| 60 } |
| 61 return shared_main_thread_context_provider_; |
| 55 } | 62 } |
| 56 | 63 |
| 57 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { | 64 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { |
| 58 // NOTIMPLEMENTED(); | 65 // NOTIMPLEMENTED(); |
| 59 } | 66 } |
| 60 | 67 |
| 61 double MusContextFactory::GetRefreshRate() const { | 68 double MusContextFactory::GetRefreshRate() const { |
| 62 return 60.0; | 69 return 60.0; |
| 63 } | 70 } |
| 64 | 71 |
| 65 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format, | 72 uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format, |
| 66 gfx::BufferUsage usage) { | 73 gfx::BufferUsage usage) { |
| 67 // TODO(sad): http://crbug.com/675431 | 74 // TODO(sad): http://crbug.com/675431 |
| 68 return GL_TEXTURE_2D; | 75 return GL_TEXTURE_2D; |
| 69 } | 76 } |
| 70 | 77 |
| 71 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() { | 78 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() { |
| 72 return gpu_->gpu_memory_buffer_manager(); | 79 return gpu_->gpu_memory_buffer_manager(); |
| 73 } | 80 } |
| 74 | 81 |
| 75 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { | 82 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { |
| 76 return raster_thread_helper_.task_graph_runner(); | 83 return raster_thread_helper_.task_graph_runner(); |
| 77 } | 84 } |
| 78 | 85 |
| 79 } // namespace aura | 86 } // namespace aura |
| OLD | NEW |