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

Unified Diff: content/browser/android/tracing_controller_android.cc

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
Index: content/browser/android/tracing_controller_android.cc
diff --git a/content/browser/android/tracing_controller_android.cc b/content/browser/android/tracing_controller_android.cc
index 3c3ee756434fa57490f67648d142d139041fd99e..a9c5b40814722a2ea2c1b5f8213188999c83a208 100644
--- a/content/browser/android/tracing_controller_android.cc
+++ b/content/browser/android/tracing_controller_android.cc
@@ -7,6 +7,7 @@
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/debug/trace_event.h"
+#include "base/json/json_writer.h"
#include "base/logging.h"
#include "content/public/browser/tracing_controller.h"
#include "jni/TracingControllerAndroid_jni.h"
@@ -76,6 +77,31 @@ void TracingControllerAndroid::OnTracingStopped(
Java_TracingControllerAndroid_onTracingStopped(env, obj.obj());
}
+bool TracingControllerAndroid::GetKnownCategoryGroupsAsync(JNIEnv* env,
+ jobject obj) {
+ if (!TracingController::GetInstance()->GetCategories(
+ base::Bind(&TracingControllerAndroid::OnKnownCategoriesReceived,
+ weak_factory_.GetWeakPtr()))) {
+ return false;
+ }
+ return true;
+}
+
+void TracingControllerAndroid::OnKnownCategoriesReceived(
+ const std::set<std::string>& categories_received) {
+ scoped_ptr<base::ListValue> category_list(new base::ListValue());
+ for (std::set<std::string>::const_iterator it = categories_received.begin();
+ it != categories_received.end();
+ ++it) {
+ category_list->AppendString(*it);
+ }
+ std::string received_category_list;
+ base::JSONWriter::Write(category_list.get(), &received_category_list);
+
+ // This log is required by adb_profile_chrome.py.
+ LOG(WARNING) << "{\"traceCategoriesList\": " << received_category_list << "}";
+}
+
static jstring GetDefaultCategories(JNIEnv* env, jobject obj) {
return base::android::ConvertUTF8ToJavaString(env,
base::debug::CategoryFilter::kDefaultCategoryFilterString).Release();

Powered by Google App Engine
This is Rietveld 408576698