Commit 5f29aae0 authored by Vikas Soni's avatar Vikas Soni Committed by Commit Bot

EndBatchReadAccess: Refactor code to erase entry correctly.

Refactor EndBatchReadAccess() to remove the entry for the current
context correctly for all the cases even though there are no registered
backings in the current context.

Bug: 1045677,1045127,1045242
Change-Id: I1a8081193900ec5d7f8955bdbd00eff96ccef68e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023289
Commit-Queue: vikas soni <vikassoni@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735633}
parent 870be419
......@@ -60,21 +60,19 @@ bool SharedImageBatchAccessManager::EndBatchReadAccess() {
if (it == backings_.end())
return false;
// If there are no registered backings, we dont need to create any fence and
// supply to any backings.
if (it->second.empty())
return true;
// Create a shared egl fence.
auto shared_egl_fence = base::MakeRefCounted<gl::SharedGLFenceEGL>();
// Pass it to all the registered backings.
for (auto* registered_backing : it->second) {
registered_backing->SetEndReadFence(shared_egl_fence);
// If there are registered backings, create the egl fence and supply to the
// backings.
if (!it->second.empty()) {
// Create a shared egl fence.
auto shared_egl_fence = base::MakeRefCounted<gl::SharedGLFenceEGL>();
// Pass it to all the registered backings.
for (auto* registered_backing : it->second) {
registered_backing->SetEndReadFence(shared_egl_fence);
}
}
// Clean up all the registered backings for this context and remove this entry
// for map.
// Remove the entry for this context.
backings_.erase(it);
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment