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

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

Issue 13465014: LayerTreeHost::SetAnimationEvents should use AnimationRegistrar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/animation/animation_registrar.h" 10 #include "cc/animation/animation_registrar.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 between_will_draw_and_did_draw_(false), 56 between_will_draw_and_did_draw_(false),
57 #endif 57 #endif
58 horizontal_scrollbar_layer_(NULL), 58 horizontal_scrollbar_layer_(NULL),
59 vertical_scrollbar_layer_(NULL) { 59 vertical_scrollbar_layer_(NULL) {
60 DCHECK_GT(layer_id_, 0); 60 DCHECK_GT(layer_id_, 0);
61 DCHECK(layer_tree_impl_); 61 DCHECK(layer_tree_impl_);
62 layer_tree_impl_->RegisterLayer(this); 62 layer_tree_impl_->RegisterLayer(this);
63 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); 63 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar();
64 layer_animation_controller_ = 64 layer_animation_controller_ =
65 registrar->GetAnimationControllerForId(layer_id_); 65 registrar->GetAnimationControllerForId(layer_id_);
66 layer_animation_controller_->AddObserver(this); 66 layer_animation_controller_->AddValueObserver(this);
67 } 67 }
68 68
69 LayerImpl::~LayerImpl() { 69 LayerImpl::~LayerImpl() {
70 #ifndef NDEBUG 70 #ifndef NDEBUG
71 DCHECK(!between_will_draw_and_did_draw_); 71 DCHECK(!between_will_draw_and_did_draw_);
72 #endif 72 #endif
73 layer_tree_impl_->UnregisterLayer(this); 73 layer_tree_impl_->UnregisterLayer(this);
74 layer_animation_controller_->RemoveObserver(this); 74 layer_animation_controller_->RemoveValueObserver(this);
75 } 75 }
76 76
77 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { 77 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) {
78 child->set_parent(this); 78 child->set_parent(this);
79 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); 79 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl());
80 children_.push_back(child.Pass()); 80 children_.push_back(child.Pass());
81 layer_tree_impl()->set_needs_update_draw_properties(); 81 layer_tree_impl()->set_needs_update_draw_properties();
82 } 82 }
83 83
84 scoped_ptr<LayerImpl> LayerImpl::RemoveChild(LayerImpl* child) { 84 scoped_ptr<LayerImpl> LayerImpl::RemoveChild(LayerImpl* child) {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. 356 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
357 // union) any update changes that have occurred on the main thread. 357 // union) any update changes that have occurred on the main thread.
358 update_rect_.Union(layer->update_rect()); 358 update_rect_.Union(layer->update_rect());
359 layer->set_update_rect(update_rect_); 359 layer->set_update_rect(update_rect_);
360 360
361 layer->SetScrollDelta(layer->scroll_delta() - layer->sent_scroll_delta()); 361 layer->SetScrollDelta(layer->scroll_delta() - layer->sent_scroll_delta());
362 layer->SetSentScrollDelta(gfx::Vector2d()); 362 layer->SetSentScrollDelta(gfx::Vector2d());
363 363
364 layer->SetStackingOrderChanged(stacking_order_changed_); 364 layer->SetStackingOrderChanged(stacking_order_changed_);
365 365
366 layer_animation_controller_->PushAnimationUpdatesTo(
367 layer->layer_animation_controller());
368
369 // Reset any state that should be cleared for the next update. 366 // Reset any state that should be cleared for the next update.
370 stacking_order_changed_ = false; 367 stacking_order_changed_ = false;
371 update_rect_ = gfx::RectF(); 368 update_rect_ = gfx::RectF();
372 } 369 }
373 370
374 std::string LayerImpl::IndentString(int indent) { 371 std::string LayerImpl::IndentString(int indent) {
375 std::string str; 372 std::string str;
376 for (int i = 0; i != indent; ++i) 373 for (int i = 0; i != indent; ++i)
377 str.append(" "); 374 str.append(" ");
378 return str; 375 return str;
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 dict->Set("layer_quad", MathUtil::AsValue(layer_quad).release()); 963 dict->Set("layer_quad", MathUtil::AsValue(layer_quad).release());
967 } 964 }
968 965
969 scoped_ptr<base::Value> LayerImpl::AsValue() const { 966 scoped_ptr<base::Value> LayerImpl::AsValue() const {
970 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 967 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
971 AsValueInto(state.get()); 968 AsValueInto(state.get());
972 return state.PassAs<base::Value>(); 969 return state.PassAs<base::Value>();
973 } 970 }
974 971
975 } // namespace cc 972 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698