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

Side by Side Diff: base/callback_internal.h

Issue 676743003: Adding /analyze support to common.gypi through GYP_DEFINES=win_analyze=1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment location Created 6 years, 1 month 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 | « no previous file | build/common.gypi » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 utility functions and classes that help the 5 // This file contains utility functions and classes that help the
6 // implementation, and management of the Callback objects. 6 // implementation, and management of the Callback objects.
7 7
8 #ifndef BASE_CALLBACK_INTERNAL_H_ 8 #ifndef BASE_CALLBACK_INTERNAL_H_
9 #define BASE_CALLBACK_INTERNAL_H_ 9 #define BASE_CALLBACK_INTERNAL_H_
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // A helper template to determine if given type is non-const move-only-type, 70 // A helper template to determine if given type is non-const move-only-type,
71 // i.e. if a value of the given type should be passed via .Pass() in a 71 // i.e. if a value of the given type should be passed via .Pass() in a
72 // destructive way. 72 // destructive way.
73 template <typename T> struct IsMoveOnlyType { 73 template <typename T> struct IsMoveOnlyType {
74 template <typename U> 74 template <typename U>
75 static YesType Test(const typename U::MoveOnlyTypeForCPP03*); 75 static YesType Test(const typename U::MoveOnlyTypeForCPP03*);
76 76
77 template <typename U> 77 template <typename U>
78 static NoType Test(...); 78 static NoType Test(...);
79 79
80 static const bool value = sizeof(Test<T>(0)) == sizeof(YesType) && 80 static const bool value = sizeof((Test<T>(0))) == sizeof(YesType) &&
81 !is_const<T>::value; 81 !is_const<T>::value;
82 }; 82 };
83 83
84 // This is a typetraits object that's used to take an argument type, and 84 // This is a typetraits object that's used to take an argument type, and
85 // extract a suitable type for storing and forwarding arguments. 85 // extract a suitable type for storing and forwarding arguments.
86 // 86 //
87 // In particular, it strips off references, and converts arrays to 87 // In particular, it strips off references, and converts arrays to
88 // pointers for storage; and it avoids accidentally trying to create a 88 // pointers for storage; and it avoids accidentally trying to create a
89 // "reference of a reference" if the argument is a reference type. 89 // "reference of a reference" if the argument is a reference type.
90 // 90 //
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 template <typename T> 170 template <typename T>
171 typename enable_if<IsMoveOnlyType<T>::value, T>::type CallbackForward(T& t) { 171 typename enable_if<IsMoveOnlyType<T>::value, T>::type CallbackForward(T& t) {
172 return t.Pass(); 172 return t.Pass();
173 } 173 }
174 174
175 } // namespace internal 175 } // namespace internal
176 } // namespace base 176 } // namespace base
177 177
178 #endif // BASE_CALLBACK_INTERNAL_H_ 178 #endif // BASE_CALLBACK_INTERNAL_H_
OLDNEW
« no previous file with comments | « no previous file | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698