Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: base/macros.h

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/mac/scoped_typeref.h ('k') | base/md5_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // This template function declaration is used in defining arraysize. 45 // This template function declaration is used in defining arraysize.
46 // Note that the function doesn't need an implementation, as we only 46 // Note that the function doesn't need an implementation, as we only
47 // use its type. 47 // use its type.
48 template <typename T, size_t N> char (&ArraySizeHelper(T (&array)[N]))[N]; 48 template <typename T, size_t N> char (&ArraySizeHelper(T (&array)[N]))[N];
49 #define arraysize(array) (sizeof(ArraySizeHelper(array))) 49 #define arraysize(array) (sizeof(ArraySizeHelper(array)))
50 50
51 // Used to explicitly mark the return value of a function as unused. If you are 51 // Used to explicitly mark the return value of a function as unused. If you are
52 // really sure you don't want to do anything with the return value of a function 52 // really sure you don't want to do anything with the return value of a function
53 // that has been marked WARN_UNUSED_RESULT, wrap it with this. Example: 53 // that has been marked WARN_UNUSED_RESULT, wrap it with this. Example:
54 // 54 //
55 // scoped_ptr<MyType> my_var = ...; 55 // std::unique_ptr<MyType> my_var = ...;
56 // if (TakeOwnership(my_var.get()) == SUCCESS) 56 // if (TakeOwnership(my_var.get()) == SUCCESS)
57 // ignore_result(my_var.release()); 57 // ignore_result(my_var.release());
58 // 58 //
59 template<typename T> 59 template<typename T>
60 inline void ignore_result(const T&) { 60 inline void ignore_result(const T&) {
61 } 61 }
62 62
63 // The following enum should be used only as a constructor argument to indicate 63 // The following enum should be used only as a constructor argument to indicate
64 // that the variable has static storage class, and that the constructor should 64 // that the variable has static storage class, and that the constructor should
65 // do nothing to its state. It indicates to the reader that it is legal to 65 // do nothing to its state. It indicates to the reader that it is legal to
(...skipping 12 matching lines...) Expand all
78 78
79 // Use these to declare and define a static local variable (static T;) so that 79 // Use these to declare and define a static local variable (static T;) so that
80 // it is leaked so that its destructors are not called at exit. If you need 80 // it is leaked so that its destructors are not called at exit. If you need
81 // thread-safe initialization, use base/lazy_instance.h instead. 81 // thread-safe initialization, use base/lazy_instance.h instead.
82 #define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \ 82 #define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \
83 static type& name = *new type arguments 83 static type& name = *new type arguments
84 84
85 } // base 85 } // base
86 86
87 #endif // BASE_MACROS_H_ 87 #endif // BASE_MACROS_H_
OLDNEW
« no previous file with comments | « base/mac/scoped_typeref.h ('k') | base/md5_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698