зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1376460 - Use Lookup instead of Get+Remove to avoid unnecessary hashtable lookups. r=froydnj
MozReview-Commit-ID: CE7r2ESeAia
This commit is contained in:
Родитель
c49a96b7fd
Коммит
557b895016
|
@ -111,18 +111,16 @@ WebRenderCompositableHolder::RemoveAsyncImagePipeline(wr::WebRenderAPI* aApi, co
|
|||
}
|
||||
|
||||
uint64_t id = wr::AsUint64(aPipelineId);
|
||||
AsyncImagePipelineHolder* holder = mAsyncImagePipelineHolders.Get(id);
|
||||
if (!holder) {
|
||||
return;
|
||||
if (auto entry = mAsyncImagePipelineHolders.Lookup(id)) {
|
||||
AsyncImagePipelineHolder* holder = entry.Data();
|
||||
++mAsyncImageEpoch; // Update webrender epoch
|
||||
aApi->ClearRootDisplayList(wr::NewEpoch(mAsyncImageEpoch), aPipelineId);
|
||||
for (wr::ImageKey key : holder->mKeys) {
|
||||
aApi->DeleteImage(key);
|
||||
}
|
||||
entry.Remove();
|
||||
RemovePipeline(aPipelineId, wr::NewEpoch(mAsyncImageEpoch));
|
||||
}
|
||||
|
||||
++mAsyncImageEpoch; // Update webrender epoch
|
||||
aApi->ClearRootDisplayList(wr::NewEpoch(mAsyncImageEpoch), aPipelineId);
|
||||
for (wr::ImageKey key : holder->mKeys) {
|
||||
aApi->DeleteImage(key);
|
||||
}
|
||||
mAsyncImagePipelineHolders.Remove(id);
|
||||
RemovePipeline(aPipelineId, wr::NewEpoch(mAsyncImageEpoch));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -333,24 +331,21 @@ WebRenderCompositableHolder::Update(const wr::PipelineId& aPipelineId, const wr:
|
|||
if (mDestroyed) {
|
||||
return;
|
||||
}
|
||||
PipelineTexturesHolder* holder = mPipelineTexturesHolders.Get(wr::AsUint64(aPipelineId));
|
||||
if (!holder) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove Pipeline
|
||||
if (holder->mDestroyedEpoch.isSome() && holder->mDestroyedEpoch.ref() <= aEpoch) {
|
||||
|
||||
mPipelineTexturesHolders.Remove(wr::AsUint64(aPipelineId));
|
||||
return;
|
||||
}
|
||||
|
||||
// Release TextureHosts based on Epoch
|
||||
while (!holder->mTextureHosts.empty()) {
|
||||
if (aEpoch <= holder->mTextureHosts.front().mEpoch) {
|
||||
break;
|
||||
if (auto entry = mPipelineTexturesHolders.Lookup(wr::AsUint64(aPipelineId))) {
|
||||
PipelineTexturesHolder* holder = entry.Data();
|
||||
// Remove Pipeline
|
||||
if (holder->mDestroyedEpoch.isSome() && holder->mDestroyedEpoch.ref() <= aEpoch) {
|
||||
entry.Remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Release TextureHosts based on Epoch
|
||||
while (!holder->mTextureHosts.empty()) {
|
||||
if (aEpoch <= holder->mTextureHosts.front().mEpoch) {
|
||||
break;
|
||||
}
|
||||
holder->mTextureHosts.pop();
|
||||
}
|
||||
holder->mTextureHosts.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче