Index: src/i18n.cc |
diff --git a/src/i18n.cc b/src/i18n.cc |
index 623de5015708ab285aa504d448d2d84b62bae1c6..b64fc17cde94a22693092a480de51f803edbacf5 100644 |
--- a/src/i18n.cc |
+++ b/src/i18n.cc |
@@ -768,28 +768,12 @@ icu::SimpleDateFormat* DateFormat::UnpackDateFormat( |
return NULL; |
} |
- |
-template<class T> |
-void DeleteNativeObjectAt(const v8::WeakCallbackData<v8::Value, void>& data, |
- int index) { |
- v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(data.GetValue()); |
- delete reinterpret_cast<T*>(obj->GetAlignedPointerFromInternalField(index)); |
-} |
- |
- |
-static void DestroyGlobalHandle( |
- const v8::WeakCallbackData<v8::Value, void>& data) { |
+void DateFormat::DeleteDateFormat(const v8::WeakCallbackInfo<void>& data) { |
+ delete reinterpret_cast<icu::SimpleDateFormat*>(data.GetInternalField(0)); |
GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); |
} |
-void DateFormat::DeleteDateFormat( |
- const v8::WeakCallbackData<v8::Value, void>& data) { |
- DeleteNativeObjectAt<icu::SimpleDateFormat>(data, 0); |
- DestroyGlobalHandle(data); |
-} |
- |
- |
icu::DecimalFormat* NumberFormat::InitializeNumberFormat( |
Isolate* isolate, |
Handle<String> locale, |
@@ -847,11 +831,9 @@ icu::DecimalFormat* NumberFormat::UnpackNumberFormat( |
return NULL; |
} |
- |
-void NumberFormat::DeleteNumberFormat( |
- const v8::WeakCallbackData<v8::Value, void>& data) { |
- DeleteNativeObjectAt<icu::DecimalFormat>(data, 0); |
- DestroyGlobalHandle(data); |
+void NumberFormat::DeleteNumberFormat(const v8::WeakCallbackInfo<void>& data) { |
+ delete reinterpret_cast<icu::DecimalFormat*>(data.GetInternalField(0)); |
+ GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); |
} |
@@ -908,11 +890,9 @@ icu::Collator* Collator::UnpackCollator(Isolate* isolate, |
return NULL; |
} |
- |
-void Collator::DeleteCollator( |
- const v8::WeakCallbackData<v8::Value, void>& data) { |
- DeleteNativeObjectAt<icu::Collator>(data, 0); |
- DestroyGlobalHandle(data); |
+void Collator::DeleteCollator(const v8::WeakCallbackInfo<void>& data) { |
+ delete reinterpret_cast<icu::Collator*>(data.GetInternalField(0)); |
+ GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); |
} |
@@ -973,12 +953,11 @@ icu::BreakIterator* BreakIterator::UnpackBreakIterator(Isolate* isolate, |
return NULL; |
} |
- |
void BreakIterator::DeleteBreakIterator( |
- const v8::WeakCallbackData<v8::Value, void>& data) { |
- DeleteNativeObjectAt<icu::BreakIterator>(data, 0); |
- DeleteNativeObjectAt<icu::UnicodeString>(data, 1); |
- DestroyGlobalHandle(data); |
+ const v8::WeakCallbackInfo<void>& data) { |
+ delete reinterpret_cast<icu::BreakIterator*>(data.GetInternalField(0)); |
+ delete reinterpret_cast<icu::UnicodeString*>(data.GetInternalField(1)); |
+ GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); |
} |
} // namespace internal |