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

Side by Side Diff: third_party/WebKit/Source/core/animation/UnderlyingValueOwner.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/animation/UnderlyingValueOwner.h" 5 #include "core/animation/UnderlyingValueOwner.h"
6 6
7 #include <memory>
8
7 namespace blink { 9 namespace blink {
8 10
9 struct NullValueWrapper { 11 struct NullValueWrapper {
10 NullValueWrapper() : value(nullptr) {} 12 NullValueWrapper() : value(nullptr) {}
11 const InterpolationValue value; 13 const InterpolationValue value;
12 }; 14 };
13 15
14 const InterpolationValue& UnderlyingValueOwner::value() const 16 const InterpolationValue& UnderlyingValueOwner::value() const
15 { 17 {
16 DEFINE_STATIC_LOCAL(NullValueWrapper, nullValueWrapper, ()); 18 DEFINE_STATIC_LOCAL(NullValueWrapper, nullValueWrapper, ());
(...skipping 18 matching lines...) Expand all
35 } 37 }
36 38
37 void UnderlyingValueOwner::set(const InterpolationType& type, InterpolationValue && value) 39 void UnderlyingValueOwner::set(const InterpolationType& type, InterpolationValue && value)
38 { 40 {
39 ASSERT(value); 41 ASSERT(value);
40 m_type = &type; 42 m_type = &type;
41 m_valueOwner = std::move(value); 43 m_valueOwner = std::move(value);
42 m_value = &m_valueOwner; 44 m_value = &m_valueOwner;
43 } 45 }
44 46
45 void UnderlyingValueOwner::set(PassOwnPtr<TypedInterpolationValue> value) 47 void UnderlyingValueOwner::set(std::unique_ptr<TypedInterpolationValue> value)
46 { 48 {
47 if (value) 49 if (value)
48 set(value->type(), std::move(value->mutableValue())); 50 set(value->type(), std::move(value->mutableValue()));
49 else 51 else
50 set(nullptr); 52 set(nullptr);
51 } 53 }
52 54
53 void UnderlyingValueOwner::set(const TypedInterpolationValue* value) 55 void UnderlyingValueOwner::set(const TypedInterpolationValue* value)
54 { 56 {
55 if (value) 57 if (value)
56 set(value->type(), value->value()); 58 set(value->type(), value->value());
57 else 59 else
58 set(nullptr); 60 set(nullptr);
59 } 61 }
60 62
61 InterpolationValue& UnderlyingValueOwner::mutableValue() 63 InterpolationValue& UnderlyingValueOwner::mutableValue()
62 { 64 {
63 ASSERT(m_type && m_value); 65 ASSERT(m_type && m_value);
64 if (!m_valueOwner) { 66 if (!m_valueOwner) {
65 m_valueOwner = m_value->clone(); 67 m_valueOwner = m_value->clone();
66 m_value = &m_valueOwner; 68 m_value = &m_valueOwner;
67 } 69 }
68 return m_valueOwner; 70 return m_valueOwner;
69 } 71 }
70 72
71 } // namespace blink 73 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698