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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 namespace content { | 164 namespace content { |
165 | 165 |
166 struct GpuProcessTransportFactory::PerCompositorData { | 166 struct GpuProcessTransportFactory::PerCompositorData { |
167 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; | 167 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; |
168 BrowserCompositorOutputSurface* display_output_surface = nullptr; | 168 BrowserCompositorOutputSurface* display_output_surface = nullptr; |
169 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; | 169 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; |
170 ReflectorImpl* reflector = nullptr; | 170 ReflectorImpl* reflector = nullptr; |
171 std::unique_ptr<cc::Display> display; | 171 std::unique_ptr<cc::Display> display; |
172 bool output_is_secure = false; | 172 bool output_is_secure = false; |
173 gfx::ColorSpace color_space; | 173 gfx::ColorSpace color_space; |
| 174 bool visible = false; |
174 }; | 175 }; |
175 | 176 |
176 GpuProcessTransportFactory::GpuProcessTransportFactory() | 177 GpuProcessTransportFactory::GpuProcessTransportFactory() |
177 : next_surface_client_id_(1u), | 178 : next_surface_client_id_(1u), |
178 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 179 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
179 callback_factory_(this) { | 180 callback_factory_(this) { |
180 cc::SetClientNameForMetrics("Browser"); | 181 cc::SetClientNameForMetrics("Browser"); |
181 | 182 |
182 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); | 183 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); |
183 | 184 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 data->display.get(), | 558 data->display.get(), |
558 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 559 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
559 vulkan_context_provider)) | 560 vulkan_context_provider)) |
560 : new cc::SurfaceDisplayOutputSurface( | 561 : new cc::SurfaceDisplayOutputSurface( |
561 surface_manager_.get(), compositor->surface_id_allocator(), | 562 surface_manager_.get(), compositor->surface_id_allocator(), |
562 data->display.get(), context_provider, | 563 data->display.get(), context_provider, |
563 shared_worker_context_provider_)); | 564 shared_worker_context_provider_)); |
564 data->display->Resize(compositor->size()); | 565 data->display->Resize(compositor->size()); |
565 data->display->SetOutputIsSecure(data->output_is_secure); | 566 data->display->SetOutputIsSecure(data->output_is_secure); |
566 data->display->SetColorSpace(data->color_space); | 567 data->display->SetColorSpace(data->color_space); |
| 568 data->display->SetVisible(data->visible); |
567 compositor->SetOutputSurface(std::move(delegated_output_surface)); | 569 compositor->SetOutputSurface(std::move(delegated_output_surface)); |
568 } | 570 } |
569 | 571 |
570 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 572 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
571 ui::Compositor* source_compositor, | 573 ui::Compositor* source_compositor, |
572 ui::Layer* target_layer) { | 574 ui::Layer* target_layer) { |
573 PerCompositorData* source_data = per_compositor_data_[source_compositor]; | 575 PerCompositorData* source_data = per_compositor_data_[source_compositor]; |
574 DCHECK(source_data); | 576 DCHECK(source_data); |
575 | 577 |
576 std::unique_ptr<ReflectorImpl> reflector( | 578 std::unique_ptr<ReflectorImpl> reflector( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 } | 650 } |
649 | 651 |
650 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { | 652 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { |
651 return this; | 653 return this; |
652 } | 654 } |
653 | 655 |
654 uint32_t GpuProcessTransportFactory::AllocateSurfaceClientId() { | 656 uint32_t GpuProcessTransportFactory::AllocateSurfaceClientId() { |
655 return next_surface_client_id_++; | 657 return next_surface_client_id_++; |
656 } | 658 } |
657 | 659 |
| 660 void GpuProcessTransportFactory::SetDisplayVisible(ui::Compositor* compositor, |
| 661 bool visible) { |
| 662 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 663 if (it == per_compositor_data_.end()) |
| 664 return; |
| 665 PerCompositorData* data = it->second; |
| 666 DCHECK(data); |
| 667 data->visible = visible; |
| 668 if (data->display) |
| 669 data->display->SetVisible(visible); |
| 670 } |
| 671 |
658 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, | 672 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, |
659 const gfx::Size& size) { | 673 const gfx::Size& size) { |
660 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 674 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
661 if (it == per_compositor_data_.end()) | 675 if (it == per_compositor_data_.end()) |
662 return; | 676 return; |
663 PerCompositorData* data = it->second; | 677 PerCompositorData* data = it->second; |
664 DCHECK(data); | 678 DCHECK(data); |
665 if (data->display) | 679 if (data->display) |
666 data->display->Resize(size); | 680 data->display->Resize(size); |
667 } | 681 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 shared_vulkan_context_provider_ = | 872 shared_vulkan_context_provider_ = |
859 cc::VulkanInProcessContextProvider::Create(); | 873 cc::VulkanInProcessContextProvider::Create(); |
860 } | 874 } |
861 | 875 |
862 shared_vulkan_context_provider_initialized_ = true; | 876 shared_vulkan_context_provider_initialized_ = true; |
863 } | 877 } |
864 return shared_vulkan_context_provider_; | 878 return shared_vulkan_context_provider_; |
865 } | 879 } |
866 | 880 |
867 } // namespace content | 881 } // namespace content |
OLD | NEW |