Bug 1382861 - 1. Replace jni::AbstractCall with nsIRunnable; r=esawin
The native binding code used `jni::AbstractCall` as the interface between `ProxyNativeCall` and `DispatchToGeckoPriorityQueue`. However, we already make use of `nsIRunnable` for dispatching to the XPCOM queue, so we should just use `nsIRunnable` for the priority queue as well. MozReview-Commit-ID: KmuNMZZkXX3
This commit is contained in:
@@ -288,24 +288,17 @@ jclass GetClassRef(JNIEnv* aEnv, const char* aClassName)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DispatchToGeckoPriorityQueue(UniquePtr<AbstractCall>&& aCall)
|
||||
void DispatchToGeckoPriorityQueue(already_AddRefed<nsIRunnable> aCall)
|
||||
{
|
||||
class AbstractCallEvent : public nsAppShell::Event
|
||||
class RunnableEvent : public nsAppShell::Event
|
||||
{
|
||||
UniquePtr<AbstractCall> mCall;
|
||||
|
||||
nsCOMPtr<nsIRunnable> mCall;
|
||||
public:
|
||||
AbstractCallEvent(UniquePtr<AbstractCall>&& aCall)
|
||||
: mCall(Move(aCall))
|
||||
{}
|
||||
|
||||
void Run() override
|
||||
{
|
||||
(*mCall)();
|
||||
}
|
||||
RunnableEvent(already_AddRefed<nsIRunnable> aCall) : mCall(aCall) {}
|
||||
void Run() override { NS_ENSURE_SUCCESS_VOID(mCall->Run()); }
|
||||
};
|
||||
|
||||
nsAppShell::PostEvent(MakeUnique<AbstractCallEvent>(Move(aCall)));
|
||||
nsAppShell::PostEvent(MakeUnique<RunnableEvent>(Move(aCall)));
|
||||
}
|
||||
|
||||
bool IsFennec()
|
||||
|
||||
Reference in New Issue
Block a user