Chromium Code Reviews| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 | 162 |
| 163 namespace content { | 163 namespace content { |
| 164 | 164 |
| 165 struct GpuProcessTransportFactory::PerCompositorData { | 165 struct GpuProcessTransportFactory::PerCompositorData { |
| 166 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; | 166 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; |
| 167 BrowserCompositorOutputSurface* display_output_surface = nullptr; | 167 BrowserCompositorOutputSurface* display_output_surface = nullptr; |
| 168 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; | 168 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; |
| 169 ReflectorImpl* reflector = nullptr; | 169 ReflectorImpl* reflector = nullptr; |
| 170 std::unique_ptr<cc::Display> display; | 170 std::unique_ptr<cc::Display> display; |
| 171 bool output_is_secure = false; | 171 bool output_is_secure = false; |
| 172 gfx::ColorSpace color_space; | |
| 173 }; | 172 }; |
| 174 | 173 |
| 175 GpuProcessTransportFactory::GpuProcessTransportFactory() | 174 GpuProcessTransportFactory::GpuProcessTransportFactory() |
| 176 : next_surface_client_id_(1u), | 175 : next_surface_client_id_(1u), |
| 177 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 176 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
| 178 callback_factory_(this) { | 177 callback_factory_(this) { |
| 179 cc::SetClientNameForMetrics("Browser"); | 178 cc::SetClientNameForMetrics("Browser"); |
| 180 | 179 |
| 181 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); | 180 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); |
| 182 | 181 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 surface_manager_.get(), compositor->surface_id_allocator(), | 558 surface_manager_.get(), compositor->surface_id_allocator(), |
| 560 data->display.get(), | 559 data->display.get(), |
| 561 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 560 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
| 562 vulkan_context_provider)) | 561 vulkan_context_provider)) |
| 563 : new cc::SurfaceDisplayOutputSurface( | 562 : new cc::SurfaceDisplayOutputSurface( |
| 564 surface_manager_.get(), compositor->surface_id_allocator(), | 563 surface_manager_.get(), compositor->surface_id_allocator(), |
| 565 data->display.get(), context_provider, | 564 data->display.get(), context_provider, |
| 566 shared_worker_context_provider_)); | 565 shared_worker_context_provider_)); |
| 567 data->display->Resize(compositor->size()); | 566 data->display->Resize(compositor->size()); |
| 568 data->display->SetOutputIsSecure(data->output_is_secure); | 567 data->display->SetOutputIsSecure(data->output_is_secure); |
| 569 data->display->SetColorSpace(data->color_space); | |
| 570 compositor->SetOutputSurface(std::move(delegated_output_surface)); | 568 compositor->SetOutputSurface(std::move(delegated_output_surface)); |
| 571 } | 569 } |
| 572 | 570 |
| 573 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 571 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
| 574 ui::Compositor* source_compositor, | 572 ui::Compositor* source_compositor, |
| 575 ui::Layer* target_layer) { | 573 ui::Layer* target_layer) { |
| 576 PerCompositorData* source_data = | 574 PerCompositorData* source_data = |
| 577 per_compositor_data_[source_compositor].get(); | 575 per_compositor_data_[source_compositor].get(); |
| 578 DCHECK(source_data); | 576 DCHECK(source_data); |
| 579 | 577 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 683 } | 681 } |
| 684 | 682 |
| 685 void GpuProcessTransportFactory::SetDisplayColorSpace( | 683 void GpuProcessTransportFactory::SetDisplayColorSpace( |
| 686 ui::Compositor* compositor, | 684 ui::Compositor* compositor, |
| 687 const gfx::ColorSpace& color_space) { | 685 const gfx::ColorSpace& color_space) { |
| 688 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 686 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 689 if (it == per_compositor_data_.end()) | 687 if (it == per_compositor_data_.end()) |
| 690 return; | 688 return; |
| 691 PerCompositorData* data = it->second.get(); | 689 PerCompositorData* data = it->second.get(); |
| 692 DCHECK(data); | 690 DCHECK(data); |
| 693 data->color_space = color_space; | |
| 694 if (data->display) | 691 if (data->display) |
|
danakj
2016/09/02 23:03:32
Can you add a comment here like in SetDisplayVisib
hubbe
2016/09/02 23:16:10
Done.
| |
| 695 data->display->SetColorSpace(data->color_space); | 692 data->display->SetColorSpace(color_space); |
| 696 } | 693 } |
| 697 | 694 |
| 698 void GpuProcessTransportFactory::SetAuthoritativeVSyncInterval( | 695 void GpuProcessTransportFactory::SetAuthoritativeVSyncInterval( |
| 699 ui::Compositor* compositor, | 696 ui::Compositor* compositor, |
| 700 base::TimeDelta interval) { | 697 base::TimeDelta interval) { |
| 701 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 698 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 702 if (it == per_compositor_data_.end()) | 699 if (it == per_compositor_data_.end()) |
| 703 return; | 700 return; |
| 704 PerCompositorData* data = it->second.get(); | 701 PerCompositorData* data = it->second.get(); |
| 705 DCHECK(data); | 702 DCHECK(data); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 shared_vulkan_context_provider_ = | 871 shared_vulkan_context_provider_ = |
| 875 cc::VulkanInProcessContextProvider::Create(); | 872 cc::VulkanInProcessContextProvider::Create(); |
| 876 } | 873 } |
| 877 | 874 |
| 878 shared_vulkan_context_provider_initialized_ = true; | 875 shared_vulkan_context_provider_initialized_ = true; |
| 879 } | 876 } |
| 880 return shared_vulkan_context_provider_; | 877 return shared_vulkan_context_provider_; |
| 881 } | 878 } |
| 882 | 879 |
| 883 } // namespace content | 880 } // namespace content |
| OLD | NEW |