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 #ifndef CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_ |
6 #define CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_ |
7 | 7 |
8 #include "base/android/jni_helper.h" | 8 #include "base/android/jni_helper.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/weak_ptr.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 | 13 |
13 // This class implements the native methods of TracingControllerAndroid.java | 14 // This class implements the native methods of TracingControllerAndroid.java |
14 class TracingControllerAndroid { | 15 class TracingControllerAndroid { |
15 public: | 16 public: |
16 TracingControllerAndroid(JNIEnv* env, jobject obj); | 17 TracingControllerAndroid(JNIEnv* env, jobject obj); |
17 void Destroy(JNIEnv* env, jobject obj); | 18 void Destroy(JNIEnv* env, jobject obj); |
18 | 19 |
19 bool StartTracing(JNIEnv* env, | 20 bool StartTracing(JNIEnv* env, |
20 jobject obj, | 21 jobject obj, |
21 jstring filename, | 22 jstring filename, |
22 jstring categories, | 23 jstring categories, |
23 jboolean record_continuously); | 24 jboolean record_continuously); |
24 void StopTracing(JNIEnv* env, jobject obj); | 25 void StopTracing(JNIEnv* env, jobject obj); |
25 | 26 |
26 private: | 27 private: |
27 ~TracingControllerAndroid(); | 28 ~TracingControllerAndroid(); |
28 void OnTracingStopped(); | 29 void OnTracingStopped(const base::FilePath& file_path); |
29 | 30 |
30 JavaObjectWeakGlobalRef weak_java_object_; | 31 JavaObjectWeakGlobalRef weak_java_object_; |
31 | 32 base::FilePath file_path_; |
32 class Subscriber; | 33 base::WeakPtrFactory<TracingControllerAndroid> weak_factory_; |
33 scoped_ptr<Subscriber> subscriber_; | |
34 | 34 |
35 DISALLOW_COPY_AND_ASSIGN(TracingControllerAndroid); | 35 DISALLOW_COPY_AND_ASSIGN(TracingControllerAndroid); |
36 }; | 36 }; |
37 | 37 |
38 // Register this class's native methods through jni. | 38 // Register this class's native methods through jni. |
39 bool RegisterTracingControllerAndroid(JNIEnv* env); | 39 bool RegisterTracingControllerAndroid(JNIEnv* env); |
40 | 40 |
41 } // namespace content | 41 } // namespace content |
42 | 42 |
43 #endif // CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_ | 43 #endif // CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_ |
OLD | NEW |