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

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

Issue 2299003002: Remove uses of external begin frame sources (Closed)
Patch Set: Fix test crashes Created 4 years, 3 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/render_thread_impl.h ('k') | content/renderer/render_widget.h » ('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 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 #endif 1587 #endif
1588 return gpu_memory_buffer_manager(); 1588 return gpu_memory_buffer_manager();
1589 } 1589 }
1590 1590
1591 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { 1591 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() {
1592 return renderer_scheduler_.get(); 1592 return renderer_scheduler_.get();
1593 } 1593 }
1594 1594
1595 std::unique_ptr<cc::BeginFrameSource> 1595 std::unique_ptr<cc::BeginFrameSource>
1596 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { 1596 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) {
1597 // Blimp drives itself and doesn't need a real begin frame source.
danakj 2016/09/09 21:20:47 Does blimp server actually make an output surface?
enne (OOO) 2016/09/09 22:06:09 Oh! I thought it did, but it looks like it doesn't
1598 // Instead of handling nullptr everywhere, this just provides a noop.
1599 const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
1600 if (cmd->HasSwitch(switches::kUseRemoteCompositing)) {
1601 return base::MakeUnique<cc::StubBeginFrameSource>();
1602 }
1603
1597 return base::MakeUnique<CompositorExternalBeginFrameSource>( 1604 return base::MakeUnique<CompositorExternalBeginFrameSource>(
1598 compositor_message_filter_.get(), sync_message_filter(), routing_id); 1605 compositor_message_filter_.get(), sync_message_filter(), routing_id);
1599 } 1606 }
1600 1607
1601 cc::ImageSerializationProcessor* 1608 cc::ImageSerializationProcessor*
1602 RenderThreadImpl::GetImageSerializationProcessor() { 1609 RenderThreadImpl::GetImageSerializationProcessor() {
1603 return GetContentClient()->renderer()->GetImageSerializationProcessor(); 1610 return GetContentClient()->renderer()->GetImageSerializationProcessor();
1604 } 1611 }
1605 1612
1606 cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() { 1613 cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 #endif 1834 #endif
1828 1835
1829 uint32_t output_surface_id = g_next_output_surface_id++; 1836 uint32_t output_surface_id = g_next_output_surface_id++;
1830 1837
1831 if (command_line.HasSwitch(switches::kEnableVulkan)) { 1838 if (command_line.HasSwitch(switches::kEnableVulkan)) {
1832 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = 1839 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider =
1833 cc::VulkanInProcessContextProvider::Create(); 1840 cc::VulkanInProcessContextProvider::Create();
1834 if (vulkan_context_provider) { 1841 if (vulkan_context_provider) {
1835 DCHECK(!layout_test_mode()); 1842 DCHECK(!layout_test_mode());
1836 return base::MakeUnique<CompositorOutputSurface>( 1843 return base::MakeUnique<CompositorOutputSurface>(
1837 routing_id, output_surface_id, std::move(vulkan_context_provider), 1844 routing_id, output_surface_id,
1845 CreateExternalBeginFrameSource(routing_id),
1846 std::move(vulkan_context_provider),
1838 std::move(frame_swap_message_queue)); 1847 std::move(frame_swap_message_queue));
1839 } 1848 }
1840 } 1849 }
1841 1850
1842 // Create a gpu process channel and verify we want to use GPU compositing 1851 // Create a gpu process channel and verify we want to use GPU compositing
1843 // before creating any context providers. 1852 // before creating any context providers.
1844 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; 1853 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host;
1845 if (!use_software) { 1854 if (!use_software) {
1846 gpu_channel_host = EstablishGpuChannelSync(); 1855 gpu_channel_host = EstablishGpuChannelSync();
1847 if (!gpu_channel_host) { 1856 if (!gpu_channel_host) {
1848 // Cause the compositor to wait and try again. 1857 // Cause the compositor to wait and try again.
1849 return nullptr; 1858 return nullptr;
1850 } 1859 }
1851 // We may get a valid channel, but with a software renderer. In that case, 1860 // We may get a valid channel, but with a software renderer. In that case,
1852 // disable GPU compositing. 1861 // disable GPU compositing.
1853 if (gpu_channel_host->gpu_info().software_rendering) 1862 if (gpu_channel_host->gpu_info().software_rendering)
1854 use_software = true; 1863 use_software = true;
1855 } 1864 }
1856 1865
1857 if (use_software) { 1866 if (use_software) {
1858 DCHECK(!layout_test_mode()); 1867 DCHECK(!layout_test_mode());
1859 return base::MakeUnique<CompositorOutputSurface>( 1868 return base::MakeUnique<CompositorOutputSurface>(
1860 routing_id, output_surface_id, nullptr, nullptr, 1869 routing_id, output_surface_id,
1870 CreateExternalBeginFrameSource(routing_id), nullptr, nullptr,
1861 std::move(frame_swap_message_queue)); 1871 std::move(frame_swap_message_queue));
1862 } 1872 }
1863 1873
1864 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider = 1874 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider =
1865 SharedCompositorWorkerContextProvider(); 1875 SharedCompositorWorkerContextProvider();
1866 if (!worker_context_provider) { 1876 if (!worker_context_provider) {
1867 // Cause the compositor to wait and try again. 1877 // Cause the compositor to wait and try again.
1868 return nullptr; 1878 return nullptr;
1869 } 1879 }
1870 1880
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 if (layout_test_deps_) { 1913 if (layout_test_deps_) {
1904 return layout_test_deps_->CreateOutputSurface( 1914 return layout_test_deps_->CreateOutputSurface(
1905 routing_id, std::move(gpu_channel_host), std::move(context_provider), 1915 routing_id, std::move(gpu_channel_host), std::move(context_provider),
1906 std::move(worker_context_provider), this); 1916 std::move(worker_context_provider), this);
1907 } 1917 }
1908 1918
1909 #if defined(OS_ANDROID) 1919 #if defined(OS_ANDROID)
1910 if (sync_compositor_message_filter_) { 1920 if (sync_compositor_message_filter_) {
1911 return base::MakeUnique<SynchronousCompositorOutputSurface>( 1921 return base::MakeUnique<SynchronousCompositorOutputSurface>(
1912 std::move(context_provider), std::move(worker_context_provider), 1922 std::move(context_provider), std::move(worker_context_provider),
1913 routing_id, output_surface_id, sync_compositor_message_filter_.get(), 1923 routing_id, output_surface_id,
1924 CreateExternalBeginFrameSource(routing_id),
1925 sync_compositor_message_filter_.get(),
1914 std::move(frame_swap_message_queue)); 1926 std::move(frame_swap_message_queue));
1915 } 1927 }
1916 #endif 1928 #endif
1917 1929 return base::WrapUnique(new CompositorOutputSurface(
1918 return base::MakeUnique<CompositorOutputSurface>( 1930 routing_id, output_surface_id, CreateExternalBeginFrameSource(routing_id),
1919 routing_id, output_surface_id, std::move(context_provider), 1931 std::move(context_provider), std::move(worker_context_provider),
1920 std::move(worker_context_provider), std::move(frame_swap_message_queue)); 1932 std::move(frame_swap_message_queue)));
1921 } 1933 }
1922 1934
1923 std::unique_ptr<cc::SwapPromise> 1935 std::unique_ptr<cc::SwapPromise>
1924 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( 1936 RenderThreadImpl::RequestCopyOfOutputForLayoutTest(
1925 int32_t routing_id, 1937 int32_t routing_id,
1926 std::unique_ptr<cc::CopyOutputRequest> request) { 1938 std::unique_ptr<cc::CopyOutputRequest> request) {
1927 DCHECK(layout_test_deps_); 1939 DCHECK(layout_test_deps_);
1928 return layout_test_deps_->RequestCopyOfOutput(routing_id, std::move(request)); 1940 return layout_test_deps_->RequestCopyOfOutput(routing_id, std::move(request));
1929 } 1941 }
1930 1942
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 if (blink::mainThreadIsolate()) { 2257 if (blink::mainThreadIsolate()) {
2246 blink::mainThreadIsolate()->MemoryPressureNotification( 2258 blink::mainThreadIsolate()->MemoryPressureNotification(
2247 v8::MemoryPressureLevel::kCritical); 2259 v8::MemoryPressureLevel::kCritical);
2248 blink::MemoryPressureNotificationToWorkerThreadIsolates( 2260 blink::MemoryPressureNotificationToWorkerThreadIsolates(
2249 v8::MemoryPressureLevel::kCritical); 2261 v8::MemoryPressureLevel::kCritical);
2250 } 2262 }
2251 } 2263 }
2252 2264
2253 2265
2254 } // namespace content 2266 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698