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

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: rebase Created 6 years, 8 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 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 return false; 1849 return false;
1850 1850
1851 if (settings_.impl_side_painting) { 1851 if (settings_.impl_side_painting) {
1852 CreateAndSetTileManager( 1852 CreateAndSetTileManager(
1853 resource_provider.get(), 1853 resource_provider.get(),
1854 output_surface->context_provider().get(), 1854 output_surface->context_provider().get(),
1855 GetRendererCapabilities().using_map_image, 1855 GetRendererCapabilities().using_map_image,
1856 GetRendererCapabilities().allow_rasterize_on_demand); 1856 GetRendererCapabilities().allow_rasterize_on_demand);
1857 } 1857 }
1858 1858
1859 // Setup BeginFrameEmulation if it's not supported natively 1859 if (!settings_.throttle_frame_production) {
1860 if (!settings_.begin_impl_frame_scheduling_enabled) { 1860 // Disable VSync
1861 output_surface->SetThrottleFrameProduction(false);
1862 } else if (!settings_.begin_impl_frame_scheduling_enabled) {
1863 // Setup BeginFrameEmulation if it's not supported natively
1861 const base::TimeDelta display_refresh_interval = 1864 const base::TimeDelta display_refresh_interval =
1862 base::TimeDelta::FromMicroseconds( 1865 base::TimeDelta::FromMicroseconds(
1863 base::Time::kMicrosecondsPerSecond / 1866 base::Time::kMicrosecondsPerSecond /
1864 settings_.refresh_rate); 1867 settings_.refresh_rate);
1865 1868
1866 output_surface->InitializeBeginFrameEmulation( 1869 output_surface->InitializeBeginFrameEmulation(
1867 proxy_->ImplThreadTaskRunner(), 1870 proxy_->ImplThreadTaskRunner(),
1868 settings_.throttle_frame_production,
1869 display_refresh_interval); 1871 display_refresh_interval);
1870 } 1872 }
1871 1873
1872 int max_frames_pending = 1874 int max_frames_pending =
1873 output_surface->capabilities().max_frames_pending; 1875 output_surface->capabilities().max_frames_pending;
1874 if (max_frames_pending <= 0) 1876 if (max_frames_pending <= 0)
1875 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; 1877 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING;
1876 output_surface->SetMaxFramesPending(max_frames_pending); 1878 client_->SetMaxSwapsPending(max_frames_pending);
1877 1879
1878 resource_provider_ = resource_provider.Pass(); 1880 resource_provider_ = resource_provider.Pass();
1879 output_surface_ = output_surface.Pass(); 1881 output_surface_ = output_surface.Pass();
1880 1882
1881 client_->OnCanDrawStateChanged(CanDraw()); 1883 client_->OnCanDrawStateChanged(CanDraw());
1882 1884
1883 return true; 1885 return true;
1884 } 1886 }
1885 1887
1886 bool LayerTreeHostImpl::DeferredInitialize( 1888 bool LayerTreeHostImpl::DeferredInitialize(
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3046 swap_promise_monitor_.erase(monitor); 3048 swap_promise_monitor_.erase(monitor);
3047 } 3049 }
3048 3050
3049 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { 3051 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() {
3050 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3052 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3051 for (; it != swap_promise_monitor_.end(); it++) 3053 for (; it != swap_promise_monitor_.end(); it++)
3052 (*it)->OnSetNeedsRedrawOnImpl(); 3054 (*it)->OnSetNeedsRedrawOnImpl();
3053 } 3055 }
3054 3056
3055 } // namespace cc 3057 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698