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/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
12 #include "content/public/browser/tracing_controller.h" | 12 #include "content/public/browser/tracing_controller.h" |
13 #include "jni/TracingControllerAndroid_jni.h" | 13 #include "jni/TracingControllerAndroid_jni.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 static jlong Init(JNIEnv* env, jobject obj) { | 17 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
18 TracingControllerAndroid* profiler = new TracingControllerAndroid(env, obj); | 18 TracingControllerAndroid* profiler = new TracingControllerAndroid(env, obj); |
19 return reinterpret_cast<intptr_t>(profiler); | 19 return reinterpret_cast<intptr_t>(profiler); |
20 } | 20 } |
21 | 21 |
22 TracingControllerAndroid::TracingControllerAndroid(JNIEnv* env, jobject obj) | 22 TracingControllerAndroid::TracingControllerAndroid(JNIEnv* env, jobject obj) |
23 : weak_java_object_(env, obj), | 23 : weak_java_object_(env, obj), |
24 weak_factory_(this) {} | 24 weak_factory_(this) {} |
25 | 25 |
26 TracingControllerAndroid::~TracingControllerAndroid() {} | 26 TracingControllerAndroid::~TracingControllerAndroid() {} |
27 | 27 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 ++it) { | 95 ++it) { |
96 category_list.AppendString(*it); | 96 category_list.AppendString(*it); |
97 } | 97 } |
98 std::string received_category_list; | 98 std::string received_category_list; |
99 base::JSONWriter::Write(category_list, &received_category_list); | 99 base::JSONWriter::Write(category_list, &received_category_list); |
100 | 100 |
101 // This log is required by adb_profile_chrome.py. | 101 // This log is required by adb_profile_chrome.py. |
102 LOG(WARNING) << "{\"traceCategoriesList\": " << received_category_list << "}"; | 102 LOG(WARNING) << "{\"traceCategoriesList\": " << received_category_list << "}"; |
103 } | 103 } |
104 | 104 |
105 static ScopedJavaLocalRef<jstring> GetDefaultCategories(JNIEnv* env, | 105 static ScopedJavaLocalRef<jstring> GetDefaultCategories( |
106 jobject obj) { | 106 JNIEnv* env, |
| 107 const JavaParamRef<jobject>& obj) { |
107 base::trace_event::TraceConfig trace_config; | 108 base::trace_event::TraceConfig trace_config; |
108 return base::android::ConvertUTF8ToJavaString( | 109 return base::android::ConvertUTF8ToJavaString( |
109 env, trace_config.ToCategoryFilterString()); | 110 env, trace_config.ToCategoryFilterString()); |
110 } | 111 } |
111 | 112 |
112 bool RegisterTracingControllerAndroid(JNIEnv* env) { | 113 bool RegisterTracingControllerAndroid(JNIEnv* env) { |
113 return RegisterNativesImpl(env); | 114 return RegisterNativesImpl(env); |
114 } | 115 } |
115 | 116 |
116 } // namespace content | 117 } // namespace content |
OLD | NEW |