OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/compositor/gpu_process_transport_factory.h" | 5 #include "content/browser/compositor/gpu_process_transport_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 namespace content { | 154 namespace content { |
155 | 155 |
156 struct GpuProcessTransportFactory::PerCompositorData { | 156 struct GpuProcessTransportFactory::PerCompositorData { |
157 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; | 157 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; |
158 BrowserCompositorOutputSurface* display_output_surface = nullptr; | 158 BrowserCompositorOutputSurface* display_output_surface = nullptr; |
159 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; | 159 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; |
160 ReflectorImpl* reflector = nullptr; | 160 ReflectorImpl* reflector = nullptr; |
161 std::unique_ptr<cc::Display> display; | 161 std::unique_ptr<cc::Display> display; |
162 bool output_is_secure = false; | 162 bool output_is_secure = false; |
| 163 gfx::ColorSpace color_space; |
163 }; | 164 }; |
164 | 165 |
165 GpuProcessTransportFactory::GpuProcessTransportFactory() | 166 GpuProcessTransportFactory::GpuProcessTransportFactory() |
166 : next_surface_id_namespace_(1u), | 167 : next_surface_id_namespace_(1u), |
167 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 168 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
168 callback_factory_(this) { | 169 callback_factory_(this) { |
169 cc::SetClientNameForMetrics("Browser"); | 170 cc::SetClientNameForMetrics("Browser"); |
170 | 171 |
171 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); | 172 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); |
172 | 173 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 surface_manager_.get(), compositor->surface_id_allocator(), | 534 surface_manager_.get(), compositor->surface_id_allocator(), |
534 data->display.get(), | 535 data->display.get(), |
535 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 536 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
536 vulkan_context_provider)) | 537 vulkan_context_provider)) |
537 : new cc::SurfaceDisplayOutputSurface( | 538 : new cc::SurfaceDisplayOutputSurface( |
538 surface_manager_.get(), compositor->surface_id_allocator(), | 539 surface_manager_.get(), compositor->surface_id_allocator(), |
539 data->display.get(), context_provider, | 540 data->display.get(), context_provider, |
540 shared_worker_context_provider_)); | 541 shared_worker_context_provider_)); |
541 data->display->Resize(compositor->size()); | 542 data->display->Resize(compositor->size()); |
542 data->display->SetOutputIsSecure(data->output_is_secure); | 543 data->display->SetOutputIsSecure(data->output_is_secure); |
| 544 data->display->SetColorSpace(data->color_space); |
543 compositor->SetOutputSurface(std::move(delegated_output_surface)); | 545 compositor->SetOutputSurface(std::move(delegated_output_surface)); |
544 } | 546 } |
545 | 547 |
546 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 548 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
547 ui::Compositor* source_compositor, | 549 ui::Compositor* source_compositor, |
548 ui::Layer* target_layer) { | 550 ui::Layer* target_layer) { |
549 PerCompositorData* source_data = per_compositor_data_[source_compositor]; | 551 PerCompositorData* source_data = per_compositor_data_[source_compositor]; |
550 DCHECK(source_data); | 552 DCHECK(source_data); |
551 | 553 |
552 std::unique_ptr<ReflectorImpl> reflector( | 554 std::unique_ptr<ReflectorImpl> reflector( |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 } | 650 } |
649 | 651 |
650 void GpuProcessTransportFactory::SetDisplayColorSpace( | 652 void GpuProcessTransportFactory::SetDisplayColorSpace( |
651 ui::Compositor* compositor, | 653 ui::Compositor* compositor, |
652 const gfx::ColorSpace& color_space) { | 654 const gfx::ColorSpace& color_space) { |
653 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 655 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
654 if (it == per_compositor_data_.end()) | 656 if (it == per_compositor_data_.end()) |
655 return; | 657 return; |
656 PerCompositorData* data = it->second; | 658 PerCompositorData* data = it->second; |
657 DCHECK(data); | 659 DCHECK(data); |
| 660 data->color_space = color_space; |
658 if (data->display) | 661 if (data->display) |
659 data->display->SetColorSpace(color_space); | 662 data->display->SetColorSpace(data->color_space); |
660 } | 663 } |
661 | 664 |
662 void GpuProcessTransportFactory::SetAuthoritativeVSyncInterval( | 665 void GpuProcessTransportFactory::SetAuthoritativeVSyncInterval( |
663 ui::Compositor* compositor, | 666 ui::Compositor* compositor, |
664 base::TimeDelta interval) { | 667 base::TimeDelta interval) { |
665 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 668 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
666 if (it == per_compositor_data_.end()) | 669 if (it == per_compositor_data_.end()) |
667 return; | 670 return; |
668 PerCompositorData* data = it->second; | 671 PerCompositorData* data = it->second; |
669 DCHECK(data); | 672 DCHECK(data); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 shared_vulkan_context_provider_ = | 819 shared_vulkan_context_provider_ = |
817 cc::VulkanInProcessContextProvider::Create(); | 820 cc::VulkanInProcessContextProvider::Create(); |
818 } | 821 } |
819 | 822 |
820 shared_vulkan_context_provider_initialized_ = true; | 823 shared_vulkan_context_provider_initialized_ = true; |
821 } | 824 } |
822 return shared_vulkan_context_provider_; | 825 return shared_vulkan_context_provider_; |
823 } | 826 } |
824 | 827 |
825 } // namespace content | 828 } // namespace content |
OLD | NEW |