Skip to content

Commit

Permalink
Merge branch 'patchesPorted' into 'nemo_embedlite_38'
Browse files Browse the repository at this point in the history
Patches ported



See merge request !9
  • Loading branch information
Raine Makelainen committed Nov 3, 2015
2 parents 5f0865c + b5ed4b9 commit 7c3c50d
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 5 deletions.
1 change: 1 addition & 0 deletions embedding/embedlite/embedding.js
Expand Up @@ -101,6 +101,7 @@ pref("ui.dragThresholdY", 25);
pref("embedlite.dispatch_mouse_events", false); // Will dispatch mouse events if page using them
pref("media.gstreamer.enabled", true);
pref("media.prefer-gstreamer", true);
pref("media.gstreamer.enable-blacklist", false);
// Disable X backend on GTK
pref("gfx.xrender.enabled", false);
pref("gfx.qt.rgb16.force", true);
Expand Down
16 changes: 15 additions & 1 deletion embedding/embedlite/embedshared/EmbedLiteViewBaseChild.cpp
Expand Up @@ -1057,7 +1057,21 @@ EmbedLiteViewBaseChild::OnLoadFinished()
NS_IMETHODIMP
EmbedLiteViewBaseChild::OnWindowCloseRequested()
{
return SendOnWindowCloseRequested() ? NS_OK : NS_ERROR_FAILURE;
if (SendOnWindowCloseRequested()) {
// The event listeners can indirectly hold a reference to nsWebBrowser.
// Since the listener removal process is not synchronous we have to make
// sure that we start the process before ::RecvDestroy is called. Otherwise
// NULLing mWebBrowser in the function won't actually remove it and the current
// implementation relies on that. The nsWebBrowser object needs to be removed in
// order for all EmbedLitePuppetWidgets we created to also be released. The puppet
// widget implementation holds a pointer to EmbedLiteViewThreadParent in mEmbed
// variable and can use it during shutdown process. This means puppet widgets
// have to be removed before the view.
if (mChrome)
mChrome->RemoveEventHandler();
return NS_OK;
}
return NS_ERROR_FAILURE;
}

NS_IMETHODIMP
Expand Down
Expand Up @@ -246,6 +246,7 @@ EmbedLiteCompositorParent::ResumeRendering()
if (mLastViewSize.width > 0 && mLastViewSize.height > 0) {
CompositorParent::ScheduleResumeOnCompositorThread(mLastViewSize.width,
mLastViewSize.height);
CompositorParent::ScheduleRenderOnCompositorThread();
}
}

Expand Down
9 changes: 8 additions & 1 deletion gfx/gl/GLContextProviderEGL.cpp
Expand Up @@ -100,6 +100,7 @@ class AutoDestroyHWND {
#include "gfxFailure.h"
#include "gfxASurface.h"
#include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "GLContextProvider.h"
#include "GLLibraryEGL.h"
#include "TextureImageEGL.h"
Expand Down Expand Up @@ -421,7 +422,13 @@ GLContextEGL::IsCurrent() {
bool
GLContextEGL::RenewSurface() {
if (!mOwnsContext) {
return false;
if (gfxPrefs::UseExternalWindow()) {
mSurface = sEGLLibrary.fGetCurrentSurface(LOCAL_EGL_DRAW);
MOZ_ASSERT(mSurface != EGL_NO_SURFACE);
return MakeCurrent(true);
} else {
return false;
}
}
#ifndef MOZ_WIDGET_ANDROID
MOZ_CRASH("unimplemented");
Expand Down
34 changes: 31 additions & 3 deletions gfx/layers/opengl/CompositorOGL.cpp
Expand Up @@ -87,6 +87,7 @@ CompositorOGL::CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth,
, mUseExternalSurfaceSize(aUseExternalSurfaceSize)
, mFrameInProgress(false)
, mDestroyed(false)
, mPaused(false)
, mHeight(0)
, mCurrentProgram(nullptr)
{
Expand Down Expand Up @@ -1390,10 +1391,21 @@ CompositorOGL::CopyToTarget(DrawTarget* aTarget, const nsIntPoint& aTopLeft, con
void
CompositorOGL::Pause()
{
#ifdef MOZ_WIDGET_ANDROID
if (!gl() || gl()->IsDestroyed())
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_QT)
if (!gl() || gl()->IsDestroyed() || !gfxPrefs::UseExternalWindow())
return;

if (mFrameInProgress) {
// The browser may request compositor pause when actual compositing is
// in progress. Make sure we abort this process.
mGLContext->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);
mFrameInProgress = false;
mCurrentRenderTarget = nullptr;

if (mTexturePool) {
mTexturePool->EndFrame();
}
}
// ReleaseSurface internally calls MakeCurrent.
gl()->ReleaseSurface();
#else
Expand All @@ -1403,15 +1415,22 @@ CompositorOGL::Pause()
// TODO: call Layers->SetCompositor(nullptr);
CleanupResources();
#endif

mPaused = true;
}

bool
CompositorOGL::Resume()
{
#ifdef MOZ_WIDGET_ANDROID
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_QT)
if (!gfxPrefs::UseExternalWindow())
return true;

if (!gl() || gl()->IsDestroyed())
return false;

mPaused = false;

// RenewSurface internally calls MakeCurrent.
return gl()->RenewSurface();
#else
Expand All @@ -1424,6 +1443,15 @@ CompositorOGL::Resume()
return true;
}

bool
CompositorOGL::Ready()
{
if (gfxPrefs::UseExternalWindow() && mPaused) {
return false;
}
return Compositor::Ready();
}

TemporaryRef<DataTextureSource>
CompositorOGL::CreateDataTextureSource(TextureFlags aFlags)
{
Expand Down
2 changes: 2 additions & 0 deletions gfx/layers/opengl/CompositorOGL.h
Expand Up @@ -277,6 +277,7 @@ class CompositorOGL final : public Compositor

virtual void Pause() override;
virtual bool Resume() override;
virtual bool Ready() override;

virtual nsIWidget* GetWidget() const override { return mWidget; }

Expand Down Expand Up @@ -435,6 +436,7 @@ class CompositorOGL final : public Compositor
ContextStateTrackerOGL mContextStateTracker;

bool mDestroyed;
bool mPaused;

/**
* Height of the OpenGL context's primary framebuffer in pixels. Used by
Expand Down
1 change: 1 addition & 0 deletions gfx/thebes/gfxPrefs.h
Expand Up @@ -197,6 +197,7 @@ class gfxPrefs final
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-items", CanvasSkiaGLCacheItems, int32_t, 256);

DECL_GFX_PREF(Once, "gfx.compositor.clear-context", ClearCompoisitorContext, bool, true);
DECL_GFX_PREF(Once, "gfx.compositor.external-window", UseExternalWindow, bool, false);

DECL_GFX_PREF(Live, "gfx.color_management.enablev4", CMSEnableV4, bool, false);
DECL_GFX_PREF(Live, "gfx.color_management.mode", CMSMode, int32_t,-1);
Expand Down
3 changes: 3 additions & 0 deletions ipc/glue/MessagePump.cpp
Expand Up @@ -143,7 +143,10 @@ if (did_work && delayed_work_time_.is_null()
#ifdef MOZ_NUWA_PROCESS
if (!IsNuwaReady() || !IsNuwaProcess())
#endif
{
mDelayedWorkTimer->Cancel();
mDelayedWorkTimer = nullptr;
}

keep_running_ = true;
}
Expand Down

0 comments on commit 7c3c50d

Please sign in to comment.