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

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

Issue 2923583002: Remove RendererCompositorFrameSink and use ClientCompositorFrameSink instead (Closed)
Patch Set: Fix windows Created 3 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
« no previous file with comments | « content/renderer/mus/renderer_window_tree_client.cc ('k') | ui/aura/mus/window_port_mus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "cc/output/buffer_to_texture_target_map.h" 48 #include "cc/output/buffer_to_texture_target_map.h"
49 #include "cc/output/compositor_frame_sink.h" 49 #include "cc/output/compositor_frame_sink.h"
50 #include "cc/output/copy_output_request.h" 50 #include "cc/output/copy_output_request.h"
51 #include "cc/output/vulkan_in_process_context_provider.h" 51 #include "cc/output/vulkan_in_process_context_provider.h"
52 #include "cc/raster/task_graph_runner.h" 52 #include "cc/raster/task_graph_runner.h"
53 #include "cc/trees/layer_tree_host_common.h" 53 #include "cc/trees/layer_tree_host_common.h"
54 #include "cc/trees/layer_tree_settings.h" 54 #include "cc/trees/layer_tree_settings.h"
55 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h" 55 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h"
56 #include "components/metrics/public/interfaces/single_sample_metrics.mojom.h" 56 #include "components/metrics/public/interfaces/single_sample_metrics.mojom.h"
57 #include "components/metrics/single_sample_metrics.h" 57 #include "components/metrics/single_sample_metrics.h"
58 #include "components/viz/client/client_compositor_frame_sink.h"
59 #include "components/viz/client/local_surface_id_provider.h"
58 #include "content/child/appcache/appcache_dispatcher.h" 60 #include "content/child/appcache/appcache_dispatcher.h"
59 #include "content/child/appcache/appcache_frontend_impl.h" 61 #include "content/child/appcache/appcache_frontend_impl.h"
60 #include "content/child/blob_storage/blob_message_filter.h" 62 #include "content/child/blob_storage/blob_message_filter.h"
61 #include "content/child/child_histogram_message_filter.h" 63 #include "content/child/child_histogram_message_filter.h"
62 #include "content/child/child_resource_message_filter.h" 64 #include "content/child/child_resource_message_filter.h"
63 #include "content/child/db_message_filter.h" 65 #include "content/child/db_message_filter.h"
64 #include "content/child/indexed_db/indexed_db_dispatcher.h" 66 #include "content/child/indexed_db/indexed_db_dispatcher.h"
65 #include "content/child/memory/child_memory_coordinator_impl.h" 67 #include "content/child/memory/child_memory_coordinator_impl.h"
66 #include "content/child/resource_dispatcher.h" 68 #include "content/child/resource_dispatcher.h"
67 #include "content/child/resource_scheduling_filter.h" 69 #include "content/child/resource_scheduling_filter.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 #include "content/renderer/cache_storage/cache_storage_message_filter.h" 101 #include "content/renderer/cache_storage/cache_storage_message_filter.h"
100 #include "content/renderer/categorized_worker_pool.h" 102 #include "content/renderer/categorized_worker_pool.h"
101 #include "content/renderer/devtools/devtools_agent_filter.h" 103 #include "content/renderer/devtools/devtools_agent_filter.h"
102 #include "content/renderer/dom_storage/dom_storage_dispatcher.h" 104 #include "content/renderer/dom_storage/dom_storage_dispatcher.h"
103 #include "content/renderer/dom_storage/webstoragearea_impl.h" 105 #include "content/renderer/dom_storage/webstoragearea_impl.h"
104 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" 106 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
105 #include "content/renderer/effective_connection_type_helper.h" 107 #include "content/renderer/effective_connection_type_helper.h"
106 #include "content/renderer/gpu/compositor_external_begin_frame_source.h" 108 #include "content/renderer/gpu/compositor_external_begin_frame_source.h"
107 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" 109 #include "content/renderer/gpu/compositor_forwarding_message_filter.h"
108 #include "content/renderer/gpu/frame_swap_message_queue.h" 110 #include "content/renderer/gpu/frame_swap_message_queue.h"
109 #include "content/renderer/gpu/renderer_compositor_frame_sink.h"
110 #include "content/renderer/input/input_event_filter.h" 111 #include "content/renderer/input/input_event_filter.h"
111 #include "content/renderer/input/input_handler_manager.h" 112 #include "content/renderer/input/input_handler_manager.h"
112 #include "content/renderer/input/main_thread_input_event_filter.h" 113 #include "content/renderer/input/main_thread_input_event_filter.h"
113 #include "content/renderer/media/audio_input_message_filter.h" 114 #include "content/renderer/media/audio_input_message_filter.h"
114 #include "content/renderer/media/audio_message_filter.h" 115 #include "content/renderer/media/audio_message_filter.h"
115 #include "content/renderer/media/audio_renderer_mixer_manager.h" 116 #include "content/renderer/media/audio_renderer_mixer_manager.h"
116 #include "content/renderer/media/media_stream_center.h" 117 #include "content/renderer/media/media_stream_center.h"
117 #include "content/renderer/media/midi_message_filter.h" 118 #include "content/renderer/media/midi_message_filter.h"
118 #include "content/renderer/media/render_media_client.h" 119 #include "content/renderer/media/render_media_client.h"
119 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" 120 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 connector->BindInterface(mojom::kBrowserServiceName, std::move(request)); 413 connector->BindInterface(mojom::kBrowserServiceName, std::move(request));
413 return; 414 return;
414 } 415 }
415 416
416 task_runner->PostTask( 417 task_runner->PostTask(
417 FROM_HERE, 418 FROM_HERE,
418 base::Bind(&CreateSingleSampleMetricsProvider, std::move(task_runner), 419 base::Bind(&CreateSingleSampleMetricsProvider, std::move(task_runner),
419 connector, base::Passed(&request))); 420 connector, base::Passed(&request)));
420 } 421 }
421 422
423 class RendererLocalSurfaceIdProvider : public viz::LocalSurfaceIdProvider {
424 public:
425 const cc::LocalSurfaceId& GetLocalSurfaceIdForFrame(
426 const cc::CompositorFrame& frame) override {
427 auto new_surface_properties =
428 RenderWidgetSurfaceProperties::FromCompositorFrame(frame);
429 if (!local_surface_id_.is_valid() ||
430 new_surface_properties != surface_properties_) {
431 local_surface_id_ = local_surface_id_allocator_.GenerateId();
432 surface_properties_ = new_surface_properties;
433 }
434 return local_surface_id_;
435 }
436
437 private:
438 cc::LocalSurfaceIdAllocator local_surface_id_allocator_;
439 cc::LocalSurfaceId local_surface_id_;
440 RenderWidgetSurfaceProperties surface_properties_;
441 };
442
422 } // namespace 443 } // namespace
423 444
424 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() { 445 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() {
425 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal"); 446 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal");
426 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted"); 447 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted");
427 custom_histograms_.insert("V8.MemoryHeapSampleTotalUsed"); 448 custom_histograms_.insert("V8.MemoryHeapSampleTotalUsed");
428 custom_histograms_.insert("V8.MemoryHeapUsed"); 449 custom_histograms_.insert("V8.MemoryHeapUsed");
429 custom_histograms_.insert("V8.MemoryHeapCommitted"); 450 custom_histograms_.insert("V8.MemoryHeapCommitted");
430 } 451 }
431 452
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 cc::mojom::MojoCompositorFrameSinkClientRequest client_request = 1928 cc::mojom::MojoCompositorFrameSinkClientRequest client_request =
1908 mojo::MakeRequest(&client); 1929 mojo::MakeRequest(&client);
1909 1930
1910 if (command_line.HasSwitch(switches::kEnableVulkan)) { 1931 if (command_line.HasSwitch(switches::kEnableVulkan)) {
1911 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = 1932 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider =
1912 cc::VulkanInProcessContextProvider::Create(); 1933 cc::VulkanInProcessContextProvider::Create();
1913 if (vulkan_context_provider) { 1934 if (vulkan_context_provider) {
1914 DCHECK(!layout_test_mode()); 1935 DCHECK(!layout_test_mode());
1915 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), 1936 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request),
1916 std::move(client)); 1937 std::move(client));
1917 callback.Run(base::MakeUnique<RendererCompositorFrameSink>( 1938 callback.Run(base::MakeUnique<viz::ClientCompositorFrameSink>(
1918 routing_id, std::move(synthetic_begin_frame_source), 1939 std::move(vulkan_context_provider),
1919 std::move(vulkan_context_provider), std::move(sink_info), 1940 std::move(synthetic_begin_frame_source), std::move(sink_info),
1920 std::move(client_request))); 1941 std::move(client_request),
1942 base::MakeUnique<RendererLocalSurfaceIdProvider>(),
1943 false /* enable_surface_synchroninzation */));
1921 return; 1944 return;
1922 } 1945 }
1923 } 1946 }
1924 1947
1925 // Create a gpu process channel and verify we want to use GPU compositing 1948 // Create a gpu process channel and verify we want to use GPU compositing
1926 // before creating any context providers. 1949 // before creating any context providers.
1927 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; 1950 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host;
1928 if (!use_software) { 1951 if (!use_software) {
1929 gpu_channel_host = EstablishGpuChannelSync(); 1952 gpu_channel_host = EstablishGpuChannelSync();
1930 if (!gpu_channel_host) { 1953 if (!gpu_channel_host) {
1931 // Cause the compositor to wait and try again. 1954 // Cause the compositor to wait and try again.
1932 callback.Run(nullptr); 1955 callback.Run(nullptr);
1933 return; 1956 return;
1934 } 1957 }
1935 // We may get a valid channel, but with a software renderer. In that case, 1958 // We may get a valid channel, but with a software renderer. In that case,
1936 // disable GPU compositing. 1959 // disable GPU compositing.
1937 if (gpu_channel_host->gpu_info().software_rendering) 1960 if (gpu_channel_host->gpu_info().software_rendering)
1938 use_software = true; 1961 use_software = true;
1939 } 1962 }
1940 1963
1941 if (use_software) { 1964 if (use_software) {
1942 DCHECK(!layout_test_mode()); 1965 DCHECK(!layout_test_mode());
1943 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), 1966 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request),
1944 std::move(client)); 1967 std::move(client));
1945 callback.Run(base::MakeUnique<RendererCompositorFrameSink>( 1968 callback.Run(base::MakeUnique<viz::ClientCompositorFrameSink>(
1946 routing_id, std::move(synthetic_begin_frame_source), nullptr, nullptr, 1969 nullptr, nullptr, nullptr, shared_bitmap_manager(),
1947 nullptr, shared_bitmap_manager(), std::move(sink_info), 1970 std::move(synthetic_begin_frame_source), std::move(sink_info),
1948 std::move(client_request))); 1971 std::move(client_request),
1972 base::MakeUnique<RendererLocalSurfaceIdProvider>(),
1973 false /* enable_surface_synchroninzation */));
1949 return; 1974 return;
1950 } 1975 }
1951 1976
1952 scoped_refptr<ui::ContextProviderCommandBuffer> worker_context_provider = 1977 scoped_refptr<ui::ContextProviderCommandBuffer> worker_context_provider =
1953 SharedCompositorWorkerContextProvider(); 1978 SharedCompositorWorkerContextProvider();
1954 if (!worker_context_provider) { 1979 if (!worker_context_provider) {
1955 // Cause the compositor to wait and try again. 1980 // Cause the compositor to wait and try again.
1956 callback.Run(nullptr); 1981 callback.Run(nullptr);
1957 return; 1982 return;
1958 } 1983 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 std::move(context_provider), std::move(worker_context_provider), 2032 std::move(context_provider), std::move(worker_context_provider),
2008 GetGpuMemoryBufferManager(), shared_bitmap_manager(), routing_id, 2033 GetGpuMemoryBufferManager(), shared_bitmap_manager(), routing_id,
2009 g_next_compositor_frame_sink_id++, std::move(begin_frame_source), 2034 g_next_compositor_frame_sink_id++, std::move(begin_frame_source),
2010 sync_compositor_message_filter_.get(), 2035 sync_compositor_message_filter_.get(),
2011 std::move(frame_swap_message_queue))); 2036 std::move(frame_swap_message_queue)));
2012 return; 2037 return;
2013 } 2038 }
2014 #endif 2039 #endif
2015 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), 2040 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request),
2016 std::move(client)); 2041 std::move(client));
2017 callback.Run(base::WrapUnique(new RendererCompositorFrameSink( 2042 callback.Run(base::MakeUnique<viz::ClientCompositorFrameSink>(
2018 routing_id, std::move(synthetic_begin_frame_source),
2019 std::move(context_provider), std::move(worker_context_provider), 2043 std::move(context_provider), std::move(worker_context_provider),
2020 GetGpuMemoryBufferManager(), nullptr, std::move(sink_info), 2044 GetGpuMemoryBufferManager(), nullptr,
2021 std::move(client_request)))); 2045 std::move(synthetic_begin_frame_source), std::move(sink_info),
2046 std::move(client_request),
2047 base::MakeUnique<RendererLocalSurfaceIdProvider>(),
2048 false /* enable_surface_synchroninzation */));
2022 } 2049 }
2023 2050
2024 AssociatedInterfaceRegistry* 2051 AssociatedInterfaceRegistry*
2025 RenderThreadImpl::GetAssociatedInterfaceRegistry() { 2052 RenderThreadImpl::GetAssociatedInterfaceRegistry() {
2026 return &associated_interfaces_; 2053 return &associated_interfaces_;
2027 } 2054 }
2028 2055
2029 std::unique_ptr<cc::SwapPromise> 2056 std::unique_ptr<cc::SwapPromise>
2030 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( 2057 RenderThreadImpl::RequestCopyOfOutputForLayoutTest(
2031 int32_t routing_id, 2058 int32_t routing_id,
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 } 2497 }
2471 } 2498 }
2472 2499
2473 void RenderThreadImpl::OnRendererInterfaceRequest( 2500 void RenderThreadImpl::OnRendererInterfaceRequest(
2474 mojom::RendererAssociatedRequest request) { 2501 mojom::RendererAssociatedRequest request) {
2475 DCHECK(!renderer_binding_.is_bound()); 2502 DCHECK(!renderer_binding_.is_bound());
2476 renderer_binding_.Bind(std::move(request)); 2503 renderer_binding_.Bind(std::move(request));
2477 } 2504 }
2478 2505
2479 } // namespace content 2506 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/mus/renderer_window_tree_client.cc ('k') | ui/aura/mus/window_port_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698