Chromium Code Reviews| Index: third_party/WebKit/Source/core/style/DataPersistent.h |
| diff --git a/third_party/WebKit/Source/core/style/DataPersistent.h b/third_party/WebKit/Source/core/style/DataPersistent.h |
| index 3672b6a7909f96fbd37a49502e3ef5634a75188b..e8451aba778846b33aa794e9915f0b87002015df 100644 |
| --- a/third_party/WebKit/Source/core/style/DataPersistent.h |
| +++ b/third_party/WebKit/Source/core/style/DataPersistent.h |
| @@ -42,6 +42,11 @@ class DataPersistent { |
| const_cast<DataPersistent&>(other).own_copy_ = false; |
| } |
| + DataPersistent(DataPersistent&& other) |
| + : data_(std::move(other.data_)), own_copy_(other.own_copy_) { |
| + other.own_copy_ = false; |
| + } |
| + |
| const T* Get() const { return data_ ? data_->Get() : nullptr; } |
| const T& operator*() const { return data_ ? *Get() : nullptr; } |
| @@ -74,6 +79,12 @@ class DataPersistent { |
| } |
| void operator=(std::nullptr_t) { data_.clear(); } |
| + DataPersistent& operator=(DataPersistent&& other) { |
| + data_ = std::move(other.data_); |
| + own_copy_ = other.own_copy_; |
| + other.own_copy_ = false; |
|
alancutter (OOO until 2018)
2017/06/13 03:49:29
Here's one way to avoid repetition of logic:
~Dat
shend
2017/06/13 20:54:43
Lol I have no idea what that does :P, so I'll keep
|
| + return *this; |
| + } |
| private: |
| // Reduce size of DataPersistent<> by delaying creation of Persistent<>. |