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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 551 } |
551 | 552 |
552 bool Layer::TransformIsAnimating() const { | 553 bool Layer::TransformIsAnimating() const { |
553 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); | 554 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); |
554 } | 555 } |
555 | 556 |
556 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { | 557 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { |
557 DCHECK(IsPropertyChangeAllowed()); | 558 DCHECK(IsPropertyChangeAllowed()); |
558 if (scroll_offset_ == scroll_offset) | 559 if (scroll_offset_ == scroll_offset) |
559 return; | 560 return; |
| 561 TRACE_EVENT2("impl-scroll", |
| 562 "Layer::SetScrollOffset", |
| 563 "scrollX", scroll_offset.x(), |
| 564 "scrollY", scroll_offset.y()); |
560 scroll_offset_ = scroll_offset; | 565 scroll_offset_ = scroll_offset; |
561 SetNeedsCommit(); | 566 SetNeedsCommit(); |
562 } | 567 } |
563 | 568 |
564 void Layer::SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset) { | 569 void Layer::SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset) { |
565 DCHECK(IsPropertyChangeAllowed()); | 570 DCHECK(IsPropertyChangeAllowed()); |
566 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); | 571 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); |
567 if (scroll_offset_ == scroll_offset) | 572 if (scroll_offset_ == scroll_offset) |
568 return; | 573 return; |
| 574 TRACE_EVENT2("impl-scroll", |
| 575 "Layer::SetScrollOffsetFromImplSide", |
| 576 "scrollX", scroll_offset.x(), |
| 577 "scrollY", scroll_offset.y()); |
569 scroll_offset_ = scroll_offset; | 578 scroll_offset_ = scroll_offset; |
570 if (!did_scroll_callback_.is_null()) | 579 if (!did_scroll_callback_.is_null()) |
571 did_scroll_callback_.Run(); | 580 did_scroll_callback_.Run(); |
572 // Note: didScroll() could potentially change the layer structure. | 581 // Note: didScroll() could potentially change the layer structure. |
573 // "this" may have been destroyed during the process. | 582 // "this" may have been destroyed during the process. |
574 } | 583 } |
575 | 584 |
576 void Layer::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) { | 585 void Layer::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) { |
577 DCHECK(IsPropertyChangeAllowed()); | 586 DCHECK(IsPropertyChangeAllowed()); |
578 if (max_scroll_offset_ == max_scroll_offset) | 587 if (max_scroll_offset_ == max_scroll_offset) |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 | 957 |
949 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 958 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
950 return layer_tree_host_->rendering_stats_instrumentation(); | 959 return layer_tree_host_->rendering_stats_instrumentation(); |
951 } | 960 } |
952 | 961 |
953 bool Layer::SupportsLCDText() const { | 962 bool Layer::SupportsLCDText() const { |
954 return false; | 963 return false; |
955 } | 964 } |
956 | 965 |
957 } // namespace cc | 966 } // namespace cc |
OLD | NEW |