| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file contains macros and macro-like constructs (e.g., templates) that | 5 // This file contains macros and macro-like constructs (e.g., templates) that |
| 6 // are commonly used throughout Chromium source. (It may also contain things | 6 // are commonly used throughout Chromium source. (It may also contain things |
| 7 // that are closely related to things that are commonly used that belong in this | 7 // that are closely related to things that are commonly used that belong in this |
| 8 // file.) | 8 // file.) |
| 9 | 9 |
| 10 #ifndef BASE_MACROS_H_ | 10 #ifndef BASE_MACROS_H_ |
| 11 #define BASE_MACROS_H_ | 11 #define BASE_MACROS_H_ |
| 12 | 12 |
| 13 #include <stddef.h> // For size_t. | 13 #include <stddef.h> // For size_t. |
| 14 #include <string.h> // For memcpy. | 14 #include <string.h> // For memcpy. |
| 15 | 15 |
| 16 // Put this in the private: declarations for a class to be uncopyable. | 16 // Put this in the declarations for a class to be uncopyable. |
| 17 #define DISALLOW_COPY(TypeName) \ | 17 #define DISALLOW_COPY(TypeName) \ |
| 18 TypeName(const TypeName&) | 18 TypeName(const TypeName&) = delete |
| 19 | 19 |
| 20 // Put this in the private: declarations for a class to be unassignable. | 20 // Put this in the declarations for a class to be unassignable. |
| 21 #define DISALLOW_ASSIGN(TypeName) \ | 21 #define DISALLOW_ASSIGN(TypeName) \ |
| 22 void operator=(const TypeName&) | 22 void operator=(const TypeName&) = delete |
| 23 | 23 |
| 24 // A macro to disallow the copy constructor and operator= functions | 24 // A macro to disallow the copy constructor and operator= functions |
| 25 // This should be used in the private: declarations for a class | 25 // This should be used in the private: declarations for a class |
| 26 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ | 26 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
| 27 TypeName(const TypeName&); \ | 27 TypeName(const TypeName&); \ |
| 28 void operator=(const TypeName&) | 28 void operator=(const TypeName&) |
| 29 | 29 |
| 30 // An older, deprecated, politically incorrect name for the above. | 30 // An older, deprecated, politically incorrect name for the above. |
| 31 // NOTE: The usage of this macro was banned from our code base, but some | 31 // NOTE: The usage of this macro was banned from our code base, but some |
| 32 // third_party libraries are yet using it. | 32 // third_party libraries are yet using it. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 // Use these to declare and define a static local variable (static T;) so that | 190 // Use these to declare and define a static local variable (static T;) so that |
| 191 // it is leaked so that its destructors are not called at exit. If you need | 191 // it is leaked so that its destructors are not called at exit. If you need |
| 192 // thread-safe initialization, use base/lazy_instance.h instead. | 192 // thread-safe initialization, use base/lazy_instance.h instead. |
| 193 #define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \ | 193 #define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \ |
| 194 static type& name = *new type arguments | 194 static type& name = *new type arguments |
| 195 | 195 |
| 196 } // base | 196 } // base |
| 197 | 197 |
| 198 #endif // BASE_MACROS_H_ | 198 #endif // BASE_MACROS_H_ |
| OLD | NEW |