OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/android/tracing_controller_android.h" | 5 #include "content/browser/android/tracing_controller_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 TracingControllerAndroid::~TracingControllerAndroid() {} | 26 TracingControllerAndroid::~TracingControllerAndroid() {} |
27 | 27 |
28 void TracingControllerAndroid::Destroy(JNIEnv* env, jobject obj) { | 28 void TracingControllerAndroid::Destroy(JNIEnv* env, jobject obj) { |
29 delete this; | 29 delete this; |
30 } | 30 } |
31 | 31 |
32 bool TracingControllerAndroid::StartTracing(JNIEnv* env, | 32 bool TracingControllerAndroid::StartTracing(JNIEnv* env, |
33 jobject obj, | 33 jobject obj, |
34 jstring jcategories, | 34 jstring jcategories, |
35 jboolean record_continuously) { | 35 jstring jtraceoptions) { |
36 std::string categories = | 36 std::string categories = |
37 base::android::ConvertJavaStringToUTF8(env, jcategories); | 37 base::android::ConvertJavaStringToUTF8(env, jcategories); |
| 38 std::string trace_options = |
| 39 base::android::ConvertJavaStringToUTF8(env, jtraceoptions); |
38 | 40 |
39 // This log is required by adb_profile_chrome.py. | 41 // This log is required by adb_profile_chrome.py. |
40 LOG(WARNING) << "Logging performance trace to file"; | 42 LOG(WARNING) << "Logging performance trace to file"; |
41 | 43 |
42 return TracingController::GetInstance()->EnableRecording( | 44 return TracingController::GetInstance()->EnableRecording( |
43 categories, | 45 base::debug::CategoryFilter(categories), |
44 record_continuously ? TracingController::RECORD_CONTINUOUSLY | 46 base::debug::TraceOptions(trace_options), |
45 : TracingController::DEFAULT_OPTIONS, | |
46 TracingController::EnableRecordingDoneCallback()); | 47 TracingController::EnableRecordingDoneCallback()); |
47 } | 48 } |
48 | 49 |
49 void TracingControllerAndroid::StopTracing(JNIEnv* env, | 50 void TracingControllerAndroid::StopTracing(JNIEnv* env, |
50 jobject obj, | 51 jobject obj, |
51 jstring jfilepath) { | 52 jstring jfilepath) { |
52 base::FilePath file_path( | 53 base::FilePath file_path( |
53 base::android::ConvertJavaStringToUTF8(env, jfilepath)); | 54 base::android::ConvertJavaStringToUTF8(env, jfilepath)); |
54 if (!TracingController::GetInstance()->DisableRecording( | 55 if (!TracingController::GetInstance()->DisableRecording( |
55 file_path, | 56 file_path, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 static jstring GetDefaultCategories(JNIEnv* env, jobject obj) { | 106 static jstring GetDefaultCategories(JNIEnv* env, jobject obj) { |
106 return base::android::ConvertUTF8ToJavaString(env, | 107 return base::android::ConvertUTF8ToJavaString(env, |
107 base::debug::CategoryFilter::kDefaultCategoryFilterString).Release(); | 108 base::debug::CategoryFilter::kDefaultCategoryFilterString).Release(); |
108 } | 109 } |
109 | 110 |
110 bool RegisterTracingControllerAndroid(JNIEnv* env) { | 111 bool RegisterTracingControllerAndroid(JNIEnv* env) { |
111 return RegisterNativesImpl(env); | 112 return RegisterNativesImpl(env); |
112 } | 113 } |
113 | 114 |
114 } // namespace content | 115 } // namespace content |
OLD | NEW |