Closed
Bug 1187145
Opened 10 years ago
Closed 10 years ago
Replace nsBaseHashtable::Enumerate() calls in gfx/ with iterators
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla44
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: n.nethercote, Assigned: sotaro)
References
Details
(Whiteboard: [gfx-noted])
Attachments
(1 file, 4 obsolete files)
38.90 KB,
patch
|
sotaro
:
review+
|
Details | Diff | Splinter Review |
Because iterators are so much nicer than enumerate functions.
There are nine occurrences of Enumerate() in this directory.
A note to the assignee: to preserve existing behaviour, you should probably use
nsBaseHashtable::Iterator::Data() rather than nsBaseHashtable::Iterator::UserData(). (The latter should be used when replacing nsBaseHashtable::EnumerateRead()).
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → sotaro.ikeda.g
Assignee | ||
Updated•10 years ago
|
Whiteboard: [gfx-noted]
Assignee | ||
Comment 1•10 years ago
|
||
Assignee | ||
Comment 3•10 years ago
|
||
Improved readability of types.
Attachment #8661867 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Attachment #8662051 -
Flags: review?(jdaggett)
![]() |
Reporter | |
Comment 4•10 years ago
|
||
Comment on attachment 8662051 [details] [diff] [review]
patch - Replace nsBaseHashtable::Enumerate() calls in gfx/ with iterators
Review of attachment 8662051 [details] [diff] [review]:
-----------------------------------------------------------------
I have some drive-by comments...
::: gfx/thebes/gfxFT2FontList.cpp
@@ +1158,5 @@
> // so we just maintain the existing order)
> + for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) {
> + nsStringHashKey::KeyType key = iter.Key();
> + nsRefPtr<gfxFontFamily>& family = iter.Data();
> + FinalizeFamilyMemberList(key, family, false /* aSortFaces */);
I usually write cases like this as "/* aSortFaces = */ false".
@@ +1331,5 @@
> void
> gfxFT2FontList::GetSystemFontList(InfallibleTArray<FontListEntry>* retValue)
> {
> + for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) {
> + FT2FontFamily *family = static_cast<FT2FontFamily*>(iter.Data().get());
Put the '*' on the left? I know this file in inconsistent, but on-the-left is official Mozilla style so you might as well do it for changed code :)
Actually, you might as well use |auto| here instead. I think it's better when the type is obvious due to a static_cast.
@@ +1335,5 @@
> + FT2FontFamily *family = static_cast<FT2FontFamily*>(iter.Data().get());
> + family->AddFacesToFontList(retValue, FT2FontFamily::kVisible);
> + }
> + for (auto iter = mHiddenFontFamilies.Iter(); !iter.Done(); iter.Next()) {
> + FT2FontFamily *family = static_cast<FT2FontFamily*>(iter.Data().get());
Ditto.
@@ +1477,5 @@
> // hence @font-face { src:local(...) } will not find hidden fonts.
> + for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) {
> + nsStringHashKey::KeyType key = iter.Key();
> + nsRefPtr<gfxFontFamily>& fontFamily = iter.Data();
> + fontEntry = FindFullName(key, fontFamily, fullName);
I would inline FindFullName() here.
::: gfx/thebes/gfxPlatformFontList.cpp
@@ +283,5 @@
> TimeStamp start = TimeStamp::Now();
> + bool timedOut = false;
> + // if mFirstChar is not 0, only load facenames for families
> + // that start with this character
> + char16_t firstChar(0);
|char16_t firstChar = 0;| looks better.
Assignee | ||
Updated•10 years ago
|
Attachment #8662051 -
Flags: review?(jdaggett)
Assignee | ||
Comment 5•10 years ago
|
||
Thanks for the view, I''s update in a next patch.
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8662051 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Attachment #8665118 -
Attachment is patch: true
Attachment #8665118 -
Attachment mime type: text/x-patch → text/plain
Assignee | ||
Updated•10 years ago
|
Attachment #8665118 -
Flags: review?(n.nethercote)
![]() |
Reporter | |
Comment 7•10 years ago
|
||
Comment on attachment 8665118 [details] [diff] [review]
patch - Replace nsBaseHashtable::Enumerate() calls in gfx/ with iterators
Review of attachment 8665118 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/thebes/gfxFT2FontList.cpp
@@ +1460,5 @@
>
> // Note that we only check mFontFamilies here, not mHiddenFontFamilies;
> // hence @font-face { src:local(...) } will not find hidden fonts.
> + for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) {
> + // Check family name, based on the assumption that the
Nit: trailing whitespace.
@@ +1482,5 @@
> + }
> + if (fe->Name().Equals(fullName,
> + nsCaseInsensitiveStringComparator())) {
> + fontEntry = static_cast<FT2FontEntry*>(fe);
> + break;
If you have a label at the end of the loop you could |goto| it from here...
@@ +1489,5 @@
> + }
> +
> + if (fontEntry) {
> + break;
> + }
... avoiding the need for this check.
Attachment #8665118 -
Flags: review?(n.nethercote) → review+
Assignee | ||
Comment 8•10 years ago
|
||
Apply the comments.
Attachment #8665118 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Attachment #8665441 -
Flags: review+
![]() |
Reporter | |
Comment 10•10 years ago
|
||
Thank you for doing this bug.
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in
before you can comment on or make changes to this bug.
Description
•