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( ...@@ -768,28 +768,12 @@ icu::SimpleDateFormat* DateFormat::UnpackDateFormat(
return NULL; return NULL;
} }
void DateFormat::DeleteDateFormat(const v8::WeakCallbackInfo<void>& data) {
template<class T> delete reinterpret_cast<icu::SimpleDateFormat*>(data.GetInternalField(0));
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) {
GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); 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( icu::DecimalFormat* NumberFormat::InitializeNumberFormat(
Isolate* isolate, Isolate* isolate,
Handle<String> locale, Handle<String> locale,
...@@ -847,11 +831,9 @@ icu::DecimalFormat* NumberFormat::UnpackNumberFormat( ...@@ -847,11 +831,9 @@ icu::DecimalFormat* NumberFormat::UnpackNumberFormat(
return NULL; return NULL;
} }
void NumberFormat::DeleteNumberFormat(const v8::WeakCallbackInfo<void>& data) {
void NumberFormat::DeleteNumberFormat( delete reinterpret_cast<icu::DecimalFormat*>(data.GetInternalField(0));
const v8::WeakCallbackData<v8::Value, void>& data) { GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter()));
DeleteNativeObjectAt<icu::DecimalFormat>(data, 0);
DestroyGlobalHandle(data);
} }
...@@ -908,11 +890,9 @@ icu::Collator* Collator::UnpackCollator(Isolate* isolate, ...@@ -908,11 +890,9 @@ icu::Collator* Collator::UnpackCollator(Isolate* isolate,
return NULL; return NULL;
} }
void Collator::DeleteCollator(const v8::WeakCallbackInfo<void>& data) {
void Collator::DeleteCollator( delete reinterpret_cast<icu::Collator*>(data.GetInternalField(0));
const v8::WeakCallbackData<v8::Value, void>& data) { GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter()));
DeleteNativeObjectAt<icu::Collator>(data, 0);
DestroyGlobalHandle(data);
} }
...@@ -973,12 +953,11 @@ icu::BreakIterator* BreakIterator::UnpackBreakIterator(Isolate* isolate, ...@@ -973,12 +953,11 @@ icu::BreakIterator* BreakIterator::UnpackBreakIterator(Isolate* isolate,
return NULL; return NULL;
} }
void BreakIterator::DeleteBreakIterator( void BreakIterator::DeleteBreakIterator(
const v8::WeakCallbackData<v8::Value, void>& data) { const v8::WeakCallbackInfo<void>& data) {
DeleteNativeObjectAt<icu::BreakIterator>(data, 0); delete reinterpret_cast<icu::BreakIterator*>(data.GetInternalField(0));
DeleteNativeObjectAt<icu::UnicodeString>(data, 1); delete reinterpret_cast<icu::UnicodeString*>(data.GetInternalField(1));
DestroyGlobalHandle(data); GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter()));
} }
} // namespace internal } // namespace internal
......
...@@ -51,8 +51,7 @@ class DateFormat { ...@@ -51,8 +51,7 @@ class DateFormat {
// Release memory we allocated for the DateFormat once the JS object that // Release memory we allocated for the DateFormat once the JS object that
// holds the pointer gets garbage collected. // holds the pointer gets garbage collected.
static void DeleteDateFormat( static void DeleteDateFormat(const v8::WeakCallbackInfo<void>& data);
const v8::WeakCallbackData<v8::Value, void>& data);
private: private:
DateFormat(); DateFormat();
...@@ -75,8 +74,7 @@ class NumberFormat { ...@@ -75,8 +74,7 @@ class NumberFormat {
// Release memory we allocated for the NumberFormat once the JS object that // Release memory we allocated for the NumberFormat once the JS object that
// holds the pointer gets garbage collected. // holds the pointer gets garbage collected.
static void DeleteNumberFormat( static void DeleteNumberFormat(const v8::WeakCallbackInfo<void>& data);
const v8::WeakCallbackData<v8::Value, void>& data);
private: private:
NumberFormat(); NumberFormat();
...@@ -98,8 +96,7 @@ class Collator { ...@@ -98,8 +96,7 @@ class Collator {
// Release memory we allocated for the Collator once the JS object that holds // Release memory we allocated for the Collator once the JS object that holds
// the pointer gets garbage collected. // the pointer gets garbage collected.
static void DeleteCollator( static void DeleteCollator(const v8::WeakCallbackInfo<void>& data);
const v8::WeakCallbackData<v8::Value, void>& data);
private: private:
Collator(); Collator();
...@@ -121,8 +118,7 @@ class BreakIterator { ...@@ -121,8 +118,7 @@ class BreakIterator {
// Release memory we allocated for the BreakIterator once the JS object that // Release memory we allocated for the BreakIterator once the JS object that
// holds the pointer gets garbage collected. // holds the pointer gets garbage collected.
static void DeleteBreakIterator( static void DeleteBreakIterator(const v8::WeakCallbackInfo<void>& data);
const v8::WeakCallbackData<v8::Value, void>& data);
private: private:
BreakIterator(); BreakIterator();
......
...@@ -336,9 +336,9 @@ RUNTIME_FUNCTION(Runtime_CreateDateTimeFormat) { ...@@ -336,9 +336,9 @@ RUNTIME_FUNCTION(Runtime_CreateDateTimeFormat) {
// Make object handle weak so we can delete the data format once GC kicks in. // Make object handle weak so we can delete the data format once GC kicks in.
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(), GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
reinterpret_cast<void*>(wrapper.location()), DateFormat::DeleteDateFormat,
DateFormat::DeleteDateFormat); WeakCallbackType::kInternalFields);
return *local_object; return *local_object;
} }
...@@ -430,9 +430,9 @@ RUNTIME_FUNCTION(Runtime_CreateNumberFormat) { ...@@ -430,9 +430,9 @@ RUNTIME_FUNCTION(Runtime_CreateNumberFormat) {
JSObject::AddProperty(local_object, key, value, NONE); JSObject::AddProperty(local_object, key, value, NONE);
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(), GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
reinterpret_cast<void*>(wrapper.location()), NumberFormat::DeleteNumberFormat,
NumberFormat::DeleteNumberFormat); WeakCallbackType::kInternalFields);
return *local_object; return *local_object;
} }
...@@ -536,9 +536,9 @@ RUNTIME_FUNCTION(Runtime_CreateCollator) { ...@@ -536,9 +536,9 @@ RUNTIME_FUNCTION(Runtime_CreateCollator) {
JSObject::AddProperty(local_object, key, value, NONE); JSObject::AddProperty(local_object, key, value, NONE);
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(), GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
reinterpret_cast<void*>(wrapper.location()), Collator::DeleteCollator,
Collator::DeleteCollator); WeakCallbackType::kInternalFields);
return *local_object; return *local_object;
} }
...@@ -640,9 +640,9 @@ RUNTIME_FUNCTION(Runtime_CreateBreakIterator) { ...@@ -640,9 +640,9 @@ RUNTIME_FUNCTION(Runtime_CreateBreakIterator) {
// Make object handle weak so we can delete the break iterator once GC kicks // Make object handle weak so we can delete the break iterator once GC kicks
// in. // in.
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(), GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
reinterpret_cast<void*>(wrapper.location()), BreakIterator::DeleteBreakIterator,
BreakIterator::DeleteBreakIterator); WeakCallbackType::kInternalFields);
return *local_object; 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