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

Unified Diff: third_party/WebKit/Source/core/animation/InterpolableValue.h

Issue 2273233002: Remove redundant size member from InterpolableList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/InterpolableValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/animation/InterpolableValue.h
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValue.h b/third_party/WebKit/Source/core/animation/InterpolableValue.h
index 1c214ed04e9e451d42b017c756e3e8225a68c814..97944a0c930800711520481801be1202f8306a15 100644
--- a/third_party/WebKit/Source/core/animation/InterpolableValue.h
+++ b/third_party/WebKit/Source/core/animation/InterpolableValue.h
@@ -122,20 +122,17 @@ public:
bool isList() const final { return true; }
void set(size_t position, std::unique_ptr<InterpolableValue> value)
{
- DCHECK_LT(position, m_size);
m_values[position] = std::move(value);
}
const InterpolableValue* get(size_t position) const
{
- DCHECK_LT(position, m_size);
return m_values[position].get();
}
std::unique_ptr<InterpolableValue>& getMutable(size_t position)
{
- DCHECK_LT(position, m_size);
alancutter (OOO until 2018) 2016/08/25 02:03:53 These checks are already performed by Vector::at()
return m_values[position];
}
- size_t length() const { return m_size; }
+ size_t length() const { return m_values.size(); }
bool equals(const InterpolableValue& other) const final;
std::unique_ptr<InterpolableValue> clone() const final { return create(*this); }
std::unique_ptr<InterpolableValue> cloneAndZero() const final;
@@ -145,20 +142,17 @@ public:
private:
void interpolate(const InterpolableValue& to, const double progress, InterpolableValue& result) const final;
explicit InterpolableList(size_t size)
- : m_size(size)
- , m_values(m_size)
+ : m_values(size)
{
}
InterpolableList(const InterpolableList& other)
- : m_size(other.m_size)
- , m_values(m_size)
+ : m_values(other.length())
{
- for (size_t i = 0; i < m_size; i++)
+ for (size_t i = 0; i < length(); i++)
set(i, other.m_values[i]->clone());
}
- size_t m_size;
Vector<std::unique_ptr<InterpolableValue>> m_values;
};
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/InterpolableValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698