Commit 83bd7656 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

vaapi: Don't use = {} to clear base::queues

This CL removes the use of = {} to clear base::queues, because, for classes,
zero initialization simply clears the (non-static) data members, which might
leave the objects in an incorrect meta state because ctors are not called:
this should not be an issue for std::queue, but it is for base::queue, which
is implemented as a base::circular_deque.

Nothing is crashing now, but a sibling unlanded sister CL (crrev.com/c/947341)
had some issues with a similar idiom, so I'm removing it just in case.

[1] http://en.cppreference.com/w/cpp/language/zero_initialization

Bug: 717265
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I96af3e6475c0596f3316219bd51732e085f5e098
Reviewed-on: https://chromium-review.googlesource.com/1005917Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550162}
parent a971e271
......@@ -414,7 +414,8 @@ void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange(
// All surfaces released, destroy them and dismiss all PictureBuffers.
awaiting_va_surfaces_recycle_ = false;
available_va_surfaces_ = {};
base::queue<VASurfaceID> empty;
std::swap(available_va_surfaces_, empty);
vaapi_wrapper_->DestroySurfaces();
for (PictureMap::iterator iter = picture_map_.begin();
......@@ -481,7 +482,8 @@ void VaapiVideoDecodeAccelerator::AssignPictureBuffers(
base::AutoLock auto_lock(lock_);
DCHECK(picture_map_.empty());
available_picture_buffers_ = {};
base::queue<int32_t> empty;
std::swap(available_picture_buffers_, empty);
RETURN_AND_NOTIFY_ON_FAILURE(
buffers.size() >= requested_num_pics_,
......
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