Closed Bug 232351 Opened 21 years ago Closed 21 years ago

make a stub implementation of nsIDocumentObserver

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.7alpha

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Whiteboard: [patch])

Attachments

(2 files)

I think it might be good to have a stub implementation of nsIDocumentObserver
that implementors of nsIDocumentObserver within content and layout can derive
from (instead of directly from nsIDocumentObserver).

It would have empty implementations (using the existing macros) of all the
nsIDocumentObserver methods, but the nsISupports methods would still be pure
virtual.  (I'd probably want to call it nsStubDocumentObserver or
nsDocumentObserverStub.)

This would have two advantages:
 * it would reduce code size
 * it would hopefully reduce CPU cache misses and perhaps even missed branch
prediction, since (to some degree) instead of calling a bunch of different
functions when looping over observers, we'd repeatedly call the same function.

Thoughts?
Sounds pretty good to me.
jst also suggested the possibility of inline virtual functions on
nsIDocumentObserver, but neither of us is sure exactly what that would do.

We're leaning towards nsStubDocumentObserver.
Yeah, i think a nsStubDocumentObserver would be the safest too. We should still
keep the macros in nsIDocumentObserver.h though, since we have documentobservers
outside of gklayout, such as transformiix and inspector.
This is a total language-geek nit: nsStubDocumentObserver is slightly verb-ier
than the clearly-noun-phrase nsDocumentObserverStub, and I think for concrete
class names, noun phrases win.

/be
Status: NEW → ASSIGNED
Whiteboard: [patch]
Target Milestone: --- → mozilla1.7alpha
Comment on attachment 140035 [details] [diff] [review]
patch

I think I prefer nsStubDocumentObserver -- it's no verbier than
nsIDocumentObserver itself.
Attachment #140035 - Flags: review?(jst)
Comment on attachment 140035 [details] [diff] [review]
patch

r=jst
Attachment #140035 - Flags: review?(jst) → review+
Attachment #140035 - Flags: superreview?(peterv) → superreview+
Fix checked in to trunk, 2004-01-28 13:01/02/04 -0800.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
/me would have just called it nsDocumentObserver ;-)
Attachment #140118 - Flags: superreview?(jst)
Attachment #140118 - Flags: review?(jst)
Comment on attachment 140118 [details] [diff] [review]
missed one

r+sr=jst
Attachment #140118 - Flags: superreview?(jst)
Attachment #140118 - Flags: superreview+
Attachment #140118 - Flags: review?(jst)
Attachment #140118 - Flags: review+
Comment on attachment 140118 [details] [diff] [review]
missed one

Checked in to trunk, 2004-01-28 17:45 -0800.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: