summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 22:50:19 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 22:50:19 +0000
commitd527cdd8d20d760114726a0b65d6ff85f7832880 (patch)
tree971aac9dc208539a380083b1fd336d6a8a341877 /ppapi/shared_impl
parentae3ac17598586553c9963df44566427410afadae (diff)
downloadchromium_src-d527cdd8d20d760114726a0b65d6ff85f7832880.zip
chromium_src-d527cdd8d20d760114726a0b65d6ff85f7832880.tar.gz
chromium_src-d527cdd8d20d760114726a0b65d6ff85f7832880.tar.bz2
Gracefully handle multiple Flush/Reset/Decode with same id
The DCHECKs don't trigger in release, and in any case it's a bit rude to have the renderer crash on a plugin that did the wrong thing, so send an error instead. BUG=None TEST=Pepper Flash Review URL: http://codereview.chromium.org/7628025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96649 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r--ppapi/shared_impl/video_decoder_impl.cc18
-rw-r--r--ppapi/shared_impl/video_decoder_impl.h6
2 files changed, 14 insertions, 10 deletions
diff --git a/ppapi/shared_impl/video_decoder_impl.cc b/ppapi/shared_impl/video_decoder_impl.cc
index e665941..ef20f8b 100644
--- a/ppapi/shared_impl/video_decoder_impl.cc
+++ b/ppapi/shared_impl/video_decoder_impl.cc
@@ -44,22 +44,26 @@ void VideoDecoderImpl::Destroy() {
UnrefResource(context3d_id_);
}
-void VideoDecoderImpl::SetFlushCallback(PP_CompletionCallback callback) {
+bool VideoDecoderImpl::SetFlushCallback(PP_CompletionCallback callback) {
CHECK(callback.func);
- DCHECK(!flush_callback_.func);
+ if (flush_callback_.func)
+ return false;
flush_callback_ = callback;
+ return true;
}
-void VideoDecoderImpl::SetResetCallback(PP_CompletionCallback callback) {
+bool VideoDecoderImpl::SetResetCallback(PP_CompletionCallback callback) {
CHECK(callback.func);
- DCHECK(!reset_callback_.func);
+ if (reset_callback_.func)
+ return false;
reset_callback_ = callback;
+ return true;
}
-void VideoDecoderImpl::SetBitstreamBufferCallback(
+bool VideoDecoderImpl::SetBitstreamBufferCallback(
int32 bitstream_buffer_id, PP_CompletionCallback callback) {
- CHECK(bitstream_buffer_callbacks_.insert(
- std::make_pair(bitstream_buffer_id, callback)).second);
+ return bitstream_buffer_callbacks_.insert(
+ std::make_pair(bitstream_buffer_id, callback)).second;
}
void VideoDecoderImpl::RunFlushCallback(int32 result) {
diff --git a/ppapi/shared_impl/video_decoder_impl.h b/ppapi/shared_impl/video_decoder_impl.h
index b874bba..6cd8044 100644
--- a/ppapi/shared_impl/video_decoder_impl.h
+++ b/ppapi/shared_impl/video_decoder_impl.h
@@ -44,9 +44,9 @@ class VideoDecoderImpl : public thunk::PPB_VideoDecoder_API {
std::vector<PP_VideoConfigElement>* out_configs);
protected:
- void SetFlushCallback(PP_CompletionCallback callback);
- void SetResetCallback(PP_CompletionCallback callback);
- void SetBitstreamBufferCallback(
+ bool SetFlushCallback(PP_CompletionCallback callback);
+ bool SetResetCallback(PP_CompletionCallback callback);
+ bool SetBitstreamBufferCallback(
int32 bitstream_buffer_id, PP_CompletionCallback callback);
void RunFlushCallback(int32 result);