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 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 #endif | 1827 #endif |
1828 | 1828 |
1829 uint32_t output_surface_id = g_next_output_surface_id++; | 1829 uint32_t output_surface_id = g_next_output_surface_id++; |
1830 | 1830 |
1831 if (command_line.HasSwitch(switches::kEnableVulkan)) { | 1831 if (command_line.HasSwitch(switches::kEnableVulkan)) { |
1832 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = | 1832 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = |
1833 cc::VulkanInProcessContextProvider::Create(); | 1833 cc::VulkanInProcessContextProvider::Create(); |
1834 if (vulkan_context_provider) { | 1834 if (vulkan_context_provider) { |
1835 DCHECK(!layout_test_mode()); | 1835 DCHECK(!layout_test_mode()); |
1836 return base::MakeUnique<CompositorOutputSurface>( | 1836 return base::MakeUnique<CompositorOutputSurface>( |
1837 routing_id, output_surface_id, std::move(vulkan_context_provider), | 1837 routing_id, output_surface_id, |
| 1838 CreateExternalBeginFrameSource(routing_id), |
| 1839 std::move(vulkan_context_provider), |
1838 std::move(frame_swap_message_queue)); | 1840 std::move(frame_swap_message_queue)); |
1839 } | 1841 } |
1840 } | 1842 } |
1841 | 1843 |
1842 // Create a gpu process channel and verify we want to use GPU compositing | 1844 // Create a gpu process channel and verify we want to use GPU compositing |
1843 // before creating any context providers. | 1845 // before creating any context providers. |
1844 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; | 1846 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; |
1845 if (!use_software) { | 1847 if (!use_software) { |
1846 gpu_channel_host = EstablishGpuChannelSync(); | 1848 gpu_channel_host = EstablishGpuChannelSync(); |
1847 if (!gpu_channel_host) { | 1849 if (!gpu_channel_host) { |
1848 // Cause the compositor to wait and try again. | 1850 // Cause the compositor to wait and try again. |
1849 return nullptr; | 1851 return nullptr; |
1850 } | 1852 } |
1851 // We may get a valid channel, but with a software renderer. In that case, | 1853 // We may get a valid channel, but with a software renderer. In that case, |
1852 // disable GPU compositing. | 1854 // disable GPU compositing. |
1853 if (gpu_channel_host->gpu_info().software_rendering) | 1855 if (gpu_channel_host->gpu_info().software_rendering) |
1854 use_software = true; | 1856 use_software = true; |
1855 } | 1857 } |
1856 | 1858 |
1857 if (use_software) { | 1859 if (use_software) { |
1858 DCHECK(!layout_test_mode()); | 1860 DCHECK(!layout_test_mode()); |
1859 return base::MakeUnique<CompositorOutputSurface>( | 1861 return base::MakeUnique<CompositorOutputSurface>( |
1860 routing_id, output_surface_id, nullptr, nullptr, | 1862 routing_id, output_surface_id, |
| 1863 CreateExternalBeginFrameSource(routing_id), nullptr, nullptr, |
1861 std::move(frame_swap_message_queue)); | 1864 std::move(frame_swap_message_queue)); |
1862 } | 1865 } |
1863 | 1866 |
1864 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider = | 1867 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider = |
1865 SharedCompositorWorkerContextProvider(); | 1868 SharedCompositorWorkerContextProvider(); |
1866 if (!worker_context_provider) { | 1869 if (!worker_context_provider) { |
1867 // Cause the compositor to wait and try again. | 1870 // Cause the compositor to wait and try again. |
1868 return nullptr; | 1871 return nullptr; |
1869 } | 1872 } |
1870 | 1873 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 if (layout_test_deps_) { | 1906 if (layout_test_deps_) { |
1904 return layout_test_deps_->CreateOutputSurface( | 1907 return layout_test_deps_->CreateOutputSurface( |
1905 routing_id, std::move(gpu_channel_host), std::move(context_provider), | 1908 routing_id, std::move(gpu_channel_host), std::move(context_provider), |
1906 std::move(worker_context_provider), this); | 1909 std::move(worker_context_provider), this); |
1907 } | 1910 } |
1908 | 1911 |
1909 #if defined(OS_ANDROID) | 1912 #if defined(OS_ANDROID) |
1910 if (sync_compositor_message_filter_) { | 1913 if (sync_compositor_message_filter_) { |
1911 return base::MakeUnique<SynchronousCompositorOutputSurface>( | 1914 return base::MakeUnique<SynchronousCompositorOutputSurface>( |
1912 std::move(context_provider), std::move(worker_context_provider), | 1915 std::move(context_provider), std::move(worker_context_provider), |
1913 routing_id, output_surface_id, sync_compositor_message_filter_.get(), | 1916 routing_id, output_surface_id, |
| 1917 CreateExternalBeginFrameSource(routing_id), |
| 1918 sync_compositor_message_filter_.get(), |
1914 std::move(frame_swap_message_queue)); | 1919 std::move(frame_swap_message_queue)); |
1915 } | 1920 } |
1916 #endif | 1921 #endif |
1917 | 1922 return base::WrapUnique(new CompositorOutputSurface( |
1918 return base::MakeUnique<CompositorOutputSurface>( | 1923 routing_id, output_surface_id, CreateExternalBeginFrameSource(routing_id), |
1919 routing_id, output_surface_id, std::move(context_provider), | 1924 std::move(context_provider), std::move(worker_context_provider), |
1920 std::move(worker_context_provider), std::move(frame_swap_message_queue)); | 1925 std::move(frame_swap_message_queue))); |
1921 } | 1926 } |
1922 | 1927 |
1923 std::unique_ptr<cc::SwapPromise> | 1928 std::unique_ptr<cc::SwapPromise> |
1924 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( | 1929 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( |
1925 int32_t routing_id, | 1930 int32_t routing_id, |
1926 std::unique_ptr<cc::CopyOutputRequest> request) { | 1931 std::unique_ptr<cc::CopyOutputRequest> request) { |
1927 DCHECK(layout_test_deps_); | 1932 DCHECK(layout_test_deps_); |
1928 return layout_test_deps_->RequestCopyOfOutput(routing_id, std::move(request)); | 1933 return layout_test_deps_->RequestCopyOfOutput(routing_id, std::move(request)); |
1929 } | 1934 } |
1930 | 1935 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2245 if (blink::mainThreadIsolate()) { | 2250 if (blink::mainThreadIsolate()) { |
2246 blink::mainThreadIsolate()->MemoryPressureNotification( | 2251 blink::mainThreadIsolate()->MemoryPressureNotification( |
2247 v8::MemoryPressureLevel::kCritical); | 2252 v8::MemoryPressureLevel::kCritical); |
2248 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2253 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
2249 v8::MemoryPressureLevel::kCritical); | 2254 v8::MemoryPressureLevel::kCritical); |
2250 } | 2255 } |
2251 } | 2256 } |
2252 | 2257 |
2253 | 2258 |
2254 } // namespace content | 2259 } // namespace content |
OLD | NEW |