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

Unified Diff: Source/platform/heap/Heap.h

Issue 614373007: Oilpan: Remove adoptRefCountedGarbageCollected (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/heap/Heap.h
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h
index 0b1e891d2f1e70a9d12b7d8407b2456f3a5896f9..7ebe049abeae0038c20a13a83a0e70398ed08410 100644
--- a/Source/platform/heap/Heap.h
+++ b/Source/platform/heap/Heap.h
@@ -682,61 +682,6 @@ public:
class HeapDoesNotContainCache : public HeapExtentCache<NegativeEntry> { };
-// FIXME: This is currently used by the WebAudio code.
-// We should attempt to restructure the WebAudio code so that the main thread
-// alone determines life-time and receives messages about life-time from the
-// audio thread.
-template<typename T>
-class ThreadSafeRefCountedGarbageCollected : public GarbageCollectedFinalized<T>, public WTF::ThreadSafeRefCountedBase {
- WTF_MAKE_NONCOPYABLE(ThreadSafeRefCountedGarbageCollected);
-
-public:
- ThreadSafeRefCountedGarbageCollected()
- {
- makeKeepAlive();
- }
-
- // Override ref to deal with a case where a reference count goes up
- // from 0 to 1. This can happen in the following scenario:
- // (1) The reference count becomes 0, but on-stack pointers keep references to the object.
- // (2) The on-stack pointer is assigned to a RefPtr. The reference count becomes 1.
- // In this case, we have to resurrect m_keepAlive.
- void ref()
- {
- MutexLocker lock(m_mutex);
- if (UNLIKELY(!refCount())) {
- makeKeepAlive();
- }
- WTF::ThreadSafeRefCountedBase::ref();
- }
-
- // Override deref to deal with our own deallocation based on ref counting.
- void deref()
- {
- MutexLocker lock(m_mutex);
- if (derefBase()) {
- ASSERT(m_keepAlive);
- m_keepAlive.clear();
- }
- }
-
- using GarbageCollectedFinalized<T>::operator new;
- using GarbageCollectedFinalized<T>::operator delete;
-
-protected:
- ~ThreadSafeRefCountedGarbageCollected() { }
-
-private:
- void makeKeepAlive()
- {
- ASSERT(!m_keepAlive);
- m_keepAlive = adoptPtr(new CrossThreadPersistent<T>(static_cast<T*>(this)));
- }
-
- OwnPtr<CrossThreadPersistent<T> > m_keepAlive;
- mutable Mutex m_mutex;
-};
-
template<typename DataType>
class PagePool {
protected:
@@ -1232,9 +1177,8 @@ class RefCountedGarbageCollected : public GarbageCollectedFinalized<T> {
public:
RefCountedGarbageCollected()
- : m_refCount(1)
+ : m_refCount(0)
{
- makeKeepAlive();
}
// Implement method to increase reference count for use with
@@ -1296,15 +1240,6 @@ private:
Persistent<T>* m_keepAlive;
};
-template<typename T>
-T* adoptRefCountedGarbageCollected(T* ptr)
-{
- ASSERT(ptr->hasOneRef());
- ptr->deref();
- WTF::adopted(ptr);
- return ptr;
-}
-
// Classes that contain heap references but aren't themselves heap
// allocated, have some extra macros available which allows their use
// to be restricted to cases where the garbage collector is able

Powered by Google App Engine
This is Rietveld 408576698