| OLD | NEW |
| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "cc/output/layer_tree_frame_sink.h" | 50 #include "cc/output/layer_tree_frame_sink.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_layer_tree_frame_sink.h" | 58 #include "components/viz/client/client_layer_tree_frame_sink.h" |
| 59 #include "components/viz/client/client_shared_bitmap_manager.h" | 59 #include "components/viz/client/client_shared_bitmap_manager.h" |
| 60 #include "components/viz/client/hit_test_data_provider.h" |
| 60 #include "components/viz/client/local_surface_id_provider.h" | 61 #include "components/viz/client/local_surface_id_provider.h" |
| 61 #include "content/child/appcache/appcache_dispatcher.h" | 62 #include "content/child/appcache/appcache_dispatcher.h" |
| 62 #include "content/child/appcache/appcache_frontend_impl.h" | 63 #include "content/child/appcache/appcache_frontend_impl.h" |
| 63 #include "content/child/blob_storage/blob_message_filter.h" | 64 #include "content/child/blob_storage/blob_message_filter.h" |
| 64 #include "content/child/child_histogram_message_filter.h" | 65 #include "content/child/child_histogram_message_filter.h" |
| 65 #include "content/child/child_resource_message_filter.h" | 66 #include "content/child/child_resource_message_filter.h" |
| 66 #include "content/child/db_message_filter.h" | 67 #include "content/child/db_message_filter.h" |
| 67 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 68 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
| 68 #include "content/child/memory/child_memory_coordinator_impl.h" | 69 #include "content/child/memory/child_memory_coordinator_impl.h" |
| 69 #include "content/child/resource_dispatcher.h" | 70 #include "content/child/resource_dispatcher.h" |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 if (command_line.HasSwitch(switches::kEnableVulkan)) { | 1972 if (command_line.HasSwitch(switches::kEnableVulkan)) { |
| 1972 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = | 1973 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = |
| 1973 cc::VulkanInProcessContextProvider::Create(); | 1974 cc::VulkanInProcessContextProvider::Create(); |
| 1974 if (vulkan_context_provider) { | 1975 if (vulkan_context_provider) { |
| 1975 DCHECK(!layout_test_mode()); | 1976 DCHECK(!layout_test_mode()); |
| 1976 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), | 1977 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), |
| 1977 std::move(client)); | 1978 std::move(client)); |
| 1978 callback.Run(base::MakeUnique<viz::ClientLayerTreeFrameSink>( | 1979 callback.Run(base::MakeUnique<viz::ClientLayerTreeFrameSink>( |
| 1979 std::move(vulkan_context_provider), | 1980 std::move(vulkan_context_provider), |
| 1980 std::move(synthetic_begin_frame_source), std::move(sink_info), | 1981 std::move(synthetic_begin_frame_source), std::move(sink_info), |
| 1981 std::move(client_request), | 1982 std::move(client_request), nullptr /* hit_test_data_provider */, |
| 1982 base::MakeUnique<RendererLocalSurfaceIdProvider>(), | 1983 base::MakeUnique<RendererLocalSurfaceIdProvider>(), |
| 1983 false /* enable_surface_synchroninzation */)); | 1984 false /* enable_surface_synchroninzation */)); |
| 1984 return; | 1985 return; |
| 1985 } | 1986 } |
| 1986 } | 1987 } |
| 1987 | 1988 |
| 1988 // Create a gpu process channel and verify we want to use GPU compositing | 1989 // Create a gpu process channel and verify we want to use GPU compositing |
| 1989 // before creating any context providers. | 1990 // before creating any context providers. |
| 1990 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; | 1991 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; |
| 1991 if (!use_software) { | 1992 if (!use_software) { |
| 1992 gpu_channel_host = EstablishGpuChannelSync(); | 1993 gpu_channel_host = EstablishGpuChannelSync(); |
| 1993 if (!gpu_channel_host) { | 1994 if (!gpu_channel_host) { |
| 1994 // Cause the compositor to wait and try again. | 1995 // Cause the compositor to wait and try again. |
| 1995 callback.Run(nullptr); | 1996 callback.Run(nullptr); |
| 1996 return; | 1997 return; |
| 1997 } | 1998 } |
| 1998 // We may get a valid channel, but with a software renderer. In that case, | 1999 // We may get a valid channel, but with a software renderer. In that case, |
| 1999 // disable GPU compositing. | 2000 // disable GPU compositing. |
| 2000 if (gpu_channel_host->gpu_info().software_rendering) | 2001 if (gpu_channel_host->gpu_info().software_rendering) |
| 2001 use_software = true; | 2002 use_software = true; |
| 2002 } | 2003 } |
| 2003 | 2004 |
| 2004 if (use_software) { | 2005 if (use_software) { |
| 2005 DCHECK(!layout_test_mode()); | 2006 DCHECK(!layout_test_mode()); |
| 2006 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), | 2007 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), |
| 2007 std::move(client)); | 2008 std::move(client)); |
| 2008 callback.Run(base::MakeUnique<viz::ClientLayerTreeFrameSink>( | 2009 callback.Run(base::MakeUnique<viz::ClientLayerTreeFrameSink>( |
| 2009 nullptr, nullptr, nullptr, shared_bitmap_manager(), | 2010 nullptr, nullptr, nullptr, shared_bitmap_manager(), |
| 2010 std::move(synthetic_begin_frame_source), std::move(sink_info), | 2011 std::move(synthetic_begin_frame_source), std::move(sink_info), |
| 2011 std::move(client_request), | 2012 std::move(client_request), nullptr /* hit_test_data_provider */, |
| 2012 base::MakeUnique<RendererLocalSurfaceIdProvider>(), | 2013 base::MakeUnique<RendererLocalSurfaceIdProvider>(), |
| 2013 false /* enable_surface_synchroninzation */)); | 2014 false /* enable_surface_synchroninzation */)); |
| 2014 return; | 2015 return; |
| 2015 } | 2016 } |
| 2016 | 2017 |
| 2017 scoped_refptr<ui::ContextProviderCommandBuffer> worker_context_provider = | 2018 scoped_refptr<ui::ContextProviderCommandBuffer> worker_context_provider = |
| 2018 SharedCompositorWorkerContextProvider(); | 2019 SharedCompositorWorkerContextProvider(); |
| 2019 if (!worker_context_provider) { | 2020 if (!worker_context_provider) { |
| 2020 // Cause the compositor to wait and try again. | 2021 // Cause the compositor to wait and try again. |
| 2021 callback.Run(nullptr); | 2022 callback.Run(nullptr); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 std::move(frame_swap_message_queue))); | 2077 std::move(frame_swap_message_queue))); |
| 2077 return; | 2078 return; |
| 2078 } | 2079 } |
| 2079 #endif | 2080 #endif |
| 2080 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), | 2081 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), |
| 2081 std::move(client)); | 2082 std::move(client)); |
| 2082 callback.Run(base::MakeUnique<viz::ClientLayerTreeFrameSink>( | 2083 callback.Run(base::MakeUnique<viz::ClientLayerTreeFrameSink>( |
| 2083 std::move(context_provider), std::move(worker_context_provider), | 2084 std::move(context_provider), std::move(worker_context_provider), |
| 2084 GetGpuMemoryBufferManager(), nullptr, | 2085 GetGpuMemoryBufferManager(), nullptr, |
| 2085 std::move(synthetic_begin_frame_source), std::move(sink_info), | 2086 std::move(synthetic_begin_frame_source), std::move(sink_info), |
| 2086 std::move(client_request), | 2087 std::move(client_request), nullptr /* hit_test_data_provider */, |
| 2087 base::MakeUnique<RendererLocalSurfaceIdProvider>(), | 2088 base::MakeUnique<RendererLocalSurfaceIdProvider>(), |
| 2088 false /* enable_surface_synchroninzation */)); | 2089 false /* enable_surface_synchroninzation */)); |
| 2089 } | 2090 } |
| 2090 | 2091 |
| 2091 AssociatedInterfaceRegistry* | 2092 AssociatedInterfaceRegistry* |
| 2092 RenderThreadImpl::GetAssociatedInterfaceRegistry() { | 2093 RenderThreadImpl::GetAssociatedInterfaceRegistry() { |
| 2093 return &associated_interfaces_; | 2094 return &associated_interfaces_; |
| 2094 } | 2095 } |
| 2095 | 2096 |
| 2096 std::unique_ptr<cc::SwapPromise> | 2097 std::unique_ptr<cc::SwapPromise> |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2541 } | 2542 } |
| 2542 } | 2543 } |
| 2543 | 2544 |
| 2544 void RenderThreadImpl::OnRendererInterfaceRequest( | 2545 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2545 mojom::RendererAssociatedRequest request) { | 2546 mojom::RendererAssociatedRequest request) { |
| 2546 DCHECK(!renderer_binding_.is_bound()); | 2547 DCHECK(!renderer_binding_.is_bound()); |
| 2547 renderer_binding_.Bind(std::move(request)); | 2548 renderer_binding_.Bind(std::move(request)); |
| 2548 } | 2549 } |
| 2549 | 2550 |
| 2550 } // namespace content | 2551 } // namespace content |
| OLD | NEW |