Skip to content

Commit

Permalink
Bug 1317604 - 3. Don't create EventDispatcher when JNI is not availab…
Browse files Browse the repository at this point in the history
…le; r=me

Follow-up to not create the global EventDispatcher in AndroidBridge when
JNI is not available.
  • Loading branch information
Jim Chen committed Nov 21, 2016
1 parent 5db79d7 commit dd02faa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions widget/android/AndroidBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,12 @@ NS_IMPL_ISUPPORTS(nsAndroidBridge, nsIAndroidEventDispatcher, nsIAndroidBridge)

nsAndroidBridge::nsAndroidBridge()
{
RefPtr<widget::EventDispatcher> dispatcher = new widget::EventDispatcher();
dispatcher->Attach(java::EventDispatcher::GetInstance(),
/* window */ nullptr);
mEventDispatcher = dispatcher;
if (jni::IsAvailable()) {
RefPtr<widget::EventDispatcher> dispatcher = new widget::EventDispatcher();
dispatcher->Attach(java::EventDispatcher::GetInstance(),
/* window */ nullptr);
mEventDispatcher = dispatcher;
}

AddObservers();
}
Expand Down
2 changes: 1 addition & 1 deletion widget/android/AndroidBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class nsAndroidBridge final : public nsIAndroidBridge,
NS_DECL_NSIANDROIDBRIDGE
NS_DECL_NSIOBSERVER

NS_FORWARD_NSIANDROIDEVENTDISPATCHER(mEventDispatcher->)
NS_FORWARD_SAFE_NSIANDROIDEVENTDISPATCHER(mEventDispatcher)

nsAndroidBridge();

Expand Down

0 comments on commit dd02faa

Please sign in to comment.