Closed
Bug 585867
Opened 14 years ago
Closed 14 years ago
Remove OOM checks from property getters in nsComputedDOMStyle and make them not return nsresult
Categories
(Core :: CSS Parsing and Computation, defect, P4)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla5
People
(Reporter: craig.topper, Assigned: craig.topper)
References
(Blocks 1 open bug)
Details
Attachments
(5 files, 7 obsolete files)
85.00 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
8.58 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
6.39 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
26.91 KB,
patch
|
Details | Diff | Splinter Review | |
115.52 KB,
patch
|
Details | Diff | Splinter Review |
The property getters in nsComputedDOMStyle spend a lot of code handling OOM errors. Since allocation is now infallible all these checks can be removed simplifying the code and allowing the getters to lose their outparam.
Assignee | ||
Comment 3•14 years ago
|
||
Unfortunately, nsCOMArray and nsTArray are not infallible during resize operations. To work around this I have added my own call to mozalloc_handle_oom which will abort making us infallible. I modeled this after the code for moz_xmalloc.
Attachment #466930 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•14 years ago
|
Attachment #466931 -
Attachment is patch: true
Attachment #466931 -
Attachment mime type: application/octet-stream → text/plain
Assignee | ||
Comment 5•14 years ago
|
||
This patch removes the outparam from all of the property getters and moves to a single AddRef after the getter returns.
Attachment #466932 -
Flags: review?(bzbarsky)
Comment 6•14 years ago
|
||
Comment on attachment 466927 [details] [diff] [review] Part 2: Make SetToRGBAColor return void >diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp >--- a/layout/style/nsComputedDOMStyle.cpp >+++ b/layout/style/nsComputedDOMStyle.cpp >@@ -661,23 +661,22 @@ nsComputedDOMStyle::DoGetStackSizing(nsI > > val->SetIdent(GetStyleXUL()->mStretchStack ? eCSSKeyword_stretch_to_fit : > eCSSKeyword_ignore); > > NS_ADDREF(*aValue = val); > return NS_OK; > } > >-nsresult >+void > nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue, > nscolor aColor) > { > if (NS_GET_A(aColor) == 0) { > aValue->SetIdent(eCSSKeyword_transparent); >- return NS_OK; > } You still need the return, right?
Comment 8•14 years ago
|
||
Craig, are those patches pretty much current (in that I should go ahead and review them), or have you had to merge since you posted them in nontrivial ways?
Assignee | ||
Comment 9•14 years ago
|
||
I can post newer patches. Can't remember if any of the merges were non trivial.
Assignee | ||
Comment 10•14 years ago
|
||
Attachment #466925 -
Attachment is obsolete: true
Attachment #500641 -
Flags: review?(bzbarsky)
Attachment #466925 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 11•14 years ago
|
||
Attachment #466927 -
Attachment is obsolete: true
Attachment #500642 -
Flags: review?(bzbarsky)
Attachment #466927 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 12•14 years ago
|
||
This patch converts the nsCOMArray<nsIDOMCSSValue> in nsDOMCSSValueList to an infallible nsTArray<nsCOMPtr<nsIDOMCSSValue>>.
Attachment #466930 -
Attachment is obsolete: true
Attachment #500643 -
Flags: review?(bzbarsky)
Attachment #466930 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 13•14 years ago
|
||
Attachment #466931 -
Attachment is obsolete: true
Attachment #500644 -
Flags: review?(bzbarsky)
Attachment #466931 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 14•14 years ago
|
||
Attachment #466932 -
Attachment is obsolete: true
Attachment #500646 -
Flags: review?(bzbarsky)
Attachment #466932 -
Flags: review?(bzbarsky)
Comment 15•14 years ago
|
||
Comment on attachment 500641 [details] [diff] [review] Part 1: Remove OOM checks on retval of GetROCSSPrimitiveValue and GetROCSSValueList r=me
Attachment #500641 -
Flags: review?(bzbarsky) → review+
Comment 16•14 years ago
|
||
Comment on attachment 500642 [details] [diff] [review] Part 2: Make SetToRGBAColor return void r=me
Attachment #500642 -
Flags: review?(bzbarsky) → review+
Comment 17•14 years ago
|
||
Comment on attachment 500643 [details] [diff] [review] Part 3: Make AppendCSSValue infallible Why do you need the mozilla/mozalloc_oom.h include in nsDOMCSSValueList.cpp? r=me with that explained or removed.
Attachment #500643 -
Flags: review?(bzbarsky) → review+
Comment 18•14 years ago
|
||
Ah, that looks like a leftover from the previous patch version. Just remove it.
Comment 19•14 years ago
|
||
Comment on attachment 500644 [details] [diff] [review] Part 4: Make SetValueToStyleImage return void r=me
Attachment #500644 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 20•14 years ago
|
||
(In reply to comment #17) > Comment on attachment 500643 [details] [diff] [review] > Part 3: Make AppendCSSValue infallible > > Why do you need the mozilla/mozalloc_oom.h include in nsDOMCSSValueList.cpp? > r=me with that explained or removed. Oops that's leftover from before I converted to nsTArray. I was previously aborting myself since nsTArray wasn't infallible.
Comment 21•14 years ago
|
||
Comment on attachment 500646 [details] [diff] [review] Part 5: Remove outparam and AddRef from all property getters The changes to nsComputedDOMStyle::GetEllipseRadii change behavior (by changing the call to SetValueToCoord). Merge issue? Other than that, document in the struct in the header the ownership model for these getters (returned pointer is to a refcounted object that's just been created, with a refcount still at 0). r=me with those two things fixed.
Attachment #500646 -
Flags: review?(bzbarsky) → review+
Comment 22•14 years ago
|
||
Note that this will end up conflicting with bug 256274 (which adds some stuff to nsComputedDOMStyle). I think we should land this first, since the merge in the other direction should be simpler. None of this is an issue until the tree reopens, of course....
Blocks: css-ruby
Assignee | ||
Comment 23•14 years ago
|
||
Patch to address review comments
Attachment #500643 -
Attachment is obsolete: true
Assignee | ||
Comment 24•14 years ago
|
||
Addresses review comments
Attachment #500646 -
Attachment is obsolete: true
Comment 25•14 years ago
|
||
Craig, thanks for updating those! Pushed to birch: http://hg.mozilla.org/projects/birch/rev/2366a35dd7ce http://hg.mozilla.org/projects/birch/rev/a4b02f48bd0e http://hg.mozilla.org/projects/birch/rev/47487a9c4b11 http://hg.mozilla.org/projects/birch/rev/f1762e209d6c http://hg.mozilla.org/projects/birch/rev/39ec013827f5
Whiteboard: fixed-in-birch
https://hg.mozilla.org/mozilla-central/rev/2366a35dd7ce https://hg.mozilla.org/mozilla-central/rev/a4b02f48bd0e https://hg.mozilla.org/mozilla-central/rev/47487a9c4b11 https://hg.mozilla.org/mozilla-central/rev/f1762e209d6c https://hg.mozilla.org/mozilla-central/rev/39ec013827f5
Status: NEW → RESOLVED
Closed: 14 years ago
Priority: -- → P4
Resolution: --- → FIXED
Whiteboard: fixed-in-birch
Target Milestone: --- → mozilla2.2
Updated•14 years ago
|
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•