diff options
Diffstat (limited to 'chromium/content/renderer/pepper')
6 files changed, 54 insertions, 21 deletions
diff --git a/chromium/content/renderer/pepper/message_channel.cc b/chromium/content/renderer/pepper/message_channel.cc index 7c5961cfbe2..51132a6dc42 100644 --- a/chromium/content/renderer/pepper/message_channel.cc +++ b/chromium/content/renderer/pepper/message_channel.cc @@ -292,6 +292,18 @@ NPClass message_channel_class = { } // namespace // MessageChannel -------------------------------------------------------------- +struct MessageChannel::VarConversionResult { + VarConversionResult(const ppapi::ScopedPPVar& r, bool s) + : result(r), + success(s), + conversion_completed(true) {} + VarConversionResult() + : success(false), + conversion_completed(false) {} + ppapi::ScopedPPVar result; + bool success; + bool conversion_completed; +}; MessageChannel::MessageChannelNPObject::MessageChannelNPObject() { } diff --git a/chromium/content/renderer/pepper/message_channel.h b/chromium/content/renderer/pepper/message_channel.h index 43aa0f95a62..e0020e688c1 100644 --- a/chromium/content/renderer/pepper/message_channel.h +++ b/chromium/content/renderer/pepper/message_channel.h @@ -11,12 +11,15 @@ #include "base/memory/weak_ptr.h" #include "ppapi/shared_impl/resource.h" -#include "ppapi/shared_impl/scoped_pp_var.h" #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" #include "third_party/npapi/bindings/npruntime.h" struct PP_Var; +namespace ppapi { +class ScopedPPVar; +} + namespace content { class PepperPluginInstanceImpl; @@ -87,18 +90,7 @@ class MessageChannel { private: // Struct for storing the result of a NPVariant being converted to a PP_Var. - struct VarConversionResult { - VarConversionResult(const ppapi::ScopedPPVar& r, bool s) - : result(r), - success(s), - conversion_completed(true) {} - VarConversionResult() - : success(false), - conversion_completed(false) {} - ppapi::ScopedPPVar result; - bool success; - bool conversion_completed; - }; + struct VarConversionResult; // This is called when an NPVariant is finished being converted. // |result_iteartor| is an iterator into |converted_var_queue_| where the diff --git a/chromium/content/renderer/pepper/pepper_platform_context_3d.cc b/chromium/content/renderer/pepper/pepper_platform_context_3d.cc index b9fd07b67d5..6c3408bd429 100644 --- a/chromium/content/renderer/pepper/pepper_platform_context_3d.cc +++ b/chromium/content/renderer/pepper/pepper_platform_context_3d.cc @@ -107,6 +107,7 @@ bool PlatformContext3D::Init(const int32* attrib_list, if (!command_buffer_->ProduceFrontBuffer(names[0])) return false; mailbox_ = names[0]; + sync_point_ = command_buffer_->InsertSyncPoint(); command_buffer_->SetChannelErrorCallback( base::Bind(&PlatformContext3D::OnContextLost, @@ -118,8 +119,15 @@ bool PlatformContext3D::Init(const int32* attrib_list, return true; } -void PlatformContext3D::GetBackingMailbox(gpu::Mailbox* mailbox) { +void PlatformContext3D::GetBackingMailbox(gpu::Mailbox* mailbox, + uint32* sync_point) { *mailbox = mailbox_; + *sync_point = sync_point_; +} + +void PlatformContext3D::InsertSyncPointForBackingMailbox() { + DCHECK(command_buffer_); + sync_point_ = command_buffer_->InsertSyncPoint(); } bool PlatformContext3D::IsOpaque() { diff --git a/chromium/content/renderer/pepper/pepper_platform_context_3d.h b/chromium/content/renderer/pepper/pepper_platform_context_3d.h index 2520bbd65da..dcd42caa611 100644 --- a/chromium/content/renderer/pepper/pepper_platform_context_3d.h +++ b/chromium/content/renderer/pepper/pepper_platform_context_3d.h @@ -31,7 +31,11 @@ class PlatformContext3D { bool Init(const int32* attrib_list, PlatformContext3D* share_context); // Retrieves the mailbox name for the front buffer backing the context. - void GetBackingMailbox(gpu::Mailbox* mailbox); + void GetBackingMailbox(gpu::Mailbox* mailbox, uint32* sync_point); + + // Inserts a new sync point to associate with the backing mailbox, that should + // be waited on before using the mailbox. + void InsertSyncPointForBackingMailbox(); // Returns true if the backing texture is always opaque. bool IsOpaque(); @@ -68,6 +72,7 @@ class PlatformContext3D { scoped_refptr<GpuChannelHost> channel_; gpu::Mailbox mailbox_; + uint32 sync_point_; bool has_alpha_; CommandBufferProxyImpl* command_buffer_; base::Closure context_lost_callback_; diff --git a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc index c6d6582132c..405d6ceb4c4 100644 --- a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -700,9 +700,21 @@ void PepperPluginInstanceImpl::ScrollRect(int dx, } } +static void IgnoreCallback(unsigned, bool) {} + void PepperPluginInstanceImpl::CommitBackingTexture() { - if (texture_layer_.get()) - texture_layer_->SetNeedsDisplay(); + if (!texture_layer_.get()) + return; + PlatformContext3D* context = bound_graphics_3d_->platform_context(); + gpu::Mailbox mailbox; + uint32 sync_point = 0; + context->GetBackingMailbox(&mailbox, &sync_point); + DCHECK(!mailbox.IsZero()); + DCHECK_NE(sync_point, 0u); + texture_layer_->SetTextureMailbox( + cc::TextureMailbox(mailbox, sync_point), + cc::SingleReleaseCallback::Create(base::Bind(&IgnoreCallback))); + texture_layer_->SetNeedsDisplay(); } void PepperPluginInstanceImpl::InstanceCrashed() { @@ -1857,16 +1869,16 @@ bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output, #endif } -static void IgnoreCallback(unsigned, bool) {} - void PepperPluginInstanceImpl::UpdateLayer() { if (!container_) return; gpu::Mailbox mailbox; + uint32 sync_point = 0; if (bound_graphics_3d_.get()) { PlatformContext3D* context = bound_graphics_3d_->platform_context(); - context->GetBackingMailbox(&mailbox); + context->GetBackingMailbox(&mailbox, &sync_point); + DCHECK_EQ(mailbox.IsZero(), sync_point == 0); } bool want_3d_layer = !mailbox.IsZero(); bool want_2d_layer = bound_graphics_2d_platform_ && @@ -1895,7 +1907,7 @@ void PepperPluginInstanceImpl::UpdateLayer() { texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL); opaque = bound_graphics_3d_->IsOpaque(); texture_layer_->SetTextureMailbox( - cc::TextureMailbox(mailbox, 0), + cc::TextureMailbox(mailbox, sync_point), cc::SingleReleaseCallback::Create(base::Bind(&IgnoreCallback))); } else { DCHECK(bound_graphics_2d_platform_); diff --git a/chromium/content/renderer/pepper/ppb_graphics_3d_impl.cc b/chromium/content/renderer/pepper/ppb_graphics_3d_impl.cc index 1564279f7b4..989b9994395 100644 --- a/chromium/content/renderer/pepper/ppb_graphics_3d_impl.cc +++ b/chromium/content/renderer/pepper/ppb_graphics_3d_impl.cc @@ -197,6 +197,10 @@ int32 PPB_Graphics3D_Impl::DoSwapBuffers() { if (gles2_impl()) gles2_impl()->SwapBuffers(); + // Since the backing texture has been updated, a new sync point should be + // inserted. + platform_context_->InsertSyncPointForBackingMailbox(); + if (bound_to_instance_) { // If we are bound to the instance, we need to ask the compositor // to commit our backing texture so that the graphics appears on the page. |