| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 union U { | 61 union U { |
| 62 char four_chars[4]; | 62 char four_chars[4]; |
| 63 short two_shorts[2]; | 63 short two_shorts[2]; |
| 64 int one_hopefully_four_byte_int; | 64 int one_hopefully_four_byte_int; |
| 65 int has_prefix_; | 65 int has_prefix_; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 // https://crbug.com/640749#c1: Some type traits are inside blink namespace. | 68 // https://crbug.com/640749#c1: Some type traits are inside blink namespace. |
| 69 struct IsGarbageCollectedMixin { | 69 struct IsGarbageCollectedMixin { |
| 70 static const bool value = true; | 70 static const bool value = true; |
| 71 static const bool safe_to_compare_to_empty_or_deleted = false; |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 } // namespace blink | 74 } // namespace blink |
| 74 | 75 |
| 76 namespace not_blink { |
| 77 |
| 78 // These are traits for WTF types that may be defined outside of blink such |
| 79 // as in mojo. But their names are unique so we can globally treat them as |
| 80 // type traits for renaming. |
| 81 struct GloballyKnownTraits { |
| 82 static const bool safe_to_compare_to_empty_or_deleted = false; |
| 83 }; |
| 84 |
| 85 } // namespace not_blink |
| 86 |
| 75 namespace WTF { | 87 namespace WTF { |
| 76 | 88 |
| 77 // We don't want to capitalize fields in type traits | 89 // We don't want to capitalize fields in type traits |
| 78 // (i.e. the |value| -> |kValue| rename is undesirable below). | 90 // (i.e. the |value| -> |kValue| rename is undesirable below). |
| 79 struct TypeTrait1 { | 91 struct TypeTrait1 { |
| 80 static const bool value = true; | 92 static const bool value = true; |
| 81 }; | 93 }; |
| 82 | 94 |
| 83 // Some type traits are implemented as classes, not structs | 95 // Some type traits are implemented as classes, not structs |
| 84 // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable). | 96 // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable). |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Test that references to a static field are correctly rewritten. | 178 // Test that references to a static field are correctly rewritten. |
| 167 blink::C::instance_count_++; | 179 blink::C::instance_count_++; |
| 168 // Force instantiation of a copy constructor for blink::C to make sure field | 180 // Force instantiation of a copy constructor for blink::C to make sure field |
| 169 // initializers for synthesized functions don't cause weird rewrites. | 181 // initializers for synthesized functions don't cause weird rewrites. |
| 170 blink::C c; | 182 blink::C c; |
| 171 blink::C c2 = c; | 183 blink::C c2 = c; |
| 172 | 184 |
| 173 bool b1 = WTF::TypeTrait1::value; | 185 bool b1 = WTF::TypeTrait1::value; |
| 174 bool b2 = WTF::TypeTrait2<void>::value; | 186 bool b2 = WTF::TypeTrait2<void>::value; |
| 175 } | 187 } |
| OLD | NEW |