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 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 device_viewport_valid_for_tile_management_ = valid_for_tile_management; | 1275 device_viewport_valid_for_tile_management_ = valid_for_tile_management; |
1276 } | 1276 } |
1277 | 1277 |
1278 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 1278 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
1279 if (damage_rect.IsEmpty()) | 1279 if (damage_rect.IsEmpty()) |
1280 return; | 1280 return; |
1281 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 1281 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
1282 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1282 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
1283 } | 1283 } |
1284 | 1284 |
1285 void LayerTreeHostImpl::BeginImplFrame(const BeginFrameArgs& args) { | 1285 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { |
1286 client_->BeginImplFrame(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::OnSwapBuffersComplete() { |
1294 client_->OnSwapBuffersCompleteOnImplThread(); | 1294 client_->OnSwapBuffersCompleteOnImplThread(); |
1295 } | 1295 } |
1296 | 1296 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 TRACE_EVENT_FLOW_STEP0( | 1492 TRACE_EVENT_FLOW_STEP0( |
1493 "input", | 1493 "input", |
1494 "LatencyInfo.Flow", | 1494 "LatencyInfo.Flow", |
1495 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1495 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), |
1496 "SwapBuffers"); | 1496 "SwapBuffers"); |
1497 } | 1497 } |
1498 renderer_->SwapBuffers(metadata); | 1498 renderer_->SwapBuffers(metadata); |
1499 return true; | 1499 return true; |
1500 } | 1500 } |
1501 | 1501 |
1502 void LayerTreeHostImpl::SetNeedsBeginImplFrame(bool enable) { | 1502 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { |
1503 if (output_surface_) | 1503 if (output_surface_) |
1504 output_surface_->SetNeedsBeginImplFrame(enable); | 1504 output_surface_->SetNeedsBeginFrame(enable); |
| 1505 } |
| 1506 |
| 1507 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 1508 // Sample the frame time now. This time will be used for updating animations |
| 1509 // when we draw. |
| 1510 UpdateCurrentFrameTime(); |
1505 } | 1511 } |
1506 | 1512 |
1507 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { | 1513 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { |
1508 gfx::SizeF dip_size = | 1514 gfx::SizeF dip_size = |
1509 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); | 1515 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); |
1510 | 1516 |
1511 float top_offset = | 1517 float top_offset = |
1512 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; | 1518 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; |
1513 | 1519 |
1514 return gfx::SizeF(dip_size.width(), | 1520 return gfx::SizeF(dip_size.width(), |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 return false; | 1878 return false; |
1873 | 1879 |
1874 if (settings_.impl_side_painting) { | 1880 if (settings_.impl_side_painting) { |
1875 CreateAndSetTileManager( | 1881 CreateAndSetTileManager( |
1876 resource_provider.get(), | 1882 resource_provider.get(), |
1877 output_surface->context_provider().get(), | 1883 output_surface->context_provider().get(), |
1878 GetRendererCapabilities().using_map_image, | 1884 GetRendererCapabilities().using_map_image, |
1879 GetRendererCapabilities().allow_rasterize_on_demand); | 1885 GetRendererCapabilities().allow_rasterize_on_demand); |
1880 } | 1886 } |
1881 | 1887 |
1882 // Setup BeginImplFrameEmulation if it's not supported natively | 1888 // Setup BeginFrameEmulation if it's not supported natively |
1883 if (!settings_.begin_impl_frame_scheduling_enabled) { | 1889 if (!settings_.begin_impl_frame_scheduling_enabled) { |
1884 const base::TimeDelta display_refresh_interval = | 1890 const base::TimeDelta display_refresh_interval = |
1885 base::TimeDelta::FromMicroseconds( | 1891 base::TimeDelta::FromMicroseconds( |
1886 base::Time::kMicrosecondsPerSecond / | 1892 base::Time::kMicrosecondsPerSecond / |
1887 settings_.refresh_rate); | 1893 settings_.refresh_rate); |
1888 | 1894 |
1889 output_surface->InitializeBeginImplFrameEmulation( | 1895 output_surface->InitializeBeginFrameEmulation( |
1890 proxy_->ImplThreadTaskRunner(), | 1896 proxy_->ImplThreadTaskRunner(), |
1891 settings_.throttle_frame_production, | 1897 settings_.throttle_frame_production, |
1892 display_refresh_interval); | 1898 display_refresh_interval); |
1893 } | 1899 } |
1894 | 1900 |
1895 int max_frames_pending = | 1901 int max_frames_pending = |
1896 output_surface->capabilities().max_frames_pending; | 1902 output_surface->capabilities().max_frames_pending; |
1897 if (max_frames_pending <= 0) | 1903 if (max_frames_pending <= 0) |
1898 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 1904 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
1899 output_surface->SetMaxFramesPending(max_frames_pending); | 1905 output_surface->SetMaxFramesPending(max_frames_pending); |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3072 swap_promise_monitor_.erase(monitor); | 3078 swap_promise_monitor_.erase(monitor); |
3073 } | 3079 } |
3074 | 3080 |
3075 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3081 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3076 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3082 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3077 for (; it != swap_promise_monitor_.end(); it++) | 3083 for (; it != swap_promise_monitor_.end(); it++) |
3078 (*it)->OnSetNeedsRedrawOnImpl(); | 3084 (*it)->OnSetNeedsRedrawOnImpl(); |
3079 } | 3085 } |
3080 | 3086 |
3081 } // namespace cc | 3087 } // namespace cc |
OLD | NEW |