diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-19 14:37:12 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-19 14:37:12 +0000 |
commit | a1ea4276f87f945dfe922f7c37c08f2d203e4e59 (patch) | |
tree | 125f9e604c64f1bd38f8ff44d8784b062f0245c4 /core/fxcrt/widestring.cpp | |
parent | ee3e3a4f3cbaa99ae3609f575ff9b2c329c5df2a (diff) | |
download | pdfium-a1ea4276f87f945dfe922f7c37c08f2d203e4e59.tar.xz |
fxcrt::{Byte,Wide}String missing move-assign operator
This hasn't been a big deal, since no data is copied, but avoids
some ref-count churn in the process.
Change-Id: I53c059284aa6806793c59a0c19b3e0d7fe4191d6
Reviewed-on: https://pdfium-review.googlesource.com/35350
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/widestring.cpp')
-rw-r--r-- | core/fxcrt/widestring.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp index 25f253ea11..cde1973d26 100644 --- a/core/fxcrt/widestring.cpp +++ b/core/fxcrt/widestring.cpp @@ -441,9 +441,16 @@ const WideString& WideString::operator=(const WideStringView& stringSrc) { return *this; } -const WideString& WideString::operator=(const WideString& stringSrc) { - if (m_pData != stringSrc.m_pData) - m_pData = stringSrc.m_pData; +const WideString& WideString::operator=(const WideString& that) { + if (m_pData != that.m_pData) + m_pData = that.m_pData; + + return *this; +} + +const WideString& WideString::operator=(WideString&& that) { + if (m_pData != that.m_pData) + m_pData = std::move(that.m_pData); return *this; } @@ -662,6 +669,10 @@ void WideString::Concat(const wchar_t* pSrcData, size_t nSrcLen) { m_pData.Swap(pNewData); } +intptr_t WideString::ReferenceCountForTesting() const { + return m_pData ? m_pData->m_nRefs : 0; +} + ByteString WideString::UTF8Encode() const { return FX_UTF8Encode(AsStringView()); } |