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

Side by Side Diff: Source/heap/Heap.h

Issue 197343003: Fix PersistentHeapHashMap to work with stack allocated, heap backed weak collections (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/heap/Heap.cpp » ('j') | Source/wtf/HashTable.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 // Push a trace callback on the marking stack. 772 // Push a trace callback on the marking stack.
773 static void pushTraceCallback(void* containerObject, TraceCallback); 773 static void pushTraceCallback(void* containerObject, TraceCallback);
774 774
775 // Push a weak pointer callback on the weak callback 775 // Push a weak pointer callback on the weak callback
776 // stack. General object pointer callbacks are pushed on a thread 776 // stack. General object pointer callbacks are pushed on a thread
777 // local weak callback stack and the callback is called on the 777 // local weak callback stack and the callback is called on the
778 // thread that owns the object. Cell pointer callbacks are pushed 778 // thread that owns the object. Cell pointer callbacks are pushed
779 // on a static callback stack and the weak callback is performed 779 // on a static callback stack and the weak callback is performed
780 // on the thread performing garbage collection. This is OK because 780 // on the thread performing garbage collection. This is OK because
781 // cells are just cleared and no deallocation can happen. 781 // cells are just cleared and no deallocation can happen.
782 static void pushWeakObjectPointerCallback(void* containerObject, WeakPointer Callback); 782 static void pushWeakObjectPointerCallback(void* closure, void* containerObje ct, WeakPointerCallback);
Mads Ager (chromium) 2014/03/12 15:46:50 Please update the comment with an explanation of w
Erik Corry 2014/03/13 07:46:21 Done.
783 static void pushWeakCellPointerCallback(void** cell, WeakPointerCallback); 783 static void pushWeakCellPointerCallback(void** cell, WeakPointerCallback);
784 784
785 // Pop the top of the marking stack and call the callback with the visitor 785 // Pop the top of the marking stack and call the callback with the visitor
786 // and the object. Returns false when there is nothing more to do. 786 // and the object. Returns false when there is nothing more to do.
787 static bool popAndInvokeTraceCallback(Visitor*); 787 static bool popAndInvokeTraceCallback(Visitor*);
788 788
789 // Pop the top of the weak callback stack and call the callback with the vis itor 789 // Pop the top of the weak callback stack and call the callback with the vis itor
790 // and the object. Returns false when there is nothing more to do. 790 // and the object. Returns false when there is nothing more to do.
791 static bool popAndInvokeWeakPointerCallback(Visitor*); 791 static bool popAndInvokeWeakPointerCallback(Visitor*);
792 792
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 { 1256 {
1257 return !visitor->isAlive(t); 1257 return !visitor->isAlive(t);
1258 } 1258 }
1259 1259
1260 template<typename T, typename U> 1260 template<typename T, typename U>
1261 static bool hasDeadMember(Visitor* visitor, const WTF::KeyValuePair<T, U>& t ) 1261 static bool hasDeadMember(Visitor* visitor, const WTF::KeyValuePair<T, U>& t )
1262 { 1262 {
1263 return hasDeadMember(visitor, t.key) || hasDeadMember(visitor, t.value); 1263 return hasDeadMember(visitor, t.key) || hasDeadMember(visitor, t.value);
1264 } 1264 }
1265 1265
1266 static void registerWeakMembers(Visitor* visitor, const void* object, WeakPo interCallback callback) 1266 static void registerWeakMembers(Visitor* visitor, const void* closure, const void* object, WeakPointerCallback callback)
1267 { 1267 {
1268 visitor->registerWeakMembers(object, callback); 1268 visitor->registerWeakMembers(closure, object, callback);
1269 } 1269 }
1270 1270
1271 template<typename T> 1271 template<typename T>
1272 struct ResultType { 1272 struct ResultType {
1273 typedef T* Type; 1273 typedef T* Type;
1274 }; 1274 };
1275 1275
1276 // The WTF classes use Allocator::VectorBackingHelper in order to find a 1276 // The WTF classes use Allocator::VectorBackingHelper in order to find a
1277 // class to template their backing allocation operation on. For off-heap 1277 // class to template their backing allocation operation on. For off-heap
1278 // allocations the VectorBackingHelper is a dummy class, since the class is 1278 // allocations the VectorBackingHelper is a dummy class, since the class is
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 // to export. This forces it to export all the methods from ThreadHeap. 1709 // to export. This forces it to export all the methods from ThreadHeap.
1710 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*); 1710 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*);
1711 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); 1711 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*);
1712 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; 1712 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>;
1713 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>; 1713 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>;
1714 #endif 1714 #endif
1715 1715
1716 } 1716 }
1717 1717
1718 #endif // Heap_h 1718 #endif // Heap_h
OLDNEW
« no previous file with comments | « no previous file | Source/heap/Heap.cpp » ('j') | Source/wtf/HashTable.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698