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

Unified Diff: include/v8.h

Issue 23581010: restore persistent dtor (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 88c81ae36e184d92c61efff65f4cce601ccc2fed..5410334df57a25862861a81b386e2eafd9409244 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -544,6 +544,14 @@ template <class T, class M> class Persistent {
Copy(that);
return *this;
}
+ /**
+ * The destructor will dispose the Persistent based on the
+ * kResetInDestructor flags in the traits class. Since not calling dispose
+ * can result in a memory leak, it is recommended to always set this flag.
+ */
+ V8_INLINE(~Persistent()) {
+ if (M::kResetInDestructor) Reset();
+ }
/**
* If non-empty, destroy the underlying storage cell
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698