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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 199523002: cc: Throttle swaps in Scheduler instead of OutputSurface (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 9 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 return false; 1828 return false;
1829 1829
1830 if (settings_.impl_side_painting) { 1830 if (settings_.impl_side_painting) {
1831 CreateAndSetTileManager( 1831 CreateAndSetTileManager(
1832 resource_provider.get(), 1832 resource_provider.get(),
1833 output_surface->context_provider().get(), 1833 output_surface->context_provider().get(),
1834 GetRendererCapabilities().using_map_image, 1834 GetRendererCapabilities().using_map_image,
1835 GetRendererCapabilities().allow_rasterize_on_demand); 1835 GetRendererCapabilities().allow_rasterize_on_demand);
1836 } 1836 }
1837 1837
1838 // Setup BeginImplFrameEmulation if it's not supported natively 1838 if (!settings_.throttle_frame_production) {
1839 if (!settings_.begin_impl_frame_scheduling_enabled) { 1839 // Disable VSync
1840 output_surface->SetThrottleFrameProduction(false);
1841 } else if (!settings_.begin_impl_frame_scheduling_enabled) {
1842 // Setup BeginImplFrameEmulation if it's not supported natively
1840 const base::TimeDelta display_refresh_interval = 1843 const base::TimeDelta display_refresh_interval =
1841 base::TimeDelta::FromMicroseconds( 1844 base::TimeDelta::FromMicroseconds(
1842 base::Time::kMicrosecondsPerSecond / 1845 base::Time::kMicrosecondsPerSecond /
1843 settings_.refresh_rate); 1846 settings_.refresh_rate);
1844 1847
1845 output_surface->InitializeBeginImplFrameEmulation( 1848 output_surface->InitializeBeginImplFrameEmulation(
1846 proxy_->ImplThreadTaskRunner(), 1849 proxy_->ImplThreadTaskRunner(),
1847 settings_.throttle_frame_production,
1848 display_refresh_interval); 1850 display_refresh_interval);
1849 } 1851 }
1850 1852
1851 int max_frames_pending = 1853 int max_frames_pending =
1852 output_surface->capabilities().max_frames_pending; 1854 output_surface->capabilities().max_frames_pending;
1853 if (max_frames_pending <= 0) 1855 if (max_frames_pending <= 0)
1854 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; 1856 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING;
1855 output_surface->SetMaxFramesPending(max_frames_pending); 1857 client_->SetMaxSwapsPending(max_frames_pending);
1856 1858
1857 resource_provider_ = resource_provider.Pass(); 1859 resource_provider_ = resource_provider.Pass();
1858 output_surface_ = output_surface.Pass(); 1860 output_surface_ = output_surface.Pass();
1859 1861
1860 client_->OnCanDrawStateChanged(CanDraw()); 1862 client_->OnCanDrawStateChanged(CanDraw());
1861 1863
1862 return true; 1864 return true;
1863 } 1865 }
1864 1866
1865 bool LayerTreeHostImpl::DeferredInitialize( 1867 bool LayerTreeHostImpl::DeferredInitialize(
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 swap_promise_monitor_.erase(monitor); 3020 swap_promise_monitor_.erase(monitor);
3019 } 3021 }
3020 3022
3021 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { 3023 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() {
3022 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3024 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3023 for (; it != swap_promise_monitor_.end(); it++) 3025 for (; it != swap_promise_monitor_.end(); it++)
3024 (*it)->OnSetNeedsRedrawOnImpl(); 3026 (*it)->OnSetNeedsRedrawOnImpl();
3025 } 3027 }
3026 3028
3027 } // namespace cc 3029 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698