aw_tracing_controller.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ANDROID_WEBVIEW_BROWSER_TRACING_AW_TRACING_CONTROLLER_H_
  5. #define ANDROID_WEBVIEW_BROWSER_TRACING_AW_TRACING_CONTROLLER_H_
  6. #include "base/android/jni_weak_ref.h"
  7. #include "base/memory/weak_ptr.h"
  8. namespace android_webview {
  9. class AwTracingController {
  10. public:
  11. AwTracingController(JNIEnv* env, jobject obj);
  12. AwTracingController(const AwTracingController&) = delete;
  13. AwTracingController& operator=(const AwTracingController&) = delete;
  14. bool Start(JNIEnv* env,
  15. const base::android::JavaParamRef<jobject>& obj,
  16. const base::android::JavaParamRef<jstring>& categories,
  17. jint mode);
  18. bool StopAndFlush(JNIEnv* env,
  19. const base::android::JavaParamRef<jobject>& obj);
  20. bool IsTracing(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
  21. private:
  22. ~AwTracingController();
  23. void OnTraceDataReceived(std::unique_ptr<std::string> chunk);
  24. void OnTraceDataComplete();
  25. JavaObjectWeakGlobalRef weak_java_object_;
  26. base::WeakPtrFactory<AwTracingController> weak_factory_{this};
  27. };
  28. } // namespace android_webview
  29. #endif // ANDROID_WEBVIEW_BROWSER_TRACING_AW_TRACING_CONTROLLER_H_