Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: content/renderer/render_widget.cc

Issue 2002303002: Consolidate OutputSurface constructors into GL vs Vulkan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: outputsurface-constructors: rebase-and-fixcrash Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 29 matching lines...) Expand all
40 #include "content/common/swapped_out_messages.h" 40 #include "content/common/swapped_out_messages.h"
41 #include "content/common/text_input_state.h" 41 #include "content/common/text_input_state.h"
42 #include "content/common/view_messages.h" 42 #include "content/common/view_messages.h"
43 #include "content/public/common/content_features.h" 43 #include "content/public/common/content_features.h"
44 #include "content/public/common/content_switches.h" 44 #include "content/public/common/content_switches.h"
45 #include "content/public/common/context_menu_params.h" 45 #include "content/public/common/context_menu_params.h"
46 #include "content/renderer/cursor_utils.h" 46 #include "content/renderer/cursor_utils.h"
47 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h" 47 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h"
48 #include "content/renderer/external_popup_menu.h" 48 #include "content/renderer/external_popup_menu.h"
49 #include "content/renderer/gpu/compositor_output_surface.h" 49 #include "content/renderer/gpu/compositor_output_surface.h"
50 #include "content/renderer/gpu/delegated_compositor_output_surface.h"
51 #include "content/renderer/gpu/frame_swap_message_queue.h" 50 #include "content/renderer/gpu/frame_swap_message_queue.h"
52 #include "content/renderer/gpu/mailbox_output_surface.h" 51 #include "content/renderer/gpu/mailbox_output_surface.h"
53 #include "content/renderer/gpu/queue_message_swap_promise.h" 52 #include "content/renderer/gpu/queue_message_swap_promise.h"
54 #include "content/renderer/gpu/render_widget_compositor.h" 53 #include "content/renderer/gpu/render_widget_compositor.h"
55 #include "content/renderer/ime_event_guard.h" 54 #include "content/renderer/ime_event_guard.h"
56 #include "content/renderer/input/input_handler_manager.h" 55 #include "content/renderer/input/input_handler_manager.h"
57 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 56 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
58 #include "content/renderer/render_frame_impl.h" 57 #include "content/renderer/render_frame_impl.h"
59 #include "content/renderer/render_frame_proxy.h" 58 #include "content/renderer/render_frame_proxy.h"
60 #include "content/renderer/render_process.h" 59 #include "content/renderer/render_process.h"
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 return connection->CreateOutputSurface(); 718 return connection->CreateOutputSurface();
720 } 719 }
721 #endif 720 #endif
722 721
723 uint32_t output_surface_id = next_output_surface_id_++; 722 uint32_t output_surface_id = next_output_surface_id_++;
724 723
725 if (command_line.HasSwitch(switches::kEnableVulkan)) { 724 if (command_line.HasSwitch(switches::kEnableVulkan)) {
726 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = 725 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider =
727 cc::VulkanInProcessContextProvider::Create(); 726 cc::VulkanInProcessContextProvider::Create();
728 if (vulkan_context_provider) { 727 if (vulkan_context_provider) {
729 return base::WrapUnique(new DelegatedCompositorOutputSurface( 728 return base::WrapUnique(new CompositorOutputSurface(
730 routing_id(), output_surface_id, nullptr, nullptr, 729 routing_id(), output_surface_id, vulkan_context_provider,
731 vulkan_context_provider, frame_swap_message_queue_)); 730 frame_swap_message_queue_));
732 } 731 }
733 } 732 }
734 733
735 // Create a gpu process channel and verify we want to use GPU compositing 734 // Create a gpu process channel and verify we want to use GPU compositing
736 // before creating any context providers. 735 // before creating any context providers.
737 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; 736 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host;
738 if (!use_software) { 737 if (!use_software) {
739 gpu_channel_host = RenderThreadImpl::current()->EstablishGpuChannelSync( 738 gpu_channel_host = RenderThreadImpl::current()->EstablishGpuChannelSync(
740 CAUSE_FOR_GPU_LAUNCH_RENDERER_VERIFY_GPU_COMPOSITING); 739 CAUSE_FOR_GPU_LAUNCH_RENDERER_VERIFY_GPU_COMPOSITING);
741 if (!gpu_channel_host) { 740 if (!gpu_channel_host) {
742 // Cause the compositor to wait and try again. 741 // Cause the compositor to wait and try again.
743 return nullptr; 742 return nullptr;
744 } 743 }
745 // We may get a valid channel, but with a software renderer. In that case, 744 // We may get a valid channel, but with a software renderer. In that case,
746 // disable GPU compositing. 745 // disable GPU compositing.
747 if (gpu_channel_host->gpu_info().software_rendering) 746 if (gpu_channel_host->gpu_info().software_rendering)
748 use_software = true; 747 use_software = true;
749 } 748 }
750 749
751 if (use_software) { 750 if (use_software) {
752 return base::WrapUnique(new DelegatedCompositorOutputSurface( 751 return base::WrapUnique(
753 routing_id(), output_surface_id, nullptr, nullptr, nullptr, 752 new CompositorOutputSurface(routing_id(), output_surface_id, nullptr,
754 frame_swap_message_queue_)); 753 nullptr, frame_swap_message_queue_));
755 } 754 }
756 755
757 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider = 756 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider =
758 RenderThreadImpl::current()->SharedCompositorWorkerContextProvider(); 757 RenderThreadImpl::current()->SharedCompositorWorkerContextProvider();
759 if (!worker_context_provider) { 758 if (!worker_context_provider) {
760 // Cause the compositor to wait and try again. 759 // Cause the compositor to wait and try again.
761 return nullptr; 760 return nullptr;
762 } 761 }
763 762
764 // The renderer compositor context doesn't do a lot of stuff, so we don't 763 // The renderer compositor context doesn't do a lot of stuff, so we don't
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 output_surface_id, 800 output_surface_id,
802 RenderThreadImpl::current()->sync_compositor_message_filter(), 801 RenderThreadImpl::current()->sync_compositor_message_filter(),
803 frame_swap_message_queue_)); 802 frame_swap_message_queue_));
804 } 803 }
805 #endif 804 #endif
806 805
807 // Composite-to-mailbox is currently used for layout tests in order to cause 806 // Composite-to-mailbox is currently used for layout tests in order to cause
808 // them to draw inside in the renderer to do the readback there. This should 807 // them to draw inside in the renderer to do the readback there. This should
809 // no longer be the case when crbug.com/311404 is fixed. 808 // no longer be the case when crbug.com/311404 is fixed.
810 if (RenderThreadImpl::current()->layout_test_mode()) { 809 if (RenderThreadImpl::current()->layout_test_mode()) {
811 return base::WrapUnique(new MailboxOutputSurface( 810 return base::MakeUnique<MailboxOutputSurface>(
812 routing_id(), output_surface_id, std::move(context_provider), 811 output_surface_id, std::move(context_provider),
813 std::move(worker_context_provider), frame_swap_message_queue_, 812 std::move(worker_context_provider));
814 cc::RGBA_8888));
815 } 813 }
816 814
817 return base::WrapUnique(new DelegatedCompositorOutputSurface( 815 return base::WrapUnique(new CompositorOutputSurface(
818 routing_id(), output_surface_id, std::move(context_provider), 816 routing_id(), output_surface_id, std::move(context_provider),
819 std::move(worker_context_provider), nullptr, frame_swap_message_queue_)); 817 std::move(worker_context_provider), frame_swap_message_queue_));
820 } 818 }
821 819
822 std::unique_ptr<cc::BeginFrameSource> 820 std::unique_ptr<cc::BeginFrameSource>
823 RenderWidget::CreateExternalBeginFrameSource() { 821 RenderWidget::CreateExternalBeginFrameSource() {
824 return compositor_deps_->CreateExternalBeginFrameSource(routing_id_); 822 return compositor_deps_->CreateExternalBeginFrameSource(routing_id_);
825 } 823 }
826 824
827 void RenderWidget::DidCommitAndDrawCompositorFrame() { 825 void RenderWidget::DidCommitAndDrawCompositorFrame() {
828 // NOTE: Tests may break if this event is renamed or moved. See 826 // NOTE: Tests may break if this event is renamed or moved. See
829 // tab_capture_performancetest.cc. 827 // tab_capture_performancetest.cc.
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 } 2090 }
2093 2091
2094 float RenderWidget::GetOriginalDeviceScaleFactor() const { 2092 float RenderWidget::GetOriginalDeviceScaleFactor() const {
2095 return 2093 return
2096 screen_metrics_emulator_ ? 2094 screen_metrics_emulator_ ?
2097 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : 2095 screen_metrics_emulator_->original_screen_info().deviceScaleFactor :
2098 device_scale_factor_; 2096 device_scale_factor_;
2099 } 2097 }
2100 2098
2101 } // namespace content 2099 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/mailbox_output_surface.cc ('k') | ui/compositor/test/in_process_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698