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