summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authorvrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-28 22:16:30 +0000
committervrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-28 22:16:30 +0000
commita81c24c6c04e6f86dc3f2b902c69f4df4f8d614f (patch)
treef807f2bad720835274bf2ae6b9bcabd39665bf56 /webkit/plugins
parent6930c52974a804f6462a546ffb46b0c14caa983b (diff)
downloadchromium_src-a81c24c6c04e6f86dc3f2b902c69f4df4f8d614f.zip
chromium_src-a81c24c6c04e6f86dc3f2b902c69f4df4f8d614f.tar.gz
chromium_src-a81c24c6c04e6f86dc3f2b902c69f4df4f8d614f.tar.bz2
Remove ReadWriteTokens from GpuVideoDecodeAccelerator + fallout
With apatrick's changes in r93066, we no longer need to manually sync up with the command buffer before handling IPC messages in GpuVideoDecodeAccelerator. BUG=none TEST=gles2 example runs without crashing Review URL: http://codereview.chromium.org/7521015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.cc3
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.h7
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h4
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.cc32
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.h16
5 files changed, 46 insertions, 16 deletions
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index 1270504..9fe11e6 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -46,8 +46,7 @@ MockPluginDelegate::PlatformContext3D* MockPluginDelegate::CreateContext3D() {
MockPluginDelegate::PlatformVideoDecoder*
MockPluginDelegate::CreateVideoDecoder(
media::VideoDecodeAccelerator::Client* client,
- int32 command_buffer_route_id,
- gpu::CommandBufferHelper* cmd_buffer_helper) {
+ int32 command_buffer_route_id) {
return NULL;
}
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index c58d4fd..5a6c9f8 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -7,10 +7,6 @@
#include "webkit/plugins/ppapi/plugin_delegate.h"
-namespace gpu {
-class CommandBufferHelper;
-}
-
namespace webkit {
namespace ppapi {
@@ -28,8 +24,7 @@ class MockPluginDelegate : public PluginDelegate {
virtual PlatformContext3D* CreateContext3D();
virtual PlatformVideoDecoder* CreateVideoDecoder(
media::VideoDecodeAccelerator::Client* client,
- int32 command_buffer_route_id,
- gpu::CommandBufferHelper* cmd_buffer_helper);
+ int32 command_buffer_route_id);
virtual PlatformAudio* CreateAudio(uint32_t sample_rate,
uint32_t sample_count,
PlatformAudio::Client* client);
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index ebfda18..7c2ad18 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -46,7 +46,6 @@ class Rect;
namespace gpu {
class CommandBuffer;
-class CommandBufferHelper;
}
namespace ppapi {
@@ -264,8 +263,7 @@ class PluginDelegate {
// The caller will own the pointer returned from this.
virtual PlatformVideoDecoder* CreateVideoDecoder(
media::VideoDecodeAccelerator::Client* client,
- int32 command_buffer_route_id,
- gpu::CommandBufferHelper* cmd_buffer_helper) = 0;
+ int32 command_buffer_route_id) = 0;
// The caller is responsible for calling Shutdown() on the returned pointer
// to clean up the corresponding resources allocated during this call.
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
index 849e5b8..4874998 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
@@ -37,15 +37,14 @@ PPB_VideoDecoder_Impl::PPB_VideoDecoder_Impl(PluginInstance* instance)
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
context3d_id_(0),
flush_callback_(PP_BlockUntilComplete()),
- reset_callback_(PP_BlockUntilComplete()) {
+ reset_callback_(PP_BlockUntilComplete()),
+ gles2_impl_(NULL) {
ppp_videodecoder_ =
static_cast<const PPP_VideoDecoder_Dev*>(instance->module()->
GetPluginInterface(PPP_VIDEODECODER_DEV_INTERFACE));
}
PPB_VideoDecoder_Impl::~PPB_VideoDecoder_Impl() {
- if (context3d_id_)
- ResourceTracker::Get()->UnrefResource(context3d_id_);
}
PPB_VideoDecoder_API* PPB_VideoDecoder_Impl::AsPPB_VideoDecoder_API() {
@@ -70,13 +69,15 @@ int32_t PPB_VideoDecoder_Impl::Initialize(
context3d_id_ = context_id;
ResourceTracker::Get()->AddRefResource(context3d_id_);
+
int command_buffer_route_id =
context3d->platform_context()->GetCommandBufferRouteId();
if (command_buffer_route_id == 0)
return PP_ERROR_FAILED;
-
platform_video_decoder_ = instance()->delegate()->CreateVideoDecoder(
- this, command_buffer_route_id, context3d->gles2_impl()->helper());
+ this, command_buffer_route_id);
+
+ gles2_impl_ = context3d->gles2_impl();
if (!platform_video_decoder_)
return PP_ERROR_FAILED;
@@ -95,6 +96,7 @@ int32_t PPB_VideoDecoder_Impl::Initialize(
copied.push_back(static_cast<uint32>(*current));
}
+ FlushCommandBuffer();
if (platform_video_decoder_->Initialize(copied)) {
initialization_callback_ = callback;
return PP_OK_COMPLETIONPENDING;
@@ -120,6 +122,7 @@ int32_t PPB_VideoDecoder_Impl::Decode(
CHECK(bitstream_buffer_callbacks_.insert(std::make_pair(
bitstream_buffer->id, callback)).second);
+ FlushCommandBuffer();
platform_video_decoder_->Decode(decode_buffer);
return PP_OK_COMPLETIONPENDING;
}
@@ -139,12 +142,16 @@ void PPB_VideoDecoder_Impl::AssignPictureBuffers(
in_buf.texture_id);
wrapped_buffers.push_back(buffer);
}
+
+ FlushCommandBuffer();
platform_video_decoder_->AssignPictureBuffers(wrapped_buffers);
}
void PPB_VideoDecoder_Impl::ReusePictureBuffer(int32_t picture_buffer_id) {
if (!platform_video_decoder_)
return;
+
+ FlushCommandBuffer();
platform_video_decoder_->ReusePictureBuffer(picture_buffer_id);
}
@@ -156,6 +163,7 @@ int32_t PPB_VideoDecoder_Impl::Flush(PP_CompletionCallback callback) {
// TODO(fischman,vrk): consider implications of already-outstanding callback.
flush_callback_ = callback;
+ FlushCommandBuffer();
platform_video_decoder_->Flush();
return PP_OK_COMPLETIONPENDING;
}
@@ -168,6 +176,7 @@ int32_t PPB_VideoDecoder_Impl::Reset(PP_CompletionCallback callback) {
// TODO(fischman,vrk): consider implications of already-outstanding callback.
reset_callback_ = callback;
+ FlushCommandBuffer();
platform_video_decoder_->Reset();
return PP_OK_COMPLETIONPENDING;
}
@@ -175,7 +184,12 @@ int32_t PPB_VideoDecoder_Impl::Reset(PP_CompletionCallback callback) {
void PPB_VideoDecoder_Impl::Destroy() {
if (!platform_video_decoder_)
return;
+
+ FlushCommandBuffer();
platform_video_decoder_->Destroy();
+ gles2_impl_ = NULL;
+ if (context3d_id_)
+ ResourceTracker::Get()->UnrefResource(context3d_id_);
platform_video_decoder_ = NULL;
ppp_videodecoder_ = NULL;
}
@@ -268,5 +282,13 @@ void PPB_VideoDecoder_Impl::NotifyInitializeDone() {
PP_RunAndClearCompletionCallback(&initialization_callback_, PP_OK);
}
+void PPB_VideoDecoder_Impl::FlushCommandBuffer() {
+ // For the out-of-process case, |gles2_impl_| will be NULL in the renderer
+ // process. The VideoDecoder_Proxy is charged with the responsibility of
+ // doing this Flush() in the analogous places in the plugin process.
+ if (gles2_impl_)
+ gles2_impl_->Flush();
+}
+
} // namespace ppapi
} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.h b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
index a1e2f07..b6193e7 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.h
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
@@ -23,6 +23,12 @@ struct PP_VideoBitstreamBuffer_Dev;
struct PPB_VideoDecoder_Dev;
struct PPP_VideoDecoder_Dev;
+namespace gpu {
+namespace gles2 {
+class GLES2Implementation;
+}
+}
+
namespace webkit {
namespace ppapi {
@@ -69,6 +75,9 @@ class PPB_VideoDecoder_Impl : public Resource,
// done.
typedef std::map<int32, PP_CompletionCallback> CallbackById;
+ // Tell command buffer to process all commands it has received so far.
+ void FlushCommandBuffer();
+
// This is NULL before initialization, and if this PPB_VideoDecoder_Impl is
// swapped with another.
scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_;
@@ -88,6 +97,13 @@ class PPB_VideoDecoder_Impl : public Resource,
// Reference to the plugin requesting this interface.
const PPP_VideoDecoder_Dev* ppp_videodecoder_;
+ // Reference to the GLES2Implementation owned by PPB_Context3D_Impl.
+ // PPB_Context3D_Impl is guaranteed to be alive for the lifetime of this
+ // class.
+ // In the out-of-process case, Context3D's gles2_impl() exists in the plugin
+ // process only, so gles2_impl_ is NULL in that case.
+ gpu::gles2::GLES2Implementation* gles2_impl_;
+
DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl);
};