Bug 596451 part C - simplify the behavior of the returning surface from Show, because it's only used to hand back ownership of IPDL shared memory.

This commit is contained in:
Benjamin Smedberg 2010-10-14 14:14:23 -04:00
parent 135698e22c
commit 71106cd304
3 changed files with 15 additions and 27 deletions

View File

@ -169,12 +169,14 @@ parent:
async NPN_InvalidateRect(NPRect rect);
// Give |newSurface|, containing this instance's updated pixels, to
// the browser for compositing. Get back |prevSurface|, containing
// old pixels, to be recycled
// the browser for compositing. When this method returns, any surface
// previously passed to Show may be destroyed.
//
// @param rect - actually updated rectangle, comparing to prevSurface content
// could be used for partial render of layer to topLevel context
// @param newSurface - remotable surface
// @param prevSurface - return surface for recycling
// @param prevSurface - if the previous surface was shared-memory, returns
// the shmem for reuse
sync Show(NPRect updatedRect, SurfaceDescriptor newSurface)
returns (SurfaceDescriptor prevSurface);

View File

@ -2483,7 +2483,6 @@ PluginInstanceChild::ShowPluginFrame()
NPRect r = { rect.y, rect.x, rect.YMost(), rect.XMost() };
SurfaceDescriptor currSurf;
SurfaceDescriptor outSurf = null_t();
#ifdef MOZ_X11
if (mCurrentSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
gfxXlibSurface *xsurf = static_cast<gfxXlibSurface*>(mCurrentSurface.get());
@ -2500,7 +2499,11 @@ PluginInstanceChild::ShowPluginFrame()
NS_RUNTIMEABORT("Surface type is not remotable");
return false;
}
if (!SendShow(r, currSurf, &outSurf)) {
// Unused, except to possibly return a shmem to us
SurfaceDescriptor returnSurf;
if (!SendShow(r, currSurf, &returnSurf)) {
return false;
}

View File

@ -498,31 +498,14 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
#endif
mSentPaintNotification = PR_FALSE;
if (mFrontSurface) {
#ifdef MOZ_X11
if (mFrontSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
gfxXlibSurface *xsurf = static_cast<gfxXlibSurface*>(mFrontSurface.get());
*prevSurface =
SurfaceDescriptorX11(xsurf->XDrawable(), xsurf->XRenderFormat()->id,
mFrontSurface->GetSize());
} else
#endif
if (gfxSharedImageSurface::IsSharedImage(mFrontSurface)) {
*prevSurface = static_cast<gfxSharedImageSurface*>(mFrontSurface.get())->GetShmem();
} else {
*prevSurface = null_t();
}
} else {
if (mFrontSurface && gfxSharedImageSurface::IsSharedImage(mFrontSurface))
*prevSurface = static_cast<gfxSharedImageSurface*>(mFrontSurface.get())->GetShmem();
else
*prevSurface = null_t();
}
mFrontSurface = surface;
RecvNPN_InvalidateRect(updatedRect);
#ifdef MOZ_X11
// Sync prevSurface before sending to child
if (prevSurface->type() == SurfaceDescriptor::TSurfaceDescriptorX11) {
XSync(DefaultXDisplay(), False);
}
#endif
return true;
}