| 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 #include "base/compiler_specific.h" // For ALLOW_UNUSED. | |
| 17 | |
| 18 // Put this in the private: declarations for a class to be uncopyable. | 16 // Put this in the private: declarations for a class to be uncopyable. |
| 19 #define DISALLOW_COPY(TypeName) \ | 17 #define DISALLOW_COPY(TypeName) \ |
| 20 TypeName(const TypeName&) | 18 TypeName(const TypeName&) |
| 21 | 19 |
| 22 // Put this in the private: declarations for a class to be unassignable. | 20 // Put this in the private: declarations for a class to be unassignable. |
| 23 #define DISALLOW_ASSIGN(TypeName) \ | 21 #define DISALLOW_ASSIGN(TypeName) \ |
| 24 void operator=(const TypeName&) | 22 void operator=(const TypeName&) |
| 25 | 23 |
| 26 // A macro to disallow the copy constructor and operator= functions | 24 // A macro to disallow the copy constructor and operator= functions |
| 27 // This should be used in the private: declarations for a class | 25 // This should be used in the private: declarations for a class |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 199 |
| 202 // Use these to declare and define a static local variable (static T;) so that | 200 // Use these to declare and define a static local variable (static T;) so that |
| 203 // it is leaked so that its destructors are not called at exit. If you need | 201 // it is leaked so that its destructors are not called at exit. If you need |
| 204 // thread-safe initialization, use base/lazy_instance.h instead. | 202 // thread-safe initialization, use base/lazy_instance.h instead. |
| 205 #define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \ | 203 #define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \ |
| 206 static type& name = *new type arguments | 204 static type& name = *new type arguments |
| 207 | 205 |
| 208 } // base | 206 } // base |
| 209 | 207 |
| 210 #endif // BASE_MACROS_H_ | 208 #endif // BASE_MACROS_H_ |
| OLD | NEW |