| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // limitations under the License. | 4 // limitations under the License. |
| 5 | 5 |
| 6 #include "src/i18n.h" | 6 #include "src/i18n.h" |
| 7 | 7 |
| 8 #include "unicode/brkiter.h" | 8 #include "unicode/brkiter.h" |
| 9 #include "unicode/calendar.h" | 9 #include "unicode/calendar.h" |
| 10 #include "unicode/coll.h" | 10 #include "unicode/coll.h" |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 factory->NewStringFromAsciiChecked(result), | 594 factory->NewStringFromAsciiChecked(result), |
| 595 SLOPPY).Assert(); | 595 SLOPPY).Assert(); |
| 596 } else { | 596 } else { |
| 597 // This would never happen, since we got the locale from ICU. | 597 // This would never happen, since we got the locale from ICU. |
| 598 JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), | 598 JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), |
| 599 factory->NewStringFromStaticChars("und"), | 599 factory->NewStringFromStaticChars("und"), |
| 600 SLOPPY).Assert(); | 600 SLOPPY).Assert(); |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 | 603 |
| 604 | 604 #if !UCONFIG_NO_BREAK_ITERATION |
| 605 icu::BreakIterator* CreateICUBreakIterator( | 605 icu::BreakIterator* CreateICUBreakIterator( |
| 606 Isolate* isolate, | 606 Isolate* isolate, |
| 607 const icu::Locale& icu_locale, | 607 const icu::Locale& icu_locale, |
| 608 Handle<JSObject> options) { | 608 Handle<JSObject> options) { |
| 609 UErrorCode status = U_ZERO_ERROR; | 609 UErrorCode status = U_ZERO_ERROR; |
| 610 icu::BreakIterator* break_iterator = NULL; | 610 icu::BreakIterator* break_iterator = NULL; |
| 611 icu::UnicodeString type; | 611 icu::UnicodeString type; |
| 612 if (!ExtractStringSetting(isolate, options, "type", &type)) return NULL; | 612 if (!ExtractStringSetting(isolate, options, "type", &type)) return NULL; |
| 613 | 613 |
| 614 if (type == UNICODE_STRING_SIMPLE("character")) { | 614 if (type == UNICODE_STRING_SIMPLE("character")) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 628 | 628 |
| 629 if (U_FAILURE(status)) { | 629 if (U_FAILURE(status)) { |
| 630 delete break_iterator; | 630 delete break_iterator; |
| 631 return NULL; | 631 return NULL; |
| 632 } | 632 } |
| 633 | 633 |
| 634 isolate->CountUsage(v8::Isolate::UseCounterFeature::kBreakIterator); | 634 isolate->CountUsage(v8::Isolate::UseCounterFeature::kBreakIterator); |
| 635 | 635 |
| 636 return break_iterator; | 636 return break_iterator; |
| 637 } | 637 } |
| 638 | 638 #endif |
| 639 | 639 |
| 640 void SetResolvedBreakIteratorSettings(Isolate* isolate, | 640 void SetResolvedBreakIteratorSettings(Isolate* isolate, |
| 641 const icu::Locale& icu_locale, | 641 const icu::Locale& icu_locale, |
| 642 icu::BreakIterator* break_iterator, | 642 icu::BreakIterator* break_iterator, |
| 643 Handle<JSObject> resolved) { | 643 Handle<JSObject> resolved) { |
| 644 Factory* factory = isolate->factory(); | 644 Factory* factory = isolate->factory(); |
| 645 UErrorCode status = U_ZERO_ERROR; | 645 UErrorCode status = U_ZERO_ERROR; |
| 646 | 646 |
| 647 // Set the locale | 647 // Set the locale |
| 648 char result[ULOC_FULLNAME_CAPACITY]; | 648 char result[ULOC_FULLNAME_CAPACITY]; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 return NULL; | 874 return NULL; |
| 875 } | 875 } |
| 876 | 876 |
| 877 | 877 |
| 878 void Collator::DeleteCollator( | 878 void Collator::DeleteCollator( |
| 879 const v8::WeakCallbackData<v8::Value, void>& data) { | 879 const v8::WeakCallbackData<v8::Value, void>& data) { |
| 880 DeleteNativeObjectAt<icu::Collator>(data, 0); | 880 DeleteNativeObjectAt<icu::Collator>(data, 0); |
| 881 DestroyGlobalHandle(data); | 881 DestroyGlobalHandle(data); |
| 882 } | 882 } |
| 883 | 883 |
| 884 | 884 #if !UCONFIG_NO_BREAK_ITERATION |
| 885 icu::BreakIterator* BreakIterator::InitializeBreakIterator( | 885 icu::BreakIterator* BreakIterator::InitializeBreakIterator( |
| 886 Isolate* isolate, | 886 Isolate* isolate, |
| 887 Handle<String> locale, | 887 Handle<String> locale, |
| 888 Handle<JSObject> options, | 888 Handle<JSObject> options, |
| 889 Handle<JSObject> resolved) { | 889 Handle<JSObject> resolved) { |
| 890 // Convert BCP47 into ICU locale format. | 890 // Convert BCP47 into ICU locale format. |
| 891 UErrorCode status = U_ZERO_ERROR; | 891 UErrorCode status = U_ZERO_ERROR; |
| 892 icu::Locale icu_locale; | 892 icu::Locale icu_locale; |
| 893 char icu_result[ULOC_FULLNAME_CAPACITY]; | 893 char icu_result[ULOC_FULLNAME_CAPACITY]; |
| 894 int icu_length = 0; | 894 int icu_length = 0; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 return NULL; | 939 return NULL; |
| 940 } | 940 } |
| 941 | 941 |
| 942 | 942 |
| 943 void BreakIterator::DeleteBreakIterator( | 943 void BreakIterator::DeleteBreakIterator( |
| 944 const v8::WeakCallbackData<v8::Value, void>& data) { | 944 const v8::WeakCallbackData<v8::Value, void>& data) { |
| 945 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); | 945 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); |
| 946 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); | 946 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); |
| 947 DestroyGlobalHandle(data); | 947 DestroyGlobalHandle(data); |
| 948 } | 948 } |
| 949 | 949 #endif |
| 950 } } // namespace v8::internal | 950 } } // namespace v8::internal |
| OLD | NEW |