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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Handle.h

Issue 1461193003: Revert of [Oilpan] Prepare full definition of classes before using Member (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make patch applicable Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 m_raw = nullptr; 764 m_raw = nullptr;
765 return *this; 765 return *this;
766 } 766 }
767 767
768 void swap(Member<T>& other) 768 void swap(Member<T>& other)
769 { 769 {
770 std::swap(m_raw, other.m_raw); 770 std::swap(m_raw, other.m_raw);
771 checkPointer(); 771 checkPointer();
772 } 772 }
773 773
774 T* get() const 774 T* get() const { return m_raw; }
775 {
776 static_assert(IsFullyDefined<T>::value, "T is not fully defined.");
777 return m_raw;
778 }
779 775
780 void clear() { m_raw = nullptr; } 776 void clear() { m_raw = nullptr; }
781 777
782 778
783 protected: 779 protected:
784 void checkPointer() 780 void checkPointer()
785 { 781 {
786 static_assert(IsFullyDefined<T>::value, "T is not fully defined.");
787
788 #if ENABLE(ASSERT) && defined(ADDRESS_SANITIZER) 782 #if ENABLE(ASSERT) && defined(ADDRESS_SANITIZER)
789 if (!m_raw) 783 if (!m_raw)
790 return; 784 return;
791 // HashTable can store a special value (which is not aligned to the 785 // HashTable can store a special value (which is not aligned to the
792 // allocation granularity) to Member<> to represent a deleted entry. 786 // allocation granularity) to Member<> to represent a deleted entry.
793 // Thus we treat a pointer that is not aligned to the granularity 787 // Thus we treat a pointer that is not aligned to the granularity
794 // as a valid pointer. 788 // as a valid pointer.
795 if (reinterpret_cast<intptr_t>(m_raw) % allocationGranularity) 789 if (reinterpret_cast<intptr_t>(m_raw) % allocationGranularity)
796 return; 790 return;
797 791
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 // TODO(sof): extend WTF::FunctionWrapper call overloading to also handle (C rossThread)WeakPersistent. 1504 // TODO(sof): extend WTF::FunctionWrapper call overloading to also handle (C rossThread)WeakPersistent.
1511 static T* unwrap(const StorageType& value) { return value.get(); } 1505 static T* unwrap(const StorageType& value) { return value.get(); }
1512 }; 1506 };
1513 1507
1514 template<typename T> 1508 template<typename T>
1515 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; 1509 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete;
1516 1510
1517 } // namespace WTF 1511 } // namespace WTF
1518 1512
1519 #endif 1513 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698