Skip to content

Commit

Permalink
Partial fix for shutdown. still need to cleanup event queue and recon…
Browse files Browse the repository at this point in the history
…sider compositor destroy
  • Loading branch information
tmeshkova committed Mar 21, 2014
1 parent b6e80f7 commit 9e1d2f0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
16 changes: 12 additions & 4 deletions embedding/embedlite/embedthread/EmbedLitePuppetWidget.cpp
Expand Up @@ -28,6 +28,8 @@
#include "EmbedLiteCompositorParent.h"
#include "mozilla/Preferences.h"
#include "EmbedLiteApp.h"
#include "LayerScope.h"
#include "mozilla/unused.h"

using namespace mozilla::dom;
using namespace mozilla::hal;
Expand Down Expand Up @@ -81,6 +83,8 @@ EmbedLitePuppetWidget::IsTopLevel()

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

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

Expand All @@ -91,12 +95,16 @@ void EmbedLitePuppetWidget::DestroyCompositor()
// events already in the MessageLoop get processed before the
// CompositorChild is destroyed, so we add a task to the MessageLoop to
// handle compositor desctruction.
MessageLoop::current()->PostTask(FROM_HERE,
NewRunnableMethod(mCompositorChild.get(), &CompositorChild::Destroy));
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.
mCompositorParent.forget();
mCompositorChild.forget();
if (mCompositorParent)
unused << mCompositorParent.forget();
if (mCompositorChild)
unused << mCompositorChild.forget();
}
}

Expand Down
8 changes: 3 additions & 5 deletions embedding/embedlite/embedthread/EmbedLiteViewThreadChild.cpp
Expand Up @@ -129,8 +129,8 @@ bool EmbedLiteViewThreadChild::RecvDestroy()
AppChild()->AppService()->UnregisterView(mId);
if (mHelper)
mHelper->Unload();
if (mBChrome)
mBChrome->RemoveEventHandler();
if (mChrome)
mChrome->RemoveEventHandler();
mWidget = nullptr;
mWebBrowser = nullptr;
mChrome = nullptr;
Expand Down Expand Up @@ -184,9 +184,7 @@ EmbedLiteViewThreadChild::InitGeckoWindow(const uint32_t& parentId)

nsCOMPtr<nsIDOMWindow> domWindow;

nsIWebBrowserChrome** aNewWindow = getter_AddRefs(mChrome);
mBChrome = new WebBrowserChrome(this);
CallQueryInterface(static_cast<nsIWebBrowserChrome*>(mBChrome), aNewWindow);
mChrome = new WebBrowserChrome(this);
uint32_t aChromeFlags = 0; // View()->GetWindowFlags();

mWebBrowser->SetContainerWindow(mChrome);
Expand Down
3 changes: 1 addition & 2 deletions embedding/embedlite/embedthread/EmbedLiteViewThreadChild.h
Expand Up @@ -128,10 +128,9 @@ class EmbedLiteViewThreadChild : public PEmbedLiteViewChild,
uint64_t mOuterId;
nsCOMPtr<nsIWidget> mWidget;
nsCOMPtr<nsIWebBrowser> mWebBrowser;
nsCOMPtr<nsIWebBrowserChrome> mChrome;
nsRefPtr<WebBrowserChrome> mChrome;
nsCOMPtr<nsIDOMWindow> mDOMWindow;
nsCOMPtr<nsIWebNavigation> mWebNavigation;
WebBrowserChrome* mBChrome;
gfxSize mViewSize;
bool mViewResized;
gfxSize mGLViewSize;
Expand Down

0 comments on commit 9e1d2f0

Please sign in to comment.