summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
diff options
context:
space:
mode:
authorpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-06 22:30:43 +0000
committerpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-06 22:30:43 +0000
commit92bcd6462ed37baf238c5aeaf4951b6513567549 (patch)
tree0a973f8f7965a1ace83d151c189be3dc9381b4f7 /ppapi/cpp
parent4f26140d4e526b6046d74bb5153847b2c78dc051 (diff)
downloadchromium_src-92bcd6462ed37baf238c5aeaf4951b6513567549.zip
chromium_src-92bcd6462ed37baf238c5aeaf4951b6513567549.tar.gz
chromium_src-92bcd6462ed37baf238c5aeaf4951b6513567549.tar.bz2
Revert 87919 - Revert 87905 (broke PPAPITest.Scrollbar on win) - PPAPI: Fix interface functions that take PP_CompletionCallbacks, but don't
return codes from pp_errors.h 87905 - Review URL: http://codereview.chromium.org/6975053 87919 - Review URL: http://codereview.chromium.org/7058061 BUG=85010 TEST=none Review URL: http://codereview.chromium.org/6975053 Review URL: http://codereview.chromium.org/7058061 TBR=dhollowa@chromium.org Review URL: http://codereview.chromium.org/7112040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88055 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r--ppapi/cpp/dev/video_decoder_dev.cc54
-rw-r--r--ppapi/cpp/dev/video_decoder_dev.h22
2 files changed, 47 insertions, 29 deletions
diff --git a/ppapi/cpp/dev/video_decoder_dev.cc b/ppapi/cpp/dev/video_decoder_dev.cc
index a6994b5..b1ebcfb 100644
--- a/ppapi/cpp/dev/video_decoder_dev.cc
+++ b/ppapi/cpp/dev/video_decoder_dev.cc
@@ -22,19 +22,24 @@ template <> const char* interface_name<PPB_VideoDecoder_Dev>() {
} // namespace
-VideoDecoder::VideoDecoder(const Instance* instance,
- const PP_VideoConfigElement* config,
- CompletionCallback callback,
- Client* client)
+VideoDecoder::VideoDecoder(const Instance* instance, Client* client)
: client_(client) {
if (!has_interface<PPB_VideoDecoder_Dev>())
return;
PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create(
- instance->pp_instance(), config, callback.pp_completion_callback()));
+ instance->pp_instance()));
}
VideoDecoder::~VideoDecoder() {}
+int32_t VideoDecoder::Initialize(const PP_VideoConfigElement* config,
+ CompletionCallback callback) {
+ if (!has_interface<PPB_VideoDecoder_Dev>())
+ return PP_ERROR_NOINTERFACE;
+ return get_interface<PPB_VideoDecoder_Dev>()->Initialize(
+ pp_resource(), config, callback.pp_completion_callback());
+}
+
bool VideoDecoder::GetConfigs(Instance* instance,
const PP_VideoConfigElement* prototype_config,
PP_VideoConfigElement* matching_configs,
@@ -63,12 +68,15 @@ void VideoDecoder::AssignSysmemBuffers(
pp_resource(), buffers.size(), &buffers[0]);
}
-bool VideoDecoder::Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
- CompletionCallback callback) {
- if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
- return false;
- return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Decode(
- pp_resource(), &bitstream_buffer, callback.pp_completion_callback()));
+int32_t VideoDecoder::Decode(
+ const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
+ CompletionCallback callback) {
+ if (!has_interface<PPB_VideoDecoder_Dev>())
+ return PP_ERROR_NOINTERFACE;
+ if (!pp_resource())
+ return PP_ERROR_BADRESOURCE;
+ return get_interface<PPB_VideoDecoder_Dev>()->Decode(
+ pp_resource(), &bitstream_buffer, callback.pp_completion_callback());
}
void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) {
@@ -78,18 +86,22 @@ void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) {
pp_resource(), picture_buffer_id);
}
-bool VideoDecoder::Flush(CompletionCallback callback) {
- if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
- return false;
- return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Flush(
- pp_resource(), callback.pp_completion_callback()));
+int32_t VideoDecoder::Flush(CompletionCallback callback) {
+ if (!has_interface<PPB_VideoDecoder_Dev>())
+ return PP_ERROR_NOINTERFACE;
+ if (!pp_resource())
+ return PP_ERROR_BADRESOURCE;
+ return get_interface<PPB_VideoDecoder_Dev>()->Flush(
+ pp_resource(), callback.pp_completion_callback());
}
-bool VideoDecoder::Abort(CompletionCallback callback) {
- if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
- return false;
- return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Abort(
- pp_resource(), callback.pp_completion_callback()));
+int32_t VideoDecoder::Abort(CompletionCallback callback) {
+ if (!has_interface<PPB_VideoDecoder_Dev>())
+ return PP_ERROR_NOINTERFACE;
+ if (!pp_resource())
+ return PP_ERROR_BADRESOURCE;
+ return get_interface<PPB_VideoDecoder_Dev>()->Abort(
+ pp_resource(), callback.pp_completion_callback());
}
} // namespace pp
diff --git a/ppapi/cpp/dev/video_decoder_dev.h b/ppapi/cpp/dev/video_decoder_dev.h
index 51aa594..e6558b1 100644
--- a/ppapi/cpp/dev/video_decoder_dev.h
+++ b/ppapi/cpp/dev/video_decoder_dev.h
@@ -54,15 +54,21 @@ class VideoDecoder : public Resource {
//
// Parameters:
// |instance| is the pointer to the plug-in instance.
- // |config| is the configuration on which the decoder should be initialized.
// |callback| will be called when decoder is initialized.
// |client| is the pointer to the client object. Ownership of the object is
// not transferred and it must outlive the lifetime of this class.
- VideoDecoder(const Instance* instance,
- const PP_VideoConfigElement* config,
- CompletionCallback callback, Client* client);
+ VideoDecoder(const Instance* instance, Client* client);
~VideoDecoder();
+ // Initializates the video decoder with a requested configuration.
+ // Calls Init() on PPB_VideoDecoder_Dev interface.
+ //
+ // Parameters:
+ // |config| is the configuration on which the decoder should be initialized.
+ // |callback| will be called when decoder is initialized.
+ int32_t Initialize(const PP_VideoConfigElement* config,
+ CompletionCallback callback);
+
// GetConfigs returns supported configurations that are subsets of given
// |prototype_config|.
bool GetConfigs(Instance* instance,
@@ -79,19 +85,19 @@ class VideoDecoder : public Resource {
// Decodes given bitstream buffer. Once decoder is done with processing
// |bitstream_buffer| is will call |callback| with provided user data.
- bool Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
- CompletionCallback callback);
+ int32_t Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
+ CompletionCallback callback);
// Tells the decoder to reuse given picture buffer.
void ReusePictureBuffer(int32_t picture_buffer_id);
// Flushes the decoder. |callback| will be called as soon as Flush has been
// finished.
- bool Flush(CompletionCallback callback);
+ int32_t Flush(CompletionCallback callback);
// Dispatches abortion request to the decoder to abort decoding as soon as
// possible. |callback| will be called as soon as abortion has been finished.
- bool Abort(CompletionCallback callback);
+ int32_t Abort(CompletionCallback callback);
private:
// Pointer to the plugin's video decoder support interface for providing the