| 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 c5199c173c2c4d6b9286d2ee525480ff9e326986..f0a0e7d6b167550370a26e2be94b5d2cfa100621 100644
|
| --- a/third_party/WebKit/Source/wtf/TypeTraits.h
|
| +++ b/third_party/WebKit/Source/wtf/TypeTraits.h
|
| @@ -23,9 +23,11 @@
|
| #define TypeTraits_h
|
|
|
| #include <cstddef>
|
| +#include <limits>
|
| #include <type_traits>
|
| #include <utility>
|
|
|
| +#include "base/template_util.h"
|
| #include "wtf/Compiler.h"
|
|
|
| namespace WTF {
|
| @@ -141,6 +143,18 @@ template <typename T> struct IsTriviallyDestructible {
|
| #endif
|
| };
|
|
|
| +// In MSVC, enums default to 'int' as their underlying type, which means when
|
| +// they are interpreted as signed when read out of a bitfield. This causes
|
| +// issues when trying to serialize/deserialize an enum from a bitfield. To fix
|
| +// this, ensure that all bitfields use an unsigned underlying type, e.g.
|
| +// enum class Foo : unsigned {}.
|
| +// TODO(sashab): Migrate this to be a clang plugin instead.
|
| +template <typename T>
|
| +struct IsEnumSafeToStoreInBitfield {
|
| + static_assert(std::is_enum<T>::value, "T must be an enum.");
|
| + static const bool value = !std::numeric_limits<base::underlying_type<T>>::is_signed;
|
| +};
|
| +
|
| template <typename T, typename U> struct IsSubclass {
|
| private:
|
| typedef char YesType;
|
|
|