mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1351169 - [1.2] Update GeckoView's state after finishing window reattachment. r=jchen
This commit is contained in:
parent
6a6d84470c
commit
f6e5f80eca
@ -237,7 +237,8 @@ public final class EventDispatcher extends JNIObject {
|
||||
public void dispatch(final String type, final GeckoBundle message,
|
||||
final EventCallback callback) {
|
||||
synchronized (this) {
|
||||
if (isReadyForDispatchingToGecko() && hasGeckoListener(type)) {
|
||||
if (isReadyForDispatchingToGecko() && mAttachedToGecko &&
|
||||
hasGeckoListener(type)) {
|
||||
dispatchToGecko(type, message, JavaCallbackDelegate.wrap(callback));
|
||||
return;
|
||||
}
|
||||
|
@ -110,6 +110,16 @@ public class GeckoView extends LayerView
|
||||
private synchronized void setState(final State newState) {
|
||||
mNativeQueue.setState(newState);
|
||||
}
|
||||
|
||||
@WrapForJNI(calledFrom = "gecko")
|
||||
private synchronized void onReattach(final GeckoView view) {
|
||||
if (view.mNativeQueue == mNativeQueue) {
|
||||
return;
|
||||
}
|
||||
view.mNativeQueue.setState(mNativeQueue.getState());
|
||||
mNativeQueue = view.mNativeQueue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Object to hold onto our nsWindow connection when GeckoView gets destroyed.
|
||||
@ -299,13 +309,6 @@ public class GeckoView extends LayerView
|
||||
}
|
||||
|
||||
protected void reattachWindow() {
|
||||
synchronized (mWindow) {
|
||||
if (mNativeQueue != mWindow.mNativeQueue) {
|
||||
mNativeQueue.setState(mWindow.mNativeQueue.getState());
|
||||
mWindow.mNativeQueue = mNativeQueue;
|
||||
}
|
||||
}
|
||||
|
||||
if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
|
||||
mWindow.reattach(this, getCompositor(), mEventDispatcher);
|
||||
} else {
|
||||
|
@ -998,6 +998,14 @@ constexpr char GeckoView::Window::DisposeNative_t::signature[];
|
||||
constexpr char GeckoView::Window::LoadUri_t::name[];
|
||||
constexpr char GeckoView::Window::LoadUri_t::signature[];
|
||||
|
||||
constexpr char GeckoView::Window::OnReattach_t::name[];
|
||||
constexpr char GeckoView::Window::OnReattach_t::signature[];
|
||||
|
||||
auto GeckoView::Window::OnReattach(GeckoView::Param a0) const -> void
|
||||
{
|
||||
return mozilla::jni::Method<OnReattach_t>::Call(Window::mCtx, nullptr, a0);
|
||||
}
|
||||
|
||||
constexpr char GeckoView::Window::Open_t::name[];
|
||||
constexpr char GeckoView::Window::Open_t::signature[];
|
||||
|
||||
|
@ -3004,6 +3004,26 @@ public:
|
||||
mozilla::jni::DispatchTarget::PROXY;
|
||||
};
|
||||
|
||||
struct OnReattach_t {
|
||||
typedef Window Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
GeckoView::Param> Args;
|
||||
static constexpr char name[] = "onReattach";
|
||||
static constexpr char signature[] =
|
||||
"(Lorg/mozilla/gecko/GeckoView;)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
static const mozilla::jni::CallingThread callingThread =
|
||||
mozilla::jni::CallingThread::GECKO;
|
||||
static const mozilla::jni::DispatchTarget dispatchTarget =
|
||||
mozilla::jni::DispatchTarget::CURRENT;
|
||||
};
|
||||
|
||||
auto OnReattach(GeckoView::Param) const -> void;
|
||||
|
||||
struct Open_t {
|
||||
typedef Window Owner;
|
||||
typedef void ReturnType;
|
||||
|
@ -1332,6 +1332,8 @@ nsWindow::GeckoViewSupport::Reattach(const GeckoView::Window::LocalRef& inst,
|
||||
MOZ_ASSERT(window.mAndroidView);
|
||||
window.mAndroidView->mEventDispatcher->Attach(
|
||||
java::EventDispatcher::Ref::From(aDispatcher), mDOMWindow);
|
||||
|
||||
mGeckoViewWindow->OnReattach(aView);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user