Use RAII notifier classes to simplify code
Categories
(Core :: SVG, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox81 | --- | fixed |
People
(Reporter: longsonr, Assigned: longsonr)
Details
Attachments
(1 file, 1 external file, 2 obsolete files)
|
2.46 KB,
patch
|
Details | Diff | Splinter Review |
| Assignee | ||
Comment 1•7 years ago
|
||
| Assignee | ||
Comment 2•7 years ago
|
||
| Assignee | ||
Updated•7 years ago
|
Updated•7 years ago
|
| Assignee | ||
Updated•7 years ago
|
Comment 3•7 years ago
|
||
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Updated•7 years ago
|
Comment 7•7 years ago
|
||
Backed out for build bustages.
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=232920780&repo=mozilla-inbound&lineNumber=20244
Backout: https://hg.mozilla.org/integration/mozilla-inbound/rev/d08b9d599f252613a3e68758ed2a4e9b0459066c
Comment 8•7 years ago
|
||
Hi,
I found there is quite a lot of code duplication in these 9 RAII helpers. Especially the 4 helpers for Boolean, Enum, Integer, Number are exactly the same; another 3 helpers IntegerPair, NumberPair, Length are also exactly the same.
Have you considered using template + macro to avoid the duplication?
| Assignee | ||
Comment 9•7 years ago
|
||
There are at least 3 different variants here, further deduplication could be done but I wouldn't want to make things more confusing. Note that I plan to fix bug 1518666 first now as I think that will fix the windows compilation issue.
Comment 10•7 years ago
|
||
I think the root cause of the code duplication is that we lack some generic interface in methods of dom/svg/SVGElement.h. Every method concerning a specific type has hardcoded the type into the method name. Like SVGElement::DidChangeBoolean, SVGElement::DidChangeInteger, ..., which eliminates the possibility to write generic code.
At least now, the Boolean, Enum, Integer and Number have almost the same interface, but we have to write 4 exact duplicate for them. I think it would help reducing future code duplication if we add some generic method by tag dispatching in SVGElement.
I will attach a prototype patch below.
Comment 11•7 years ago
|
||
Comment 12•7 years ago
|
||
There is some typo in the prototype, it should be mSVGElement->template DidChange<tag>(mVal->mAttrEnum); for dependent type. But it's just an idea...
| Assignee | ||
Comment 13•7 years ago
|
||
Thanks for the ideas Violet. I'll consider incorporating them when I come back to this bug.
| Assignee | ||
Comment 14•6 years ago
|
||
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Comment 15•6 years ago
|
||
The compilation issue is fixed by making the LengthList classes into template and then instantiating that so we only have one class of each type.
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Comment 16•6 years ago
|
||
| Assignee | ||
Comment 17•6 years ago
|
||
Comment 18•6 years ago
|
||
Comment 19•6 years ago
|
||
| bugherder | ||
Comment 20•6 years ago
•
|
||
Backed out changeset 07a20e5f68e3 (bug 1524314) for Build bustage in dom/svg/DOMSVGPointList.h. a=backout
Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&group_state=expanded&revision=4b30578a98809b44d7ed8bdbba264d3ed1ed8c6d
Backout:
https://hg.mozilla.org/mozilla-central/rev/13fe46663222c174ae60555240b4017e2466bb55
Updated•6 years ago
|
| Assignee | ||
Comment 21•6 years ago
|
||
Comment 22•6 years ago
|
||
Comment 23•6 years ago
|
||
| bugherder | ||
Description
•