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

Side by Side Diff: ui/compositor/layer_animation_element.cc

Issue 1159633002: Clean up ui<->cc layers interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « ui/compositor/layer.cc ('k') | ui/compositor/layer_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/compositor/layer_animation_element.h" 5 #include "ui/compositor/layer_animation_element.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.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 "ui/compositor/float_animation_curve_adapter.h" 10 #include "ui/compositor/float_animation_curve_adapter.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 protected: 334 protected:
335 explicit ThreadedLayerAnimationElement(const LayerAnimationElement& element) 335 explicit ThreadedLayerAnimationElement(const LayerAnimationElement& element)
336 : LayerAnimationElement(element) { 336 : LayerAnimationElement(element) {
337 } 337 }
338 338
339 bool OnProgress(double t, LayerAnimationDelegate* delegate) override { 339 bool OnProgress(double t, LayerAnimationDelegate* delegate) override {
340 if (t < 1.0) 340 if (t < 1.0)
341 return false; 341 return false;
342 342
343 if (Started()) { 343 if (Started() && IsThreaded()) {
344 delegate->RemoveThreadedAnimation(animation_id()); 344 delegate->RemoveThreadedAnimation(animation_id());
345 } 345 }
346 346
347 OnEnd(delegate); 347 OnEnd(delegate);
348 return true; 348 return true;
349 } 349 }
350 350
351 void OnAbort(LayerAnimationDelegate* delegate) override { 351 void OnAbort(LayerAnimationDelegate* delegate) override {
352 if (delegate && Started()) { 352 if (delegate && Started() && IsThreaded()) {
353 delegate->RemoveThreadedAnimation(animation_id()); 353 delegate->RemoveThreadedAnimation(animation_id());
354 } 354 }
355 } 355 }
356 356
357 void RequestEffectiveStart(LayerAnimationDelegate* delegate) override { 357 void RequestEffectiveStart(LayerAnimationDelegate* delegate) override {
358 DCHECK(animation_group_id()); 358 DCHECK(animation_group_id());
359 if (duration() == base::TimeDelta()) { 359 if (!IsThreaded()) {
360 set_effective_start_time(requested_start_time()); 360 set_effective_start_time(requested_start_time());
361 return; 361 return;
362 } 362 }
363 set_effective_start_time(base::TimeTicks()); 363 set_effective_start_time(base::TimeTicks());
364 scoped_ptr<cc::Animation> animation = CreateCCAnimation(); 364 scoped_ptr<cc::Animation> animation = CreateCCAnimation();
365 animation->set_needs_synchronized_start_time(true); 365 animation->set_needs_synchronized_start_time(true);
366 delegate->AddThreadedAnimation(animation.Pass()); 366 delegate->AddThreadedAnimation(animation.Pass());
367 } 367 }
368 368
369 virtual void OnEnd(LayerAnimationDelegate* delegate) = 0; 369 virtual void OnEnd(LayerAnimationDelegate* delegate) = 0;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 } 833 }
834 834
835 // static 835 // static
836 LayerAnimationElement* LayerAnimationElement::CreateColorElement( 836 LayerAnimationElement* LayerAnimationElement::CreateColorElement(
837 SkColor color, 837 SkColor color,
838 base::TimeDelta duration) { 838 base::TimeDelta duration) {
839 return new ColorTransition(color, duration); 839 return new ColorTransition(color, duration);
840 } 840 }
841 841
842 } // namespace ui 842 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.cc ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698