Closed Bug 230092 Opened 21 years ago Closed 21 years ago

[FIX]improve hashtable stuff in event queue service

Categories

(Core :: XPCOM, defect, P1)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.7alpha

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file, 3 obsolete files)

Die, returners of addrefed raw ptrs, die!
Attached patch Like this-ish (obsolete) — Splinter Review
The changes to nsHashKeys were done by bsmedberg; r=me on those.
Comment on attachment 138404 [details] [diff] [review] Like this-ish darin, bsmedberg, could you review?
Attachment #138404 - Flags: superreview?(darin)
Attachment #138404 - Flags: review?(bsmedberg)
Priority: -- → P1
Summary: improve hashtable stuff in event queue service → [FIX]improve hashtable stuff in event queue service
Target Milestone: --- → mozilla1.7alpha
Attachment #138404 - Flags: review?(bsmedberg) → review+
Attachment #138404 - Attachment is obsolete: true
Attachment #138404 - Flags: superreview?(darin)
Attachment #138421 - Flags: superreview?(brendan)
Attachment #138421 - Flags: review?(bsmedberg)
Comment on attachment 138421 [details] [diff] [review] Oops. Forgot to init the hashtable... >--- xpcom/threads/nsEventQueueService.cpp 3 Dec 2003 23:53:22 -0000 1.41 >+++ xpcom/threads/nsEventQueueService.cpp 5 Jan 2004 16:46:48 -0000 nsEventQueueServiceImpl::PushThreadEventQueue(nsIEventQueue **aNewQueue) [snip] > if (ourChain) > ourChain->AppendQueue(newQueue); // append new queue to it > > *aNewQueue = newQueue; >- NS_IF_ADDREF(*aNewQueue); Don't you still need this?
No, I do not. See the part right above that: - nsCOMPtr<nsIEventQueue> newQueue; - MakeNewQueue((PRThread*)key.GetValue(), native, getter_AddRefs(newQueue)); // create new queue + nsIEventQueue* newQueue = nsnull; + MakeNewQueue(currentThread, native, &newQueue); // create new queue; addrefs
Comment on attachment 138421 [details] [diff] [review] Oops. Forgot to init the hashtable... ah yes, ok
Attachment #138421 - Flags: review?(bsmedberg) → review+
Attachment #138421 - Flags: superreview?(brendan) → superreview?(darin)
Comment on attachment 138421 [details] [diff] [review] Oops. Forgot to init the hashtable... >Index: xpcom/threads/nsEventQueueService.h >- nsSupportsHashtable mEventQTable; >+ nsInterfaceHashtable<nsVoidPtrHashKey, nsIEventQueue> mEventQTable; > PRMonitor *mEventQMonitor; > }; nit: looks like some effort was previously made to line up the variable names in a column. maybe you want to either preserve that or simply eliminate the extra space in front of *mEventQMonitor? >Index: xpcom/threads/nsEventQueueService.cpp >+PR_STATIC_CALLBACK(PLDHashOperator) >+hash_enum_remove_queues(const void *aThread_ptr, >+ nsCOMPtr<nsIEventQueue>& aQueue, >+ void* closure) > { >- // 'aData' should be the eldest queue. >- nsIEventQueue *eldestQueue = (nsIEventQueue*)aData; >- >- nsCOMPtr<nsPIEventQueueChain> pie(do_QueryInterface(eldestQueue)); >+ // 'aQueue' should be the eldest queue. >+ nsCOMPtr<nsPIEventQueueChain> pie(do_QueryInterface(aQueue)); nitty nit: i think aQueue should be called "aEldestQueue" to preserve the self-documenting name. sr=darin
Attachment #138421 - Flags: superreview?(darin) → superreview+
Attached patch Patch updated to nits (obsolete) — Splinter Review
Attachment #138421 - Attachment is obsolete: true
Checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment on attachment 138729 [details] [diff] [review] Patch updated to nits nsEventQueueServiceImpl::CreateEventQueue(PRThread *aThread, PRBool aNative) + mEventQTable.Get(aThread, getter_AddRefs(queue)); do you need a strong reference? + nsCOMPtr<nsIEventQueue> queue; + mEventQTable.Get(currentThread, getter_AddRefs(queue)); and here?
> nsEventQueueServiceImpl::CreateEventQueue(PRThread *aThread, PRBool aNative) No, I guess I could push the strong ref down into the !queue case.... > and here? Also looks like it may be doable, yes. Wanna post patches? Or should I work on it when I get the chance to?
I'd prefer you to do it... I don't have much time this month
This has three changes: 1) Use GetWeak in those two spots 2) Fix what looks like an obvious bug in CreateEventQueue (passing wrong thread to MakeNewQueue). 3) Fix what looks like a bug in PushThreadEventQueue (looking at the original queue for the thread rather than the youngest one).
Attachment #138729 - Attachment is obsolete: true
Reopening till I get that in.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment on attachment 138763 [details] [diff] [review] Patch to that effect darin, would you review?
Attachment #138763 - Flags: superreview?(darin)
Attachment #138763 - Flags: review?(darin)
Attachment #138763 - Flags: review?(darin) → review?(danm-moz)
Attachment #138763 - Flags: review?(danm-moz) → review+
Comment on attachment 138763 [details] [diff] [review] Patch to that effect sr=darin
Attachment #138763 - Flags: superreview?(darin) → superreview+
Checked that in too.
Status: REOPENED → RESOLVED
Closed: 21 years ago21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: