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 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 device_viewport_valid_for_tile_management_ = valid_for_tile_management; | 1267 device_viewport_valid_for_tile_management_ = valid_for_tile_management; |
1268 } | 1268 } |
1269 | 1269 |
1270 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 1270 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
1271 if (damage_rect.IsEmpty()) | 1271 if (damage_rect.IsEmpty()) |
1272 return; | 1272 return; |
1273 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 1273 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
1274 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1274 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
1275 } | 1275 } |
1276 | 1276 |
1277 void LayerTreeHostImpl::BeginImplFrame(const BeginFrameArgs& args) { | 1277 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { |
1278 client_->BeginImplFrame(args); | 1278 client_->BeginFrame(args); |
1279 } | 1279 } |
1280 | 1280 |
1281 void LayerTreeHostImpl::DidSwapBuffers() { | 1281 void LayerTreeHostImpl::DidSwapBuffers() { |
1282 client_->DidSwapBuffersOnImplThread(); | 1282 client_->DidSwapBuffersOnImplThread(); |
1283 } | 1283 } |
1284 | 1284 |
1285 void LayerTreeHostImpl::OnSwapBuffersComplete() { | 1285 void LayerTreeHostImpl::OnSwapBuffersComplete() { |
1286 client_->OnSwapBuffersCompleteOnImplThread(); | 1286 client_->OnSwapBuffersCompleteOnImplThread(); |
1287 } | 1287 } |
1288 | 1288 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 if (frame.has_no_damage) { | 1462 if (frame.has_no_damage) { |
1463 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); | 1463 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); |
1464 return false; | 1464 return false; |
1465 } | 1465 } |
1466 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); | 1466 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); |
1467 active_tree()->FinishSwapPromises(&metadata); | 1467 active_tree()->FinishSwapPromises(&metadata); |
1468 renderer_->SwapBuffers(metadata); | 1468 renderer_->SwapBuffers(metadata); |
1469 return true; | 1469 return true; |
1470 } | 1470 } |
1471 | 1471 |
1472 void LayerTreeHostImpl::SetNeedsBeginImplFrame(bool enable) { | 1472 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { |
1473 if (output_surface_) | 1473 if (output_surface_) |
1474 output_surface_->SetNeedsBeginImplFrame(enable); | 1474 output_surface_->SetNeedsBeginFrame(enable); |
1475 } | 1475 } |
1476 | 1476 |
1477 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { | 1477 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { |
1478 gfx::SizeF dip_size = | 1478 gfx::SizeF dip_size = |
1479 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); | 1479 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); |
1480 | 1480 |
1481 float top_offset = | 1481 float top_offset = |
1482 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; | 1482 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; |
1483 | 1483 |
1484 return gfx::SizeF(dip_size.width(), | 1484 return gfx::SizeF(dip_size.width(), |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 return false; | 1825 return false; |
1826 | 1826 |
1827 if (settings_.impl_side_painting) { | 1827 if (settings_.impl_side_painting) { |
1828 CreateAndSetTileManager( | 1828 CreateAndSetTileManager( |
1829 resource_provider.get(), | 1829 resource_provider.get(), |
1830 output_surface->context_provider().get(), | 1830 output_surface->context_provider().get(), |
1831 GetRendererCapabilities().using_map_image, | 1831 GetRendererCapabilities().using_map_image, |
1832 GetRendererCapabilities().allow_rasterize_on_demand); | 1832 GetRendererCapabilities().allow_rasterize_on_demand); |
1833 } | 1833 } |
1834 | 1834 |
1835 // Setup BeginImplFrameEmulation if it's not supported natively | 1835 // Setup BeginFrameEmulation if it's not supported natively |
1836 if (!settings_.begin_impl_frame_scheduling_enabled) { | 1836 if (!settings_.begin_impl_frame_scheduling_enabled) { |
1837 const base::TimeDelta display_refresh_interval = | 1837 const base::TimeDelta display_refresh_interval = |
1838 base::TimeDelta::FromMicroseconds( | 1838 base::TimeDelta::FromMicroseconds( |
1839 base::Time::kMicrosecondsPerSecond / | 1839 base::Time::kMicrosecondsPerSecond / |
1840 settings_.refresh_rate); | 1840 settings_.refresh_rate); |
1841 | 1841 |
1842 output_surface->InitializeBeginImplFrameEmulation( | 1842 output_surface->InitializeBeginFrameEmulation( |
1843 proxy_->ImplThreadTaskRunner(), | 1843 proxy_->ImplThreadTaskRunner(), |
1844 settings_.throttle_frame_production, | 1844 settings_.throttle_frame_production, |
1845 display_refresh_interval); | 1845 display_refresh_interval); |
1846 } | 1846 } |
1847 | 1847 |
1848 int max_frames_pending = | 1848 int max_frames_pending = |
1849 output_surface->capabilities().max_frames_pending; | 1849 output_surface->capabilities().max_frames_pending; |
1850 if (max_frames_pending <= 0) | 1850 if (max_frames_pending <= 0) |
1851 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 1851 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
1852 output_surface->SetMaxFramesPending(max_frames_pending); | 1852 output_surface->SetMaxFramesPending(max_frames_pending); |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3019 swap_promise_monitor_.erase(monitor); | 3019 swap_promise_monitor_.erase(monitor); |
3020 } | 3020 } |
3021 | 3021 |
3022 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3022 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3023 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3023 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3024 for (; it != swap_promise_monitor_.end(); it++) | 3024 for (; it != swap_promise_monitor_.end(); it++) |
3025 (*it)->OnSetNeedsRedrawOnImpl(); | 3025 (*it)->OnSetNeedsRedrawOnImpl(); |
3026 } | 3026 } |
3027 | 3027 |
3028 } // namespace cc | 3028 } // namespace cc |
OLD | NEW |