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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "cc/animation/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
11 #include "cc/animation/scrollbar_animation_controller.h" | 11 #include "cc/animation/scrollbar_animation_controller.h" |
12 #include "cc/input/pinch_zoom_scrollbar.h" | 12 #include "cc/input/pinch_zoom_scrollbar.h" |
13 #include "cc/layers/heads_up_display_layer_impl.h" | 13 #include "cc/layers/heads_up_display_layer_impl.h" |
14 #include "cc/layers/layer.h" | 14 #include "cc/layers/layer.h" |
| 15 #include "cc/layers/render_surface_impl.h" |
15 #include "cc/layers/scrollbar_layer_impl.h" | 16 #include "cc/layers/scrollbar_layer_impl.h" |
16 #include "cc/trees/layer_tree_host_common.h" | 17 #include "cc/trees/layer_tree_host_common.h" |
17 #include "cc/trees/layer_tree_host_impl.h" | 18 #include "cc/trees/layer_tree_host_impl.h" |
18 #include "ui/gfx/size_conversions.h" | 19 #include "ui/gfx/size_conversions.h" |
19 #include "ui/gfx/vector2d_conversions.h" | 20 #include "ui/gfx/vector2d_conversions.h" |
20 | 21 |
21 namespace cc { | 22 namespace cc { |
22 | 23 |
23 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) | 24 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) |
24 : layer_tree_host_impl_(layer_tree_host_impl), | 25 : layer_tree_host_impl_(layer_tree_host_impl), |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 void LayerTreeImpl::ClearRenderSurfaces() { | 328 void LayerTreeImpl::ClearRenderSurfaces() { |
328 ClearRenderSurfacesOnLayerImplRecursive(root_layer()); | 329 ClearRenderSurfacesOnLayerImplRecursive(root_layer()); |
329 render_surface_layer_list_.clear(); | 330 render_surface_layer_list_.clear(); |
330 set_needs_update_draw_properties(); | 331 set_needs_update_draw_properties(); |
331 } | 332 } |
332 | 333 |
333 bool LayerTreeImpl::AreVisibleResourcesReady() const { | 334 bool LayerTreeImpl::AreVisibleResourcesReady() const { |
334 TRACE_EVENT0("cc", "LayerTreeImpl::AreVisibleResourcesReady"); | 335 TRACE_EVENT0("cc", "LayerTreeImpl::AreVisibleResourcesReady"); |
335 | 336 |
336 typedef LayerIterator<LayerImpl, | 337 typedef LayerIterator<LayerImpl, |
337 std::vector<LayerImpl*>, | 338 LayerImplList, |
338 RenderSurfaceImpl, | 339 RenderSurfaceImpl, |
339 LayerIteratorActions::BackToFront> LayerIteratorType; | 340 LayerIteratorActions::BackToFront> LayerIteratorType; |
340 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_); | 341 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_); |
341 for (LayerIteratorType it = LayerIteratorType::Begin( | 342 for (LayerIteratorType it = LayerIteratorType::Begin( |
342 &render_surface_layer_list_); it != end; ++it) { | 343 &render_surface_layer_list_); it != end; ++it) { |
343 if (it.represents_itself() && !(*it)->AreVisibleResourcesReady()) | 344 if (it.represents_itself() && !(*it)->AreVisibleResourcesReady()) |
344 return false; | 345 return false; |
345 } | 346 } |
346 | 347 |
347 return true; | 348 return true; |
348 } | 349 } |
349 | 350 |
350 const LayerTreeImpl::LayerList& LayerTreeImpl::RenderSurfaceLayerList() const { | 351 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { |
351 // If this assert triggers, then the list is dirty. | 352 // If this assert triggers, then the list is dirty. |
352 DCHECK(!needs_update_draw_properties_); | 353 DCHECK(!needs_update_draw_properties_); |
353 return render_surface_layer_list_; | 354 return render_surface_layer_list_; |
354 } | 355 } |
355 | 356 |
356 gfx::Size LayerTreeImpl::ScrollableSize() const { | 357 gfx::Size LayerTreeImpl::ScrollableSize() const { |
357 if (!root_scroll_layer_ || root_scroll_layer_->children().empty()) | 358 if (!root_scroll_layer_ || root_scroll_layer_->children().empty()) |
358 return gfx::Size(); | 359 return gfx::Size(); |
359 return root_scroll_layer_->children()[0]->bounds(); | 360 return root_scroll_layer_->children()[0]->bounds(); |
360 } | 361 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 return layer_tree_host_impl_->debug_rect_history(); | 532 return layer_tree_host_impl_->debug_rect_history(); |
532 } | 533 } |
533 | 534 |
534 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { | 535 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { |
535 return layer_tree_host_impl_->animation_registrar(); | 536 return layer_tree_host_impl_->animation_registrar(); |
536 } | 537 } |
537 | 538 |
538 scoped_ptr<base::Value> LayerTreeImpl::AsValue() const { | 539 scoped_ptr<base::Value> LayerTreeImpl::AsValue() const { |
539 scoped_ptr<base::ListValue> state(new base::ListValue()); | 540 scoped_ptr<base::ListValue> state(new base::ListValue()); |
540 typedef LayerIterator<LayerImpl, | 541 typedef LayerIterator<LayerImpl, |
541 std::vector<LayerImpl*>, | 542 LayerImplList, |
542 RenderSurfaceImpl, | 543 RenderSurfaceImpl, |
543 LayerIteratorActions::BackToFront> LayerIteratorType; | 544 LayerIteratorActions::BackToFront> LayerIteratorType; |
544 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_); | 545 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_); |
545 for (LayerIteratorType it = LayerIteratorType::Begin( | 546 for (LayerIteratorType it = LayerIteratorType::Begin( |
546 &render_surface_layer_list_); it != end; ++it) { | 547 &render_surface_layer_list_); it != end; ++it) { |
547 if (!it.represents_itself()) | 548 if (!it.represents_itself()) |
548 continue; | 549 continue; |
549 state->Append((*it)->AsValue().release()); | 550 state->Append((*it)->AsValue().release()); |
550 } | 551 } |
551 return state.PassAs<base::Value>(); | 552 return state.PassAs<base::Value>(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 StartFadeOutAnimation(PinchZoomScrollbarHorizontal()); | 660 StartFadeOutAnimation(PinchZoomScrollbarHorizontal()); |
660 StartFadeOutAnimation(PinchZoomScrollbarVertical()); | 661 StartFadeOutAnimation(PinchZoomScrollbarVertical()); |
661 } | 662 } |
662 | 663 |
663 bool LayerTreeImpl::HasPinchZoomScrollbars() const { | 664 bool LayerTreeImpl::HasPinchZoomScrollbars() const { |
664 return pinch_zoom_scrollbar_horizontal_layer_id_ != Layer::INVALID_ID && | 665 return pinch_zoom_scrollbar_horizontal_layer_id_ != Layer::INVALID_ID && |
665 pinch_zoom_scrollbar_vertical_layer_id_ != Layer::INVALID_ID; | 666 pinch_zoom_scrollbar_vertical_layer_id_ != Layer::INVALID_ID; |
666 } | 667 } |
667 | 668 |
668 } // namespace cc | 669 } // namespace cc |
OLD | NEW |