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

Side by Side Diff: cc/animation/animation_host.cc

Issue 2258833002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 | « no previous file | cc/animation/animation_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 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 "cc/animation/animation_host.h" 5 #include "cc/animation/animation_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 28 matching lines...) Expand all
39 return animation_host; 39 return animation_host;
40 } 40 }
41 41
42 AnimationHost::AnimationHost(ThreadInstance thread_instance) 42 AnimationHost::AnimationHost(ThreadInstance thread_instance)
43 : mutator_host_client_(nullptr), 43 : mutator_host_client_(nullptr),
44 thread_instance_(thread_instance), 44 thread_instance_(thread_instance),
45 supports_scroll_animations_(false), 45 supports_scroll_animations_(false),
46 animation_waiting_for_deletion_(false) { 46 animation_waiting_for_deletion_(false) {
47 if (thread_instance_ == ThreadInstance::IMPL) { 47 if (thread_instance_ == ThreadInstance::IMPL) {
48 scroll_offset_animations_impl_ = 48 scroll_offset_animations_impl_ =
49 base::WrapUnique(new ScrollOffsetAnimationsImpl(this)); 49 base::MakeUnique<ScrollOffsetAnimationsImpl>(this);
50 } else { 50 } else {
51 scroll_offset_animations_ = 51 scroll_offset_animations_ = base::MakeUnique<ScrollOffsetAnimations>(this);
52 base::WrapUnique(new ScrollOffsetAnimations(this));
53 } 52 }
54 } 53 }
55 54
56 AnimationHost::~AnimationHost() { 55 AnimationHost::~AnimationHost() {
57 scroll_offset_animations_impl_ = nullptr; 56 scroll_offset_animations_impl_ = nullptr;
58 57
59 ClearTimelines(); 58 ClearTimelines();
60 DCHECK(!mutator_host_client()); 59 DCHECK(!mutator_host_client());
61 DCHECK(element_to_animations_map_.empty()); 60 DCHECK(element_to_animations_map_.empty());
62 } 61 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 TRACE_EVENT0("cc", "AnimationHost::UpdateAnimationState"); 287 TRACE_EVENT0("cc", "AnimationHost::UpdateAnimationState");
289 ElementToAnimationsMap active_element_animations_map_copy = 288 ElementToAnimationsMap active_element_animations_map_copy =
290 active_element_to_animations_map_; 289 active_element_to_animations_map_;
291 for (auto& it : active_element_animations_map_copy) 290 for (auto& it : active_element_animations_map_copy)
292 it.second->UpdateState(start_ready_animations, events); 291 it.second->UpdateState(start_ready_animations, events);
293 292
294 return true; 293 return true;
295 } 294 }
296 295
297 std::unique_ptr<AnimationEvents> AnimationHost::CreateEvents() { 296 std::unique_ptr<AnimationEvents> AnimationHost::CreateEvents() {
298 return base::WrapUnique(new AnimationEvents()); 297 return base::MakeUnique<AnimationEvents>();
299 } 298 }
300 299
301 void AnimationHost::SetAnimationEvents( 300 void AnimationHost::SetAnimationEvents(
302 std::unique_ptr<AnimationEvents> events) { 301 std::unique_ptr<AnimationEvents> events) {
303 for (size_t event_index = 0; event_index < events->events_.size(); 302 for (size_t event_index = 0; event_index < events->events_.size();
304 ++event_index) { 303 ++event_index) {
305 ElementId element_id = events->events_[event_index].element_id; 304 ElementId element_id = events->events_[event_index].element_id;
306 305
307 // Use the map of all ElementAnimations, not just active ones, since 306 // Use the map of all ElementAnimations, not just active ones, since
308 // non-active ElementAnimations may still receive events for impl-only 307 // non-active ElementAnimations may still receive events for impl-only
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 const AnimationHost::ElementToAnimationsMap& 566 const AnimationHost::ElementToAnimationsMap&
568 AnimationHost::all_element_animations_for_testing() const { 567 AnimationHost::all_element_animations_for_testing() const {
569 return element_to_animations_map_; 568 return element_to_animations_map_;
570 } 569 }
571 570
572 void AnimationHost::OnAnimationWaitingForDeletion() { 571 void AnimationHost::OnAnimationWaitingForDeletion() {
573 animation_waiting_for_deletion_ = true; 572 animation_waiting_for_deletion_ = true;
574 } 573 }
575 574
576 } // namespace cc 575 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/animation/animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698