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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 } // namespace | 147 } // namespace |
148 | 148 |
149 namespace content { | 149 namespace content { |
150 | 150 |
151 struct GpuProcessTransportFactory::PerCompositorData { | 151 struct GpuProcessTransportFactory::PerCompositorData { |
152 gpu::SurfaceHandle surface_handle; | 152 gpu::SurfaceHandle surface_handle; |
153 BrowserCompositorOutputSurface* surface; | 153 BrowserCompositorOutputSurface* surface; |
154 ReflectorImpl* reflector; | 154 ReflectorImpl* reflector; |
155 std::unique_ptr<cc::OnscreenDisplayClient> display_client; | 155 std::unique_ptr<cc::OnscreenDisplayClient> display_client; |
| 156 bool output_is_secure = false; |
156 | 157 |
157 PerCompositorData() | 158 PerCompositorData() |
158 : surface_handle(gpu::kNullSurfaceHandle), | 159 : surface_handle(gpu::kNullSurfaceHandle), |
159 surface(nullptr), | 160 surface(nullptr), |
160 reflector(nullptr) {} | 161 reflector(nullptr) {} |
161 }; | 162 }; |
162 | 163 |
163 GpuProcessTransportFactory::GpuProcessTransportFactory() | 164 GpuProcessTransportFactory::GpuProcessTransportFactory() |
164 : next_surface_id_namespace_(1u), | 165 : next_surface_id_namespace_(1u), |
165 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 166 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 ? new cc::SurfaceDisplayOutputSurface( | 505 ? new cc::SurfaceDisplayOutputSurface( |
505 manager, compositor->surface_id_allocator(), | 506 manager, compositor->surface_id_allocator(), |
506 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 507 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
507 vulkan_context_provider)) | 508 vulkan_context_provider)) |
508 : new cc::SurfaceDisplayOutputSurface( | 509 : new cc::SurfaceDisplayOutputSurface( |
509 manager, compositor->surface_id_allocator(), context_provider, | 510 manager, compositor->surface_id_allocator(), context_provider, |
510 shared_worker_context_provider_)); | 511 shared_worker_context_provider_)); |
511 display_client->set_surface_output_surface(output_surface.get()); | 512 display_client->set_surface_output_surface(output_surface.get()); |
512 output_surface->set_display_client(display_client.get()); | 513 output_surface->set_display_client(display_client.get()); |
513 display_client->display()->Resize(compositor->size()); | 514 display_client->display()->Resize(compositor->size()); |
| 515 display_client->display()->SetOutputIsSecure(data->output_is_secure); |
514 data->display_client = std::move(display_client); | 516 data->display_client = std::move(display_client); |
515 compositor->SetOutputSurface(std::move(output_surface)); | 517 compositor->SetOutputSurface(std::move(output_surface)); |
516 } | 518 } |
517 | 519 |
518 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 520 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
519 ui::Compositor* source_compositor, | 521 ui::Compositor* source_compositor, |
520 ui::Layer* target_layer) { | 522 ui::Layer* target_layer) { |
521 PerCompositorData* source_data = per_compositor_data_[source_compositor]; | 523 PerCompositorData* source_data = per_compositor_data_[source_compositor]; |
522 DCHECK(source_data); | 524 DCHECK(source_data); |
523 | 525 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 if (it == per_compositor_data_.end()) | 628 if (it == per_compositor_data_.end()) |
627 return; | 629 return; |
628 PerCompositorData* data = it->second; | 630 PerCompositorData* data = it->second; |
629 DCHECK(data); | 631 DCHECK(data); |
630 if (data->surface) { | 632 if (data->surface) { |
631 data->surface->begin_frame_source()->SetAuthoritativeVSyncInterval( | 633 data->surface->begin_frame_source()->SetAuthoritativeVSyncInterval( |
632 interval); | 634 interval); |
633 } | 635 } |
634 } | 636 } |
635 | 637 |
| 638 void GpuProcessTransportFactory::SetOutputIsSecure(ui::Compositor* compositor, |
| 639 bool secure) { |
| 640 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 641 if (it == per_compositor_data_.end()) |
| 642 return; |
| 643 PerCompositorData* data = it->second; |
| 644 DCHECK(data); |
| 645 data->output_is_secure = secure; |
| 646 if (data->display_client) |
| 647 data->display_client->display()->SetOutputIsSecure(secure); |
| 648 } |
| 649 |
636 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { | 650 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { |
637 return surface_manager_.get(); | 651 return surface_manager_.get(); |
638 } | 652 } |
639 | 653 |
640 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { | 654 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { |
641 if (!gl_helper_ && !per_compositor_data_.empty()) { | 655 if (!gl_helper_ && !per_compositor_data_.empty()) { |
642 scoped_refptr<cc::ContextProvider> provider = | 656 scoped_refptr<cc::ContextProvider> provider = |
643 SharedMainThreadContextProvider(); | 657 SharedMainThreadContextProvider(); |
644 if (provider.get()) | 658 if (provider.get()) |
645 gl_helper_.reset(new display_compositor::GLHelper( | 659 gl_helper_.reset(new display_compositor::GLHelper( |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 shared_vulkan_context_provider_ = | 781 shared_vulkan_context_provider_ = |
768 cc::VulkanInProcessContextProvider::Create(); | 782 cc::VulkanInProcessContextProvider::Create(); |
769 } | 783 } |
770 | 784 |
771 shared_vulkan_context_provider_initialized_ = true; | 785 shared_vulkan_context_provider_initialized_ = true; |
772 } | 786 } |
773 return shared_vulkan_context_provider_; | 787 return shared_vulkan_context_provider_; |
774 } | 788 } |
775 | 789 |
776 } // namespace content | 790 } // namespace content |
OLD | NEW |