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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1268 device_viewport_valid_for_tile_management_ = valid_for_tile_management; | 1268 device_viewport_valid_for_tile_management_ = valid_for_tile_management; |
1269 } | 1269 } |
1270 | 1270 |
1271 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 1271 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
1272 if (damage_rect.IsEmpty()) | 1272 if (damage_rect.IsEmpty()) |
1273 return; | 1273 return; |
1274 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 1274 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
1275 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1275 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
1276 } | 1276 } |
1277 | 1277 |
1278 void LayerTreeHostImpl::BeginImplFrame(const BeginFrameArgs& args) { | 1278 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { |
1279 client_->BeginImplFrame(args); | 1279 client_->BeginFrame(args); |
1280 } | 1280 } |
1281 | 1281 |
1282 void LayerTreeHostImpl::DidSwapBuffers() { | 1282 void LayerTreeHostImpl::DidSwapBuffers() { |
1283 client_->DidSwapBuffersOnImplThread(); | 1283 client_->DidSwapBuffersOnImplThread(); |
1284 } | 1284 } |
1285 | 1285 |
1286 void LayerTreeHostImpl::OnSwapBuffersComplete() { | 1286 void LayerTreeHostImpl::OnSwapBuffersComplete() { |
1287 client_->OnSwapBuffersCompleteOnImplThread(); | 1287 client_->OnSwapBuffersCompleteOnImplThread(); |
1288 } | 1288 } |
1289 | 1289 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1470 TRACE_EVENT_FLOW_STEP0( | 1470 TRACE_EVENT_FLOW_STEP0( |
1471 "input", | 1471 "input", |
1472 "LatencyInfo.Flow", | 1472 "LatencyInfo.Flow", |
1473 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1473 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), |
1474 "SwapBuffers"); | 1474 "SwapBuffers"); |
1475 } | 1475 } |
1476 renderer_->SwapBuffers(metadata); | 1476 renderer_->SwapBuffers(metadata); |
1477 return true; | 1477 return true; |
1478 } | 1478 } |
1479 | 1479 |
1480 void LayerTreeHostImpl::SetNeedsBeginImplFrame(bool enable) { | 1480 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { |
1481 if (output_surface_) | 1481 if (output_surface_) |
1482 output_surface_->SetNeedsBeginImplFrame(enable); | 1482 output_surface_->SetNeedsBeginFrame(enable); |
1483 } | |
1484 | |
1485 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | |
1486 // Sample the frame time now. This time will be used for updating animations | |
1487 // when we draw. | |
Sami
2014/04/03 15:55:58
Neat!
| |
1488 UpdateCurrentFrameTime(); | |
1483 } | 1489 } |
1484 | 1490 |
1485 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { | 1491 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { |
1486 gfx::SizeF dip_size = | 1492 gfx::SizeF dip_size = |
1487 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); | 1493 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); |
1488 | 1494 |
1489 float top_offset = | 1495 float top_offset = |
1490 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; | 1496 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; |
1491 | 1497 |
1492 return gfx::SizeF(dip_size.width(), | 1498 return gfx::SizeF(dip_size.width(), |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1833 return false; | 1839 return false; |
1834 | 1840 |
1835 if (settings_.impl_side_painting) { | 1841 if (settings_.impl_side_painting) { |
1836 CreateAndSetTileManager( | 1842 CreateAndSetTileManager( |
1837 resource_provider.get(), | 1843 resource_provider.get(), |
1838 output_surface->context_provider().get(), | 1844 output_surface->context_provider().get(), |
1839 GetRendererCapabilities().using_map_image, | 1845 GetRendererCapabilities().using_map_image, |
1840 GetRendererCapabilities().allow_rasterize_on_demand); | 1846 GetRendererCapabilities().allow_rasterize_on_demand); |
1841 } | 1847 } |
1842 | 1848 |
1843 // Setup BeginImplFrameEmulation if it's not supported natively | 1849 // Setup BeginFrameEmulation if it's not supported natively |
1844 if (!settings_.begin_impl_frame_scheduling_enabled) { | 1850 if (!settings_.begin_impl_frame_scheduling_enabled) { |
1845 const base::TimeDelta display_refresh_interval = | 1851 const base::TimeDelta display_refresh_interval = |
1846 base::TimeDelta::FromMicroseconds( | 1852 base::TimeDelta::FromMicroseconds( |
1847 base::Time::kMicrosecondsPerSecond / | 1853 base::Time::kMicrosecondsPerSecond / |
1848 settings_.refresh_rate); | 1854 settings_.refresh_rate); |
1849 | 1855 |
1850 output_surface->InitializeBeginImplFrameEmulation( | 1856 output_surface->InitializeBeginFrameEmulation( |
1851 proxy_->ImplThreadTaskRunner(), | 1857 proxy_->ImplThreadTaskRunner(), |
1852 settings_.throttle_frame_production, | 1858 settings_.throttle_frame_production, |
1853 display_refresh_interval); | 1859 display_refresh_interval); |
1854 } | 1860 } |
1855 | 1861 |
1856 int max_frames_pending = | 1862 int max_frames_pending = |
1857 output_surface->capabilities().max_frames_pending; | 1863 output_surface->capabilities().max_frames_pending; |
1858 if (max_frames_pending <= 0) | 1864 if (max_frames_pending <= 0) |
1859 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 1865 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
1860 output_surface->SetMaxFramesPending(max_frames_pending); | 1866 output_surface->SetMaxFramesPending(max_frames_pending); |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3040 swap_promise_monitor_.erase(monitor); | 3046 swap_promise_monitor_.erase(monitor); |
3041 } | 3047 } |
3042 | 3048 |
3043 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3049 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3044 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3050 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3045 for (; it != swap_promise_monitor_.end(); it++) | 3051 for (; it != swap_promise_monitor_.end(); it++) |
3046 (*it)->OnSetNeedsRedrawOnImpl(); | 3052 (*it)->OnSetNeedsRedrawOnImpl(); |
3047 } | 3053 } |
3048 | 3054 |
3049 } // namespace cc | 3055 } // namespace cc |
OLD | NEW |