Changeset 166482 in webkit
- Timestamp:
- Mar 31, 2014 12:21:05 AM (10 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r166432 r166482 1 2014-03-31 Zan Dobersek <zdobersek@igalia.com> 2 3 Use std::unique_ptr in WTF::CompressedVector, WTF::GenericCompressedData 4 https://bugs.webkit.org/show_bug.cgi?id=130737 5 6 Switch to using std::unique_ptr instead of OwnPtr and PassOwnPtr 7 for the CompressedVector and GenericCompressedData classes. 8 9 * wtf/Compression.cpp: 10 (WTF::GenericCompressedData::create): 11 * wtf/Compression.h: 12 (WTF::CompressedVector::create): 13 (WTF::CompressibleVector::decompressIfNecessary): 14 1 15 2014-03-28 Alexey Proskuryakov <ap@apple.com> 2 16 -
trunk/Source/WTF/wtf/Compression.cpp
r155251 r166482 53 53 } 54 54 55 PassOwnPtr<GenericCompressedData> GenericCompressedData::create(const uint8_t* data, size_t dataLength)55 std::unique_ptr<GenericCompressedData> GenericCompressedData::create(const uint8_t* data, size_t dataLength) 56 56 { 57 57 enum { MinimumSize = sizeof(GenericCompressedData) * 8 }; … … 123 123 totalCompressed += currentCapacity; 124 124 totalInput += dataLength; 125 GenericCompressedData* result = new (compressedData) GenericCompressedData(dataLength, stream.total_out); 126 return adoptPtr(result); 125 return std::unique_ptr<GenericCompressedData>(new (compressedData) GenericCompressedData(dataLength, stream.total_out)); 127 126 } 128 127 … … 166 165 167 166 namespace WTF { 168 PassOwnPtr<GenericCompressedData> GenericCompressedData::create(const uint8_t*, size_t)167 std::unique_ptr<GenericCompressedData> GenericCompressedData::create(const uint8_t*, size_t) 169 168 { 170 169 return nullptr; -
trunk/Source/WTF/wtf/Compression.h
r157653 r166482 27 27 #define Compression_h 28 28 29 #include < wtf/PassOwnPtr.h>29 #include <memory> 30 30 #include <wtf/Vector.h> 31 31 … … 36 36 WTF_MAKE_FAST_ALLOCATED; 37 37 public: 38 WTF_EXPORT_PRIVATE static PassOwnPtr<GenericCompressedData> create(const uint8_t*, size_t);38 WTF_EXPORT_PRIVATE static std::unique_ptr<GenericCompressedData> create(const uint8_t*, size_t); 39 39 uint32_t compressedSize() const { return m_compressedSize; } 40 40 uint32_t originalSize() const { return m_originalSize; } … … 58 58 template <typename T> class CompressedVector : public GenericCompressedData { 59 59 public: 60 static PassOwnPtr<CompressedVector> create(const Vector<T>& source)60 static std::unique_ptr<CompressedVector> create(const Vector<T>& source) 61 61 { 62 OwnPtr<GenericCompressedData> result = GenericCompressedData::create(reinterpret_cast<const uint8_t*>(source.data()), sizeof(T) * source.size());63 return adoptPtr(static_cast<CompressedVector<T>*>(result.leakPtr()));62 std::unique_ptr<GenericCompressedData> result = GenericCompressedData::create(reinterpret_cast<const uint8_t*>(source.data()), sizeof(T) * source.size()); 63 return std::unique_ptr<CompressedVector<T>>(static_cast<CompressedVector<T>*>(result.release())); 64 64 } 65 65 … … 135 135 return; 136 136 m_compressedData->decompress(m_decompressedData); 137 m_compressedData .clear();137 m_compressedData = nullptr; 138 138 } 139 139 mutable Vector<T> m_decompressedData; 140 mutable OwnPtr<CompressedVector<T>> m_compressedData;140 mutable std::unique_ptr<CompressedVector<T>> m_compressedData; 141 141 }; 142 142
Note: See TracChangeset
for help on using the changeset viewer.