mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 1553135 - Lock LayerViewSupport
during detach so that other methods cannot be called during this time. r=geckoview-reviewers,snorp
This is caused by a race condition when the compositor is detached. Because the actual detachment happens in a new thread, `detach` can complete and release the lock on `mLayerViewSupport`, and `RecvScreenPixels` can obtain the lock, before `mLayerViewSupport` is properly cleaned up. We therefore check to ensure that `lvs` is not null before calling a method on it. Differential Revision: https://phabricator.services.mozilla.com/D36928 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
fc92f585e2
commit
8a99efca37
@ -18,15 +18,15 @@
|
|||||||
#include "mozilla/WeakPtr.h"
|
#include "mozilla/WeakPtr.h"
|
||||||
#include "mozilla/WheelHandlingHelper.h" // for WheelDeltaAdjustmentStrategy
|
#include "mozilla/WheelHandlingHelper.h" // for WheelDeltaAdjustmentStrategy
|
||||||
|
|
||||||
#include "mozilla/a11y/SessionAccessibility.h"
|
|
||||||
#include "mozilla/dom/ContentParent.h"
|
|
||||||
#include "mozilla/dom/ContentChild.h"
|
|
||||||
#include "mozilla/dom/MouseEventBinding.h"
|
|
||||||
#include "mozilla/Unused.h"
|
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/layers/RenderTrace.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "mozilla/gfx/DataSurfaceHelpers.h"
|
#include "mozilla/a11y/SessionAccessibility.h"
|
||||||
|
#include "mozilla/dom/ContentChild.h"
|
||||||
|
#include "mozilla/dom/ContentParent.h"
|
||||||
|
#include "mozilla/dom/MouseEventBinding.h"
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
|
#include "mozilla/gfx/DataSurfaceHelpers.h"
|
||||||
|
#include "mozilla/layers/RenderTrace.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using mozilla::Unused;
|
using mozilla::Unused;
|
||||||
@ -53,27 +53,27 @@ using mozilla::dom::ContentParent;
|
|||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "nsViewManager.h"
|
#include "nsViewManager.h"
|
||||||
|
|
||||||
#include "nsContentUtils.h"
|
|
||||||
#include "WidgetUtils.h"
|
#include "WidgetUtils.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
|
#include "nsGfxCIID.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsWidgetsCID.h"
|
#include "nsWidgetsCID.h"
|
||||||
#include "nsGfxCIID.h"
|
|
||||||
|
|
||||||
#include "gfxContext.h"
|
#include "gfxContext.h"
|
||||||
|
|
||||||
|
#include "AndroidContentController.h"
|
||||||
|
#include "GLContext.h"
|
||||||
|
#include "GLContextProvider.h"
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
#include "mozilla/layers/LayerManagerComposite.h"
|
#include "ScopedGLHelpers.h"
|
||||||
#include "mozilla/layers/AsyncCompositionManager.h"
|
|
||||||
#include "mozilla/layers/APZEventState.h"
|
#include "mozilla/layers/APZEventState.h"
|
||||||
#include "mozilla/layers/APZInputBridge.h"
|
#include "mozilla/layers/APZInputBridge.h"
|
||||||
#include "mozilla/layers/APZThreadUtils.h"
|
#include "mozilla/layers/APZThreadUtils.h"
|
||||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
#include "mozilla/layers/AsyncCompositionManager.h"
|
||||||
#include "GLContext.h"
|
|
||||||
#include "GLContextProvider.h"
|
|
||||||
#include "ScopedGLHelpers.h"
|
|
||||||
#include "mozilla/layers/CompositorOGL.h"
|
#include "mozilla/layers/CompositorOGL.h"
|
||||||
#include "AndroidContentController.h"
|
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||||
|
#include "mozilla/layers/LayerManagerComposite.h"
|
||||||
|
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
|
|
||||||
@ -81,18 +81,18 @@ using mozilla::dom::ContentParent;
|
|||||||
#include "AndroidBridgeUtilities.h"
|
#include "AndroidBridgeUtilities.h"
|
||||||
#include "AndroidUiThread.h"
|
#include "AndroidUiThread.h"
|
||||||
#include "FennecJNINatives.h"
|
#include "FennecJNINatives.h"
|
||||||
#include "GeneratedJNINatives.h"
|
|
||||||
#include "GeckoEditableSupport.h"
|
#include "GeckoEditableSupport.h"
|
||||||
|
#include "GeneratedJNINatives.h"
|
||||||
#include "KeyEvent.h"
|
#include "KeyEvent.h"
|
||||||
#include "MotionEvent.h"
|
#include "MotionEvent.h"
|
||||||
#include "ScreenHelperAndroid.h"
|
#include "ScreenHelperAndroid.h"
|
||||||
|
|
||||||
#include "imgIEncoder.h"
|
#include "imgIEncoder.h"
|
||||||
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "GeckoProfiler.h" // For AUTO_PROFILER_LABEL
|
#include "GeckoProfiler.h" // For AUTO_PROFILER_LABEL
|
||||||
#include "nsIXULRuntime.h"
|
#include "nsIXULRuntime.h"
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
#include "mozilla/ipc/Shmem.h"
|
#include "mozilla/ipc/Shmem.h"
|
||||||
|
|
||||||
@ -862,22 +862,29 @@ class nsWindow::LayerViewSupport final
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LockedWindowPtr window{mWindow}) {
|
||||||
uiThread->Dispatch(NS_NewRunnableFunction(
|
uiThread->Dispatch(NS_NewRunnableFunction(
|
||||||
"LayerViewSupport::OnDetach",
|
"LayerViewSupport::OnDetach",
|
||||||
[compositor, disposer = RefPtr<Runnable>(aDisposer),
|
[compositor, disposer = RefPtr<Runnable>(aDisposer),
|
||||||
result = &mCapturePixelsResults] {
|
results = &mCapturePixelsResults, lock = &window] {
|
||||||
while (!result->empty()) {
|
if (lock) {
|
||||||
result->front()->CompleteExceptionally(
|
while (!results->empty()) {
|
||||||
|
auto aResult = java::GeckoResult::LocalRef(results->front());
|
||||||
|
if (aResult) {
|
||||||
|
aResult->CompleteExceptionally(
|
||||||
java::sdk::IllegalStateException::New(
|
java::sdk::IllegalStateException::New(
|
||||||
"The compositor has detached from the session")
|
"The compositor has detached from the session")
|
||||||
.Cast<jni::Throwable>());
|
.Cast<jni::Throwable>());
|
||||||
result->pop();
|
results->pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
compositor->OnCompositorDetached();
|
compositor->OnCompositorDetached();
|
||||||
disposer->Run();
|
disposer->Run();
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const GeckoSession::Compositor::Ref& GetJavaCompositor() const {
|
const GeckoSession::Compositor::Ref& GetJavaCompositor() const {
|
||||||
return mCompositor;
|
return mCompositor;
|
||||||
|
Loading…
Reference in New Issue
Block a user