| 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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1923 if (command_line.HasSwitch(switches::kEnableVulkan)) { | 1923 if (command_line.HasSwitch(switches::kEnableVulkan)) { |
| 1924 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = | 1924 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = |
| 1925 cc::VulkanInProcessContextProvider::Create(); | 1925 cc::VulkanInProcessContextProvider::Create(); |
| 1926 if (vulkan_context_provider) { | 1926 if (vulkan_context_provider) { |
| 1927 DCHECK(!layout_test_mode()); | 1927 DCHECK(!layout_test_mode()); |
| 1928 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), | 1928 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), |
| 1929 std::move(client)); | 1929 std::move(client)); |
| 1930 callback.Run(base::MakeUnique<RendererCompositorFrameSink>( | 1930 callback.Run(base::MakeUnique<RendererCompositorFrameSink>( |
| 1931 routing_id, std::move(synthetic_begin_frame_source), | 1931 routing_id, std::move(synthetic_begin_frame_source), |
| 1932 std::move(vulkan_context_provider), std::move(sink_info), | 1932 std::move(vulkan_context_provider), std::move(sink_info), |
| 1933 std::move(client_request), std::move(frame_swap_message_queue))); | 1933 std::move(client_request))); |
| 1934 return; | 1934 return; |
| 1935 } | 1935 } |
| 1936 } | 1936 } |
| 1937 | 1937 |
| 1938 // Create a gpu process channel and verify we want to use GPU compositing | 1938 // Create a gpu process channel and verify we want to use GPU compositing |
| 1939 // before creating any context providers. | 1939 // before creating any context providers. |
| 1940 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; | 1940 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; |
| 1941 if (!use_software) { | 1941 if (!use_software) { |
| 1942 gpu_channel_host = EstablishGpuChannelSync(); | 1942 gpu_channel_host = EstablishGpuChannelSync(); |
| 1943 if (!gpu_channel_host) { | 1943 if (!gpu_channel_host) { |
| 1944 // Cause the compositor to wait and try again. | 1944 // Cause the compositor to wait and try again. |
| 1945 callback.Run(nullptr); | 1945 callback.Run(nullptr); |
| 1946 return; | 1946 return; |
| 1947 } | 1947 } |
| 1948 // We may get a valid channel, but with a software renderer. In that case, | 1948 // We may get a valid channel, but with a software renderer. In that case, |
| 1949 // disable GPU compositing. | 1949 // disable GPU compositing. |
| 1950 if (gpu_channel_host->gpu_info().software_rendering) | 1950 if (gpu_channel_host->gpu_info().software_rendering) |
| 1951 use_software = true; | 1951 use_software = true; |
| 1952 } | 1952 } |
| 1953 | 1953 |
| 1954 if (use_software) { | 1954 if (use_software) { |
| 1955 DCHECK(!layout_test_mode()); | 1955 DCHECK(!layout_test_mode()); |
| 1956 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), | 1956 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), |
| 1957 std::move(client)); | 1957 std::move(client)); |
| 1958 callback.Run(base::MakeUnique<RendererCompositorFrameSink>( | 1958 callback.Run(base::MakeUnique<RendererCompositorFrameSink>( |
| 1959 routing_id, std::move(synthetic_begin_frame_source), nullptr, nullptr, | 1959 routing_id, std::move(synthetic_begin_frame_source), nullptr, nullptr, |
| 1960 nullptr, shared_bitmap_manager(), std::move(sink_info), | 1960 nullptr, shared_bitmap_manager(), std::move(sink_info), |
| 1961 std::move(client_request), std::move(frame_swap_message_queue))); | 1961 std::move(client_request))); |
| 1962 return; | 1962 return; |
| 1963 } | 1963 } |
| 1964 | 1964 |
| 1965 scoped_refptr<ui::ContextProviderCommandBuffer> worker_context_provider = | 1965 scoped_refptr<ui::ContextProviderCommandBuffer> worker_context_provider = |
| 1966 SharedCompositorWorkerContextProvider(); | 1966 SharedCompositorWorkerContextProvider(); |
| 1967 if (!worker_context_provider) { | 1967 if (!worker_context_provider) { |
| 1968 // Cause the compositor to wait and try again. | 1968 // Cause the compositor to wait and try again. |
| 1969 callback.Run(nullptr); | 1969 callback.Run(nullptr); |
| 1970 return; | 1970 return; |
| 1971 } | 1971 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 std::move(frame_swap_message_queue))); | 2024 std::move(frame_swap_message_queue))); |
| 2025 return; | 2025 return; |
| 2026 } | 2026 } |
| 2027 #endif | 2027 #endif |
| 2028 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), | 2028 frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), |
| 2029 std::move(client)); | 2029 std::move(client)); |
| 2030 callback.Run(base::WrapUnique(new RendererCompositorFrameSink( | 2030 callback.Run(base::WrapUnique(new RendererCompositorFrameSink( |
| 2031 routing_id, std::move(synthetic_begin_frame_source), | 2031 routing_id, std::move(synthetic_begin_frame_source), |
| 2032 std::move(context_provider), std::move(worker_context_provider), | 2032 std::move(context_provider), std::move(worker_context_provider), |
| 2033 GetGpuMemoryBufferManager(), nullptr, std::move(sink_info), | 2033 GetGpuMemoryBufferManager(), nullptr, std::move(sink_info), |
| 2034 std::move(client_request), std::move(frame_swap_message_queue)))); | 2034 std::move(client_request)))); |
| 2035 } | 2035 } |
| 2036 | 2036 |
| 2037 AssociatedInterfaceRegistry* | 2037 AssociatedInterfaceRegistry* |
| 2038 RenderThreadImpl::GetAssociatedInterfaceRegistry() { | 2038 RenderThreadImpl::GetAssociatedInterfaceRegistry() { |
| 2039 return &associated_interfaces_; | 2039 return &associated_interfaces_; |
| 2040 } | 2040 } |
| 2041 | 2041 |
| 2042 std::unique_ptr<cc::SwapPromise> | 2042 std::unique_ptr<cc::SwapPromise> |
| 2043 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( | 2043 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( |
| 2044 int32_t routing_id, | 2044 int32_t routing_id, |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2483 } | 2483 } |
| 2484 } | 2484 } |
| 2485 | 2485 |
| 2486 void RenderThreadImpl::OnRendererInterfaceRequest( | 2486 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2487 mojom::RendererAssociatedRequest request) { | 2487 mojom::RendererAssociatedRequest request) { |
| 2488 DCHECK(!renderer_binding_.is_bound()); | 2488 DCHECK(!renderer_binding_.is_bound()); |
| 2489 renderer_binding_.Bind(std::move(request)); | 2489 renderer_binding_.Bind(std::move(request)); |
| 2490 } | 2490 } |
| 2491 | 2491 |
| 2492 } // namespace content | 2492 } // namespace content |
| OLD | NEW |