OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "wtf/Assertions.h" | 31 #include "wtf/Assertions.h" |
32 #include "wtf/ContainerAnnotations.h" | 32 #include "wtf/ContainerAnnotations.h" |
| 33 #include "wtf/OwnPtr.h" |
33 #include "wtf/PassRefPtr.h" | 34 #include "wtf/PassRefPtr.h" |
34 #include "wtf/RefCounted.h" | 35 #include "wtf/RefCounted.h" |
35 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
36 #include "wtf/ThreadRestrictionVerifier.h" | 37 #include "wtf/ThreadRestrictionVerifier.h" |
37 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
38 #include "wtf/text/AtomicString.h" | 39 #include "wtf/text/AtomicString.h" |
39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
40 #include <memory> | |
41 | 41 |
42 namespace WTF { | 42 namespace WTF { |
43 | 43 |
44 #if ENABLE(ASSERT) || ENABLE(SECURITY_ASSERT) | 44 #if ENABLE(ASSERT) || ENABLE(SECURITY_ASSERT) |
45 // The debug/assertion version may get bigger. | 45 // The debug/assertion version may get bigger. |
46 struct SameSizeAsRefCounted { | 46 struct SameSizeAsRefCounted { |
47 int a; | 47 int a; |
48 #if ENABLE(SECURITY_ASSERT) | 48 #if ENABLE(SECURITY_ASSERT) |
49 bool b; | 49 bool b; |
50 #endif | 50 #endif |
(...skipping 19 matching lines...) Expand all Loading... |
70 }; | 70 }; |
71 | 71 |
72 template<typename T, unsigned inlineCapacity> | 72 template<typename T, unsigned inlineCapacity> |
73 struct SameSizeAsVectorWithInlineCapacity { | 73 struct SameSizeAsVectorWithInlineCapacity { |
74 SameSizeAsVectorWithInlineCapacity<T, 0> baseCapacity; | 74 SameSizeAsVectorWithInlineCapacity<T, 0> baseCapacity; |
75 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) | 75 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
76 AlignedBuffer<inlineCapacity * sizeof(T), WTF_ALIGN_OF(T)> inlineBuffer; | 76 AlignedBuffer<inlineCapacity * sizeof(T), WTF_ALIGN_OF(T)> inlineBuffer; |
77 #endif | 77 #endif |
78 }; | 78 }; |
79 | 79 |
80 static_assert(sizeof(std::unique_ptr<int>) == sizeof(int*), "std::unique_ptr sho
uld stay small"); | 80 static_assert(sizeof(OwnPtr<int>) == sizeof(int*), "OwnPtr should stay small"); |
81 static_assert(sizeof(PassRefPtr<RefCounted<int>>) == sizeof(int*), "PassRefPtr s
hould stay small"); | 81 static_assert(sizeof(PassRefPtr<RefCounted<int>>) == sizeof(int*), "PassRefPtr s
hould stay small"); |
82 static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCount
ed should stay small"); | 82 static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCount
ed should stay small"); |
83 static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should st
ay small"); | 83 static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should st
ay small"); |
84 static_assert(sizeof(String) == sizeof(int*), "String should stay small"); | 84 static_assert(sizeof(String) == sizeof(int*), "String should stay small"); |
85 static_assert(sizeof(AtomicString) == sizeof(String), "AtomicString should stay
small"); | 85 static_assert(sizeof(AtomicString) == sizeof(String), "AtomicString should stay
small"); |
86 static_assert(sizeof(Vector<int>) == sizeof(SameSizeAsVectorWithInlineCapacity<i
nt>), "Vector should stay small"); | 86 static_assert(sizeof(Vector<int>) == sizeof(SameSizeAsVectorWithInlineCapacity<i
nt>), "Vector should stay small"); |
87 static_assert(sizeof(Vector<int, 1>) == sizeof(SameSizeAsVectorWithInlineCapacit
y<int, 1>), "Vector should stay small"); | 87 static_assert(sizeof(Vector<int, 1>) == sizeof(SameSizeAsVectorWithInlineCapacit
y<int, 1>), "Vector should stay small"); |
88 static_assert(sizeof(Vector<int, 2>) == sizeof(SameSizeAsVectorWithInlineCapacit
y<int, 2>), "Vector should stay small"); | 88 static_assert(sizeof(Vector<int, 2>) == sizeof(SameSizeAsVectorWithInlineCapacit
y<int, 2>), "Vector should stay small"); |
89 static_assert(sizeof(Vector<int, 3>) == sizeof(SameSizeAsVectorWithInlineCapacit
y<int, 3>), "Vector should stay small"); | 89 static_assert(sizeof(Vector<int, 3>) == sizeof(SameSizeAsVectorWithInlineCapacit
y<int, 3>), "Vector should stay small"); |
90 } // namespace WTF | 90 } // namespace WTF |
OLD | NEW |