Skip to content

Commit

Permalink
[embedlite] Fix browser crash upon exit. Fixes JB#36633
Browse files Browse the repository at this point in the history
Introduce surface size to the EmbedLiteCompositorParent so
that destruction phase can be executed correctly. In other
words, do not read CompositorParent::mEGLSurfaceSize directly.
  • Loading branch information
rainemak committed Oct 18, 2016
1 parent 284553c commit f86324a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions embedding/embedlite/embedthread/EmbedLiteCompositorParent.cpp
Expand Up @@ -44,6 +44,7 @@ EmbedLiteCompositorParent::EmbedLiteCompositorParent(nsIWidget* widget,
: CompositorParent(widget, aRenderToEGLSurface, aSurfaceWidth, aSurfaceHeight)
, mWindowId(windowId)
, mCurrentCompositeTask(nullptr)
, mSurfaceSize(aSurfaceWidth, aSurfaceHeight)
, mRenderMutex("EmbedLiteCompositorParent render mutex")
{
EmbedLiteWindowBaseParent* parentWindow = EmbedLiteWindowBaseParent::From(mWindowId);
Expand Down Expand Up @@ -124,8 +125,7 @@ EmbedLiteCompositorParent::UpdateTransformState()
GLContext* context = compositor->gl();
NS_ENSURE_TRUE(context, );

gfx::IntSize eglSize(mEGLSurfaceSize.width, mEGLSurfaceSize.height);
if (context->IsOffscreen() && context->OffscreenSize() != eglSize && context->ResizeOffscreen(eglSize)) {
if (context->IsOffscreen() && context->OffscreenSize() != mSurfaceSize && context->ResizeOffscreen(mSurfaceSize)) {
ScheduleRenderOnCompositorThread();
}
}
Expand Down Expand Up @@ -206,9 +206,9 @@ bool EmbedLiteCompositorParent::RenderGL(TimeStamp aScheduleTime)

void EmbedLiteCompositorParent::SetSurfaceSize(int width, int height)
{
if (width > 0 && height > 0 && (mEGLSurfaceSize.width != width || mEGLSurfaceSize.height != height)) {
if (width > 0 && height > 0 && (mSurfaceSize.width != width || mSurfaceSize.height != height)) {
SetEGLSurfaceSize(width, height);
mEGLSurfaceSize.SizeTo(width, height);
mSurfaceSize = gfx::IntSize(width, height);
}
}

Expand Down Expand Up @@ -250,9 +250,9 @@ EmbedLiteCompositorParent::SuspendRendering()
void
EmbedLiteCompositorParent::ResumeRendering()
{
if (mEGLSurfaceSize.width > 0 && mEGLSurfaceSize.height > 0) {
CompositorParent::ScheduleResumeOnCompositorThread(mEGLSurfaceSize.width,
mEGLSurfaceSize.height);
if (mSurfaceSize.width > 0 && mSurfaceSize.height > 0) {
CompositorParent::ScheduleResumeOnCompositorThread(mSurfaceSize.width,
mSurfaceSize.height);
CompositorParent::ScheduleRenderOnCompositorThread();
}
}
Expand Down
Expand Up @@ -53,6 +53,7 @@ class EmbedLiteCompositorParent : public mozilla::layers::CompositorParent

uint32_t mWindowId;
CancelableTask* mCurrentCompositeTask;
gfx::IntSize mSurfaceSize;
bool mUseExternalGLContext;
Mutex mRenderMutex;

Expand Down

0 comments on commit f86324a

Please sign in to comment.