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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
464 | 464 |
465 LayerImpl* layer_impl = | 465 LayerImpl* layer_impl = |
466 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion( | 466 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion( |
467 device_viewport_point, | 467 device_viewport_point, |
468 active_tree_->RenderSurfaceLayerList()); | 468 active_tree_->RenderSurfaceLayerList()); |
469 return layer_impl != NULL; | 469 return layer_impl != NULL; |
470 } | 470 } |
471 | 471 |
472 void LayerTreeHostImpl::SetLatencyInfoForInputEvent( | 472 void LayerTreeHostImpl::SetLatencyInfoForInputEvent( |
473 const ui::LatencyInfo& latency_info) { | 473 const ui::LatencyInfo& latency_info) { |
474 active_tree()->SetLatencyInfo(latency_info); | 474 scoped_ptr<cc::SwapPromise> swap_promise( |
danakj
2013/11/26 19:17:53
don't need cc:: inside cc::
Yufeng Shen (Slow to review)
2013/11/27 20:05:33
Done.
| |
475 new cc::LatencyInfoSwapPromise(latency_info)); | |
476 active_tree()->QueueSwapPromise(swap_promise.Pass()); | |
475 } | 477 } |
476 | 478 |
477 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 479 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
478 LayerImpl* root_draw_layer, | 480 LayerImpl* root_draw_layer, |
479 const LayerImplList& render_surface_layer_list) { | 481 const LayerImplList& render_surface_layer_list) { |
480 // For now, we use damage tracking to compute a global scissor. To do this, we | 482 // For now, we use damage tracking to compute a global scissor. To do this, we |
481 // must compute all damage tracking before drawing anything, so that we know | 483 // must compute all damage tracking before drawing anything, so that we know |
482 // the root damage rect. The root damage rect is then used to scissor each | 484 // the root damage rect. The root damage rect is then used to scissor each |
483 // surface. | 485 // surface. |
484 | 486 |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1258 } | 1260 } |
1259 | 1261 |
1260 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { | 1262 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
1261 CompositorFrameMetadata metadata; | 1263 CompositorFrameMetadata metadata; |
1262 metadata.device_scale_factor = device_scale_factor_; | 1264 metadata.device_scale_factor = device_scale_factor_; |
1263 metadata.page_scale_factor = active_tree_->total_page_scale_factor(); | 1265 metadata.page_scale_factor = active_tree_->total_page_scale_factor(); |
1264 metadata.viewport_size = active_tree_->ScrollableViewportSize(); | 1266 metadata.viewport_size = active_tree_->ScrollableViewportSize(); |
1265 metadata.root_layer_size = active_tree_->ScrollableSize(); | 1267 metadata.root_layer_size = active_tree_->ScrollableSize(); |
1266 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); | 1268 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); |
1267 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); | 1269 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); |
1268 metadata.latency_info = active_tree_->GetLatencyInfo(); | 1270 active_tree_->TakeLatencyInfo(&metadata.latency_info); |
1269 if (top_controls_manager_) { | 1271 if (top_controls_manager_) { |
1270 metadata.location_bar_offset = | 1272 metadata.location_bar_offset = |
1271 gfx::Vector2dF(0.f, top_controls_manager_->controls_top_offset()); | 1273 gfx::Vector2dF(0.f, top_controls_manager_->controls_top_offset()); |
1272 metadata.location_bar_content_translation = | 1274 metadata.location_bar_content_translation = |
1273 gfx::Vector2dF(0.f, top_controls_manager_->content_top_offset()); | 1275 gfx::Vector2dF(0.f, top_controls_manager_->content_top_offset()); |
1274 metadata.overdraw_bottom_height = overdraw_bottom_height_; | 1276 metadata.overdraw_bottom_height = overdraw_bottom_height_; |
1275 } | 1277 } |
1276 | 1278 |
1277 if (!RootScrollLayer()) | 1279 if (!RootScrollLayer()) |
1278 return metadata; | 1280 return metadata; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1417 const RendererCapabilities& LayerTreeHostImpl::GetRendererCapabilities() const { | 1419 const RendererCapabilities& LayerTreeHostImpl::GetRendererCapabilities() const { |
1418 return renderer_->Capabilities(); | 1420 return renderer_->Capabilities(); |
1419 } | 1421 } |
1420 | 1422 |
1421 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { | 1423 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
1422 if (frame.has_no_damage) { | 1424 if (frame.has_no_damage) { |
1423 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); | 1425 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); |
1424 return false; | 1426 return false; |
1425 } | 1427 } |
1426 renderer_->SwapBuffers(); | 1428 renderer_->SwapBuffers(); |
1427 active_tree_->ClearLatencyInfo(); | |
1428 active_tree()->FinishSwapPromises(); | 1429 active_tree()->FinishSwapPromises(); |
1429 return true; | 1430 return true; |
1430 } | 1431 } |
1431 | 1432 |
1432 void LayerTreeHostImpl::SetNeedsBeginImplFrame(bool enable) { | 1433 void LayerTreeHostImpl::SetNeedsBeginImplFrame(bool enable) { |
1433 if (output_surface_) | 1434 if (output_surface_) |
1434 output_surface_->SetNeedsBeginImplFrame(enable); | 1435 output_surface_->SetNeedsBeginImplFrame(enable); |
1435 } | 1436 } |
1436 | 1437 |
1437 gfx::SizeF LayerTreeHostImpl::UnscaledScrollableViewportSize() const { | 1438 gfx::SizeF LayerTreeHostImpl::UnscaledScrollableViewportSize() const { |
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2863 if (evicted_ui_resources_.empty()) | 2864 if (evicted_ui_resources_.empty()) |
2864 client_->OnCanDrawStateChanged(CanDraw()); | 2865 client_->OnCanDrawStateChanged(CanDraw()); |
2865 } | 2866 } |
2866 | 2867 |
2867 void LayerTreeHostImpl::ScheduleMicroBenchmark( | 2868 void LayerTreeHostImpl::ScheduleMicroBenchmark( |
2868 scoped_ptr<MicroBenchmarkImpl> benchmark) { | 2869 scoped_ptr<MicroBenchmarkImpl> benchmark) { |
2869 micro_benchmark_controller_.ScheduleRun(benchmark.Pass()); | 2870 micro_benchmark_controller_.ScheduleRun(benchmark.Pass()); |
2870 } | 2871 } |
2871 | 2872 |
2872 } // namespace cc | 2873 } // namespace cc |
OLD | NEW |