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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 } | 1283 } |
1284 | 1284 |
1285 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { | 1285 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { |
1286 client_->BeginFrame(args); | 1286 client_->BeginFrame(args); |
1287 } | 1287 } |
1288 | 1288 |
1289 void LayerTreeHostImpl::DidSwapBuffers() { | 1289 void LayerTreeHostImpl::DidSwapBuffers() { |
1290 client_->DidSwapBuffersOnImplThread(); | 1290 client_->DidSwapBuffersOnImplThread(); |
1291 } | 1291 } |
1292 | 1292 |
1293 void LayerTreeHostImpl::OnSwapBuffersComplete() { | 1293 void LayerTreeHostImpl::DidSwapBuffersComplete() { |
1294 client_->OnSwapBuffersCompleteOnImplThread(); | 1294 client_->DidSwapBuffersCompleteOnImplThread(); |
1295 } | 1295 } |
1296 | 1296 |
1297 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { | 1297 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { |
1298 // TODO(piman): We may need to do some validation on this ack before | 1298 // TODO(piman): We may need to do some validation on this ack before |
1299 // processing it. | 1299 // processing it. |
1300 if (renderer_) | 1300 if (renderer_) |
1301 renderer_->ReceiveSwapBuffersAck(*ack); | 1301 renderer_->ReceiveSwapBuffersAck(*ack); |
1302 | 1302 |
1303 // In OOM, we now might be able to release more resources that were held | 1303 // In OOM, we now might be able to release more resources that were held |
1304 // because they were exported. | 1304 // because they were exported. |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 return false; | 1878 return false; |
1879 | 1879 |
1880 if (settings_.impl_side_painting) { | 1880 if (settings_.impl_side_painting) { |
1881 CreateAndSetTileManager( | 1881 CreateAndSetTileManager( |
1882 resource_provider.get(), | 1882 resource_provider.get(), |
1883 output_surface->context_provider().get(), | 1883 output_surface->context_provider().get(), |
1884 GetRendererCapabilities().using_map_image, | 1884 GetRendererCapabilities().using_map_image, |
1885 GetRendererCapabilities().allow_rasterize_on_demand); | 1885 GetRendererCapabilities().allow_rasterize_on_demand); |
1886 } | 1886 } |
1887 | 1887 |
1888 // Setup BeginFrameEmulation if it's not supported natively | 1888 if (!settings_.throttle_frame_production) { |
1889 if (!settings_.begin_impl_frame_scheduling_enabled) { | 1889 // Disable VSync |
| 1890 output_surface->SetThrottleFrameProduction(false); |
| 1891 } else if (!settings_.begin_impl_frame_scheduling_enabled) { |
| 1892 // Setup BeginFrameEmulation if it's not supported natively |
1890 const base::TimeDelta display_refresh_interval = | 1893 const base::TimeDelta display_refresh_interval = |
1891 base::TimeDelta::FromMicroseconds( | 1894 base::TimeDelta::FromMicroseconds( |
1892 base::Time::kMicrosecondsPerSecond / | 1895 base::Time::kMicrosecondsPerSecond / |
1893 settings_.refresh_rate); | 1896 settings_.refresh_rate); |
1894 | 1897 |
1895 output_surface->InitializeBeginFrameEmulation( | 1898 output_surface->InitializeBeginFrameEmulation( |
1896 proxy_->ImplThreadTaskRunner(), | 1899 proxy_->ImplThreadTaskRunner(), |
1897 settings_.throttle_frame_production, | |
1898 display_refresh_interval); | 1900 display_refresh_interval); |
1899 } | 1901 } |
1900 | 1902 |
1901 int max_frames_pending = | 1903 int max_frames_pending = |
1902 output_surface->capabilities().max_frames_pending; | 1904 output_surface->capabilities().max_frames_pending; |
1903 if (max_frames_pending <= 0) | 1905 if (max_frames_pending <= 0) |
1904 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 1906 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
1905 output_surface->SetMaxFramesPending(max_frames_pending); | 1907 client_->SetMaxSwapsPending(max_frames_pending); |
1906 | 1908 |
1907 resource_provider_ = resource_provider.Pass(); | 1909 resource_provider_ = resource_provider.Pass(); |
1908 output_surface_ = output_surface.Pass(); | 1910 output_surface_ = output_surface.Pass(); |
1909 | 1911 |
1910 client_->OnCanDrawStateChanged(CanDraw()); | 1912 client_->OnCanDrawStateChanged(CanDraw()); |
1911 | 1913 |
1912 return true; | 1914 return true; |
1913 } | 1915 } |
1914 | 1916 |
1915 bool LayerTreeHostImpl::DeferredInitialize( | 1917 bool LayerTreeHostImpl::DeferredInitialize( |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3078 swap_promise_monitor_.erase(monitor); | 3080 swap_promise_monitor_.erase(monitor); |
3079 } | 3081 } |
3080 | 3082 |
3081 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3083 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3082 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3084 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3083 for (; it != swap_promise_monitor_.end(); it++) | 3085 for (; it != swap_promise_monitor_.end(); it++) |
3084 (*it)->OnSetNeedsRedrawOnImpl(); | 3086 (*it)->OnSetNeedsRedrawOnImpl(); |
3085 } | 3087 } |
3086 | 3088 |
3087 } // namespace cc | 3089 } // namespace cc |
OLD | NEW |