Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: third_party/WebKit/Source/wtf/SizeLimits.cpp

Issue 1611343002: wtf reformat test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pydent Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 26 matching lines...) Expand all
37 #include "wtf/ThreadRestrictionVerifier.h" 37 #include "wtf/ThreadRestrictionVerifier.h"
38 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
39 #include "wtf/text/AtomicString.h" 39 #include "wtf/text/AtomicString.h"
40 #include "wtf/text/WTFString.h" 40 #include "wtf/text/WTFString.h"
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
51 #if ENABLE(ASSERT) 51 #if ENABLE(ASSERT)
52 bool c; 52 bool c;
53 ThreadRestrictionVerifier d; 53 ThreadRestrictionVerifier d;
54 #endif 54 #endif
55 }; 55 };
56 #else 56 #else
57 struct SameSizeAsRefCounted { 57 struct SameSizeAsRefCounted {
58 int a; 58 int a;
59 // Don't add anything here because this should stay small. 59 // Don't add anything here because this should stay small.
60 }; 60 };
61 #endif 61 #endif
62 template<typename T, unsigned inlineCapacity = 0> 62 template <typename T, unsigned inlineCapacity = 0>
63 struct SameSizeAsVectorWithInlineCapacity; 63 struct SameSizeAsVectorWithInlineCapacity;
64 64
65 template<typename T> 65 template <typename T>
66 struct SameSizeAsVectorWithInlineCapacity<T, 0> { 66 struct SameSizeAsVectorWithInlineCapacity<T, 0> {
67 void* bufferPointer; 67 void* bufferPointer;
68 unsigned capacity; 68 unsigned capacity;
69 unsigned size; 69 unsigned size;
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(OwnPtr<int>) == sizeof(int*), "OwnPtr should 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*),
82 static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCount ed should stay small"); 82 "PassRefPtr should stay small");
83 static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should st ay small"); 83 static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted),
84 "RefCounted should stay small");
85 static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*),
86 "RefPtr should stay small");
84 static_assert(sizeof(String) == sizeof(int*), "String should stay small"); 87 static_assert(sizeof(String) == sizeof(int*), "String should stay small");
85 static_assert(sizeof(AtomicString) == sizeof(String), "AtomicString should stay small"); 88 static_assert(sizeof(AtomicString) == sizeof(String),
86 static_assert(sizeof(Vector<int>) == sizeof(SameSizeAsVectorWithInlineCapacity<i nt>), "Vector should stay small"); 89 "AtomicString should stay small");
87 static_assert(sizeof(Vector<int, 1>) == sizeof(SameSizeAsVectorWithInlineCapacit y<int, 1>), "Vector should stay small"); 90 static_assert(sizeof(Vector<int>) ==
88 static_assert(sizeof(Vector<int, 2>) == sizeof(SameSizeAsVectorWithInlineCapacit y<int, 2>), "Vector should stay small"); 91 sizeof(SameSizeAsVectorWithInlineCapacity<int>),
89 static_assert(sizeof(Vector<int, 3>) == sizeof(SameSizeAsVectorWithInlineCapacit y<int, 3>), "Vector should stay small"); 92 "Vector should stay small");
93 static_assert(sizeof(Vector<int, 1>) ==
94 sizeof(SameSizeAsVectorWithInlineCapacity<int, 1>),
95 "Vector should stay small");
96 static_assert(sizeof(Vector<int, 2>) ==
97 sizeof(SameSizeAsVectorWithInlineCapacity<int, 2>),
98 "Vector should stay small");
99 static_assert(sizeof(Vector<int, 3>) ==
100 sizeof(SameSizeAsVectorWithInlineCapacity<int, 3>),
101 "Vector should stay small");
90 } 102 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/SaturatedArithmeticTest.cpp ('k') | third_party/WebKit/Source/wtf/SpinLock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698