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

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

Issue 205173002: Move webaudio to oilpan (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
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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 delete m_keepAlive; 999 delete m_keepAlive;
1000 m_keepAlive = 0; 1000 m_keepAlive = 0;
1001 } 1001 }
1002 } 1002 }
1003 1003
1004 bool hasOneRef() 1004 bool hasOneRef()
1005 { 1005 {
1006 return m_refCount == 1; 1006 return m_refCount == 1;
1007 } 1007 }
1008 1008
1009 int refCount()
1010 {
1011 return m_refCount;
1012 }
1013
1009 protected: 1014 protected:
1010 ~RefCountedGarbageCollected() { } 1015 ~RefCountedGarbageCollected() { }
1011 1016
1012 private: 1017 private:
1013 int m_refCount; 1018 int m_refCount;
1014 Persistent<T>* m_keepAlive; 1019 Persistent<T>* m_keepAlive;
1015 }; 1020 };
1016 1021
1017 template<typename T> 1022 template<typename T>
1018 T* adoptRefCountedGarbageCollected(T* ptr) 1023 T* adoptRefCountedGarbageCollected(T* ptr)
1019 { 1024 {
1020 ASSERT(ptr->hasOneRef());
Mads Ager (chromium) 2014/03/20 08:30:00 All ref counted object should start with ref count
keishi 2014/03/27 07:39:37 I was hitting this at one point but the issue seem
1021 ptr->deref(); 1025 ptr->deref();
1022 WTF::adopted(ptr); 1026 WTF::adopted(ptr);
1023 return ptr; 1027 return ptr;
1024 } 1028 }
1025 1029
1026 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS) 1030 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
1027 #define DISALLOW_ALLOCATION() \ 1031 #define DISALLOW_ALLOCATION() \
1028 private: \ 1032 private: \
1029 void* operator new(size_t) = delete; 1033 void* operator new(size_t) = delete;
1030 #else 1034 #else
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 ASSERT(heapPageFromAddress(headerAddress + allocationSize - 1)); 1138 ASSERT(heapPageFromAddress(headerAddress + allocationSize - 1));
1135 return result; 1139 return result;
1136 } 1140 }
1137 1141
1138 // FIXME: Allocate objects that do not need finalization separately 1142 // FIXME: Allocate objects that do not need finalization separately
1139 // and use separate sweeping to not have to check for finalizers. 1143 // and use separate sweeping to not have to check for finalizers.
1140 template<typename T> 1144 template<typename T>
1141 Address Heap::allocate(size_t size) 1145 Address Heap::allocate(size_t size)
1142 { 1146 {
1143 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(); 1147 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state();
1148 ASSERT(state);
Mads Ager (chromium) 2014/03/20 08:30:00 I would remove this assert. The assert below will
keishi 2014/03/27 07:39:37 Removed.
1144 ASSERT(state->isAllocationAllowed()); 1149 ASSERT(state->isAllocationAllowed());
1145 BaseHeap* heap = state->heap(HeapTrait<T>::index); 1150 BaseHeap* heap = state->heap(HeapTrait<T>::index);
1146 Address addr = 1151 Address addr =
1147 static_cast<typename HeapTrait<T>::HeapType*>(heap)->allocate(size, GCIn foTrait<T>::get()); 1152 static_cast<typename HeapTrait<T>::HeapType*>(heap)->allocate(size, GCIn foTrait<T>::get());
1148 return addr; 1153 return addr;
1149 } 1154 }
1150 1155
1151 // FIXME: Allocate objects that do not need finalization separately 1156 // FIXME: Allocate objects that do not need finalization separately
1152 // and use separate sweeping to not have to check for finalizers. 1157 // and use separate sweeping to not have to check for finalizers.
1153 template<typename T> 1158 template<typename T>
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 // to export. This forces it to export all the methods from ThreadHeap. 1719 // to export. This forces it to export all the methods from ThreadHeap.
1715 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*); 1720 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*);
1716 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); 1721 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*);
1717 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; 1722 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>;
1718 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>; 1723 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>;
1719 #endif 1724 #endif
1720 1725
1721 } 1726 }
1722 1727
1723 #endif // Heap_h 1728 #endif // Heap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698