Pepper: Fix texture management in VideoDecoderShim on Reset.
- Use a hash_set to track available textures. This prevents weird behavior
if the plugin recycles a texture twice.
- Fix Reset, so all textures are made available on completion.
- Fix the plugin, which had a bug that allowed pictures to jump the queue
and didn't behave correctly on Reset.
BUG=281689
Review URL: https://codereview.chromium.org/337743003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277548 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/video_decoder_resource.cc b/ppapi/proxy/video_decoder_resource.cc
index 2ca5ce2..acb5f75 100644
--- a/ppapi/proxy/video_decoder_resource.cc
+++ b/ppapi/proxy/video_decoder_resource.cc
@@ -471,6 +471,10 @@
const ResourceMessageReplyParams& params) {
// All shm buffers should have been made available by now.
DCHECK_EQ(shm_buffers_.size(), available_shm_buffers_.size());
+ // Received pictures are no longer valid.
+ while (!received_pictures_.empty())
+ received_pictures_.pop();
+
scoped_refptr<TrackedCallback> callback;
callback.swap(reset_callback_);
callback->Run(params.result());