This repository was archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Servo support enabled via user.properties (#498)
- Loading branch information
1 parent
7e614e7
commit 388bfe3
Showing
20 changed files
with
723 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/src/common/shared/org/mozilla/vrbrowser/utils/ServoUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.mozilla.vrbrowser.utils; | ||
|
||
import android.content.Context; | ||
import android.util.Log; | ||
|
||
import org.mozilla.geckoview.GeckoSession; | ||
|
||
import java.lang.reflect.Constructor; | ||
|
||
public class ServoUtils { | ||
private static final String CLASSNAME = "org.mozilla.servo.ServoSession"; | ||
private static final String LOGTAG = "ServoUtils"; | ||
|
||
public static boolean isServoAvailable() { | ||
try { | ||
Class.forName(CLASSNAME); | ||
return true; | ||
} catch (ClassNotFoundException e) { | ||
return false; | ||
} | ||
} | ||
|
||
public static boolean isInstanceOfServoSession(Object obj) { | ||
try { | ||
return Class.forName(CLASSNAME).isInstance(obj); | ||
} catch (ClassNotFoundException e) { | ||
return false; | ||
} | ||
} | ||
|
||
public static GeckoSession createServoSession(Context context) { | ||
try { | ||
Class servoClass = Class.forName(CLASSNAME); | ||
Constructor<?> constructor = servoClass.getConstructor(Context.class); | ||
return (GeckoSession) constructor.newInstance(context); | ||
} catch (Exception e) { | ||
Log.e(LOGTAG, "Can't load or instanciate ServoSession: " + e); | ||
return null; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.