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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java

Issue 386983002: Correct the usage of finalize in TracingControllerAndroid class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated as per comments Created 6 years, 5 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/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java b/content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java
index b89205c7a688230a9fdc5c9e38f97c400ceb3c39..514ab6ae324d36872a47248a1e149b9712789aa7 100644
--- a/content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java
+++ b/content/public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java
@@ -242,6 +242,15 @@ public class TracingControllerAndroid {
@Override
protected void finalize() {
+ // Ensure that destroy() was called.
+ assert mNativeTracingControllerAndroid == 0;
+ }
+
+ /**
+ * Clean up the C++ side of this class.
+ * After the call, this class instance shouldn't be used.
+ */
+ public void destroy() {
if (mNativeTracingControllerAndroid != 0) {
nativeDestroy(mNativeTracingControllerAndroid);
mNativeTracingControllerAndroid = 0;

Powered by Google App Engine
This is Rietveld 408576698