Title: [180968] trunk/Source
Revision
180968
Author
ander...@apple.com
Date
2015-03-03 17:15:46 -0800 (Tue, 03 Mar 2015)

Log Message

Remove unused compression code
https://bugs.webkit.org/show_bug.cgi?id=142237

Reviewed by Geoffrey Garen.

Source/_javascript_Core:

* bytecode/UnlinkedCodeBlock.h:

Source/WTF:

* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Compression.cpp: Removed.
* wtf/Compression.h: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (180967 => 180968)


--- trunk/Source/_javascript_Core/ChangeLog	2015-03-04 01:14:43 UTC (rev 180967)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-03-04 01:15:46 UTC (rev 180968)
@@ -1,3 +1,12 @@
+2015-03-03  Anders Carlsson  <ander...@apple.com>
+
+        Remove unused compression code
+        https://bugs.webkit.org/show_bug.cgi?id=142237
+
+        Reviewed by Geoffrey Garen.
+
+        * bytecode/UnlinkedCodeBlock.h:
+
 2015-03-03  Filip Pizlo  <fpi...@apple.com>
 
         JIT debugging features that selectively disable the JITs for code blocks need to stay out of the way of the critical path of JIT management

Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h (180967 => 180968)


--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h	2015-03-04 01:14:43 UTC (rev 180967)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h	2015-03-04 01:15:46 UTC (rev 180968)
@@ -39,7 +39,6 @@
 #include "SymbolTable.h"
 #include "VirtualRegister.h"
 
-#include <wtf/Compression.h>
 #include <wtf/RefCountedArray.h>
 #include <wtf/Vector.h>
 

Modified: trunk/Source/WTF/ChangeLog (180967 => 180968)


--- trunk/Source/WTF/ChangeLog	2015-03-04 01:14:43 UTC (rev 180967)
+++ trunk/Source/WTF/ChangeLog	2015-03-04 01:15:46 UTC (rev 180968)
@@ -1,3 +1,17 @@
+2015-03-03  Anders Carlsson  <ander...@apple.com>
+
+        Remove unused compression code
+        https://bugs.webkit.org/show_bug.cgi?id=142237
+
+        Reviewed by Geoffrey Garen.
+
+        * WTF.vcxproj/WTF.vcxproj:
+        * WTF.vcxproj/WTF.vcxproj.filters:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/Compression.cpp: Removed.
+        * wtf/Compression.h: Removed.
+
 2015-03-02  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         [WK2] Remove unnecessary create() factory functions.

Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (180967 => 180968)


--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj	2015-03-04 01:14:43 UTC (rev 180967)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj	2015-03-04 01:15:46 UTC (rev 180968)
@@ -54,7 +54,6 @@
     <ClCompile Include="..\wtf\Assertions.cpp" />
     <ClCompile Include="..\wtf\BitVector.cpp" />
     <ClCompile Include="..\wtf\CompilationThread.cpp" />
-    <ClCompile Include="..\wtf\Compression.cpp" />
     <ClCompile Include="..\wtf\CryptographicUtilities.cpp" />
     <ClCompile Include="..\wtf\CryptographicallyRandomNumber.cpp" />
     <ClCompile Include="..\wtf\CurrentTime.cpp" />
@@ -173,7 +172,6 @@
     <ClInclude Include="..\wtf\CheckedArithmetic.h" />
     <ClInclude Include="..\wtf\CheckedBoolean.h" />
     <ClInclude Include="..\wtf\Compiler.h" />
-    <ClInclude Include="..\wtf\Compression.h" />
     <ClInclude Include="..\wtf\CryptographicUtilities.h" />
     <ClInclude Include="..\wtf\CryptographicallyRandomNumber.h" />
     <ClInclude Include="..\wtf\CurrentTime.h" />

Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters (180967 => 180968)


--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters	2015-03-04 01:14:43 UTC (rev 180967)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters	2015-03-04 01:15:46 UTC (rev 180968)
@@ -225,9 +225,6 @@
     <ClCompile Include="..\wtf\SixCharacterHash.cpp">
       <Filter>wtf</Filter>
     </ClCompile>
-    <ClCompile Include="..\wtf\Compression.cpp">
-      <Filter>wtf</Filter>
-    </ClCompile>
     <ClCompile Include="..\wtf\gobject\GlibUtilities.cpp">
       <Filter>wtf\gobject</Filter>
     </ClCompile>
@@ -667,9 +664,6 @@
     <ClInclude Include="..\wtf\SixCharacterHash.h">
       <Filter>wtf</Filter>
     </ClInclude>
-    <ClInclude Include="..\wtf\Compression.h">
-      <Filter>wtf</Filter>
-    </ClInclude>
     <ClInclude Include="..\wtf\FlipBytes.h">
       <Filter>wtf</Filter>
     </ClInclude>

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (180967 => 180968)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2015-03-04 01:14:43 UTC (rev 180967)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2015-03-04 01:15:46 UTC (rev 180968)
@@ -100,8 +100,6 @@
 		A748745217A0BDAE00FA04CB /* SixCharacterHash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A748744F17A0BDAE00FA04CB /* SixCharacterHash.cpp */; };
 		A748745317A0BDAE00FA04CB /* SixCharacterHash.h in Headers */ = {isa = PBXBuildFile; fileRef = A748745017A0BDAE00FA04CB /* SixCharacterHash.h */; };
 		A748745417A0BDAE00FA04CB /* StringHashDumpContext.h in Headers */ = {isa = PBXBuildFile; fileRef = A748745117A0BDAE00FA04CB /* StringHashDumpContext.h */; };
-		A7E643C617C5423B003BB16B /* Compression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E643C417C5423B003BB16B /* Compression.cpp */; };
-		A7E643C717C5423B003BB16B /* Compression.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E643C517C5423B003BB16B /* Compression.h */; };
 		A876DBD8151816E500DADB95 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A876DBD7151816E500DADB95 /* Platform.h */; };
 		A8A47385151A825B004123FF /* ASCIICType.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4725A151A825A004123FF /* ASCIICType.h */; };
 		A8A47386151A825B004123FF /* Assertions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4725B151A825A004123FF /* Assertions.cpp */; };
@@ -391,8 +389,6 @@
 		A748744F17A0BDAE00FA04CB /* SixCharacterHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SixCharacterHash.cpp; sourceTree = "<group>"; };
 		A748745017A0BDAE00FA04CB /* SixCharacterHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SixCharacterHash.h; sourceTree = "<group>"; };
 		A748745117A0BDAE00FA04CB /* StringHashDumpContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringHashDumpContext.h; sourceTree = "<group>"; };
-		A7E643C417C5423B003BB16B /* Compression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Compression.cpp; sourceTree = "<group>"; };
-		A7E643C517C5423B003BB16B /* Compression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Compression.h; sourceTree = "<group>"; };
 		A876DBD7151816E500DADB95 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
 		A8A4725A151A825A004123FF /* ASCIICType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCIICType.h; sourceTree = "<group>"; };
 		A8A4725B151A825A004123FF /* Assertions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Assertions.cpp; sourceTree = "<group>"; };
@@ -726,8 +722,6 @@
 				0F8F2B8F172E00F0007DBDA5 /* CompilationThread.cpp */,
 				0F8F2B90172E00F0007DBDA5 /* CompilationThread.h */,
 				A8A47270151A825A004123FF /* Compiler.h */,
-				A7E643C417C5423B003BB16B /* Compression.cpp */,
-				A7E643C517C5423B003BB16B /* Compression.h */,
 				E15556F318A0CC18006F48FB /* CryptographicUtilities.cpp */,
 				E15556F418A0CC18006F48FB /* CryptographicUtilities.h */,
 				A8A47273151A825A004123FF /* CryptographicallyRandomNumber.cpp */,
@@ -1078,7 +1072,6 @@
 				0FC4EDE61696149600F65041 /* CommaPrinter.h in Headers */,
 				0F8F2B91172E00FC007DBDA5 /* CompilationThread.h in Headers */,
 				A8A47398151A825B004123FF /* Compiler.h in Headers */,
-				A7E643C717C5423B003BB16B /* Compression.h in Headers */,
 				A8A4748C151A8264004123FF /* config.h in Headers */,
 				0F8F2B9C172F2596007DBDA5 /* ConversionMode.h in Headers */,
 				A8A4739B151A825B004123FF /* CryptographicallyRandomNumber.h in Headers */,
@@ -1337,7 +1330,6 @@
 				A8A47460151A825B004123FF /* CollatorDefault.cpp in Sources */,
 				A8A47463151A825B004123FF /* CollatorICU.cpp in Sources */,
 				0F8F2B92172E0103007DBDA5 /* CompilationThread.cpp in Sources */,
-				A7E643C617C5423B003BB16B /* Compression.cpp in Sources */,
 				A8A4739A151A825B004123FF /* CryptographicallyRandomNumber.cpp in Sources */,
 				A8A47439151A825B004123FF /* CString.cpp in Sources */,
 				A8A4739C151A825B004123FF /* CurrentTime.cpp in Sources */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (180967 => 180968)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2015-03-04 01:14:43 UTC (rev 180967)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2015-03-04 01:15:46 UTC (rev 180968)
@@ -12,7 +12,6 @@
     ByteOrder.h
     CompilationThread.h
     Compiler.h
-    Compression.h
     CryptographicUtilities.h
     CryptographicallyRandomNumber.h
     CurrentTime.h
@@ -147,7 +146,6 @@
     Atomics.cpp
     BitVector.cpp
     CompilationThread.cpp
-    Compression.cpp
     CryptographicUtilities.cpp
     CryptographicallyRandomNumber.cpp
     CurrentTime.cpp

Deleted: trunk/Source/WTF/wtf/Compression.cpp (180967 => 180968)


--- trunk/Source/WTF/wtf/Compression.cpp	2015-03-04 01:14:43 UTC (rev 180967)
+++ trunk/Source/WTF/wtf/Compression.cpp	2015-03-04 01:15:46 UTC (rev 180968)
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "Compression.h"
-
-#include "CheckedArithmetic.h"
-
-#if USE(ZLIB) && !COMPILER(MSVC)
-
-#include <string.h>
-#include <zlib.h>
-
-namespace WTF {
-
-static void* zAlloc(void*, uint32_t count, uint32_t size)
-{
-    CheckedSize allocSize = count;
-    allocSize *= size;
-    if (allocSize.hasOverflowed())
-        return Z_NULL;
-    void* result = 0;
-    if (tryFastMalloc(allocSize.unsafeGet()).getValue(result))
-        return result;
-    return Z_NULL;
-}
-
-static void zFree(void*, void* data)
-{
-    fastFree(data);
-}
-
-std::unique_ptr<GenericCompressedData> GenericCompressedData::create(const uint8_t* data, size_t dataLength)
-{
-    enum { MinimumSize = sizeof(GenericCompressedData) * 8 };
-
-    if (!data || dataLength < MinimumSize)
-        return nullptr;
-
-    z_stream stream;
-    memset(&stream, 0, sizeof(stream));
-    stream.zalloc = zAlloc;
-    stream.zfree = zFree;
-    stream.data_type = Z_BINARY;
-    stream.opaque = Z_NULL;
-    stream.avail_in = dataLength;
-    stream.next_in = const_cast<uint8_t*>(data);
-
-    size_t currentOffset = OBJECT_OFFSETOF(GenericCompressedData, m_data);
-    size_t currentCapacity = fastMallocGoodSize(MinimumSize);
-    Bytef* compressedData = static_cast<Bytef*>(fastMalloc(currentCapacity));
-    memset(compressedData, 0, sizeof(GenericCompressedData));
-    stream.next_out = compressedData + currentOffset;
-    stream.avail_out = currentCapacity - currentOffset;
-
-    deflateInit(&stream, Z_BEST_COMPRESSION);
-
-    while (true) {
-        int deflateResult = deflate(&stream, Z_FINISH);
-        if (deflateResult == Z_OK || !stream.avail_out) {
-            size_t newCapacity = 0;
-            currentCapacity -= stream.avail_out;
-            if (!stream.avail_in)
-                newCapacity = currentCapacity + 8;
-            else {
-                // Determine average capacity
-                size_t compressedContent = stream.next_in - data;
-                double expectedSize = static_cast<double>(dataLength) * compressedContent / currentCapacity;
-
-                // Expand capacity by at least 8 bytes so we're always growing, and to
-                // compensate for any exaggerated ideas of how effectively we'll compress
-                // data in the future.
-                newCapacity = std::max(static_cast<size_t>(expectedSize + 8), currentCapacity + 8);
-            }
-            newCapacity = fastMallocGoodSize(newCapacity);
-            if (newCapacity >= dataLength)
-                goto fail;
-            compressedData = static_cast<Bytef*>(fastRealloc(compressedData, newCapacity));
-            currentOffset = currentCapacity - stream.avail_out;
-            stream.next_out = compressedData + currentOffset;
-            stream.avail_out = newCapacity - currentCapacity;
-            currentCapacity = newCapacity;
-            continue;
-        }
-
-        if (deflateResult == Z_STREAM_END) {
-            ASSERT(!stream.avail_in);
-            break;
-        }
-
-        ASSERT_NOT_REACHED();
-    fail:
-        deflateEnd(&stream);
-        fastFree(compressedData);
-        return nullptr;
-    }
-    deflateEnd(&stream);
-    static int64_t totalCompressed = 0;
-    static int64_t totalInput = 0;
-
-    totalCompressed += currentCapacity;
-    totalInput += dataLength;
-    return std::unique_ptr<GenericCompressedData>(new (compressedData) GenericCompressedData(dataLength, stream.total_out));
-}
-
-bool GenericCompressedData::decompress(uint8_t* destination, size_t bufferSize, size_t* decompressedByteCount)
-{
-    if (decompressedByteCount)
-        *decompressedByteCount = 0;
-    z_stream stream;
-    memset(&stream, 0, sizeof(stream));
-    stream.zalloc = zAlloc;
-    stream.zfree = zFree;
-    stream.data_type = Z_BINARY;
-    stream.opaque = Z_NULL;
-    stream.next_out = destination;
-    stream.avail_out = bufferSize;
-    stream.next_in = m_data;
-    stream.avail_in = compressedSize();
-    if (inflateInit(&stream) != Z_OK) {
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-
-    int inflateResult = inflate(&stream, Z_FINISH);
-    inflateEnd(&stream);
-
-    ASSERT(stream.total_out <= bufferSize);
-    if (decompressedByteCount)
-        *decompressedByteCount = stream.total_out;
-
-    if (inflateResult != Z_STREAM_END) {
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-
-    return true;
-}
-
-}
-
-#else
-
-namespace WTF {
-std::unique_ptr<GenericCompressedData> GenericCompressedData::create(const uint8_t*, size_t)
-{
-    return nullptr;
-}
-
-bool GenericCompressedData::decompress(uint8_t*, size_t, size_t*)
-{
-    return false;
-}
-}
-
-#endif

Deleted: trunk/Source/WTF/wtf/Compression.h (180967 => 180968)


--- trunk/Source/WTF/wtf/Compression.h	2015-03-04 01:14:43 UTC (rev 180967)
+++ trunk/Source/WTF/wtf/Compression.h	2015-03-04 01:15:46 UTC (rev 180968)
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef Compression_h
-#define Compression_h
-
-#include <memory>
-#include <wtf/Vector.h>
-
-namespace WTF {
-
-class GenericCompressedData {
-    WTF_MAKE_NONCOPYABLE(GenericCompressedData)
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    WTF_EXPORT_PRIVATE static std::unique_ptr<GenericCompressedData> create(const uint8_t*, size_t);
-    uint32_t compressedSize() const { return m_compressedSize; }
-    uint32_t originalSize() const { return m_originalSize; }
-
-    WTF_EXPORT_PRIVATE bool decompress(uint8_t* destination, size_t bufferSize, size_t* decompressedByteCount = 0);
-    
-private:
-    GenericCompressedData(size_t originalSize, size_t compressedSize)
-    {
-        UNUSED_PARAM(m_data);
-        ASSERT(!m_originalSize);
-        ASSERT(!m_compressedSize);
-        m_originalSize = originalSize;
-        m_compressedSize = compressedSize;
-    }
-    uint32_t m_originalSize;
-    uint32_t m_compressedSize;
-    uint8_t m_data[1];
-};
-
-template <typename T> class CompressedVector : public GenericCompressedData {
-public:
-    static std::unique_ptr<CompressedVector> create(const Vector<T>& source)
-    {
-        std::unique_ptr<GenericCompressedData> result = GenericCompressedData::create(reinterpret_cast<const uint8_t*>(source.data()), sizeof(T) * source.size());
-        return std::unique_ptr<CompressedVector<T>>(static_cast<CompressedVector<T>*>(result.release()));
-    }
-
-    void decompress(Vector<T>& destination)
-    {
-        Vector<T> output(originalSize() / sizeof(T));
-        ASSERT(output.size() * sizeof(T) == originalSize());
-        size_t decompressedByteCount = 0;
-        GenericCompressedData::decompress(reinterpret_cast<uint8_t*>(output.data()), originalSize(), &decompressedByteCount);
-        ASSERT(decompressedByteCount == originalSize());
-        ASSERT(output.size() * sizeof(T) == decompressedByteCount);
-
-        destination.swap(output);
-    }
-
-    size_t size() const { return originalSize() / sizeof(T); }
-};
-
-template <typename T> class CompressibleVector {
-    WTF_MAKE_NONCOPYABLE(CompressibleVector)
-public:
-    CompressibleVector(size_t size = 0)
-        : m_decompressedData(size)
-    {
-    }
-
-    typedef typename Vector<T>::iterator iterator;
-    typedef typename Vector<T>::const_iterator const_iterator;
-
-    void shrinkToFit()
-    {
-        ASSERT(!m_compressedData);
-        m_compressedData = CompressedVector<T>::create(m_decompressedData);
-        if (m_compressedData)
-            m_decompressedData.clear();
-        else
-            m_decompressedData.shrinkToFit();
-    }
-
-    size_t size()
-    {
-        if (m_compressedData)
-            return m_compressedData->size();
-        return m_decompressedData.size();
-    }
-
-    template <typename U> T& operator[](Checked<U> index) { return data().at(index); }
-    template <typename U> const T& operator[](Checked<U> index) const { return data().at(index); }
-    template <typename U> T& at(Checked<U> index) { return data().at(index); }
-    template <typename U> const T& at(Checked<U> index) const { return data().at(index); }
-
-    iterator begin() { return data().begin(); }
-    iterator end() { return data().end(); }
-    const_iterator begin() const { return data().begin(); }
-    const_iterator end() const { return data().end(); }
-
-    const Vector<T>& data() const
-    {
-        decompressIfNecessary();
-        return m_decompressedData;
-    }
-
-    Vector<T>& data()
-    {
-        decompressIfNecessary();
-        return m_decompressedData;
-    }
-
-private:
-    void decompressIfNecessary() const
-    {
-        if (!m_compressedData)
-            return;
-        m_compressedData->decompress(m_decompressedData);
-        m_compressedData = nullptr;
-    }
-    mutable Vector<T> m_decompressedData;
-    mutable std::unique_ptr<CompressedVector<T>> m_compressedData;
-};
-
-}
-
-using WTF::GenericCompressedData;
-using WTF::CompressedVector;
-using WTF::CompressibleVector;
-
-#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to