Open
Bug 1262709
Opened 10 years ago
Updated 3 years ago
Implement a type-safe wrapper around nsDeque
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
NEW
People
(Reporter: chunmin, Unassigned)
Details
Per bug 1110030 comment 279, we need a type-safe wrapper around nsDeque[0].
nsDeque is widely used but it's not type safe, so I propose to implement a basic type-safe wrapper around nsDeque to help us to operate the nsDeque.
[0]
>+// The following is the type-safe wrapper around nsDeque
>+// for storing events' data.
>+// The T must be one class that supports reference counting mechanism.
>+// The EventQueueDeallocator will be called in nsDeque::~nsDeque() or
>+// nsDeque::Erase() to deallocate the objects. nsDeque::Erase() will remove
>+// and delete all items in the queue. See more from nsDeque.h.
>+template <class T>
>+class EventQueueDeallocator : public nsDequeFunctor
>+{
>+ virtual void* operator() (void* aObject)
>+ {
>+ RefPtr<T> releaseMe = dont_AddRef(static_cast<T*>(aObject));
>+ return nullptr;
>+ }
So EventQueueDeallocator is actually something very generic and so is EventQueue.
They should be renamed. Perhaps RefCountedObjectQueue. A bit long but couldn't figure out anything better right now
(in principle I'd prefer moving this useful code to be in the same directory where nsQueue.h but that can be done in a separate bug)
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•