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

Unified Diff: include/v8.h

Issue 2658008: Remove the SetExternalStringDiposeCallback API... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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 | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
===================================================================
--- include/v8.h (revision 4813)
+++ include/v8.h (working copy)
@@ -134,6 +134,7 @@
class Arguments;
class Object;
+class Heap;
class Top;
}
@@ -1026,12 +1027,24 @@
class V8EXPORT ExternalStringResourceBase {
public:
virtual ~ExternalStringResourceBase() {}
+
protected:
ExternalStringResourceBase() {}
+
+ /**
+ * Internally V8 will call this Dispose method when the external string
+ * resource is no longer needed. The default implementation will use the
+ * delete operator. This method can be overridden in subclasses to
+ * control how allocated external string resources are disposed.
+ */
+ virtual void Dispose() { delete this; }
+
private:
// Disallow copying and assigning.
ExternalStringResourceBase(const ExternalStringResourceBase&);
void operator=(const ExternalStringResourceBase&);
+
+ friend class v8::internal::Heap;
};
/**
@@ -1048,10 +1061,17 @@
* buffer.
*/
virtual ~ExternalStringResource() {}
- /** The string data from the underlying buffer.*/
+
+ /**
+ * The string data from the underlying buffer.
+ */
virtual const uint16_t* data() const = 0;
- /** The length of the string. That is, the number of two-byte characters.*/
+
+ /**
+ * The length of the string. That is, the number of two-byte characters.
+ */
virtual size_t length() const = 0;
+
protected:
ExternalStringResource() {}
};
@@ -1123,12 +1143,10 @@
/**
* Creates a new external string using the data defined in the given
* resource. When the external string is no longer live on V8's heap the
- * resource will be disposed. If a disposal callback has been set using
- * SetExternalStringDiposeCallback this callback will be called to dispose
- * the resource. Otherwise, V8 will dispose the resource using the C++ delete
- * operator. The caller of this function should not otherwise delete or
- * modify the resource. Neither should the underlying buffer be deallocated
- * or modified except through the destructor of the external string resource.
+ * resource will be disposed by calling its Dispose method. The caller of
+ * this function should not otherwise delete or modify the resource. Neither
+ * should the underlying buffer be deallocated or modified except through the
+ * destructor of the external string resource.
*/
static Local<String> NewExternal(ExternalStringResource* resource);
@@ -1146,12 +1164,10 @@
/**
* Creates a new external string using the ascii data defined in the given
* resource. When the external string is no longer live on V8's heap the
- * resource will be disposed. If a disposal callback has been set using
- * SetExternalStringDiposeCallback this callback will be called to dispose
- * the resource. Otherwise, V8 will dispose the resource using the C++ delete
- * operator. The caller of this function should not otherwise delete or
- * modify the resource. Neither should the underlying buffer be deallocated
- * or modified except through the destructor of the external string resource.
+ * resource will be disposed by calling its Dispose method. The caller of
+ * this function should not otherwise delete or modify the resource. Neither
+ * should the underlying buffer be deallocated or modified except through the
+ * destructor of the external string resource.
*/
static Local<String> NewExternal(ExternalAsciiStringResource* resource);
@@ -1251,10 +1267,6 @@
};
-typedef void (*ExternalStringDiposeCallback)
- (String::ExternalStringResourceBase* resource);
-
-
/**
* A JavaScript number value (ECMA-262, 4.3.20)
*/
@@ -2472,15 +2484,6 @@
static void RemoveMessageListeners(MessageCallback that);
/**
- * Set a callback to be called when an external string is no longer live on
- * V8's heap. The resource will no longer be needed by V8 and the embedder
- * can dispose of if. If this callback is not set V8 will free the resource
- * using the C++ delete operator.
- */
- static void SetExternalStringDiposeCallback(
- ExternalStringDiposeCallback that);
-
- /**
* Sets V8 flags from a string.
*/
static void SetFlagsFromString(const char* str, int length);
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698