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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 data->begin_frame_source = begin_frame_source.get(); | 542 data->begin_frame_source = begin_frame_source.get(); |
543 if (data->reflector) | 543 if (data->reflector) |
544 data->reflector->OnSourceSurfaceReady(data->display_output_surface); | 544 data->reflector->OnSourceSurfaceReady(data->display_output_surface); |
545 | 545 |
546 #if defined(OS_WIN) | 546 #if defined(OS_WIN) |
547 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( | 547 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( |
548 compositor->widget()); | 548 compositor->widget()); |
549 #endif | 549 #endif |
550 | 550 |
551 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( | 551 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
552 begin_frame_source.get(), compositor->task_runner().get(), | 552 compositor->task_runner().get(), |
553 display_output_surface->capabilities().max_frames_pending)); | 553 display_output_surface->capabilities().max_frames_pending)); |
554 | 554 |
555 // The Display owns and uses the |display_output_surface| created above. | 555 // The Display owns and uses the |display_output_surface| created above. |
556 data->display = base::MakeUnique<cc::Display>( | 556 data->display = base::MakeUnique<cc::Display>( |
557 HostSharedBitmapManager::current(), GetGpuMemoryBufferManager(), | 557 HostSharedBitmapManager::current(), GetGpuMemoryBufferManager(), |
558 compositor->GetRendererSettings(), compositor->frame_sink_id(), | 558 compositor->GetRendererSettings(), compositor->frame_sink_id(), |
559 std::move(begin_frame_source), std::move(display_output_surface), | 559 std::move(begin_frame_source), std::move(display_output_surface), |
560 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>( | 560 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>( |
561 compositor->task_runner().get())); | 561 compositor->task_runner().get())); |
562 | 562 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 base::TimeDelta interval) { | 720 base::TimeDelta interval) { |
721 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 721 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
722 if (it == per_compositor_data_.end()) | 722 if (it == per_compositor_data_.end()) |
723 return; | 723 return; |
724 PerCompositorData* data = it->second.get(); | 724 PerCompositorData* data = it->second.get(); |
725 DCHECK(data); | 725 DCHECK(data); |
726 if (data->begin_frame_source) | 726 if (data->begin_frame_source) |
727 data->begin_frame_source->OnUpdateVSyncParameters(timebase, interval); | 727 data->begin_frame_source->OnUpdateVSyncParameters(timebase, interval); |
728 } | 728 } |
729 | 729 |
| 730 void GpuProcessTransportFactory::SwapBeginFrameSource( |
| 731 ui::Compositor* compositor, |
| 732 std::unique_ptr<cc::BeginFrameSource>* begin_frame_source) { |
| 733 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 734 if (it == per_compositor_data_.end()) |
| 735 return; |
| 736 PerCompositorData* data = it->second.get(); |
| 737 DCHECK(data); |
| 738 if (data->display) |
| 739 data->display->SwapBeginFrameSource(begin_frame_source); |
| 740 } |
| 741 |
730 void GpuProcessTransportFactory::SetOutputIsSecure(ui::Compositor* compositor, | 742 void GpuProcessTransportFactory::SetOutputIsSecure(ui::Compositor* compositor, |
731 bool secure) { | 743 bool secure) { |
732 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 744 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
733 if (it == per_compositor_data_.end()) | 745 if (it == per_compositor_data_.end()) |
734 return; | 746 return; |
735 PerCompositorData* data = it->second.get(); | 747 PerCompositorData* data = it->second.get(); |
736 DCHECK(data); | 748 DCHECK(data); |
737 data->output_is_secure = secure; | 749 data->output_is_secure = secure; |
738 if (data->display) | 750 if (data->display) |
739 data->display->SetOutputIsSecure(secure); | 751 data->display->SetOutputIsSecure(secure); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 shared_vulkan_context_provider_ = | 893 shared_vulkan_context_provider_ = |
882 cc::VulkanInProcessContextProvider::Create(); | 894 cc::VulkanInProcessContextProvider::Create(); |
883 } | 895 } |
884 | 896 |
885 shared_vulkan_context_provider_initialized_ = true; | 897 shared_vulkan_context_provider_initialized_ = true; |
886 } | 898 } |
887 return shared_vulkan_context_provider_; | 899 return shared_vulkan_context_provider_; |
888 } | 900 } |
889 | 901 |
890 } // namespace content | 902 } // namespace content |
OLD | NEW |