OLD | NEW |
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 v8::Local<v8::Object> handle = v8::Local<v8::Object>::New(isolate, *object); | 75 v8::Local<v8::Object> handle = v8::Local<v8::Object>::New(isolate, *object); |
76 delete UnpackBreakIterator(handle); | 76 delete UnpackBreakIterator(handle); |
77 | 77 |
78 delete static_cast<icu::UnicodeString*>( | 78 delete static_cast<icu::UnicodeString*>( |
79 handle->GetAlignedPointerFromInternalField(1)); | 79 handle->GetAlignedPointerFromInternalField(1)); |
80 | 80 |
81 // Then dispose of the persistent handle to JS object. | 81 // Then dispose of the persistent handle to JS object. |
82 object->Dispose(isolate); | 82 object->Dispose(isolate); |
83 } | 83 } |
84 | 84 |
| 85 |
85 // Throws a JavaScript exception. | 86 // Throws a JavaScript exception. |
86 static v8::Handle<v8::Value> ThrowUnexpectedObjectError() { | 87 static v8::Handle<v8::Value> ThrowUnexpectedObjectError() { |
87 // Returns undefined, and schedules an exception to be thrown. | 88 // Returns undefined, and schedules an exception to be thrown. |
88 return v8::ThrowException(v8::Exception::Error( | 89 return v8::ThrowException(v8::Exception::Error( |
89 v8::String::New("BreakIterator method called on an object " | 90 v8::String::New("BreakIterator method called on an object " |
90 "that is not a BreakIterator."))); | 91 "that is not a BreakIterator."))); |
91 } | 92 } |
92 | 93 |
| 94 |
93 // Deletes the old value and sets the adopted text in corresponding | 95 // Deletes the old value and sets the adopted text in corresponding |
94 // JavaScript object. | 96 // JavaScript object. |
95 icu::UnicodeString* ResetAdoptedText( | 97 icu::UnicodeString* ResetAdoptedText( |
96 v8::Handle<v8::Object> obj, v8::Handle<v8::Value> value) { | 98 v8::Handle<v8::Object> obj, v8::Handle<v8::Value> value) { |
97 // Get the previous value from the internal field. | 99 // Get the previous value from the internal field. |
98 icu::UnicodeString* text = static_cast<icu::UnicodeString*>( | 100 icu::UnicodeString* text = static_cast<icu::UnicodeString*>( |
99 obj->GetAlignedPointerFromInternalField(1)); | 101 obj->GetAlignedPointerFromInternalField(1)); |
100 delete text; | 102 delete text; |
101 | 103 |
102 // Assign new value to the internal pointer. | 104 // Assign new value to the internal pointer. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); | 324 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); |
323 if (U_SUCCESS(status)) { | 325 if (U_SUCCESS(status)) { |
324 resolved->Set(v8::String::New("locale"), v8::String::New(result)); | 326 resolved->Set(v8::String::New("locale"), v8::String::New(result)); |
325 } else { | 327 } else { |
326 // This would never happen, since we got the locale from ICU. | 328 // This would never happen, since we got the locale from ICU. |
327 resolved->Set(v8::String::New("locale"), v8::String::New("und")); | 329 resolved->Set(v8::String::New("locale"), v8::String::New("und")); |
328 } | 330 } |
329 } | 331 } |
330 | 332 |
331 } // namespace v8_i18n | 333 } // namespace v8_i18n |
OLD | NEW |