| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 TRACE_EVENT_FLOW_STEP0( | 1480 TRACE_EVENT_FLOW_STEP0( |
| 1481 "input", | 1481 "input", |
| 1482 "LatencyInfo.Flow", | 1482 "LatencyInfo.Flow", |
| 1483 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1483 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), |
| 1484 "SwapBuffers"); | 1484 "SwapBuffers"); |
| 1485 } | 1485 } |
| 1486 renderer_->SwapBuffers(metadata); | 1486 renderer_->SwapBuffers(metadata); |
| 1487 return true; | 1487 return true; |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 void LayerTreeHostImpl::SetNeedsBeginImplFrame(bool enable) { | 1490 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { |
| 1491 if (output_surface_) | 1491 if (output_surface_) |
| 1492 output_surface_->SetNeedsBeginImplFrame(enable); | 1492 output_surface_->SetNeedsBeginFrame(enable); |
| 1493 } |
| 1494 |
| 1495 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 1496 // Sample the frame time now. This time will be used for updating animations |
| 1497 // when we draw. |
| 1498 UpdateCurrentFrameTime(); |
| 1493 } | 1499 } |
| 1494 | 1500 |
| 1495 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { | 1501 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { |
| 1496 gfx::SizeF dip_size = | 1502 gfx::SizeF dip_size = |
| 1497 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); | 1503 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); |
| 1498 | 1504 |
| 1499 float top_offset = | 1505 float top_offset = |
| 1500 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; | 1506 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; |
| 1501 | 1507 |
| 1502 return gfx::SizeF(dip_size.width(), | 1508 return gfx::SizeF(dip_size.width(), |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 return false; | 1849 return false; |
| 1844 | 1850 |
| 1845 if (settings_.impl_side_painting) { | 1851 if (settings_.impl_side_painting) { |
| 1846 CreateAndSetTileManager( | 1852 CreateAndSetTileManager( |
| 1847 resource_provider.get(), | 1853 resource_provider.get(), |
| 1848 output_surface->context_provider().get(), | 1854 output_surface->context_provider().get(), |
| 1849 GetRendererCapabilities().using_map_image, | 1855 GetRendererCapabilities().using_map_image, |
| 1850 GetRendererCapabilities().allow_rasterize_on_demand); | 1856 GetRendererCapabilities().allow_rasterize_on_demand); |
| 1851 } | 1857 } |
| 1852 | 1858 |
| 1853 // Setup BeginImplFrameEmulation if it's not supported natively | 1859 // Setup BeginFrameEmulation if it's not supported natively |
| 1854 if (!settings_.begin_impl_frame_scheduling_enabled) { | 1860 if (!settings_.begin_impl_frame_scheduling_enabled) { |
| 1855 const base::TimeDelta display_refresh_interval = | 1861 const base::TimeDelta display_refresh_interval = |
| 1856 base::TimeDelta::FromMicroseconds( | 1862 base::TimeDelta::FromMicroseconds( |
| 1857 base::Time::kMicrosecondsPerSecond / | 1863 base::Time::kMicrosecondsPerSecond / |
| 1858 settings_.refresh_rate); | 1864 settings_.refresh_rate); |
| 1859 | 1865 |
| 1860 output_surface->InitializeBeginImplFrameEmulation( | 1866 output_surface->InitializeBeginFrameEmulation( |
| 1861 proxy_->ImplThreadTaskRunner(), | 1867 proxy_->ImplThreadTaskRunner(), |
| 1862 settings_.throttle_frame_production, | 1868 settings_.throttle_frame_production, |
| 1863 display_refresh_interval); | 1869 display_refresh_interval); |
| 1864 } | 1870 } |
| 1865 | 1871 |
| 1866 int max_frames_pending = | 1872 int max_frames_pending = |
| 1867 output_surface->capabilities().max_frames_pending; | 1873 output_surface->capabilities().max_frames_pending; |
| 1868 if (max_frames_pending <= 0) | 1874 if (max_frames_pending <= 0) |
| 1869 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 1875 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
| 1870 output_surface->SetMaxFramesPending(max_frames_pending); | 1876 output_surface->SetMaxFramesPending(max_frames_pending); |
| (...skipping 1169 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 |