| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" |
| 9 #include "base/location.h" | 10 #include "base/location.h" |
| 10 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 12 #include "cc/animation/animation.h" | 13 #include "cc/animation/animation.h" |
| 13 #include "cc/animation/animation_events.h" | 14 #include "cc/animation/animation_events.h" |
| 14 #include "cc/animation/layer_animation_controller.h" | 15 #include "cc/animation/layer_animation_controller.h" |
| 15 #include "cc/layers/layer_impl.h" | 16 #include "cc/layers/layer_impl.h" |
| 16 #include "cc/output/copy_output_request.h" | 17 #include "cc/output/copy_output_request.h" |
| 17 #include "cc/output/copy_output_result.h" | 18 #include "cc/output/copy_output_result.h" |
| 18 #include "cc/trees/layer_tree_host.h" | 19 #include "cc/trees/layer_tree_host.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 } | 557 } |
| 557 | 558 |
| 558 bool Layer::TransformIsAnimating() const { | 559 bool Layer::TransformIsAnimating() const { |
| 559 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); | 560 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); |
| 560 } | 561 } |
| 561 | 562 |
| 562 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { | 563 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { |
| 563 DCHECK(IsPropertyChangeAllowed()); | 564 DCHECK(IsPropertyChangeAllowed()); |
| 564 if (scroll_offset_ == scroll_offset) | 565 if (scroll_offset_ == scroll_offset) |
| 565 return; | 566 return; |
| 567 TRACE_EVENT2("impl-scroll", |
| 568 "Layer::SetScrollOffset", |
| 569 "scroll_x", scroll_offset.x(), |
| 570 "scroll_y", scroll_offset.y()); |
| 566 scroll_offset_ = scroll_offset; | 571 scroll_offset_ = scroll_offset; |
| 567 SetNeedsCommit(); | 572 SetNeedsCommit(); |
| 568 } | 573 } |
| 569 | 574 |
| 570 void Layer::SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset) { | 575 void Layer::SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset) { |
| 571 DCHECK(IsPropertyChangeAllowed()); | 576 DCHECK(IsPropertyChangeAllowed()); |
| 572 // This function only gets called during a begin frame, so there | 577 // This function only gets called during a begin frame, so there |
| 573 // is no need to call SetNeedsUpdate here. | 578 // is no need to call SetNeedsUpdate here. |
| 574 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); | 579 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); |
| 575 if (scroll_offset_ == scroll_offset) | 580 if (scroll_offset_ == scroll_offset) |
| 576 return; | 581 return; |
| 582 TRACE_EVENT2("impl-scroll", |
| 583 "Layer::SetScrollOffsetFromImplSide", |
| 584 "scroll_x", scroll_offset.x(), |
| 585 "scroll_y", scroll_offset.y()); |
| 577 scroll_offset_ = scroll_offset; | 586 scroll_offset_ = scroll_offset; |
| 578 SetNeedsPushProperties(); | 587 SetNeedsPushProperties(); |
| 579 if (!did_scroll_callback_.is_null()) | 588 if (!did_scroll_callback_.is_null()) |
| 580 did_scroll_callback_.Run(); | 589 did_scroll_callback_.Run(); |
| 581 // The callback could potentially change the layer structure: | 590 // The callback could potentially change the layer structure: |
| 582 // "this" may have been destroyed during the process. | 591 // "this" may have been destroyed during the process. |
| 583 } | 592 } |
| 584 | 593 |
| 585 void Layer::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) { | 594 void Layer::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) { |
| 586 DCHECK(IsPropertyChangeAllowed()); | 595 DCHECK(IsPropertyChangeAllowed()); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 | 982 |
| 974 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 983 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
| 975 return layer_tree_host_->rendering_stats_instrumentation(); | 984 return layer_tree_host_->rendering_stats_instrumentation(); |
| 976 } | 985 } |
| 977 | 986 |
| 978 bool Layer::SupportsLCDText() const { | 987 bool Layer::SupportsLCDText() const { |
| 979 return false; | 988 return false; |
| 980 } | 989 } |
| 981 | 990 |
| 982 } // namespace cc | 991 } // namespace cc |
| OLD | NEW |