OLD | NEW |
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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 } | 1294 } |
1295 | 1295 |
1296 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { | 1296 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { |
1297 client_->BeginFrame(args); | 1297 client_->BeginFrame(args); |
1298 } | 1298 } |
1299 | 1299 |
1300 void LayerTreeHostImpl::DidSwapBuffers() { | 1300 void LayerTreeHostImpl::DidSwapBuffers() { |
1301 client_->DidSwapBuffersOnImplThread(); | 1301 client_->DidSwapBuffersOnImplThread(); |
1302 } | 1302 } |
1303 | 1303 |
1304 void LayerTreeHostImpl::OnSwapBuffersComplete() { | 1304 void LayerTreeHostImpl::DidSwapBuffersComplete() { |
1305 client_->OnSwapBuffersCompleteOnImplThread(); | 1305 client_->DidSwapBuffersCompleteOnImplThread(); |
1306 } | 1306 } |
1307 | 1307 |
1308 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { | 1308 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { |
1309 // TODO(piman): We may need to do some validation on this ack before | 1309 // TODO(piman): We may need to do some validation on this ack before |
1310 // processing it. | 1310 // processing it. |
1311 if (renderer_) | 1311 if (renderer_) |
1312 renderer_->ReceiveSwapBuffersAck(*ack); | 1312 renderer_->ReceiveSwapBuffersAck(*ack); |
1313 | 1313 |
1314 // In OOM, we now might be able to release more resources that were held | 1314 // In OOM, we now might be able to release more resources that were held |
1315 // because they were exported. | 1315 // because they were exported. |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 return false; | 1894 return false; |
1895 | 1895 |
1896 if (settings_.impl_side_painting) { | 1896 if (settings_.impl_side_painting) { |
1897 CreateAndSetTileManager( | 1897 CreateAndSetTileManager( |
1898 resource_provider.get(), | 1898 resource_provider.get(), |
1899 output_surface->context_provider().get(), | 1899 output_surface->context_provider().get(), |
1900 GetRendererCapabilities().using_map_image, | 1900 GetRendererCapabilities().using_map_image, |
1901 GetRendererCapabilities().allow_rasterize_on_demand); | 1901 GetRendererCapabilities().allow_rasterize_on_demand); |
1902 } | 1902 } |
1903 | 1903 |
1904 // Setup BeginFrameEmulation if it's not supported natively | 1904 if (!settings_.throttle_frame_production) { |
1905 if (!settings_.begin_impl_frame_scheduling_enabled) { | 1905 // Disable VSync |
| 1906 output_surface->SetThrottleFrameProduction(false); |
| 1907 } else if (!settings_.begin_impl_frame_scheduling_enabled) { |
| 1908 // Setup BeginFrameEmulation if it's not supported natively |
1906 const base::TimeDelta display_refresh_interval = | 1909 const base::TimeDelta display_refresh_interval = |
1907 base::TimeDelta::FromMicroseconds( | 1910 base::TimeDelta::FromMicroseconds( |
1908 base::Time::kMicrosecondsPerSecond / | 1911 base::Time::kMicrosecondsPerSecond / |
1909 settings_.refresh_rate); | 1912 settings_.refresh_rate); |
1910 | 1913 |
1911 output_surface->InitializeBeginFrameEmulation( | 1914 output_surface->InitializeBeginFrameEmulation( |
1912 proxy_->ImplThreadTaskRunner(), | 1915 proxy_->ImplThreadTaskRunner(), |
1913 settings_.throttle_frame_production, | |
1914 display_refresh_interval); | 1916 display_refresh_interval); |
1915 } | 1917 } |
1916 | 1918 |
1917 int max_frames_pending = | 1919 int max_frames_pending = |
1918 output_surface->capabilities().max_frames_pending; | 1920 output_surface->capabilities().max_frames_pending; |
1919 if (max_frames_pending <= 0) | 1921 if (max_frames_pending <= 0) |
1920 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 1922 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
1921 output_surface->SetMaxFramesPending(max_frames_pending); | 1923 client_->SetMaxSwapsPendingOnImplThread(max_frames_pending); |
1922 | 1924 |
1923 resource_provider_ = resource_provider.Pass(); | 1925 resource_provider_ = resource_provider.Pass(); |
1924 output_surface_ = output_surface.Pass(); | 1926 output_surface_ = output_surface.Pass(); |
1925 | 1927 |
1926 client_->OnCanDrawStateChanged(CanDraw()); | 1928 client_->OnCanDrawStateChanged(CanDraw()); |
1927 | 1929 |
1928 return true; | 1930 return true; |
1929 } | 1931 } |
1930 | 1932 |
1931 bool LayerTreeHostImpl::DeferredInitialize( | 1933 bool LayerTreeHostImpl::DeferredInitialize( |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3101 swap_promise_monitor_.erase(monitor); | 3103 swap_promise_monitor_.erase(monitor); |
3102 } | 3104 } |
3103 | 3105 |
3104 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3106 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3105 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3107 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3106 for (; it != swap_promise_monitor_.end(); it++) | 3108 for (; it != swap_promise_monitor_.end(); it++) |
3107 (*it)->OnSetNeedsRedrawOnImpl(); | 3109 (*it)->OnSetNeedsRedrawOnImpl(); |
3108 } | 3110 } |
3109 | 3111 |
3110 } // namespace cc | 3112 } // namespace cc |
OLD | NEW |