| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef GarbageCollected_h | 5 #ifndef GarbageCollected_h |
| 6 #define GarbageCollected_h | 6 #define GarbageCollected_h |
| 7 | 7 |
| 8 #include "platform/heap/ThreadState.h" | 8 #include "platform/heap/ThreadState.h" |
| 9 #include "wtf/Assertions.h" | 9 #include "wtf/Assertions.h" |
| 10 #include "wtf/ListHashSet.h" | 10 #include "wtf/ListHashSet.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 template <typename T> const bool NeedsAdjustAndMark<T, true>::value; | 415 template <typename T> const bool NeedsAdjustAndMark<T, true>::value; |
| 416 | 416 |
| 417 template<typename T> | 417 template<typename T> |
| 418 class NeedsAdjustAndMark<T, false> { | 418 class NeedsAdjustAndMark<T, false> { |
| 419 static_assert(sizeof(T), "T must be fully defined"); | 419 static_assert(sizeof(T), "T must be fully defined"); |
| 420 public: | 420 public: |
| 421 static const bool value = IsGarbageCollectedMixin<typename WTF::RemoveConst<
T>::Type>::value; | 421 static const bool value = IsGarbageCollectedMixin<typename WTF::RemoveConst<
T>::Type>::value; |
| 422 }; | 422 }; |
| 423 template <typename T> const bool NeedsAdjustAndMark<T, false>::value; | 423 template <typename T> const bool NeedsAdjustAndMark<T, false>::value; |
| 424 | 424 |
| 425 // TODO(sof): migrate to wtf/TypeTraits.h |
| 426 template<typename T> |
| 427 class IsFullyDefined { |
| 428 using TrueType = char; |
| 429 struct FalseType { |
| 430 char dummy[2]; |
| 431 }; |
| 432 |
| 433 template<typename U, size_t sz = sizeof(U)> static TrueType isSizeofKnown(U*
); |
| 434 static FalseType isSizeofKnown(...); |
| 435 static T& t; |
| 436 public: |
| 437 static const bool value = sizeof(TrueType) == sizeof(isSizeofKnown(&t)); |
| 438 }; |
| 439 |
| 425 } // namespace blink | 440 } // namespace blink |
| 426 | 441 |
| 427 #endif | 442 #endif |
| OLD | NEW |