mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1471434 - micro-optimize refcounting for directory enumerators; r=erahm
We were not being as efficient as we could be with passing ownership.
This commit is contained in:
parent
befc08424b
commit
8f2baafcb6
@ -168,7 +168,7 @@ nsDirEnumeratorUnix::GetNext(nsISupports** aResult)
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
NS_IF_ADDREF(*aResult = file);
|
||||
file.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -750,7 +750,7 @@ public:
|
||||
return rv;
|
||||
}
|
||||
|
||||
mNext = do_QueryInterface(file);
|
||||
mNext = file.forget();
|
||||
}
|
||||
*aResult = mNext != nullptr;
|
||||
if (!*aResult) {
|
||||
@ -768,10 +768,7 @@ public:
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aResult = mNext; // might return nullptr
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
mNext = nullptr;
|
||||
mNext.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -783,9 +780,7 @@ public:
|
||||
if (NS_FAILED(rv) || !hasMore) {
|
||||
return rv;
|
||||
}
|
||||
*aResult = mNext;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
mNext = nullptr;
|
||||
mNext.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user