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

Unified Diff: src/i18n.cc

Issue 1954033002: Remove deprecated uses of WeakCallbackData from i18n. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « src/i18n.h ('k') | src/runtime/runtime-i18n.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/i18n.h ('k') | src/runtime/runtime-i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698