OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/display/display_animator_chromeos.h" | 5 #include "ash/display/display_animator_chromeos.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/thread_task_runner_handle.h" |
11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
13 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
14 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
15 #include "ui/compositor/layer_animation_observer.h" | 16 #include "ui/compositor/layer_animation_observer.h" |
16 #include "ui/compositor/layer_animation_sequence.h" | 17 #include "ui/compositor/layer_animation_sequence.h" |
17 #include "ui/compositor/layer_animator.h" | 18 #include "ui/compositor/layer_animator.h" |
18 #include "ui/compositor/scoped_layer_animation_settings.h" | 19 #include "ui/compositor/scoped_layer_animation_settings.h" |
19 | 20 |
20 namespace ash { | 21 namespace ash { |
(...skipping 12 matching lines...) Expand all Loading... |
33 void AddNewAnimator(ui::LayerAnimator* animator) { | 34 void AddNewAnimator(ui::LayerAnimator* animator) { |
34 Observer* observer = new Observer(animator, this); | 35 Observer* observer = new Observer(animator, this); |
35 animator->AddObserver(observer); | 36 animator->AddObserver(observer); |
36 observer_list_.push_back(observer); | 37 observer_list_.push_back(observer); |
37 } | 38 } |
38 | 39 |
39 private: | 40 private: |
40 void OnSingleTaskCompleted() { | 41 void OnSingleTaskCompleted() { |
41 completed_counter_++; | 42 completed_counter_++; |
42 if (completed_counter_ >= observer_list_.size()) { | 43 if (completed_counter_ >= observer_list_.size()) { |
43 base::MessageLoopForUI::current()->DeleteSoon(FROM_HERE, this); | 44 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
44 if (!animation_aborted_) | 45 if (!animation_aborted_) |
45 base::MessageLoopForUI::current()->PostTask(FROM_HERE, callback_); | 46 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback_); |
46 } | 47 } |
47 } | 48 } |
48 | 49 |
49 void OnSingleTaskAborted() { | 50 void OnSingleTaskAborted() { |
50 animation_aborted_ = true; | 51 animation_aborted_ = true; |
51 OnSingleTaskCompleted(); | 52 OnSingleTaskCompleted(); |
52 } | 53 } |
53 | 54 |
54 // The actual observer to listen each animation completion. | 55 // The actual observer to listen each animation completion. |
55 class Observer : public ui::LayerAnimationObserver { | 56 class Observer : public ui::LayerAnimationObserver { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 if (timer_) { | 205 if (timer_) { |
205 timer_->Stop(); | 206 timer_->Stop(); |
206 timer_.reset(); | 207 timer_.reset(); |
207 } | 208 } |
208 STLDeleteContainerPairSecondPointers(hiding_layers_.begin(), | 209 STLDeleteContainerPairSecondPointers(hiding_layers_.begin(), |
209 hiding_layers_.end()); | 210 hiding_layers_.end()); |
210 hiding_layers_.clear(); | 211 hiding_layers_.clear(); |
211 } | 212 } |
212 | 213 |
213 } // namespace ash | 214 } // namespace ash |
OLD | NEW |