Backed out changeset 6763177287ca (bug 1209574) for Android perma failures

This commit is contained in:
Carsten "Tomcat" Book 2015-10-08 10:05:44 +02:00
parent 4350c14ce1
commit cb33e03f39
5 changed files with 18 additions and 72 deletions

View File

@ -366,41 +366,12 @@ final class GeckoEditable
Editable.class.getClassLoader(),
PROXY_INTERFACES, this);
LayerView v = GeckoAppShell.getLayerView();
mListener = GeckoInputConnection.create(v, this);
mIcRunHandler = mIcPostHandler = ThreadUtils.getUiHandler();
}
@WrapForJNI
/* package */ void onViewChange(final GeckoView v) {
if (DEBUG) {
// Called by nsWindow.
ThreadUtils.assertOnGeckoThread();
Log.d(LOGTAG, "onViewChange(" + v + ")");
}
final GeckoEditableListener newListener = GeckoInputConnection.create(v, this);
geckoPostToIc(new Runnable() {
@Override
public void run() {
if (DEBUG) {
Log.d(LOGTAG, "onViewChange (set listener)");
}
// Make sure there are no other things going on
mActionQueue.syncWithGecko();
mListener = newListener;
}
});
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
if (DEBUG) {
Log.d(LOGTAG, "onViewChange (set IC)");
}
v.setInputConnectionListener((InputConnectionListener) newListener);
}
});
}
private boolean onIcThread() {
return mIcRunHandler.getLooper() == Looper.myLooper();
}
@ -892,7 +863,17 @@ final class GeckoEditable
geckoPostToIc(new Runnable() {
@Override
public void run() {
mListener.notifyIMEContext(state, typeHint, modeHint, actionHint);
// Make sure there are no other things going on
mActionQueue.syncWithGecko();
// Set InputConnectionHandler in notifyIMEContext because
// GeckoInputConnection.notifyIMEContext calls restartInput() which will invoke
// InputConnectionHandler.onCreateInputConnection
GeckoView v = GeckoAppShell.getLayerView();
if (v != null) {
mListener = GeckoInputConnection.create(v, GeckoEditable.this);
v.setInputConnectionListener((InputConnectionListener) mListener);
mListener.notifyIMEContext(state, typeHint, modeHint, actionHint);
}
}
});
}

View File

@ -115,7 +115,7 @@ public class GeckoView extends LayerView
@WrapForJNI
private static final class Window extends JNIObject {
static native void open(Window instance, GeckoView view, int width, int height);
static native void open(Window instance, int width, int height);
static native void setLayerClient(Object client);
@Override protected native void disposeNative();
}
@ -225,11 +225,10 @@ public class GeckoView extends LayerView
final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
Window.open(window, this, metrics.widthPixels, metrics.heightPixels);
Window.open(window, metrics.widthPixels, metrics.heightPixels);
} else {
GeckoThread.queueNativeCallUntil(GeckoThread.State.PROFILE_READY, Window.class,
"open", window, GeckoView.class, this,
metrics.widthPixels, metrics.heightPixels);
"open", window, metrics.widthPixels, metrics.heightPixels);
}
}

View File

@ -752,14 +752,6 @@ auto GeckoEditable::OnTextChange(mozilla::jni::String::Param a0, int32_t a1, int
return mozilla::jni::Method<OnTextChange_t>::Call(this, nullptr, a0, a1, a2, a3);
}
constexpr char GeckoEditable::OnViewChange_t::name[];
constexpr char GeckoEditable::OnViewChange_t::signature[];
auto GeckoEditable::OnViewChange(mozilla::jni::Object::Param a0) const -> void
{
return mozilla::jni::Method<OnViewChange_t>::Call(this, nullptr, a0);
}
constexpr char GeckoEditableListener::name[];
constexpr char GeckoJavaSampler::name[];

View File

@ -1796,24 +1796,6 @@ public:
auto OnTextChange(mozilla::jni::String::Param, int32_t, int32_t, int32_t) const -> void;
public:
struct OnViewChange_t {
typedef GeckoEditable Owner;
typedef void ReturnType;
typedef void SetterType;
typedef mozilla::jni::Args<
mozilla::jni::Object::Param> Args;
static constexpr char name[] = "onViewChange";
static constexpr char signature[] =
"(Lorg/mozilla/gecko/GeckoView;)V";
static const bool isStatic = false;
static const bool isMultithreaded = false;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
};
auto OnViewChange(mozilla::jni::Object::Param) const -> void;
};
class GeckoEditableListener : public mozilla::jni::Class<GeckoEditableListener>
@ -2475,12 +2457,11 @@ public:
typedef void SetterType;
typedef mozilla::jni::Args<
Window::Param,
GeckoView::Param,
int32_t,
int32_t> Args;
static constexpr char name[] = "open";
static constexpr char signature[] =
"(Lorg/mozilla/gecko/GeckoView$Window;Lorg/mozilla/gecko/GeckoView;II)V";
"(Lorg/mozilla/gecko/GeckoView$Window;II)V";
static const bool isStatic = true;
static const bool isMultithreaded = true;
static const mozilla::jni::ExceptionMode exceptionMode =

View File

@ -186,7 +186,6 @@ public:
// Create and attach a window.
static void Open(const jni::ClassObject::LocalRef& cls,
GeckoView::Window::Param gvWindow,
GeckoView::Param view,
int32_t width, int32_t height);
// Set the active layer client object
@ -201,7 +200,6 @@ public:
void
nsWindow::Natives::Open(const jni::ClassObject::LocalRef& cls,
GeckoView::Window::Param gvWindow,
GeckoView::Param view,
int32_t width, int32_t height)
{
MOZ_ASSERT(NS_IsMainThread());
@ -212,10 +210,6 @@ nsWindow::Natives::Open(const jni::ClassObject::LocalRef& cls,
if (gGeckoViewWindow) {
// Should have been created the first time.
MOZ_ASSERT(gGeckoViewWindow->mNatives);
// Associate our previous GeckoEditable with the new GeckoView.
gGeckoViewWindow->mEditable->OnViewChange(view);
AttachNative(GeckoView::Window::LocalRef(cls.Env(), gvWindow),
gGeckoViewWindow->mNatives.get());
return;
@ -258,7 +252,6 @@ nsWindow::Natives::Open(const jni::ClassObject::LocalRef& cls,
// Create GeckoEditable for the new nsWindow/GeckoView pair.
gGeckoViewWindow->mEditable = GeckoEditable::New();
gGeckoViewWindow->mEditable->OnViewChange(view);
AttachNative(GeckoView::Window::LocalRef(cls.Env(), gvWindow),
gGeckoViewWindow->mNatives.get());