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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 }; | 146 }; |
147 | 147 |
148 template <typename T> | 148 template <typename T> |
149 struct GenericHashTraitsBase { | 149 struct GenericHashTraitsBase { |
150 // We don't want to capitalize fields in type traits | 150 // We don't want to capitalize fields in type traits |
151 // (i.e. the |value| -> |kValue| rename is undesirable below). | 151 // (i.e. the |value| -> |kValue| rename is undesirable below). |
152 // This problem is prevented by IsCallee heuristic. | 152 // This problem is prevented by IsCallee heuristic. |
153 static const int kWeakHandlingFlag = TypeTrait2<T>::value ? 123 : 456; | 153 static const int kWeakHandlingFlag = TypeTrait2<T>::value ? 123 : 456; |
154 }; | 154 }; |
155 | 155 |
| 156 template <int Format> |
| 157 struct IntermediateFormat { |
| 158 // Some type traits have int type. Example below is loosely based on |
| 159 // third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp |
| 160 static const int value = (Format == 123) ? 456 : 789; |
| 161 }; |
| 162 |
156 }; // namespace WTF | 163 }; // namespace WTF |
157 | 164 |
158 void F() { | 165 void F() { |
159 // Test that references to a static field are correctly rewritten. | 166 // Test that references to a static field are correctly rewritten. |
160 blink::C::instance_count_++; | 167 blink::C::instance_count_++; |
161 // Force instantiation of a copy constructor for blink::C to make sure field | 168 // Force instantiation of a copy constructor for blink::C to make sure field |
162 // initializers for synthesized functions don't cause weird rewrites. | 169 // initializers for synthesized functions don't cause weird rewrites. |
163 blink::C c; | 170 blink::C c; |
164 blink::C c2 = c; | 171 blink::C c2 = c; |
165 | 172 |
166 bool b1 = WTF::TypeTrait1::value; | 173 bool b1 = WTF::TypeTrait1::value; |
167 bool b2 = WTF::TypeTrait2<void>::value; | 174 bool b2 = WTF::TypeTrait2<void>::value; |
168 } | 175 } |
OLD | NEW |