Bug 1192082 - Expose AndroidBridge arguments through GeckoThread; r=snorp

AndroidBridge needed some arguments during its initialization. We'll
provide those arguments in GeckoThread, which AndroidBridge will access.
This commit is contained in:
Jim Chen 2015-08-13 00:53:39 -04:00
parent 9f3701ed76
commit 171ddb4e4a
3 changed files with 63 additions and 0 deletions

View File

@ -95,6 +95,11 @@ public class GeckoThread extends Thread implements GeckoEventListener {
private static GeckoThread sGeckoThread;
@WrapForJNI
private static final ClassLoader clsLoader = GeckoThread.class.getClassLoader();
@WrapForJNI
private static MessageQueue msgQueue;
private final String mArgs;
private final String mAction;
private final String mUri;
@ -336,6 +341,7 @@ public class GeckoThread extends Thread implements GeckoEventListener {
@Override
public void run() {
Looper.prepare();
GeckoThread.msgQueue = Looper.myQueue();
ThreadUtils.sGeckoThread = this;
ThreadUtils.sGeckoHandler = new Handler();

View File

@ -773,6 +773,27 @@ auto GeckoThread::SetState(mozilla::jni::Object::Param a0) -> void
return mozilla::jni::Method<SetState_t>::Call(nullptr, nullptr, a0);
}
constexpr char GeckoThread::ClsLoader_t::name[];
constexpr char GeckoThread::ClsLoader_t::signature[];
auto GeckoThread::ClsLoader() -> mozilla::jni::Object::LocalRef
{
return mozilla::jni::Field<ClsLoader_t>::Get(nullptr, nullptr);
}
constexpr char GeckoThread::MsgQueue_t::name[];
constexpr char GeckoThread::MsgQueue_t::signature[];
auto GeckoThread::MsgQueue() -> mozilla::jni::Object::LocalRef
{
return mozilla::jni::Field<MsgQueue_t>::Get(nullptr, nullptr);
}
auto GeckoThread::MsgQueue(mozilla::jni::Object::Param a0) -> void
{
return mozilla::jni::Field<MsgQueue_t>::Set(nullptr, nullptr, a0);
}
constexpr char GeckoThread::State::name[];
constexpr char GeckoThread::State::New_t::name[];

View File

@ -1839,6 +1839,42 @@ public:
static auto SetState(mozilla::jni::Object::Param) -> void;
public:
struct ClsLoader_t {
typedef GeckoThread Owner;
typedef mozilla::jni::Object::LocalRef ReturnType;
typedef mozilla::jni::Object::Param SetterType;
typedef mozilla::jni::Args<> Args;
static constexpr char name[] = "clsLoader";
static constexpr char signature[] =
"Ljava/lang/ClassLoader;";
static const bool isStatic = true;
static const bool isMultithreaded = false;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
};
static auto ClsLoader() -> mozilla::jni::Object::LocalRef;
public:
struct MsgQueue_t {
typedef GeckoThread Owner;
typedef mozilla::jni::Object::LocalRef ReturnType;
typedef mozilla::jni::Object::Param SetterType;
typedef mozilla::jni::Args<> Args;
static constexpr char name[] = "msgQueue";
static constexpr char signature[] =
"Landroid/os/MessageQueue;";
static const bool isStatic = true;
static const bool isMultithreaded = false;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
};
static auto MsgQueue() -> mozilla::jni::Object::LocalRef;
static auto MsgQueue(mozilla::jni::Object::Param) -> void;
};
class GeckoThread::State : public mozilla::jni::Class<State>