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

Unified Diff: third_party/WebKit/Source/wtf/TypeTraits.h

Issue 1611343002: wtf reformat test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pydent Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/TriState.h ('k') | third_party/WebKit/Source/wtf/TypeTraits.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/TypeTraits.h
diff --git a/third_party/WebKit/Source/wtf/TypeTraits.h b/third_party/WebKit/Source/wtf/TypeTraits.h
index 002ec4fd6e6cfdf5a29c27cb7c7866052b3b6082..f8f83d7a87d6e2872223c93b143bd7aac57b7813 100644
--- a/third_party/WebKit/Source/wtf/TypeTraits.h
+++ b/third_party/WebKit/Source/wtf/TypeTraits.h
@@ -1,4 +1,4 @@
- /*
+/*
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2009, 2010 Google Inc. All rights reserved.
*
@@ -31,101 +31,115 @@
namespace WTF {
// Returns a string that contains the type name of |T| as a substring.
-template<typename T>
-inline const char* getStringWithTypeName()
-{
- return WTF_PRETTY_FUNCTION;
+template <typename T>
+inline const char* getStringWithTypeName() {
+ return WTF_PRETTY_FUNCTION;
}
-template<typename T> class RawPtr;
+template <typename T>
+class RawPtr;
-template <typename T> struct IsWeak {
- static const bool value = false;
+template <typename T>
+struct IsWeak {
+ static const bool value = false;
};
enum WeakHandlingFlag {
- NoWeakHandlingInCollections,
- WeakHandlingInCollections
+ NoWeakHandlingInCollections,
+ WeakHandlingInCollections
};
-template <typename T> struct IsTriviallyCopyAssignable {
- static const bool value = __has_trivial_assign(T);
+template <typename T>
+struct IsTriviallyCopyAssignable {
+ static const bool value = __has_trivial_assign(T);
};
-template <typename T> struct IsTriviallyMoveAssignable {
- static const bool value = __has_trivial_assign(T);
+template <typename T>
+struct IsTriviallyMoveAssignable {
+ static const bool value = __has_trivial_assign(T);
};
-template <typename T> struct IsTriviallyDefaultConstructible {
- static const bool value = __has_trivial_constructor(T);
+template <typename T>
+struct IsTriviallyDefaultConstructible {
+ static const bool value = __has_trivial_constructor(T);
};
-template <typename T> struct IsTriviallyDestructible {
- static const bool value = __has_trivial_destructor(T);
+template <typename T>
+struct IsTriviallyDestructible {
+ static const bool value = __has_trivial_destructor(T);
};
-template <typename T, typename U> class IsSubclass {
- typedef char YesType;
- struct NoType {
- char padding[8];
- };
-
- static YesType subclassCheck(U*);
- static NoType subclassCheck(...);
- static T* t;
-public:
- static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
+template <typename T, typename U>
+class IsSubclass {
+ typedef char YesType;
+ struct NoType {
+ char padding[8];
+ };
+
+ static YesType subclassCheck(U*);
+ static NoType subclassCheck(...);
+ static T* t;
+
+ public:
+ static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
};
-template <typename T, template <typename... V> class U> class IsSubclassOfTemplate {
- typedef char YesType;
- struct NoType {
- char padding[8];
- };
-
- template <typename... W> static YesType subclassCheck(U<W...>*);
- static NoType subclassCheck(...);
- static T* t;
-public:
- static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
+template <typename T, template <typename... V> class U>
+class IsSubclassOfTemplate {
+ typedef char YesType;
+ struct NoType {
+ char padding[8];
+ };
+
+ template <typename... W>
+ static YesType subclassCheck(U<W...>*);
+ static NoType subclassCheck(...);
+ static T* t;
+
+ public:
+ static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
};
template <typename T, template <typename V, size_t W> class U>
class IsSubclassOfTemplateTypenameSize {
- typedef char YesType;
- struct NoType {
- char padding[8];
- };
-
- template <typename X, size_t Y> static YesType subclassCheck(U<X, Y>*);
- static NoType subclassCheck(...);
- static T* t;
-public:
- static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
+ typedef char YesType;
+ struct NoType {
+ char padding[8];
+ };
+
+ template <typename X, size_t Y>
+ static YesType subclassCheck(U<X, Y>*);
+ static NoType subclassCheck(...);
+ static T* t;
+
+ public:
+ static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
};
template <typename T, template <typename V, size_t W, typename X> class U>
class IsSubclassOfTemplateTypenameSizeTypename {
- typedef char YesType;
- struct NoType {
- char padding[8];
- };
-
- template <typename Y, size_t Z, typename A> static YesType subclassCheck(U<Y, Z, A>*);
- static NoType subclassCheck(...);
- static T* t;
-public:
- static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
+ typedef char YesType;
+ struct NoType {
+ char padding[8];
+ };
+
+ template <typename Y, size_t Z, typename A>
+ static YesType subclassCheck(U<Y, Z, A>*);
+ static NoType subclassCheck(...);
+ static T* t;
+
+ public:
+ static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
};
template <typename T, template <class V> class OuterTemplate>
struct RemoveTemplate {
- typedef T Type;
+ typedef T Type;
};
template <typename T, template <class V> class OuterTemplate>
struct RemoveTemplate<OuterTemplate<T>, OuterTemplate> {
- typedef T Type;
+ typedef T Type;
};
#if (COMPILER(MSVC) || !GCC_VERSION_AT_LEAST(4, 9, 0)) && !COMPILER(CLANG)
@@ -137,125 +151,143 @@ struct RemoveTemplate<OuterTemplate<T>, OuterTemplate> {
// Here, we use a template specialization for same type case to allow incomplete
// types.
-template <typename T, typename U> class IsBaseOf {
-public:
- static const bool value = std::is_base_of<T, U>::value;
+template <typename T, typename U>
+class IsBaseOf {
+ public:
+ static const bool value = std::is_base_of<T, U>::value;
};
-template <typename T> class IsBaseOf<T, T> {
-public:
- static const bool value = true;
+template <typename T>
+class IsBaseOf<T, T> {
+ public:
+ static const bool value = true;
};
#define EnsurePtrConvertibleArgDecl(From, To) \
- typename std::enable_if<WTF::IsBaseOf<To, From>::value>::type* = nullptr
+ typename std::enable_if<WTF::IsBaseOf<To, From>::value>::type* = nullptr
#define EnsurePtrConvertibleArgDefn(From, To) \
- typename std::enable_if<WTF::IsBaseOf<To, From>::value>::type*
+ typename std::enable_if<WTF::IsBaseOf<To, From>::value>::type*
#else
#define EnsurePtrConvertibleArgDecl(From, To) \
- typename std::enable_if<std::is_base_of<To, From>::value>::type* = nullptr
+ typename std::enable_if<std::is_base_of<To, From>::value>::type* = nullptr
#define EnsurePtrConvertibleArgDefn(From, To) \
- typename std::enable_if<std::is_base_of<To, From>::value>::type*
+ typename std::enable_if<std::is_base_of<To, From>::value>::type*
#endif
-} // namespace WTF
+} // namespace WTF
namespace blink {
class Visitor;
-} // namespace blink
+} // namespace blink
namespace WTF {
template <typename T>
class NeedsTracing {
- typedef char YesType;
- typedef struct NoType {
- char padding[8];
- } NoType;
-
- // Note that this also checks if a superclass of V has a trace method.
- template <typename V> static YesType checkHasTraceMethod(V* v, blink::Visitor* p = nullptr, typename std::enable_if<std::is_same<decltype(v->trace(p)), void>::value>::type* g = nullptr);
- template <typename V> static NoType checkHasTraceMethod(...);
-public:
- // We add sizeof(T) to both sides here, because we want it to fail for
- // incomplete types. Otherwise it just assumes that incomplete types do not
- // have a trace method, which may not be true.
- static const bool value = sizeof(YesType) + sizeof(T) == sizeof(checkHasTraceMethod<T>(nullptr)) + sizeof(T);
+ typedef char YesType;
+ typedef struct NoType { char padding[8]; } NoType;
+
+ // Note that this also checks if a superclass of V has a trace method.
+ template <typename V>
+ static YesType checkHasTraceMethod(
+ V* v,
+ blink::Visitor* p = nullptr,
+ typename std::enable_if<
+ std::is_same<decltype(v->trace(p)), void>::value>::type* g = nullptr);
+ template <typename V>
+ static NoType checkHasTraceMethod(...);
+
+ public:
+ // We add sizeof(T) to both sides here, because we want it to fail for
+ // incomplete types. Otherwise it just assumes that incomplete types do not
+ // have a trace method, which may not be true.
+ static const bool value = sizeof(YesType) + sizeof(T) ==
+ sizeof(checkHasTraceMethod<T>(nullptr)) + sizeof(T);
};
// Convenience template wrapping the NeedsTracingLazily template in
// Collection Traits. It helps make the code more readable.
template <typename Traits>
class NeedsTracingTrait {
-public:
- static const bool value = Traits::template NeedsTracingLazily<>::value;
+ public:
+ static const bool value = Traits::template NeedsTracingLazily<>::value;
};
template <typename T, typename U>
struct NeedsTracing<std::pair<T, U>> {
- static const bool value = NeedsTracing<T>::value || NeedsTracing<U>::value || IsWeak<T>::value || IsWeak<U>::value;
+ static const bool value = NeedsTracing<T>::value || NeedsTracing<U>::value ||
+ IsWeak<T>::value || IsWeak<U>::value;
};
// This is used to check that DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects are not
// stored in off-heap Vectors, HashTables etc.
template <typename T>
struct AllowsOnlyPlacementNew {
-private:
- using YesType = char;
- struct NoType {
- char padding[8];
- };
-
- template <typename U> static YesType checkMarker(typename U::IsAllowOnlyPlacementNew*);
- template <typename U> static NoType checkMarker(...);
-public:
- static const bool value = sizeof(checkMarker<T>(nullptr)) == sizeof(YesType);
+ private:
+ using YesType = char;
+ struct NoType {
+ char padding[8];
+ };
+
+ template <typename U>
+ static YesType checkMarker(typename U::IsAllowOnlyPlacementNew*);
+ template <typename U>
+ static NoType checkMarker(...);
+
+ public:
+ static const bool value = sizeof(checkMarker<T>(nullptr)) == sizeof(YesType);
};
-template<typename T>
+template <typename T>
class IsGarbageCollectedType {
- typedef char YesType;
- typedef struct NoType {
- char padding[8];
- } NoType;
-
- template <typename U> static YesType checkGarbageCollectedType(typename U::IsGarbageCollectedTypeMarker*);
- template <typename U> static NoType checkGarbageCollectedType(...);
-public:
- static const bool value = (sizeof(YesType) == sizeof(checkGarbageCollectedType<T>(nullptr)));
+ typedef char YesType;
+ typedef struct NoType { char padding[8]; } NoType;
+
+ template <typename U>
+ static YesType checkGarbageCollectedType(
+ typename U::IsGarbageCollectedTypeMarker*);
+ template <typename U>
+ static NoType checkGarbageCollectedType(...);
+
+ public:
+ static const bool value =
+ (sizeof(YesType) == sizeof(checkGarbageCollectedType<T>(nullptr)));
};
-template<typename T>
+template <typename T>
class IsPersistentReferenceType {
- typedef char YesType;
- typedef struct NoType {
- char padding[8];
- } NoType;
-
- template <typename U> static YesType checkPersistentReferenceType(typename U::IsPersistentReferenceTypeMarker*);
- template <typename U> static NoType checkPersistentReferenceType(...);
-public:
- static const bool value = (sizeof(YesType) == sizeof(checkPersistentReferenceType<T>(nullptr)));
+ typedef char YesType;
+ typedef struct NoType { char padding[8]; } NoType;
+
+ template <typename U>
+ static YesType checkPersistentReferenceType(
+ typename U::IsPersistentReferenceTypeMarker*);
+ template <typename U>
+ static NoType checkPersistentReferenceType(...);
+
+ public:
+ static const bool value =
+ (sizeof(YesType) == sizeof(checkPersistentReferenceType<T>(nullptr)));
};
-template<typename T>
+template <typename T>
class IsPointerToGarbageCollectedType {
-public:
- static const bool value = false;
+ public:
+ static const bool value = false;
};
-template<typename T>
+template <typename T>
class IsPointerToGarbageCollectedType<T*> {
-public:
- static const bool value = IsGarbageCollectedType<T>::value;
+ public:
+ static const bool value = IsGarbageCollectedType<T>::value;
};
-template<typename T>
+template <typename T>
class IsPointerToGarbageCollectedType<RawPtr<T>> {
-public:
- static const bool value = IsGarbageCollectedType<T>::value;
+ public:
+ static const bool value = IsGarbageCollectedType<T>::value;
};
-} // namespace WTF
+} // namespace WTF
-#endif // TypeTraits_h
+#endif // TypeTraits_h
« no previous file with comments | « third_party/WebKit/Source/wtf/TriState.h ('k') | third_party/WebKit/Source/wtf/TypeTraits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698