Commit 1f6be3d7 authored by ulan's avatar ulan Committed by Commit bot

Remove deprecated uses of WeakCallbackData from i18n.

BUG=chromium:609808
LOG=NO

Review-Url: https://codereview.chromium.org/1954033002
Cr-Commit-Position: refs/heads/master@{#36077}
parent 058809a6
......@@ -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
......
......@@ -51,8 +51,7 @@ class DateFormat {
// Release memory we allocated for the DateFormat once the JS object that
// holds the pointer gets garbage collected.
static void DeleteDateFormat(
const v8::WeakCallbackData<v8::Value, void>& data);
static void DeleteDateFormat(const v8::WeakCallbackInfo<void>& data);
private:
DateFormat();
......@@ -75,8 +74,7 @@ class NumberFormat {
// Release memory we allocated for the NumberFormat once the JS object that
// holds the pointer gets garbage collected.
static void DeleteNumberFormat(
const v8::WeakCallbackData<v8::Value, void>& data);
static void DeleteNumberFormat(const v8::WeakCallbackInfo<void>& data);
private:
NumberFormat();
......@@ -98,8 +96,7 @@ class Collator {
// Release memory we allocated for the Collator once the JS object that holds
// the pointer gets garbage collected.
static void DeleteCollator(
const v8::WeakCallbackData<v8::Value, void>& data);
static void DeleteCollator(const v8::WeakCallbackInfo<void>& data);
private:
Collator();
......@@ -121,8 +118,7 @@ class BreakIterator {
// Release memory we allocated for the BreakIterator once the JS object that
// holds the pointer gets garbage collected.
static void DeleteBreakIterator(
const v8::WeakCallbackData<v8::Value, void>& data);
static void DeleteBreakIterator(const v8::WeakCallbackInfo<void>& data);
private:
BreakIterator();
......
......@@ -336,9 +336,9 @@ RUNTIME_FUNCTION(Runtime_CreateDateTimeFormat) {
// Make object handle weak so we can delete the data format once GC kicks in.
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(),
reinterpret_cast<void*>(wrapper.location()),
DateFormat::DeleteDateFormat);
GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
DateFormat::DeleteDateFormat,
WeakCallbackType::kInternalFields);
return *local_object;
}
......@@ -430,9 +430,9 @@ RUNTIME_FUNCTION(Runtime_CreateNumberFormat) {
JSObject::AddProperty(local_object, key, value, NONE);
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(),
reinterpret_cast<void*>(wrapper.location()),
NumberFormat::DeleteNumberFormat);
GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
NumberFormat::DeleteNumberFormat,
WeakCallbackType::kInternalFields);
return *local_object;
}
......@@ -536,9 +536,9 @@ RUNTIME_FUNCTION(Runtime_CreateCollator) {
JSObject::AddProperty(local_object, key, value, NONE);
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(),
reinterpret_cast<void*>(wrapper.location()),
Collator::DeleteCollator);
GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
Collator::DeleteCollator,
WeakCallbackType::kInternalFields);
return *local_object;
}
......@@ -640,9 +640,9 @@ RUNTIME_FUNCTION(Runtime_CreateBreakIterator) {
// Make object handle weak so we can delete the break iterator once GC kicks
// in.
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(),
reinterpret_cast<void*>(wrapper.location()),
BreakIterator::DeleteBreakIterator);
GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
BreakIterator::DeleteBreakIterator,
WeakCallbackType::kInternalFields);
return *local_object;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment