| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 namespace blink { | 5 namespace blink { |
| 6 | 6 |
| 7 // Note: do not add any copy or move constructors to this class: doing so will | 7 // Note: do not add any copy or move constructors to this class: doing so will |
| 8 // break test coverage that we don't clobber the class name by trying to emit | 8 // break test coverage that we don't clobber the class name by trying to emit |
| 9 // replacements for synthesized functions. | 9 // replacements for synthesized functions. |
| 10 class C { | 10 class C { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 union U { | 58 union U { |
| 59 char fourChars[4]; | 59 char fourChars[4]; |
| 60 short twoShorts[2]; | 60 short twoShorts[2]; |
| 61 int one_hopefully_four_byte_int; | 61 int one_hopefully_four_byte_int; |
| 62 int m_hasPrefix; | 62 int m_hasPrefix; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // https://crbug.com/640749#c1: Some type traits are inside blink namespace. | 65 // https://crbug.com/640749#c1: Some type traits are inside blink namespace. |
| 66 struct IsGarbageCollectedMixin { | 66 struct IsGarbageCollectedMixin { |
| 67 static const bool value = true; | 67 static const bool value = true; |
| 68 static const bool safeToCompareToEmptyOrDeleted = false; |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace blink | 71 } // namespace blink |
| 71 | 72 |
| 73 namespace not_blink { |
| 74 |
| 75 // These are traits for WTF types that may be defined outside of blink such |
| 76 // as in mojo. But their names are unique so we can globally treat them as |
| 77 // type traits for renaming. |
| 78 struct GloballyKnownTraits { |
| 79 static const bool safeToCompareToEmptyOrDeleted = false; |
| 80 }; |
| 81 |
| 82 } // namespace not_blink |
| 83 |
| 72 namespace WTF { | 84 namespace WTF { |
| 73 | 85 |
| 74 // We don't want to capitalize fields in type traits | 86 // We don't want to capitalize fields in type traits |
| 75 // (i.e. the |value| -> |kValue| rename is undesirable below). | 87 // (i.e. the |value| -> |kValue| rename is undesirable below). |
| 76 struct TypeTrait1 { | 88 struct TypeTrait1 { |
| 77 static const bool value = true; | 89 static const bool value = true; |
| 78 }; | 90 }; |
| 79 | 91 |
| 80 // Some type traits are implemented as classes, not structs | 92 // Some type traits are implemented as classes, not structs |
| 81 // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable). | 93 // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable). |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Test that references to a static field are correctly rewritten. | 175 // Test that references to a static field are correctly rewritten. |
| 164 blink::C::instanceCount++; | 176 blink::C::instanceCount++; |
| 165 // Force instantiation of a copy constructor for blink::C to make sure field | 177 // Force instantiation of a copy constructor for blink::C to make sure field |
| 166 // initializers for synthesized functions don't cause weird rewrites. | 178 // initializers for synthesized functions don't cause weird rewrites. |
| 167 blink::C c; | 179 blink::C c; |
| 168 blink::C c2 = c; | 180 blink::C c2 = c; |
| 169 | 181 |
| 170 bool b1 = WTF::TypeTrait1::value; | 182 bool b1 = WTF::TypeTrait1::value; |
| 171 bool b2 = WTF::TypeTrait2<void>::value; | 183 bool b2 = WTF::TypeTrait2<void>::value; |
| 172 } | 184 } |
| OLD | NEW |