Skip to content

Commit

Permalink
Remove old hacks around compositor destroy functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeshkova committed May 26, 2014
1 parent cee8876 commit 2b1dbd9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
Expand Up @@ -41,7 +41,6 @@ EmbedLiteCompositorParent::EmbedLiteCompositorParent(nsIWidget* aWidget,
, mLastViewSize(aSurfaceWidth, aSurfaceHeight)
, mInitialPaintCount(0)
{
AddRef();
mCompositor = new CompositorParent(aWidget, aRenderToEGLSurface, aSurfaceWidth, aSurfaceHeight);
mCompositor->SetCompositorInterface(this);
EmbedLiteView* view = EmbedLiteApp::GetInstance()->GetViewByID(mId);
Expand Down
31 changes: 3 additions & 28 deletions embedding/embedlite/embedthread/EmbedLitePuppetWidget.cpp
Expand Up @@ -81,33 +81,6 @@ EmbedLitePuppetWidget::IsTopLevel()
mWindowType == eWindowType_invisible;
}

void EmbedLitePuppetWidget::DestroyCompositor()
{
LayerScope::DestroyServerSocket();

if (mCompositorChild) {
mCompositorChild->SendWillStop();

// The call just made to SendWillStop can result in IPC from the
// CompositorParent to the CompositorChild (e.g. caused by the destruction
// of shared memory). We need to ensure this gets processed by the
// CompositorChild before it gets destroyed. It suffices to ensure that
// events already in the MessageLoop get processed before the
// CompositorChild is destroyed, so we add a task to the MessageLoop to
// handle compositor desctruction.
if (mCompositorChild) {
MessageLoop::current()->PostTask(FROM_HERE,
NewRunnableMethod(mCompositorChild.get(), &CompositorChild::Destroy));
}
// The DestroyCompositor task we just added to the MessageLoop will handle
// releasing mCompositorParent and mCompositorChild.
if (mCompositorParent)
unused << mCompositorParent.forget();
if (mCompositorChild)
unused << mCompositorChild.forget();
}
}

EmbedLitePuppetWidget::EmbedLitePuppetWidget(EmbedLiteViewThreadChild* aEmbed, uint32_t& aId)
: mEmbed(aEmbed)
, mVisible(false)
Expand All @@ -125,7 +98,6 @@ EmbedLitePuppetWidget::~EmbedLitePuppetWidget()
MOZ_COUNT_DTOR(EmbedLitePuppetWidget);
LOGT("this:%p", this);
gTopLevelWindows.RemoveElement(this);
DestroyCompositor();
}

NS_IMETHODIMP
Expand Down Expand Up @@ -210,6 +182,9 @@ EmbedLitePuppetWidget::Destroy()
mEmbed = nullptr;
mChild = nullptr;
mCompositorWrapper = nullptr;

DestroyCompositor();

return NS_OK;
}

Expand Down
1 change: 0 additions & 1 deletion embedding/embedlite/embedthread/EmbedLitePuppetWidget.h
Expand Up @@ -156,7 +156,6 @@ class EmbedLitePuppetWidget : public nsBaseWidget,

private:
nsresult Paint();
void DestroyCompositor();
bool ViewIsValid();

EmbedLitePuppetWidget* TopWindow();
Expand Down

0 comments on commit 2b1dbd9

Please sign in to comment.