| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "weak_ptr_factory.h" | 5 #include "weak_ptr_factory.h" |
| 6 |
| 6 namespace should_succeed { | 7 namespace should_succeed { |
| 7 | 8 |
| 8 class OnlyMember { | 9 class OnlyMember { |
| 9 base::WeakPtrFactory<OnlyMember> factory_; | 10 base::WeakPtrFactory<OnlyMember> factory_; |
| 10 }; | 11 }; |
| 11 | 12 |
| 12 class FactoryLast { | 13 class FactoryLast { |
| 13 bool bool_member_; | 14 bool bool_member_; |
| 14 int int_member_; | 15 int int_member_; |
| 15 base::WeakPtrFactory<FactoryLast> factory_; | 16 base::WeakPtrFactory<FactoryLast> factory_; |
| 16 }; | 17 }; |
| 17 | 18 |
| 18 class FactoryRefersToOtherType { | 19 class FactoryRefersToOtherType { |
| 19 bool bool_member_; | 20 bool bool_member_; |
| 20 base::WeakPtrFactory<bool> bool_ptr_factory_; | 21 base::WeakPtrFactory<bool> bool_ptr_factory_; |
| 21 }; | 22 }; |
| 22 | 23 |
| 23 class FirstFactoryRefersToOtherType { | 24 class FirstFactoryRefersToOtherType { |
| 24 bool bool_member_; | 25 bool bool_member_; |
| 25 base::WeakPtrFactory<bool> bool_ptr_factory_; | 26 base::WeakPtrFactory<bool> bool_ptr_factory_; |
| 26 int int_member_; | 27 int int_member_; |
| 27 base::WeakPtrFactory<FirstFactoryRefersToOtherType> factory_; | 28 base::WeakPtrFactory<FirstFactoryRefersToOtherType> factory_; |
| 28 }; | 29 }; |
| 29 | 30 |
| 31 class TwoFactories { |
| 32 bool bool_member_; |
| 33 int int_member_; |
| 34 base::WeakPtrFactory<TwoFactories> factory1_; |
| 35 base::WeakPtrFactory<TwoFactories> factory2_; |
| 36 }; |
| 37 |
| 30 } // namespace should_succeed | 38 } // namespace should_succeed |
| 31 | 39 |
| 32 namespace should_fail { | 40 namespace should_fail { |
| 33 | 41 |
| 34 class FactoryFirst { | 42 class FactoryFirst { |
| 35 base::WeakPtrFactory<FactoryFirst> factory_; | 43 base::WeakPtrFactory<FactoryFirst> factory_; |
| 36 int int_member; | 44 int int_member; |
| 37 }; | 45 }; |
| 38 | 46 |
| 39 class FactoryMiddle { | 47 class FactoryMiddle { |
| 40 bool bool_member_; | 48 bool bool_member_; |
| 41 base::WeakPtrFactory<FactoryMiddle> factory_; | 49 base::WeakPtrFactory<FactoryMiddle> factory_; |
| 42 int int_member_; | 50 int int_member_; |
| 43 }; | 51 }; |
| 44 | 52 |
| 53 class TwoFactoriesOneBad { |
| 54 bool bool_member_; |
| 55 base::WeakPtrFactory<TwoFactoriesOneBad> factory1_; |
| 56 int int_member_; |
| 57 base::WeakPtrFactory<TwoFactoriesOneBad> factory2_; |
| 58 }; |
| 59 |
| 45 } // namespace should_fail | 60 } // namespace should_fail |
| 46 | 61 |
| 47 int main() { | 62 int main() { |
| 48 } | 63 } |
| 49 | 64 |
| OLD | NEW |