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/command_line.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "cc/base/switches.h" | 9 #include "cc/base/switches.h" |
10 #include "services/ui/public/cpp/gpu/gpu.h" | 10 #include "services/ui/public/cpp/gpu/gpu.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 void MusContextFactory::CreateCompositorFrameSink( | 56 void MusContextFactory::CreateCompositorFrameSink( |
57 base::WeakPtr<ui::Compositor> compositor) { | 57 base::WeakPtr<ui::Compositor> compositor) { |
58 gpu_->EstablishGpuChannel( | 58 gpu_->EstablishGpuChannel( |
59 base::Bind(&MusContextFactory::OnEstablishedGpuChannel, | 59 base::Bind(&MusContextFactory::OnEstablishedGpuChannel, |
60 weak_ptr_factory_.GetWeakPtr(), compositor)); | 60 weak_ptr_factory_.GetWeakPtr(), compositor)); |
61 } | 61 } |
62 | 62 |
63 scoped_refptr<cc::ContextProvider> | 63 scoped_refptr<cc::ContextProvider> |
64 MusContextFactory::SharedMainThreadContextProvider() { | 64 MusContextFactory::SharedMainThreadContextProvider() { |
65 // NOTIMPLEMENTED(); | 65 if (!shared_main_thread_context_provider_) { |
66 return nullptr; | 66 scoped_refptr<gpu::GpuChannelHost> gpu_channel = |
| 67 gpu_->EstablishGpuChannelSync(); |
| 68 shared_main_thread_context_provider_ = |
| 69 gpu_->CreateContextProvider(std::move(gpu_channel)); |
| 70 if (!shared_main_thread_context_provider_->BindToCurrentThread()) |
| 71 shared_main_thread_context_provider_ = nullptr; |
| 72 } |
| 73 return shared_main_thread_context_provider_; |
67 } | 74 } |
68 | 75 |
69 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { | 76 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { |
70 // NOTIMPLEMENTED(); | 77 // NOTIMPLEMENTED(); |
71 } | 78 } |
72 | 79 |
73 double MusContextFactory::GetRefreshRate() const { | 80 double MusContextFactory::GetRefreshRate() const { |
74 return 60.0; | 81 return 60.0; |
75 } | 82 } |
76 | 83 |
77 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() { | 84 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() { |
78 return gpu_->gpu_memory_buffer_manager(); | 85 return gpu_->gpu_memory_buffer_manager(); |
79 } | 86 } |
80 | 87 |
81 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { | 88 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { |
82 return raster_thread_helper_.task_graph_runner(); | 89 return raster_thread_helper_.task_graph_runner(); |
83 } | 90 } |
84 | 91 |
85 const cc::RendererSettings& MusContextFactory::GetRendererSettings() const { | 92 const cc::RendererSettings& MusContextFactory::GetRendererSettings() const { |
86 return renderer_settings_; | 93 return renderer_settings_; |
87 } | 94 } |
88 | 95 |
89 } // namespace aura | 96 } // namespace aura |
OLD | NEW |