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

Side by Side Diff: src/i18n.cc

Issue 99193002: Remove all stuff marked as V8_DEPRECATED. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/i18n.h ('k') | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")); 857 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat"));
858 if (JSReceiver::HasLocalProperty(obj, key)) { 858 if (JSReceiver::HasLocalProperty(obj, key)) {
859 return reinterpret_cast<icu::SimpleDateFormat*>( 859 return reinterpret_cast<icu::SimpleDateFormat*>(
860 obj->GetInternalField(0)); 860 obj->GetInternalField(0));
861 } 861 }
862 862
863 return NULL; 863 return NULL;
864 } 864 }
865 865
866 866
867 void DateFormat::DeleteDateFormat(v8::Isolate* isolate, 867 template<class T>
868 Persistent<v8::Value>* object, 868 void DeleteNativeObjectAt(const v8::WeakCallbackData<v8::Value, void>& data,
869 void* param) { 869 int index) {
870 // First delete the hidden C++ object. 870 v8::Local<v8::Object> obj = v8::Handle<v8::Object>::Cast(data.GetValue());
871 delete reinterpret_cast<icu::SimpleDateFormat*>(Handle<JSObject>::cast( 871 delete reinterpret_cast<T*>(obj->GetAlignedPointerFromInternalField(index));
872 v8::Utils::OpenPersistent(object))->GetInternalField(0));
873
874 // Then dispose of the persistent handle to JS object.
875 object->Reset();
876 } 872 }
877 873
878 874
875 static void DestroyGlobalHandle(
876 const v8::WeakCallbackData<v8::Value, void>& data) {
877 GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter()));
878 }
879
880
881 void DateFormat::DeleteDateFormat(
882 const v8::WeakCallbackData<v8::Value, void>& data) {
883 DeleteNativeObjectAt<icu::SimpleDateFormat>(data, 0);
884 DestroyGlobalHandle(data);
885 }
886
887
879 icu::DecimalFormat* NumberFormat::InitializeNumberFormat( 888 icu::DecimalFormat* NumberFormat::InitializeNumberFormat(
880 Isolate* isolate, 889 Isolate* isolate,
881 Handle<String> locale, 890 Handle<String> locale,
882 Handle<JSObject> options, 891 Handle<JSObject> options,
883 Handle<JSObject> resolved) { 892 Handle<JSObject> resolved) {
884 // Convert BCP47 into ICU locale format. 893 // Convert BCP47 into ICU locale format.
885 UErrorCode status = U_ZERO_ERROR; 894 UErrorCode status = U_ZERO_ERROR;
886 icu::Locale icu_locale; 895 icu::Locale icu_locale;
887 char icu_result[ULOC_FULLNAME_CAPACITY]; 896 char icu_result[ULOC_FULLNAME_CAPACITY];
888 int icu_length = 0; 897 int icu_length = 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 Handle<String> key = 930 Handle<String> key =
922 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")); 931 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat"));
923 if (JSReceiver::HasLocalProperty(obj, key)) { 932 if (JSReceiver::HasLocalProperty(obj, key)) {
924 return reinterpret_cast<icu::DecimalFormat*>(obj->GetInternalField(0)); 933 return reinterpret_cast<icu::DecimalFormat*>(obj->GetInternalField(0));
925 } 934 }
926 935
927 return NULL; 936 return NULL;
928 } 937 }
929 938
930 939
931 void NumberFormat::DeleteNumberFormat(v8::Isolate* isolate, 940 void NumberFormat::DeleteNumberFormat(
932 Persistent<v8::Value>* object, 941 const v8::WeakCallbackData<v8::Value, void>& data) {
933 void* param) { 942 DeleteNativeObjectAt<icu::DecimalFormat>(data, 0);
934 // First delete the hidden C++ object. 943 DestroyGlobalHandle(data);
935 delete reinterpret_cast<icu::DecimalFormat*>(Handle<JSObject>::cast(
936 v8::Utils::OpenPersistent(object))->GetInternalField(0));
937
938 // Then dispose of the persistent handle to JS object.
939 object->Reset();
940 } 944 }
941 945
942 946
943 icu::Collator* Collator::InitializeCollator( 947 icu::Collator* Collator::InitializeCollator(
944 Isolate* isolate, 948 Isolate* isolate,
945 Handle<String> locale, 949 Handle<String> locale,
946 Handle<JSObject> options, 950 Handle<JSObject> options,
947 Handle<JSObject> resolved) { 951 Handle<JSObject> resolved) {
948 // Convert BCP47 into ICU locale format. 952 // Convert BCP47 into ICU locale format.
949 UErrorCode status = U_ZERO_ERROR; 953 UErrorCode status = U_ZERO_ERROR;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 Handle<String> key = 986 Handle<String> key =
983 isolate->factory()->NewStringFromAscii(CStrVector("collator")); 987 isolate->factory()->NewStringFromAscii(CStrVector("collator"));
984 if (JSReceiver::HasLocalProperty(obj, key)) { 988 if (JSReceiver::HasLocalProperty(obj, key)) {
985 return reinterpret_cast<icu::Collator*>(obj->GetInternalField(0)); 989 return reinterpret_cast<icu::Collator*>(obj->GetInternalField(0));
986 } 990 }
987 991
988 return NULL; 992 return NULL;
989 } 993 }
990 994
991 995
992 void Collator::DeleteCollator(v8::Isolate* isolate, 996 void Collator::DeleteCollator(
993 Persistent<v8::Value>* object, 997 const v8::WeakCallbackData<v8::Value, void>& data) {
994 void* param) { 998 DeleteNativeObjectAt<icu::Collator>(data, 0);
995 // First delete the hidden C++ object. 999 DestroyGlobalHandle(data);
996 delete reinterpret_cast<icu::Collator*>(Handle<JSObject>::cast(
997 v8::Utils::OpenPersistent(object))->GetInternalField(0));
998
999 // Then dispose of the persistent handle to JS object.
1000 object->Reset();
1001 } 1000 }
1002 1001
1003 1002
1004 icu::BreakIterator* BreakIterator::InitializeBreakIterator( 1003 icu::BreakIterator* BreakIterator::InitializeBreakIterator(
1005 Isolate* isolate, 1004 Isolate* isolate,
1006 Handle<String> locale, 1005 Handle<String> locale,
1007 Handle<JSObject> options, 1006 Handle<JSObject> options,
1008 Handle<JSObject> resolved) { 1007 Handle<JSObject> resolved) {
1009 // Convert BCP47 into ICU locale format. 1008 // Convert BCP47 into ICU locale format.
1010 UErrorCode status = U_ZERO_ERROR; 1009 UErrorCode status = U_ZERO_ERROR;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 Handle<String> key = 1045 Handle<String> key =
1047 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")); 1046 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator"));
1048 if (JSReceiver::HasLocalProperty(obj, key)) { 1047 if (JSReceiver::HasLocalProperty(obj, key)) {
1049 return reinterpret_cast<icu::BreakIterator*>(obj->GetInternalField(0)); 1048 return reinterpret_cast<icu::BreakIterator*>(obj->GetInternalField(0));
1050 } 1049 }
1051 1050
1052 return NULL; 1051 return NULL;
1053 } 1052 }
1054 1053
1055 1054
1056 void BreakIterator::DeleteBreakIterator(v8::Isolate* isolate, 1055 void BreakIterator::DeleteBreakIterator(
1057 Persistent<v8::Value>* object, 1056 const v8::WeakCallbackData<v8::Value, void>& data) {
1058 void* param) { 1057 DeleteNativeObjectAt<icu::BreakIterator>(data, 0);
1059 // First delete the hidden C++ object. 1058 DeleteNativeObjectAt<icu::UnicodeString>(data, 1);
1060 delete reinterpret_cast<icu::BreakIterator*>(Handle<JSObject>::cast( 1059 DestroyGlobalHandle(data);
1061 v8::Utils::OpenPersistent(object))->GetInternalField(0));
1062
1063 delete reinterpret_cast<icu::UnicodeString*>(Handle<JSObject>::cast(
1064 v8::Utils::OpenPersistent(object))->GetInternalField(1));
1065
1066 // Then dispose of the persistent handle to JS object.
1067 object->Reset();
1068 } 1060 }
1069 1061
1070 } } // namespace v8::internal 1062 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/i18n.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698