Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2162)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java

Issue 257093004: [Android] Add an option to view the tracing record categories when running from python script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rework! Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/android/tracing_controller_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java b/content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java
index f26b274165437d100d0f912eaf62d68f0c2a4e32..172a016e3c00baa2f81b5eb216249889d79529d1 100644
--- a/content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java
+++ b/content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java
@@ -46,6 +46,7 @@ public class TracingControllerAndroid {
private static final String ACTION_START = "GPU_PROFILER_START";
private static final String ACTION_STOP = "GPU_PROFILER_STOP";
+ private static final String ACTION_LIST_CATEGORIES = "GPU_PROFILER_LIST_CATEGORIES";
private static final String FILE_EXTRA = "file";
private static final String CATEGORIES_EXTRA = "categories";
private static final String RECORD_CONTINUOUSLY_EXTRA = "continuous";
@@ -152,6 +153,12 @@ public class TracingControllerAndroid {
return startTracing(filePath, showToasts, categories, recordContinuously);
}
+ private void initializeNativeControllerIfNeeded() {
+ if (mNativeTracingControllerAndroid == 0) {
+ mNativeTracingControllerAndroid = nativeInit();
+ }
+ }
+
/**
* Start profiling to the specified file. Returns true on success.
*
@@ -177,9 +184,7 @@ public class TracingControllerAndroid {
return false;
}
// Lazy initialize the native side, to allow construction before the library is loaded.
- if (mNativeTracingControllerAndroid == 0) {
- mNativeTracingControllerAndroid = nativeInit();
- }
+ initializeNativeControllerIfNeeded();
if (!nativeStartTracing(mNativeTracingControllerAndroid, categories,
recordContinuously)) {
logAndToastError(mContext.getString(R.string.profiler_error_toast));
@@ -218,6 +223,17 @@ public class TracingControllerAndroid {
mFilename = null;
}
+ /**
+ * Get known category groups.
+ */
+ public void getCategoryGroups() {
+ // Lazy initialize the native side, to allow construction before the library is loaded.
+ initializeNativeControllerIfNeeded();
+ if (!nativeGetKnownCategoryGroupsAsync(mNativeTracingControllerAndroid)) {
+ Log.e(TAG, "Unable to fetch tracing record groups list.");
+ }
+ }
+
@Override
protected void finalize() {
if (mNativeTracingControllerAndroid != 0) {
@@ -240,6 +256,7 @@ public class TracingControllerAndroid {
TracingIntentFilter(Context context) {
addAction(context.getPackageName() + "." + ACTION_START);
addAction(context.getPackageName() + "." + ACTION_STOP);
+ addAction(context.getPackageName() + "." + ACTION_LIST_CATEGORIES);
}
}
@@ -264,6 +281,8 @@ public class TracingControllerAndroid {
}
} else if (intent.getAction().endsWith(ACTION_STOP)) {
stopTracing();
+ } else if (intent.getAction().endsWith(ACTION_LIST_CATEGORIES)) {
+ getCategoryGroups();
} else {
Log.e(TAG, "Unexpected intent: " + intent);
}
@@ -276,5 +295,6 @@ public class TracingControllerAndroid {
private native boolean nativeStartTracing(
long nativeTracingControllerAndroid, String categories, boolean recordContinuously);
private native void nativeStopTracing(long nativeTracingControllerAndroid, String filename);
+ private native boolean nativeGetKnownCategoryGroupsAsync(long nativeTracingControllerAndroid);
private native String nativeGetDefaultCategories();
}
« no previous file with comments | « content/browser/android/tracing_controller_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698