зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1695162 - Use ordinary range iteration instead of IterHash. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D106641
This commit is contained in:
Родитель
502b8a0314
Коммит
9602fc8b5c
|
@ -143,8 +143,8 @@ const nsTArray<SharedMap::Entry*>& SharedMap::EntryArray() const {
|
|||
|
||||
mEntryArray.emplace(mEntries.Count());
|
||||
auto& array = mEntryArray.ref();
|
||||
for (auto& entry : IterHash(mEntries)) {
|
||||
array.AppendElement(entry);
|
||||
for (auto& entry : mEntries) {
|
||||
array.AppendElement(entry.GetWeak());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,11 +286,11 @@ Result<Ok, nsresult> WritableSharedMap::Serialize() {
|
|||
size_t headerSize = sizeof(count);
|
||||
size_t blobCount = 0;
|
||||
|
||||
for (auto& entry : IterHash(mEntries)) {
|
||||
headerSize += entry->HeaderSize();
|
||||
blobCount += entry->BlobCount();
|
||||
for (const auto& entry : mEntries) {
|
||||
headerSize += entry.GetData()->HeaderSize();
|
||||
blobCount += entry.GetData()->BlobCount();
|
||||
|
||||
dataSize += entry->Size();
|
||||
dataSize += entry.GetData()->Size();
|
||||
AlignTo(&dataSize, kStructuredCloneAlign);
|
||||
}
|
||||
|
||||
|
@ -310,18 +310,18 @@ Result<Ok, nsresult> WritableSharedMap::Serialize() {
|
|||
// as indexes into our blobs array.
|
||||
nsTArray<RefPtr<BlobImpl>> blobImpls(blobCount);
|
||||
|
||||
for (auto& entry : IterHash(mEntries)) {
|
||||
for (auto& entry : mEntries) {
|
||||
AlignTo(&offset, kStructuredCloneAlign);
|
||||
|
||||
size_t blobOffset = blobImpls.Length();
|
||||
if (entry->BlobCount()) {
|
||||
blobImpls.AppendElements(entry->Blobs());
|
||||
if (entry.GetData()->BlobCount()) {
|
||||
blobImpls.AppendElements(entry.GetData()->Blobs());
|
||||
}
|
||||
|
||||
entry->ExtractData(&ptr[offset], offset, blobOffset);
|
||||
entry->Code(header);
|
||||
entry.GetData()->ExtractData(&ptr[offset], offset, blobOffset);
|
||||
entry.GetData()->Code(header);
|
||||
|
||||
offset += entry->Size();
|
||||
offset += entry.GetData()->Size();
|
||||
}
|
||||
|
||||
mBlobImpls = std::move(blobImpls);
|
||||
|
|
|
@ -210,8 +210,8 @@ static void TraceOp(JSTracer* trc, void* data) {
|
|||
} // anonymous namespace
|
||||
|
||||
void ScriptPreloader::Trace(JSTracer* trc) {
|
||||
for (auto& script : IterHash(mScripts)) {
|
||||
script->mScript.Trace(trc);
|
||||
for (auto& script : mScripts) {
|
||||
script.GetData()->mScript.Trace(trc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,9 +284,7 @@ void ScriptPreloader::InvalidateCache() {
|
|||
MOZ_ASSERT(mParsingSources.empty());
|
||||
MOZ_ASSERT(mPendingScripts.isEmpty());
|
||||
|
||||
for (auto& script : IterHash(mScripts)) {
|
||||
script.Remove();
|
||||
}
|
||||
mScripts.Clear();
|
||||
|
||||
// If we've already finished saving the cache at this point, start a new
|
||||
// delayed save operation. This will write out an empty cache file in place
|
||||
|
|
|
@ -54,20 +54,20 @@ nsresult URLPreloader::CollectReports(nsIHandleReportCallback* aHandleReport,
|
|||
ShallowSizeOfIncludingThis(MallocSizeOf),
|
||||
"Memory used by the URL preloader service itself.");
|
||||
|
||||
for (const auto& elem : IterHash(mCachedURLs)) {
|
||||
for (const auto& elem : mCachedURLs) {
|
||||
nsAutoCString pathName;
|
||||
pathName.Append(elem->mPath);
|
||||
pathName.Append(elem.GetData()->mPath);
|
||||
// The backslashes will automatically be replaced with slashes in
|
||||
// about:memory, without splitting each path component into a separate
|
||||
// branch in the memory report tree.
|
||||
pathName.ReplaceChar('/', '\\');
|
||||
|
||||
nsPrintfCString path("explicit/url-preloader/cached-urls/%s/[%s]",
|
||||
elem->TypeString(), pathName.get());
|
||||
elem.GetData()->TypeString(), pathName.get());
|
||||
|
||||
aHandleReport->Callback(
|
||||
""_ns, path, KIND_HEAP, UNITS_BYTES,
|
||||
elem->SizeOfIncludingThis(MallocSizeOf),
|
||||
elem.GetData()->SizeOfIncludingThis(MallocSizeOf),
|
||||
nsLiteralCString("Memory used to hold cache data for files which "
|
||||
"have been read or pre-loaded during this session."),
|
||||
aData);
|
||||
|
@ -224,9 +224,9 @@ Result<Ok, nsresult> URLPreloader::WriteCache() {
|
|||
&fd.rwget()));
|
||||
|
||||
nsTArray<URLEntry*> entries;
|
||||
for (auto& entry : IterHash(mCachedURLs)) {
|
||||
if (entry->mReadTime) {
|
||||
entries.AppendElement(entry);
|
||||
for (auto& entry : mCachedURLs) {
|
||||
if (entry.GetData()->mReadTime) {
|
||||
entries.AppendElement(entry.GetWeak());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ class URLPreloader final : public nsIObserver, public nsIMemoryReporter {
|
|||
}
|
||||
}
|
||||
|
||||
const char* TypeString() {
|
||||
const char* TypeString() const {
|
||||
switch (mType) {
|
||||
case TypeAppJar:
|
||||
return "AppJar";
|
||||
|
|
Загрузка…
Ссылка в новой задаче