mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #24443 - ferjm:gst.debug.android, r=jdm
Allow setting GST_DEBUG on Android through mach - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors
This commit is contained in:
commit
b96b08a3d9
7 changed files with 26 additions and 6 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -4819,6 +4819,7 @@ dependencies = [
|
|||
"android_injected_glue",
|
||||
"android_logger",
|
||||
"cc",
|
||||
"gstreamer",
|
||||
"jni",
|
||||
"libc",
|
||||
"log",
|
||||
|
|
|
@ -16,6 +16,7 @@ bench = false
|
|||
[dependencies]
|
||||
android_injected_glue = "0.2"
|
||||
android_logger = "0.7"
|
||||
gstreamer = "0.14.5"
|
||||
jni = "0.10.2"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
extern crate log;
|
||||
|
||||
use android_logger::{self, Filter};
|
||||
use gstreamer::debug_set_threshold_from_string;
|
||||
use jni::objects::{GlobalRef, JClass, JObject, JString, JValue};
|
||||
use jni::sys::{jboolean, jfloat, jint, jstring, JNI_TRUE};
|
||||
use jni::{errors, JNIEnv, JavaVM};
|
||||
|
@ -53,8 +54,8 @@ pub fn Java_org_mozilla_servoview_JNIServo_init(
|
|||
opts: JObject,
|
||||
callbacks_obj: JObject,
|
||||
) {
|
||||
let (mut opts, log, log_str) = match get_options(&env, opts) {
|
||||
Ok((opts, log, log_str)) => (opts, log, log_str),
|
||||
let (mut opts, log, log_str, gst_debug_str) = match get_options(&env, opts) {
|
||||
Ok((opts, log, log_str, gst_debug_str)) => (opts, log, log_str, gst_debug_str),
|
||||
Err(err) => {
|
||||
throw(&env, &err);
|
||||
return;
|
||||
|
@ -86,6 +87,11 @@ pub fn Java_org_mozilla_servoview_JNIServo_init(
|
|||
filter = filter.with_allowed_module_path(module);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(gst_debug_str) = gst_debug_str {
|
||||
debug_set_threshold_from_string(&gst_debug_str, true);
|
||||
}
|
||||
|
||||
android_logger::init_once(filter, Some("simpleservo"));
|
||||
}
|
||||
|
||||
|
@ -734,10 +740,14 @@ fn get_string(env: &JNIEnv, obj: JObject, field: &str) -> Result<Option<String>,
|
|||
}
|
||||
}
|
||||
|
||||
fn get_options(env: &JNIEnv, opts: JObject) -> Result<(InitOptions, bool, Option<String>), String> {
|
||||
fn get_options(
|
||||
env: &JNIEnv,
|
||||
opts: JObject,
|
||||
) -> Result<(InitOptions, bool, Option<String>, Option<String>), String> {
|
||||
let args = get_string(env, opts, "args")?;
|
||||
let url = get_string(env, opts, "url")?;
|
||||
let log_str = get_string(env, opts, "logStr")?;
|
||||
let gst_debug_str = get_string(env, opts, "gstDebugStr")?;
|
||||
let density = get_non_null_field(env, opts, "density", "F")?
|
||||
.f()
|
||||
.map_err(|_| "densitiy not a float")? as f32;
|
||||
|
@ -782,5 +792,5 @@ fn get_options(env: &JNIEnv, opts: JObject) -> Result<(InitOptions, bool, Option
|
|||
gl_context_pointer: None,
|
||||
native_display_pointer: None,
|
||||
};
|
||||
Ok((opts, log, log_str))
|
||||
Ok((opts, log, log_str, gst_debug_str))
|
||||
}
|
||||
|
|
|
@ -102,6 +102,9 @@ class PostBuildCommands(CommandBase):
|
|||
rust_log = env.get("RUST_LOG", None)
|
||||
if rust_log:
|
||||
extra += " -e servolog " + rust_log
|
||||
gst_debug = env.get("GST_DEBUG", None)
|
||||
if gst_debug:
|
||||
extra += " -e gstdebug " + gst_debug
|
||||
script += [
|
||||
"am start " + extra + " org.mozilla.servo/org.mozilla.servo.MainActivity",
|
||||
"sleep 0.5",
|
||||
|
|
|
@ -76,7 +76,8 @@ public class MainActivity extends Activity implements Servo.Client {
|
|||
Intent intent = getIntent();
|
||||
String args = intent.getStringExtra("servoargs");
|
||||
String log = intent.getStringExtra("servolog");
|
||||
mServoView.setServoArgs(args, log);
|
||||
String gstdebug = intent.getStringExtra("gstdebug");
|
||||
mServoView.setServoArgs(args, log, gstdebug);
|
||||
|
||||
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
|
||||
mServoView.loadUri(intent.getData());
|
||||
|
|
|
@ -74,6 +74,7 @@ public class JNIServo {
|
|||
public boolean enableSubpixelTextAntialiasing = true;
|
||||
public long VRExternalContext = 0;
|
||||
public String logStr;
|
||||
public String gstDebugStr;
|
||||
public boolean enableLogs = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ public class ServoView extends GLSurfaceView
|
|||
private boolean mAnimating;
|
||||
private String mServoArgs;
|
||||
private String mServoLog;
|
||||
private String mGstDebug;
|
||||
private GestureDetector mGestureDetector;
|
||||
private ScaleGestureDetector mScaleGestureDetector;
|
||||
|
||||
|
@ -90,9 +91,10 @@ public class ServoView extends GLSurfaceView
|
|||
initGestures(context);
|
||||
}
|
||||
|
||||
public void setServoArgs(String args, String log) {
|
||||
public void setServoArgs(String args, String log, String gstdebug) {
|
||||
mServoArgs = args;
|
||||
mServoLog = log;
|
||||
mGstDebug = gstdebug;
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
|
@ -176,6 +178,7 @@ public class ServoView extends GLSurfaceView
|
|||
String uri = mInitialUri == null ? null : mInitialUri.toString();
|
||||
options.url = uri;
|
||||
options.logStr = mServoLog;
|
||||
options.gstDebugStr = mGstDebug;
|
||||
mServo = new Servo(options, this, this, mClient, mActivity);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue