Title: [153638] trunk/Source/WTF
Revision
153638
Author
mikhail.pozdnya...@intel.com
Date
2013-08-02 01:20:23 -0700 (Fri, 02 Aug 2013)

Log Message

Check WTF::Vector size with '0' inline capacity
https://bugs.webkit.org/show_bug.cgi?id=119397

Reviewed by Andreas Kling.

Putting in place the compile assertion that had been removed with r153514.

* wtf/SizeLimits.cpp:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (153637 => 153638)


--- trunk/Source/WTF/ChangeLog	2013-08-02 07:51:49 UTC (rev 153637)
+++ trunk/Source/WTF/ChangeLog	2013-08-02 08:20:23 UTC (rev 153638)
@@ -1,3 +1,14 @@
+2013-08-02  Mikhail Pozdnyakov  <mikhail.pozdnya...@intel.com>
+
+        Check WTF::Vector size with '0' inline capacity
+        https://bugs.webkit.org/show_bug.cgi?id=119397
+
+        Reviewed by Andreas Kling.
+
+        Putting in place the compile assertion that had been removed with r153514.
+
+        * wtf/SizeLimits.cpp:
+
 2013-07-26  Mark Rowe  <mr...@apple.com>
 
         <http://webkit.org/b/119169> RetainPtr should support ARC for Objective-C objects.

Modified: trunk/Source/WTF/wtf/SizeLimits.cpp (153637 => 153638)


--- trunk/Source/WTF/wtf/SizeLimits.cpp	2013-08-02 07:51:49 UTC (rev 153637)
+++ trunk/Source/WTF/wtf/SizeLimits.cpp	2013-08-02 08:20:23 UTC (rev 153638)
@@ -54,11 +54,19 @@
     // Don't add anything here because this should stay small.
 };
 #endif
-template<typename T, unsigned inlineCapacity>
-struct SameSizeAsVectorWithInlineCapacity {
+template<typename T, unsigned inlineCapacity = 0>
+struct SameSizeAsVectorWithInlineCapacity;
+
+template<typename T>
+struct SameSizeAsVectorWithInlineCapacity<T, 0> {
     void* bufferPointer;
     unsigned capacity;
     unsigned size;
+};
+
+template<typename T, unsigned inlineCapacity>
+struct SameSizeAsVectorWithInlineCapacity {
+    SameSizeAsVectorWithInlineCapacity<T, 0> baseCapacity;
     AlignedBuffer<inlineCapacity * sizeof(T), WTF_ALIGN_OF(T)> inlineBuffer;
 };
 
@@ -67,6 +75,7 @@
 COMPILE_ASSERT(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), RefCounted_should_stay_small);
 COMPILE_ASSERT(sizeof(RefCountedCustomAllocated<int>) == sizeof(SameSizeAsRefCounted), RefCountedCustomAllocated_should_stay_small);
 COMPILE_ASSERT(sizeof(RefPtr<RefCounted<int> >) == sizeof(int*), RefPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(Vector<int>) == sizeof(SameSizeAsVectorWithInlineCapacity<int>), Vector_should_stay_small);
 COMPILE_ASSERT(sizeof(Vector<int, 1>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 1>), Vector_should_stay_small);
 COMPILE_ASSERT(sizeof(Vector<int, 2>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 2>), Vector_should_stay_small);
 COMPILE_ASSERT(sizeof(Vector<int, 3>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 3>), Vector_should_stay_small);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to