Bug 575526 - NON-IPC build is broken in e10s branch r=joe

This commit is contained in:
Oleg Romashin 2010-06-29 10:47:32 -07:00
parent c3574973c1
commit 6366a23349

View File

@ -422,7 +422,7 @@ public:
NS_IMETHOD Redraw(const gfxRect &r); NS_IMETHOD Redraw(const gfxRect &r);
// Swap this back buffer with the front, and copy its contents to the new back. // Swap this back buffer with the front, and copy its contents to the new back.
// x, y, w, and h specify the area of |back| that is dirty. // x, y, w, and h specify the area of |back| that is dirty.
NS_IMETHOD Swap(Shmem& back, PRInt32 x, PRInt32 y, NS_IMETHOD Swap(mozilla::ipc::Shmem& back, PRInt32 x, PRInt32 y,
PRInt32 w, PRInt32 h); PRInt32 w, PRInt32 h);
NS_IMETHOD Swap(PRUint32 nativeID, PRInt32 x, PRInt32 y, NS_IMETHOD Swap(PRUint32 nativeID, PRInt32 x, PRInt32 y,
PRInt32 w, PRInt32 h); PRInt32 w, PRInt32 h);
@ -494,10 +494,12 @@ protected:
*/ */
gfxASurface::gfxImageFormat GetImageFormat() const; gfxASurface::gfxImageFormat GetImageFormat() const;
#ifdef MOZ_IPC
/** /**
* Sync data from mBackSurface to mSurface. * Sync data from mBackSurface to mSurface.
*/ */
nsresult Swap(const gfxRect& aRect); nsresult Swap(const gfxRect& aRect);
#endif
// Member vars // Member vars
PRInt32 mWidth, mHeight; PRInt32 mWidth, mHeight;
@ -835,12 +837,14 @@ nsCanvasRenderingContext2D::~nsCanvasRenderingContext2D()
{ {
Destroy(); Destroy();
#ifdef MOZ_IPC
ContentProcessParent* allocator = ContentProcessParent::GetSingleton(PR_FALSE); ContentProcessParent* allocator = ContentProcessParent::GetSingleton(PR_FALSE);
if (allocator && gfxSharedImageSurface::IsSharedImage(mBackSurface)) { if (allocator && gfxSharedImageSurface::IsSharedImage(mBackSurface)) {
Shmem mem = static_cast<gfxSharedImageSurface*>(mBackSurface.get())->GetShmem(); Shmem mem = static_cast<gfxSharedImageSurface*>(mBackSurface.get())->GetShmem();
allocator->DeallocShmem(mem); allocator->DeallocShmem(mem);
} }
mBackSurface = nsnull; mBackSurface = nsnull;
#endif
sNumLivingContexts--; sNumLivingContexts--;
if (!sNumLivingContexts) { if (!sNumLivingContexts) {
@ -854,11 +858,13 @@ nsCanvasRenderingContext2D::~nsCanvasRenderingContext2D()
void void
nsCanvasRenderingContext2D::Destroy() nsCanvasRenderingContext2D::Destroy()
{ {
#ifdef MOZ_IPC
ContentProcessParent* allocator = ContentProcessParent::GetSingleton(PR_FALSE); ContentProcessParent* allocator = ContentProcessParent::GetSingleton(PR_FALSE);
if (allocator && gfxSharedImageSurface::IsSharedImage(mSurface)) { if (allocator && gfxSharedImageSurface::IsSharedImage(mSurface)) {
Shmem &mem = static_cast<gfxSharedImageSurface*>(mSurface.get())->GetShmem(); Shmem &mem = static_cast<gfxSharedImageSurface*>(mSurface.get())->GetShmem();
allocator->DeallocShmem(mem); allocator->DeallocShmem(mem);
} }
#endif
// only do this for non-docshell created contexts, // only do this for non-docshell created contexts,
// since those are the ones that we created a surface for // since those are the ones that we created a surface for
@ -1216,6 +1222,7 @@ nsCanvasRenderingContext2D::SetIsIPC(PRBool isIPC)
#endif #endif
} }
#ifdef MOZ_IPC
nsresult nsresult
nsCanvasRenderingContext2D::Swap(const gfxRect& aRect) nsCanvasRenderingContext2D::Swap(const gfxRect& aRect)
{ {
@ -1247,9 +1254,10 @@ nsCanvasRenderingContext2D::Swap(const gfxRect& aRect)
} }
return NS_OK; return NS_OK;
} }
#endif
NS_IMETHODIMP NS_IMETHODIMP
nsCanvasRenderingContext2D::Swap(Shmem& aBack, nsCanvasRenderingContext2D::Swap(mozilla::ipc::Shmem& aBack,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{ {
#ifdef MOZ_IPC #ifdef MOZ_IPC
@ -1273,6 +1281,8 @@ nsCanvasRenderingContext2D::Swap(Shmem& aBack,
// Take mBackSurface shared memory ownership // Take mBackSurface shared memory ownership
mem = aBack; mem = aBack;
return Swap(gfxRect(x, y, w, h)); return Swap(gfxRect(x, y, w, h));
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif #endif
} }
@ -1280,10 +1290,14 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::Swap(PRUint32 nativeID, nsCanvasRenderingContext2D::Swap(PRUint32 nativeID,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{ {
#ifdef MOZ_IPC
if (mIsBackSurfaceReadable) if (mIsBackSurfaceReadable)
NS_ERROR("Back surface readable before swap, this must not happen"); NS_ERROR("Back surface readable before swap, this must not happen");
mIsBackSurfaceReadable = PR_TRUE; mIsBackSurfaceReadable = PR_TRUE;
return Swap(gfxRect(x, y, w, h)); return Swap(gfxRect(x, y, w, h));
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP