Closed Bug 1186793 Opened 10 years ago Closed 10 years ago

Replace nsBaseHashtable::EnumerateRead() calls in gfx/ with iterators

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: n.nethercote, Assigned: sotaro)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file, 1 obsolete file)

Because iterators are so much nicer than enumerate functions. There are seven occurrences of EnumerateRead() in this directory. A note to the assignee: to preserve existing behaviour, you should probably use nsBaseHashtable::Iterator::UserData() rather than nsBaseHashtable::Iterator::Data(). (The latter should be used when replacing nsBaseHashtable::Enumerate()).
Assignee: nobody → sotaro.ikeda.g
Whiteboard: [gfx-noted]
Attachment #8666897 - Flags: review?(n.nethercote)
Comment on attachment 8666897 [details] [diff] [review] patch - Replace nsBaseHashtable::EnumerateRead() calls in gfx/ with iterators Review of attachment 8666897 [details] [diff] [review]: ----------------------------------------------------------------- Thank you for doing this conversion. r=me with the minor comments below addressed. ::: gfx/ipc/GfxMessageUtils.h @@ +918,5 @@ > struct MessageAndAttributeMap > { > Message* msg; > const mozilla::gfx::AttributeMap& map; > }; Can you remove this type now? @@ +955,5 @@ > + HANDLE_TYPE(Matrix5x4) > + HANDLE_TYPE(Point3D) > + HANDLE_TYPE(Color) > + HANDLE_TYPE(AttributeMap) > + HANDLE_TYPE(Floats) Nit: don't change the indentation here; the old indentation was correct. It might also be worth renaming the macro from HANDLE_TYPE to CASE_TYPE, to make it a little clearer that it's part of the switch. ::: gfx/src/FilterSupport.cpp @@ +2080,5 @@ > + const uint32_t& attributeName = iter.Key(); > + Attribute* attribute = iter.UserData(); > + Attribute* matchingAttribute = mMap.Get(attributeName); > + if (!matchingAttribute || > + *matchingAttribute != *attribute) { Nit: no need for a line break in the middle of this expression. @@ +2082,5 @@ > + Attribute* matchingAttribute = mMap.Get(attributeName); > + if (!matchingAttribute || > + *matchingAttribute != *attribute) { > + matches = false; > + break; Just |return false;| here and |return true;| after the loop, and then you can remove |matches|.
Attachment #8666897 - Flags: review?(n.nethercote) → review+
Thanks for the review. I am going update them in a next patch.
Apply comments.
Attachment #8666897 - Attachment is obsolete: true
Attachment #8667304 - Flags: review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: