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