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 "src/api.h" | 8 #include "src/api.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 namespace v8 { | 32 namespace v8 { |
33 namespace internal { | 33 namespace internal { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 bool ExtractStringSetting(Isolate* isolate, | 37 bool ExtractStringSetting(Isolate* isolate, |
38 Handle<JSObject> options, | 38 Handle<JSObject> options, |
39 const char* key, | 39 const char* key, |
40 icu::UnicodeString* setting) { | 40 icu::UnicodeString* setting) { |
41 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked(key); | 41 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked(key); |
42 Handle<Object> object = Object::GetProperty(options, str).ToHandleChecked(); | 42 Handle<Object> object = |
| 43 JSReceiver::GetProperty(options, str).ToHandleChecked(); |
43 if (object->IsString()) { | 44 if (object->IsString()) { |
44 v8::String::Utf8Value utf8_string( | 45 v8::String::Utf8Value utf8_string( |
45 v8::Utils::ToLocal(Handle<String>::cast(object))); | 46 v8::Utils::ToLocal(Handle<String>::cast(object))); |
46 *setting = icu::UnicodeString::fromUTF8(*utf8_string); | 47 *setting = icu::UnicodeString::fromUTF8(*utf8_string); |
47 return true; | 48 return true; |
48 } | 49 } |
49 return false; | 50 return false; |
50 } | 51 } |
51 | 52 |
52 | 53 |
53 bool ExtractIntegerSetting(Isolate* isolate, | 54 bool ExtractIntegerSetting(Isolate* isolate, |
54 Handle<JSObject> options, | 55 Handle<JSObject> options, |
55 const char* key, | 56 const char* key, |
56 int32_t* value) { | 57 int32_t* value) { |
57 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked(key); | 58 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked(key); |
58 Handle<Object> object = Object::GetProperty(options, str).ToHandleChecked(); | 59 Handle<Object> object = |
| 60 JSReceiver::GetProperty(options, str).ToHandleChecked(); |
59 if (object->IsNumber()) { | 61 if (object->IsNumber()) { |
60 object->ToInt32(value); | 62 object->ToInt32(value); |
61 return true; | 63 return true; |
62 } | 64 } |
63 return false; | 65 return false; |
64 } | 66 } |
65 | 67 |
66 | 68 |
67 bool ExtractBooleanSetting(Isolate* isolate, | 69 bool ExtractBooleanSetting(Isolate* isolate, |
68 Handle<JSObject> options, | 70 Handle<JSObject> options, |
69 const char* key, | 71 const char* key, |
70 bool* value) { | 72 bool* value) { |
71 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked(key); | 73 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked(key); |
72 Handle<Object> object = Object::GetProperty(options, str).ToHandleChecked(); | 74 Handle<Object> object = |
| 75 JSReceiver::GetProperty(options, str).ToHandleChecked(); |
73 if (object->IsBoolean()) { | 76 if (object->IsBoolean()) { |
74 *value = object->BooleanValue(); | 77 *value = object->BooleanValue(); |
75 return true; | 78 return true; |
76 } | 79 } |
77 return false; | 80 return false; |
78 } | 81 } |
79 | 82 |
80 | 83 |
81 icu::SimpleDateFormat* CreateICUDateFormat( | 84 icu::SimpleDateFormat* CreateICUDateFormat( |
82 Isolate* isolate, | 85 Isolate* isolate, |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 | 976 |
974 void BreakIterator::DeleteBreakIterator( | 977 void BreakIterator::DeleteBreakIterator( |
975 const v8::WeakCallbackData<v8::Value, void>& data) { | 978 const v8::WeakCallbackData<v8::Value, void>& data) { |
976 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); | 979 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); |
977 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); | 980 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); |
978 DestroyGlobalHandle(data); | 981 DestroyGlobalHandle(data); |
979 } | 982 } |
980 | 983 |
981 } // namespace internal | 984 } // namespace internal |
982 } // namespace v8 | 985 } // namespace v8 |
OLD | NEW |