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

Unified Diff: include/v8.h

Issue 1026283004: fix disposal of phantom handles in GlobalValueMap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | include/v8-util.h » ('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 51fae0e564f0c752284a77e411fd37378c7a84c6..07449def48a8c2ddb6c0f6093dfa985d517663ed 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -471,6 +471,9 @@ template <class T> class Eternal {
};
+static const int kInternalFieldsInWeakCallback = 2;
+
+
template <typename T>
class WeakCallbackInfo {
public:
@@ -478,21 +481,28 @@ class WeakCallbackInfo {
WeakCallbackInfo(Isolate* isolate, T* parameter, void* internal_field1,
void* internal_field2)
- : isolate_(isolate),
- parameter_(parameter),
- internal_field1_(internal_field1),
- internal_field2_(internal_field2) {}
+ : isolate_(isolate), parameter_(parameter) {
+ internal_fields_[0] = internal_field1;
+ internal_fields_[1] = internal_field2;
+ }
V8_INLINE Isolate* GetIsolate() const { return isolate_; }
V8_INLINE T* GetParameter() const { return parameter_; }
- V8_INLINE void* GetInternalField1() const { return internal_field1_; }
- V8_INLINE void* GetInternalField2() const { return internal_field2_; }
+ V8_INLINE void* GetInternalField(int index) const;
+
+ V8_INLINE V8_DEPRECATE_SOON("use indexed version",
+ void* GetInternalField1()) const {
+ return internal_fields_[0];
+ }
+ V8_INLINE V8_DEPRECATE_SOON("use indexed version",
+ void* GetInternalField2()) const {
+ return internal_fields_[1];
+ }
private:
Isolate* isolate_;
T* parameter_;
- void* internal_field1_;
- void* internal_field2_;
+ void* internal_fields_[2];
};
@@ -5974,6 +5984,7 @@ class V8_EXPORT V8 {
static void CheckIsJust(bool is_just);
static void ToLocalEmpty();
+ static void InternalFieldOutOfBounds(int index);
template <class T> friend class Handle;
template <class T> friend class Local;
@@ -5981,6 +5992,8 @@ class V8_EXPORT V8 {
friend class MaybeLocal;
template <class T>
friend class Maybe;
+ template <class T>
+ friend class WeakCallbackInfo;
template <class T> friend class Eternal;
template <class T> friend class PersistentBase;
template <class T, class M> friend class Persistent;
@@ -6833,6 +6846,17 @@ Local<T> MaybeLocal<T>::ToLocalChecked() {
template <class T>
+void* WeakCallbackInfo<T>::GetInternalField(int index) const {
+#ifdef V8_ENABLE_CHECKS
+ if (index < 0 || index >= kInternalFieldsInWeakCallback) {
+ V8::InternalFieldOutOfBounds(index);
+ }
+#endif
+ return internal_fields_[index];
+}
+
+
+template <class T>
T* PersistentBase<T>::New(Isolate* isolate, T* that) {
if (that == NULL) return NULL;
internal::Object** p = reinterpret_cast<internal::Object**>(that);
« no previous file with comments | « no previous file | include/v8-util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698