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

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

Issue 2323123002: Make disable vsync run the renderer independently (Closed)
Patch Set: With additional comment 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
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 #include "third_party/WebKit/public/web/WebKit.h" 155 #include "third_party/WebKit/public/web/WebKit.h"
156 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" 156 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h"
157 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 157 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
158 #include "third_party/WebKit/public/web/WebScriptController.h" 158 #include "third_party/WebKit/public/web/WebScriptController.h"
159 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 159 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
160 #include "third_party/WebKit/public/web/WebView.h" 160 #include "third_party/WebKit/public/web/WebView.h"
161 #include "third_party/icu/source/i18n/unicode/timezone.h" 161 #include "third_party/icu/source/i18n/unicode/timezone.h"
162 #include "third_party/skia/include/core/SkGraphics.h" 162 #include "third_party/skia/include/core/SkGraphics.h"
163 #include "ui/base/layout.h" 163 #include "ui/base/layout.h"
164 #include "ui/base/ui_base_switches.h" 164 #include "ui/base/ui_base_switches.h"
165 #include "ui/gl/gl_switches.h"
165 166
166 #if defined(OS_ANDROID) 167 #if defined(OS_ANDROID)
167 #include <cpu-features.h> 168 #include <cpu-features.h>
168 #include "content/renderer/android/synchronous_compositor_filter.h" 169 #include "content/renderer/android/synchronous_compositor_filter.h"
169 #include "content/renderer/android/synchronous_compositor_output_surface.h" 170 #include "content/renderer/android/synchronous_compositor_output_surface.h"
170 #include "content/renderer/media/android/renderer_demuxer_android.h" 171 #include "content/renderer/media/android/renderer_demuxer_android.h"
171 #include "content/renderer/media/android/stream_texture_factory.h" 172 #include "content/renderer/media/android/stream_texture_factory.h"
172 #include "media/base/android/media_codec_util.h" 173 #include "media/base/android/media_codec_util.h"
173 #endif 174 #endif
174 175
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 #endif 1588 #endif
1588 return gpu_memory_buffer_manager(); 1589 return gpu_memory_buffer_manager();
1589 } 1590 }
1590 1591
1591 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { 1592 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() {
1592 return renderer_scheduler_.get(); 1593 return renderer_scheduler_.get();
1593 } 1594 }
1594 1595
1595 std::unique_ptr<cc::BeginFrameSource> 1596 std::unique_ptr<cc::BeginFrameSource>
1596 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { 1597 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) {
1598 const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
1599 if (cmd->HasSwitch(switches::kDisableGpuVsync)) {
1600 std::string display_vsync_string =
1601 cmd->GetSwitchValueASCII(switches::kDisableGpuVsync);
1602 if (display_vsync_string != "gpu") {
1603 // In disable gpu vsync mode, also let the renderer tick as fast as it
1604 // can. The top level begin frame source will also be running as a back
1605 // to back begin frame source, but using a synthetic begin frame source
1606 // here reduces latency when in this mode (at least for frames
1607 // starting--it potentially increases it for input on the other hand.)
1608 base::SingleThreadTaskRunner* compositor_impl_side_task_runner =
1609 compositor_task_runner_ ? compositor_task_runner_.get()
1610 : base::ThreadTaskRunnerHandle::Get().get();
1611 return base::MakeUnique<cc::BackToBackBeginFrameSource>(
1612 base::MakeUnique<cc::DelayBasedTimeSource>(
1613 compositor_impl_side_task_runner));
1614 }
1615 }
1616
1597 return base::MakeUnique<CompositorExternalBeginFrameSource>( 1617 return base::MakeUnique<CompositorExternalBeginFrameSource>(
1598 compositor_message_filter_.get(), sync_message_filter(), routing_id); 1618 compositor_message_filter_.get(), sync_message_filter(), routing_id);
1599 } 1619 }
1600 1620
1601 cc::ImageSerializationProcessor* 1621 cc::ImageSerializationProcessor*
1602 RenderThreadImpl::GetImageSerializationProcessor() { 1622 RenderThreadImpl::GetImageSerializationProcessor() {
1603 return GetContentClient()->renderer()->GetImageSerializationProcessor(); 1623 return GetContentClient()->renderer()->GetImageSerializationProcessor();
1604 } 1624 }
1605 1625
1606 cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() { 1626 cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() {
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 if (blink::mainThreadIsolate()) { 2270 if (blink::mainThreadIsolate()) {
2251 blink::mainThreadIsolate()->MemoryPressureNotification( 2271 blink::mainThreadIsolate()->MemoryPressureNotification(
2252 v8::MemoryPressureLevel::kCritical); 2272 v8::MemoryPressureLevel::kCritical);
2253 blink::MemoryPressureNotificationToWorkerThreadIsolates( 2273 blink::MemoryPressureNotificationToWorkerThreadIsolates(
2254 v8::MemoryPressureLevel::kCritical); 2274 v8::MemoryPressureLevel::kCritical);
2255 } 2275 }
2256 } 2276 }
2257 2277
2258 2278
2259 } // namespace content 2279 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698