Closed
Bug 416872
Opened 18 years ago
Closed 17 years ago
Simplify GetState() impl's for defunct objects
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: aaronlev, Assigned: surkov)
References
(Blocks 1 open bug)
Details
(Keywords: access, fixed1.9.1)
Attachments
(1 file)
|
50.18 KB,
patch
|
davidb
:
review+
neil
:
superreview+
beltzner
:
approval1.9.1+
beltzner
:
approval1.9.1b2-
|
Details | Diff | Splinter Review |
Right now each GetState() impl that calls up to the parent class must check mDOMNode and return early.
It would be simpler if we could just return early if GetState() != NS_OK.
That would be accomplished by returning NS_OK_DEFUNCT_OBJECT or something like that.
| Assignee | ||
Comment 1•17 years ago
|
||
Attachment #346202 -
Flags: superreview?(neil)
Attachment #346202 -
Flags: review?(david.bolter)
Comment 2•17 years ago
|
||
Comment on attachment 346202 [details] [diff] [review]
patch
>+ nsresult __rv = res; /* Don't evaluate |res| more than once */ \
>+ if (NS_FAILED(__rv)) { \
>+ NS_ENSURE_SUCCESS_BODY(res, ret) \
Eww, NS_ENSURE_SUCCESS_BODY has an external dependency on __rv :-(
Attachment #346202 -
Flags: superreview?(neil) → superreview+
Comment 3•17 years ago
|
||
Comment on attachment 346202 [details] [diff] [review]
patch
Hi Surkov, Neil has already sr+'ed so these questions/comments are really just for my own education:
>--- a/accessible/src/base/nsAccessNode.h
>+++ b/accessible/src/base/nsAccessNode.h
>@@ -68,16 +68,30 @@ class nsApplicationAccessibleWrap;
> class nsApplicationAccessibleWrap;
> class nsIDocShellTreeItem;
>
> #define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
> #define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
>
> typedef nsInterfaceHashtable<nsVoidPtrHashKey, nsIAccessNode>
> nsAccessNodeHashtable;
>+
>+#define NS_OK_DEFUNCT_OBJECT \
>+NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x22)
Where did 0x22 come from?
>+
>+#define NS_ENSURE_A11Y_SUCCESS(res, ret)
I wondered if other modules might have a similar requirement for dealing with defunct objects, and if this should be a more general shared macro... but I guess leaving it in nsAccessNode.h allows us to easily add additional future checks that may be more a11y specific.
>+ PR_BEGIN_MACRO \
>+ nsresult __rv = res; /* Don't evaluate |res| more than once */ \
>+ if (NS_FAILED(__rv)) { \
>+ NS_ENSURE_SUCCESS_BODY(res, ret) \
>+ return ret; \
>+ } \
>+ if (__rv == NS_OK_DEFUNCT_OBJECT) \
>+ return ret; \
>+ PR_END_MACRO
Attachment #346202 -
Flags: review?(david.bolter) → review+
| Assignee | ||
Comment 4•17 years ago
|
||
(In reply to comment #3)
> Where did 0x22 come from?
0x21 is used in nsAccessible.h. I don't remember why it's 0x21. I guess free numbers are started from this point.
>
> >+
> >+#define NS_ENSURE_A11Y_SUCCESS(res, ret)
>
> I wondered if other modules might have a similar requirement for dealing with
> defunct objects, and if this should be a more general shared macro... but I
> guess leaving it in nsAccessNode.h allows us to easily add additional future
> checks that may be more a11y specific.
Sorry I'm not sure I got you. This macros can be used everywhere in a11y module (because nsAccessNode.h is included almost everywhere). I think it may be resonable to use it not for getState() only. But here it's important because this method doesn't fail if the object is defunct.
Comment 5•17 years ago
|
||
(In reply to comment #4)
> (In reply to comment #3)
> > >+
> > >+#define NS_ENSURE_A11Y_SUCCESS(res, ret)
> >
> > I wondered if other modules might have a similar requirement for dealing with
> > defunct objects, and if this should be a more general shared macro... but I
> > guess leaving it in nsAccessNode.h allows us to easily add additional future
> > checks that may be more a11y specific.
>
> Sorry I'm not sure I got you. This macros can be used everywhere in a11y module
> (because nsAccessNode.h is included almost everywhere). I think it may be
> resonable to use it not for getState() only. But here it's important because
> this method doesn't fail if the object is defunct.
I was thinking about outside the a11y module actually, but it was really just "thinking out loud". I'm not positive there is a need for a general macro for protecting against defunt-ness.
In other words, don't worry about it :)
| Assignee | ||
Comment 6•17 years ago
|
||
Comment on attachment 346202 [details] [diff] [review]
patch
just code clean up, no risk
Attachment #346202 -
Flags: approval1.9.1b2?
Updated•17 years ago
|
Attachment #346202 -
Flags: approval1.9.1b2?
Attachment #346202 -
Flags: approval1.9.1b2-
Attachment #346202 -
Flags: approval1.9.1?
Comment 7•17 years ago
|
||
Comment on attachment 346202 [details] [diff] [review]
patch
We're closing down for beta 2, we'll get this after we branch.
Updated•17 years ago
|
Attachment #346202 -
Flags: approval1.9.1? → approval1.9.1+
Comment 8•17 years ago
|
||
Comment on attachment 346202 [details] [diff] [review]
patch
a191=beltzner
| Assignee | ||
Comment 9•17 years ago
|
||
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
Keywords: fixed1.9.1
You need to log in
before you can comment on or make changes to this bug.
Description
•