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

Side by Side Diff: Source/wtf/TypeTraits.h

Issue 23531003: Type check when upcasting PassOwnPtr/PassOwnArrayPtr to avoid possible function call ambiguousness (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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
« Source/wtf/PassRefPtr.h ('K') | « Source/wtf/RefPtr.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // but the implementation returns false for built-in types. We add the extra IsPod condition to 239 // but the implementation returns false for built-in types. We add the extra IsPod condition to
240 // work around this. 240 // work around this.
241 template <typename T> struct HasTrivialConstructor { 241 template <typename T> struct HasTrivialConstructor {
242 static const bool value = __has_trivial_constructor(T) || IsPod<RemoveCo nstVolatile<T> >::value; 242 static const bool value = __has_trivial_constructor(T) || IsPod<RemoveCo nstVolatile<T> >::value;
243 }; 243 };
244 template <typename T> struct HasTrivialDestructor { 244 template <typename T> struct HasTrivialDestructor {
245 static const bool value = __has_trivial_destructor(T) || IsPod<RemoveCon stVolatile<T> >::value; 245 static const bool value = __has_trivial_destructor(T) || IsPod<RemoveCon stVolatile<T> >::value;
246 }; 246 };
247 247
248 #define EnsurePtrConvertibleType(ReturnType, From, To) \ 248 #define EnsurePtrConvertibleType(ReturnType, From, To) \
249 typename EnableIf<IsPointerConvertible<From, To>::Value, ReturnType>::Type 249 typename EnableIf<IsPointerConvertible<From, To>::Value, ReturnType>::Type
Nico 2013/08/29 19:58:47 …here it is, right? I don't see the value in remov
Nico 2013/08/31 20:51:34 Any thoughts on this comment?
250 #define EnsurePtrConvertibleArgDecl(From, To) \
251 EnsurePtrConvertibleType(bool, From, To) = true
252 #define EnsurePtrConvertibleArgDefn(From, To) \
253 EnsurePtrConvertibleType(bool, From, To)
254 250
255 } // namespace WTF 251 } // namespace WTF
256 252
257 namespace WebCore { 253 namespace WebCore {
258 254
259 class JSONValue; 255 class JSONValue;
260 256
261 } // namespace WebCore 257 } // namespace WebCore
262 258
263 namespace WTF { 259 namespace WTF {
264 260
265 // FIXME: Disable pointer conversion checking against JSONValue. 261 // FIXME: Disable pointer conversion checking against JSONValue.
266 // The current CodeGeneratorInspector.py generates code which upcasts to JSO NValue from undefined types. 262 // The current CodeGeneratorInspector.py generates code which upcasts to JSO NValue from undefined types.
267 template<typename From> class IsPointerConvertible<From, WebCore::JSONValue> { 263 template<typename From> class IsPointerConvertible<From, WebCore::JSONValue> {
268 public: 264 public:
269 enum { 265 enum {
270 Value = true 266 Value = true
271 }; 267 };
272 }; 268 };
273 269
274 } // namespace WTF 270 } // namespace WTF
275 271
276 272
277 #endif // TypeTraits_h 273 #endif // TypeTraits_h
OLDNEW
« Source/wtf/PassRefPtr.h ('K') | « Source/wtf/RefPtr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698