зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1260243 - Remove sendEventToGeckoSync and related code; r=me
We can remove GeckoAppShell.sendEventToGeckoSync and related code because GeckoThread.waitOnGecko is replacing it.
This commit is contained in:
Родитель
a8db6b0407
Коммит
8af38dfebc
|
@ -387,56 +387,6 @@ public class GeckoAppShell
|
|||
return null;
|
||||
}
|
||||
|
||||
private static final Object sEventAckLock = new Object();
|
||||
private static boolean sWaitingForEventAck;
|
||||
|
||||
// Block the current thread until the Gecko event loop is caught up
|
||||
public static void sendEventToGeckoSync(GeckoEvent e) {
|
||||
e.setAckNeeded(true);
|
||||
|
||||
long time = SystemClock.uptimeMillis();
|
||||
boolean isUiThread = ThreadUtils.isOnUiThread();
|
||||
|
||||
synchronized (sEventAckLock) {
|
||||
if (sWaitingForEventAck) {
|
||||
// should never happen since we always leave it as false when we exit this function.
|
||||
Log.e(LOGTAG, "geckoEventSync() may have been called twice concurrently!", new Exception());
|
||||
// fall through for graceful handling
|
||||
}
|
||||
|
||||
sendEventToGecko(e);
|
||||
sWaitingForEventAck = true;
|
||||
while (true) {
|
||||
if (GeckoThread.isStateAtLeast(GeckoThread.State.EXITING)) {
|
||||
// Gecko is quitting; don't do anything.
|
||||
Log.d(LOGTAG, "Skipping Gecko event sync during exit");
|
||||
sWaitingForEventAck = false;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
sEventAckLock.wait(1000);
|
||||
} catch (InterruptedException ie) {
|
||||
}
|
||||
if (!sWaitingForEventAck) {
|
||||
// response received
|
||||
break;
|
||||
}
|
||||
long waited = SystemClock.uptimeMillis() - time;
|
||||
Log.d(LOGTAG, "Gecko event sync taking too long: " + waited + "ms");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Signal the Java thread that it's time to wake up
|
||||
@WrapForJNI
|
||||
public static void acknowledgeEvent() {
|
||||
synchronized (sEventAckLock) {
|
||||
sWaitingForEventAck = false;
|
||||
sEventAckLock.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
private static final Runnable sCallbackRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -113,7 +113,6 @@ public class GeckoEvent {
|
|||
|
||||
private final int mType;
|
||||
private int mAction;
|
||||
private boolean mAckNeeded;
|
||||
private long mTime;
|
||||
private Point[] mPoints;
|
||||
private int[] mPointIndicies;
|
||||
|
@ -631,8 +630,4 @@ public class GeckoEvent {
|
|||
event.mGamepadValues = values;
|
||||
return event;
|
||||
}
|
||||
|
||||
public void setAckNeeded(boolean ackNeeded) {
|
||||
mAckNeeded = ackNeeded;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ using namespace mozilla::dom;
|
|||
jclass AndroidGeckoEvent::jGeckoEventClass = 0;
|
||||
jfieldID AndroidGeckoEvent::jActionField = 0;
|
||||
jfieldID AndroidGeckoEvent::jTypeField = 0;
|
||||
jfieldID AndroidGeckoEvent::jAckNeededField = 0;
|
||||
jfieldID AndroidGeckoEvent::jTimeField = 0;
|
||||
jfieldID AndroidGeckoEvent::jPoints = 0;
|
||||
jfieldID AndroidGeckoEvent::jPointIndicies = 0;
|
||||
|
@ -104,7 +103,6 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
|
|||
|
||||
jActionField = geckoEvent.getField("mAction", "I");
|
||||
jTypeField = geckoEvent.getField("mType", "I");
|
||||
jAckNeededField = geckoEvent.getField("mAckNeeded", "Z");
|
||||
jTimeField = geckoEvent.getField("mTime", "J");
|
||||
jPoints = geckoEvent.getField("mPoints", "[Landroid/graphics/Point;");
|
||||
jPointIndicies = geckoEvent.getField("mPointIndicies", "[I");
|
||||
|
@ -341,7 +339,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
|
|||
|
||||
mAction = jenv->GetIntField(jobj, jActionField);
|
||||
mType = jenv->GetIntField(jobj, jTypeField);
|
||||
mAckNeeded = jenv->GetBooleanField(jobj, jAckNeededField);
|
||||
|
||||
switch (mType) {
|
||||
case NATIVE_GESTURE_EVENT:
|
||||
|
@ -513,7 +510,6 @@ void
|
|||
AndroidGeckoEvent::Init(int aType)
|
||||
{
|
||||
mType = aType;
|
||||
mAckNeeded = false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -471,7 +471,6 @@ public:
|
|||
|
||||
int Action() { return mAction; }
|
||||
int Type() { return mType; }
|
||||
bool AckNeeded() { return mAckNeeded; }
|
||||
int64_t Time() { return mTime; }
|
||||
const nsTArray<nsIntPoint>& Points() { return mPoints; }
|
||||
const nsTArray<int>& PointIndicies() { return mPointIndicies; }
|
||||
|
@ -524,7 +523,6 @@ public:
|
|||
protected:
|
||||
int mAction;
|
||||
int mType;
|
||||
bool mAckNeeded;
|
||||
int64_t mTime;
|
||||
nsTArray<nsIntPoint> mPoints;
|
||||
nsTArray<nsIntPoint> mPointRadii;
|
||||
|
@ -581,7 +579,6 @@ protected:
|
|||
static jclass jGeckoEventClass;
|
||||
static jfieldID jActionField;
|
||||
static jfieldID jTypeField;
|
||||
static jfieldID jAckNeededField;
|
||||
static jfieldID jTimeField;
|
||||
static jfieldID jPoints;
|
||||
static jfieldID jPointIndicies;
|
||||
|
|
|
@ -50,14 +50,6 @@ auto DownloadsIntegration::ScanMedia(mozilla::jni::String::Param a0, mozilla::jn
|
|||
template<> const char mozilla::jni::Context<GeckoAppShell, jobject>::name[] =
|
||||
"org/mozilla/gecko/GeckoAppShell";
|
||||
|
||||
constexpr char GeckoAppShell::AcknowledgeEvent_t::name[];
|
||||
constexpr char GeckoAppShell::AcknowledgeEvent_t::signature[];
|
||||
|
||||
auto GeckoAppShell::AcknowledgeEvent() -> void
|
||||
{
|
||||
return mozilla::jni::Method<AcknowledgeEvent_t>::Call(GeckoAppShell::Context(), nullptr);
|
||||
}
|
||||
|
||||
constexpr char GeckoAppShell::AddPluginViewWrapper_t::name[];
|
||||
constexpr char GeckoAppShell::AddPluginViewWrapper_t::signature[];
|
||||
|
||||
|
|
|
@ -131,21 +131,6 @@ class GeckoAppShell : public mozilla::jni::ObjectBase<GeckoAppShell, jobject>
|
|||
public:
|
||||
explicit GeckoAppShell(const Context& ctx) : ObjectBase<GeckoAppShell, jobject>(ctx) {}
|
||||
|
||||
struct AcknowledgeEvent_t {
|
||||
typedef GeckoAppShell Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "acknowledgeEvent";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = true;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
static auto AcknowledgeEvent() -> void;
|
||||
|
||||
struct AddPluginViewWrapper_t {
|
||||
typedef GeckoAppShell Owner;
|
||||
typedef void ReturnType;
|
||||
|
|
|
@ -969,10 +969,6 @@ nsAppShell::LegacyGeckoEvent::Run()
|
|||
break;
|
||||
}
|
||||
|
||||
if (curEvent->AckNeeded()) {
|
||||
widget::GeckoAppShell::AcknowledgeEvent();
|
||||
}
|
||||
|
||||
EVLOG("nsAppShell: -- done event %p %d", (void*)curEvent.get(), curEvent->Type());
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче