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

Unified Diff: include/v8.h

Issue 15023010: Add Persistent::ClearAndLeak. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 7 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 3a86e86e020cbc9448c50f2ccd21476035a66c2e..ba70a33d9739161e09f973afc1be657bce60f7c8 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -695,6 +695,8 @@ template <class T> class Persistent // NOLINT
*/
V8_INLINE(void Reset(Isolate* isolate, const Handle<T>& other));
+ V8_INLINE(T* LeakPersistent());
Sven Panne 2013/05/10 12:00:02 Please add a comment that it is necessary to re-wr
marja 2013/05/10 13:02:26 Done.
+
#ifndef V8_USE_UNSAFE_HANDLES
#ifndef V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
@@ -5384,6 +5386,7 @@ void Persistent<T>::SetWrapperClassId(uint16_t class_id) {
SetWrapperClassId(Isolate::GetCurrent(), class_id);
}
+
template <class T>
void Persistent<T>::Reset(Isolate* isolate, const Handle<T>& other) {
Dispose(isolate);
@@ -5400,6 +5403,21 @@ void Persistent<T>::Reset(Isolate* isolate, const Handle<T>& other) {
#endif
}
+
+template <class T>
+T* Persistent<T>::LeakPersistent() {
Sven Panne 2013/05/10 12:00:02 As discussed offline, we should better name it "Cl
marja 2013/05/10 13:02:26 Done.
+ T* old;
+#ifdef V8_USE_UNSAFE_HANDLES
+ old = this->operator*();
Sven Panne 2013/05/10 12:00:02 Can we use '*this' here? If not, a comment might b
marja 2013/05/10 13:02:26 "this" is not Persistent, but Persistent*, so "*th
+ *this = Persistent<T>();
+#else
+ old = val_;
+ val_ = NULL;
+#endif
+ return old;
+}
+
+
template <class T>
void Persistent<T>::SetWrapperClassId(Isolate* isolate, uint16_t class_id) {
typedef internal::Internals I;
« 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