Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "wtf/Assertions.h" | 33 #include "wtf/Assertions.h" |
| 34 #include "wtf/OwnPtr.h" | 34 #include "wtf/OwnPtr.h" |
| 35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 36 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 38 #include "wtf/ThreadRestrictionVerifier.h" | 38 #include "wtf/ThreadRestrictionVerifier.h" |
| 39 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 40 #include "wtf/text/AtomicString.h" | |
| 41 #include "wtf/text/WTFString.h" | |
| 40 | 42 |
| 41 namespace WTF { | 43 namespace WTF { |
| 42 | 44 |
| 43 #if !defined(NDEBUG) || SECURITY_ASSERT_ENABLED | 45 #if !defined(NDEBUG) || SECURITY_ASSERT_ENABLED |
| 44 // The debug/assertion version may get bigger. | 46 // The debug/assertion version may get bigger. |
| 45 struct SameSizeAsRefCounted { | 47 struct SameSizeAsRefCounted { |
| 46 int a; | 48 int a; |
| 47 #if SECURITY_ASSERT_ENABLED | 49 #if SECURITY_ASSERT_ENABLED |
| 48 bool b; | 50 bool b; |
| 49 #endif | 51 #endif |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 71 template<typename T, unsigned inlineCapacity> | 73 template<typename T, unsigned inlineCapacity> |
| 72 struct SameSizeAsVectorWithInlineCapacity { | 74 struct SameSizeAsVectorWithInlineCapacity { |
| 73 SameSizeAsVectorWithInlineCapacity<T, 0> baseCapacity; | 75 SameSizeAsVectorWithInlineCapacity<T, 0> baseCapacity; |
| 74 AlignedBuffer<inlineCapacity * sizeof(T), WTF_ALIGN_OF(T)> inlineBuffer; | 76 AlignedBuffer<inlineCapacity * sizeof(T), WTF_ALIGN_OF(T)> inlineBuffer; |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 COMPILE_ASSERT(sizeof(OwnPtr<int>) == sizeof(int*), OwnPtr_should_stay_small); | 79 COMPILE_ASSERT(sizeof(OwnPtr<int>) == sizeof(int*), OwnPtr_should_stay_small); |
| 78 COMPILE_ASSERT(sizeof(PassRefPtr<RefCounted<int> >) == sizeof(int*), PassRefPtr_ should_stay_small); | 80 COMPILE_ASSERT(sizeof(PassRefPtr<RefCounted<int> >) == sizeof(int*), PassRefPtr_ should_stay_small); |
| 79 COMPILE_ASSERT(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), RefCount ed_should_stay_small); | 81 COMPILE_ASSERT(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), RefCount ed_should_stay_small); |
| 80 COMPILE_ASSERT(sizeof(RefPtr<RefCounted<int> >) == sizeof(int*), RefPtr_should_s tay_small); | 82 COMPILE_ASSERT(sizeof(RefPtr<RefCounted<int> >) == sizeof(int*), RefPtr_should_s tay_small); |
| 83 COMPILE_ASSERT(sizeof(String) == sizeof(int*), String_should_stay_small); | |
| 84 COMPILE_ASSERT(sizeof(AtomicString) == sizeof(String), AtomicString_should_stay_ small); | |
|
abarth-chromium
2014/03/21 17:12:22
We already have this compile assert somewhere else
| |
| 81 COMPILE_ASSERT(sizeof(Vector<int>) == sizeof(SameSizeAsVectorWithInlineCapacity< int>), Vector_should_stay_small); | 85 COMPILE_ASSERT(sizeof(Vector<int>) == sizeof(SameSizeAsVectorWithInlineCapacity< int>), Vector_should_stay_small); |
| 82 COMPILE_ASSERT(sizeof(Vector<int, 1>) == sizeof(SameSizeAsVectorWithInlineCapaci ty<int, 1>), Vector_should_stay_small); | 86 COMPILE_ASSERT(sizeof(Vector<int, 1>) == sizeof(SameSizeAsVectorWithInlineCapaci ty<int, 1>), Vector_should_stay_small); |
| 83 COMPILE_ASSERT(sizeof(Vector<int, 2>) == sizeof(SameSizeAsVectorWithInlineCapaci ty<int, 2>), Vector_should_stay_small); | 87 COMPILE_ASSERT(sizeof(Vector<int, 2>) == sizeof(SameSizeAsVectorWithInlineCapaci ty<int, 2>), Vector_should_stay_small); |
| 84 COMPILE_ASSERT(sizeof(Vector<int, 3>) == sizeof(SameSizeAsVectorWithInlineCapaci ty<int, 3>), Vector_should_stay_small); | 88 COMPILE_ASSERT(sizeof(Vector<int, 3>) == sizeof(SameSizeAsVectorWithInlineCapaci ty<int, 3>), Vector_should_stay_small); |
| 85 } | 89 } |
| OLD | NEW |