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