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

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

Issue 813883002: replace COMPILE_ASSERT with static_assert in platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: final fixups Created 6 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
« no previous file with comments | « Source/platform/geometry/Region.cpp ('k') | Source/platform/heap/Heap.h » ('j') | 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) 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 351 }
352 352
353 template<typename U> 353 template<typename U>
354 U* as() const 354 U* as() const
355 { 355 {
356 return static_cast<U*>(m_raw); 356 return static_cast<U*>(m_raw);
357 } 357 }
358 358
359 void trace(Visitor* visitor) 359 void trace(Visitor* visitor)
360 { 360 {
361 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis tent); 361 STATIC_ASSERT_IS_GARBAGE_COLLECTED(T, "non-garbage collected object shou ld not be in Persistent");
362 #if ENABLE(GC_PROFILE_MARKING) 362 #if ENABLE(GC_PROFILE_MARKING)
363 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tr acingName); 363 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tr acingName);
364 #endif 364 #endif
365 visitor->mark(m_raw); 365 visitor->mark(m_raw);
366 } 366 }
367 367
368 RawPtr<T> release() 368 RawPtr<T> release()
369 { 369 {
370 RawPtr<T> result = m_raw; 370 RawPtr<T> result = m_raw;
371 m_raw = nullptr; 371 m_raw = nullptr;
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 #define WillBeHeapTerminatedArrayBuilder blink::HeapTerminatedArrayBuilder 812 #define WillBeHeapTerminatedArrayBuilder blink::HeapTerminatedArrayBuilder
813 #define WillBeHeapLinkedStack blink::HeapLinkedStack 813 #define WillBeHeapLinkedStack blink::HeapLinkedStack
814 #define PersistentHeapHashMapWillBeHeapHashMap blink::HeapHashMap 814 #define PersistentHeapHashMapWillBeHeapHashMap blink::HeapHashMap
815 #define PersistentHeapHashSetWillBeHeapHashSet blink::HeapHashSet 815 #define PersistentHeapHashSetWillBeHeapHashSet blink::HeapHashSet
816 #define PersistentHeapDequeWillBeHeapDeque blink::HeapDeque 816 #define PersistentHeapDequeWillBeHeapDeque blink::HeapDeque
817 #define PersistentHeapVectorWillBeHeapVector blink::HeapVector 817 #define PersistentHeapVectorWillBeHeapVector blink::HeapVector
818 818
819 template<typename T> T* adoptRefWillBeNoop(T* ptr) 819 template<typename T> T* adoptRefWillBeNoop(T* ptr)
820 { 820 {
821 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value; 821 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value;
822 COMPILE_ASSERT(notRefCounted, youMustAdopt); 822 static_assert(notRefCounted, "you must adopt");
823 return ptr; 823 return ptr;
824 } 824 }
825 825
826 template<typename T> T* adoptPtrWillBeNoop(T* ptr) 826 template<typename T> T* adoptPtrWillBeNoop(T* ptr)
827 { 827 {
828 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value; 828 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value;
829 COMPILE_ASSERT(notRefCounted, youMustAdopt); 829 static_assert(notRefCounted, "you must adopt");
830 return ptr; 830 return ptr;
831 } 831 }
832 832
833 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED // do nothing when oilpan is ena bled. 833 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED // do nothing when oilpan is ena bled.
834 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing 834 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing
835 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing 835 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing
836 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing 836 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing
837 837
838 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ 838 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \
839 static type* name = (new Persistent<type>(arguments))->get(); 839 static type* name = (new Persistent<type>(arguments))->get();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 template<typename T> 1188 template<typename T>
1189 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin k::IsGarbageCollectedType<T>::value> { 1189 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin k::IsGarbageCollectedType<T>::value> {
1190 }; 1190 };
1191 1191
1192 template<typename T> 1192 template<typename T>
1193 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; 1193 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete;
1194 1194
1195 } // namespace WTF 1195 } // namespace WTF
1196 1196
1197 #endif 1197 #endif
OLDNEW
« no previous file with comments | « Source/platform/geometry/Region.cpp ('k') | Source/platform/heap/Heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698