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

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

Issue 1407043002: Added more constructors to CallbackLayerAnimationObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/callback_layer_animation_observer.h" 5 #include "ui/compositor/callback_layer_animation_observer.h"
6 6
7 #include "base/bind.h"
7 #include "ui/compositor/layer_animation_sequence.h" 8 #include "ui/compositor/layer_animation_sequence.h"
8 9
9 namespace ui { 10 namespace ui {
10 11
12 void CallbackLayerAnimationObserver::DummyAnimationStartedCallback(
13 const CallbackLayerAnimationObserver&) {}
14
15 bool CallbackLayerAnimationObserver::DummyAnimationEndedCallback(
16 bool should_delete_observer,
17 const CallbackLayerAnimationObserver&) {
18 return should_delete_observer;
19 }
20
11 CallbackLayerAnimationObserver::CallbackLayerAnimationObserver( 21 CallbackLayerAnimationObserver::CallbackLayerAnimationObserver(
12 AnimationStartedCallback animation_started_callback, 22 AnimationStartedCallback animation_started_callback,
13 AnimationEndedCallback animation_ended_callback) 23 AnimationEndedCallback animation_ended_callback)
14 : active_(false), 24 : animation_started_callback_(animation_started_callback),
15 attached_sequence_count_(0), 25 animation_ended_callback_(animation_ended_callback) {}
16 detached_sequence_count_(0), 26
17 started_count_(0), 27 CallbackLayerAnimationObserver::CallbackLayerAnimationObserver(
18 aborted_count_(0), 28 AnimationStartedCallback animation_started_callback,
19 successful_count_(0), 29 bool should_delete_observer)
20 animation_started_callback_(animation_started_callback), 30 : animation_started_callback_(animation_started_callback),
21 animation_ended_callback_(animation_ended_callback), 31 animation_ended_callback_(base::Bind(
22 destroyed_(nullptr) {} 32 &CallbackLayerAnimationObserver::DummyAnimationEndedCallback,
33 should_delete_observer)) {}
34
35 CallbackLayerAnimationObserver::CallbackLayerAnimationObserver(
36 AnimationEndedCallback animation_ended_callback)
37 : animation_started_callback_(base::Bind(
38 &CallbackLayerAnimationObserver::DummyAnimationStartedCallback)),
39 animation_ended_callback_(animation_ended_callback) {}
23 40
24 CallbackLayerAnimationObserver::~CallbackLayerAnimationObserver() { 41 CallbackLayerAnimationObserver::~CallbackLayerAnimationObserver() {
25 if (destroyed_) 42 if (destroyed_)
26 *destroyed_ = true; 43 *destroyed_ = true;
27 } 44 }
28 45
29 void CallbackLayerAnimationObserver::SetActive() { 46 void CallbackLayerAnimationObserver::SetActive() {
30 active_ = true; 47 active_ = true;
31 48
32 bool destroyed = false; 49 bool destroyed = false;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return; 123 return;
107 } 124 }
108 destroyed_ = nullptr; 125 destroyed_ = nullptr;
109 126
110 if (should_delete) 127 if (should_delete)
111 delete this; 128 delete this;
112 } 129 }
113 } 130 }
114 131
115 } // namespace ui 132 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/callback_layer_animation_observer.h ('k') | ui/compositor/callback_layer_animation_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698