Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1734063003: Share animations from compositor to main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make NotifyAnimationTakeover pure virtual Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/numerics/safe_conversions.h" 13 #include "base/numerics/safe_conversions.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
16 #include "base/trace_event/trace_event_argument.h" 16 #include "base/trace_event/trace_event_argument.h"
17 #include "cc/animation/animation_host.h"
17 #include "cc/animation/animation_registrar.h" 18 #include "cc/animation/animation_registrar.h"
18 #include "cc/animation/mutable_properties.h" 19 #include "cc/animation/mutable_properties.h"
19 #include "cc/base/math_util.h" 20 #include "cc/base/math_util.h"
20 #include "cc/base/simple_enclosed_region.h" 21 #include "cc/base/simple_enclosed_region.h"
21 #include "cc/debug/debug_colors.h" 22 #include "cc/debug/debug_colors.h"
22 #include "cc/debug/layer_tree_debug_state.h" 23 #include "cc/debug/layer_tree_debug_state.h"
23 #include "cc/debug/micro_benchmark_impl.h" 24 #include "cc/debug/micro_benchmark_impl.h"
24 #include "cc/debug/traced_value.h" 25 #include "cc/debug/traced_value.h"
25 #include "cc/input/main_thread_scrolling_reason.h" 26 #include "cc/input/main_thread_scrolling_reason.h"
26 #include "cc/input/scroll_state.h" 27 #include "cc/input/scroll_state.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } 493 }
493 494
494 skia::RefPtr<SkPicture> LayerImpl::GetPicture() { 495 skia::RefPtr<SkPicture> LayerImpl::GetPicture() {
495 return skia::RefPtr<SkPicture>(); 496 return skia::RefPtr<SkPicture>();
496 } 497 }
497 498
498 scoped_ptr<LayerImpl> LayerImpl::CreateLayerImpl(LayerTreeImpl* tree_impl) { 499 scoped_ptr<LayerImpl> LayerImpl::CreateLayerImpl(LayerTreeImpl* tree_impl) {
499 return LayerImpl::Create(tree_impl, layer_id_, scroll_offset_); 500 return LayerImpl::Create(tree_impl, layer_id_, scroll_offset_);
500 } 501 }
501 502
503 void LayerImpl::set_main_thread_scrolling_reasons(
504 uint32_t main_thread_scrolling_reasons) {
505 if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons)
506 return;
507
508 if (main_thread_scrolling_reasons &
509 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects &&
510 layer_tree_impl()) {
511 if (layer_tree_impl()->ScrollOffsetIsAnimatingOnImplOnly(this)) {
512 layer_tree_impl()->animation_host()->ScrollAnimationAbort(
513 true /* needs_completion */);
514 } else if (layer_animation_controller()) {
515 layer_animation_controller()->AbortAnimations(
ajuma 2016/02/26 23:56:54 Shouldn't this be only if the animations are impl-
ymalik 2016/02/29 16:31:09 Yes, you're right. I am removing it though, since
516 TargetProperty::SCROLL_OFFSET, true /* needs_completion */);
517 }
518 }
519
520 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons;
521 }
522
502 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { 523 void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
503 layer->SetTransformOrigin(transform_origin_); 524 layer->SetTransformOrigin(transform_origin_);
504 layer->SetBackgroundColor(background_color_); 525 layer->SetBackgroundColor(background_color_);
505 layer->SetBounds(bounds_); 526 layer->SetBounds(bounds_);
506 layer->SetDoubleSided(double_sided_); 527 layer->SetDoubleSided(double_sided_);
507 layer->SetDrawsContent(DrawsContent()); 528 layer->SetDrawsContent(DrawsContent());
508 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); 529 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
509 // If whether layer has render surface changes, we need to update draw 530 // If whether layer has render surface changes, we need to update draw
510 // properties. 531 // properties.
511 // TODO(weiliangc): Should be safely removed after impl side is able to 532 // TODO(weiliangc): Should be safely removed after impl side is able to
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 .layer_transforms_should_scale_layer_contents) { 1799 .layer_transforms_should_scale_layer_contents) {
1779 return default_scale; 1800 return default_scale;
1780 } 1801 }
1781 1802
1782 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1803 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1783 DrawTransform(), default_scale); 1804 DrawTransform(), default_scale);
1784 return std::max(transform_scales.x(), transform_scales.y()); 1805 return std::max(transform_scales.x(), transform_scales.y());
1785 } 1806 }
1786 1807
1787 } // namespace cc 1808 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698