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

Side by Side Diff: src/i18n.cc

Issue 226543003: Handlify i18n.cc. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months 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 | « no previous file | no next file » | 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 namespace v8 { 51 namespace v8 {
52 namespace internal { 52 namespace internal {
53 53
54 namespace { 54 namespace {
55 55
56 bool ExtractStringSetting(Isolate* isolate, 56 bool ExtractStringSetting(Isolate* isolate,
57 Handle<JSObject> options, 57 Handle<JSObject> options,
58 const char* key, 58 const char* key,
59 icu::UnicodeString* setting) { 59 icu::UnicodeString* setting) {
60 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key)); 60 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key));
61 MaybeObject* maybe_object = options->GetProperty(*str); 61 Handle<Object> object = Object::GetProperty(options, str);
62 Object* object; 62 if (object->IsString()) {
63 if (maybe_object->ToObject(&object) && object->IsString()) {
64 v8::String::Utf8Value utf8_string( 63 v8::String::Utf8Value utf8_string(
65 v8::Utils::ToLocal(Handle<String>(String::cast(object)))); 64 v8::Utils::ToLocal(Handle<String>::cast(object)));
66 *setting = icu::UnicodeString::fromUTF8(*utf8_string); 65 *setting = icu::UnicodeString::fromUTF8(*utf8_string);
67 return true; 66 return true;
68 } 67 }
69 return false; 68 return false;
70 } 69 }
71 70
72 71
73 bool ExtractIntegerSetting(Isolate* isolate, 72 bool ExtractIntegerSetting(Isolate* isolate,
74 Handle<JSObject> options, 73 Handle<JSObject> options,
75 const char* key, 74 const char* key,
76 int32_t* value) { 75 int32_t* value) {
77 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key)); 76 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key));
78 MaybeObject* maybe_object = options->GetProperty(*str); 77 Handle<Object> object = Object::GetProperty(options, str);
79 Object* object; 78 if (object->IsNumber()) {
80 if (maybe_object->ToObject(&object) && object->IsNumber()) {
81 object->ToInt32(value); 79 object->ToInt32(value);
82 return true; 80 return true;
83 } 81 }
84 return false; 82 return false;
85 } 83 }
86 84
87 85
88 bool ExtractBooleanSetting(Isolate* isolate, 86 bool ExtractBooleanSetting(Isolate* isolate,
89 Handle<JSObject> options, 87 Handle<JSObject> options,
90 const char* key, 88 const char* key,
91 bool* value) { 89 bool* value) {
92 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key)); 90 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key));
93 MaybeObject* maybe_object = options->GetProperty(*str); 91 Handle<Object> object = Object::GetProperty(options, str);
94 Object* object; 92 if (object->IsBoolean()) {
95 if (maybe_object->ToObject(&object) && object->IsBoolean()) {
96 *value = object->BooleanValue(); 93 *value = object->BooleanValue();
97 return true; 94 return true;
98 } 95 }
99 return false; 96 return false;
100 } 97 }
101 98
102 99
103 icu::SimpleDateFormat* CreateICUDateFormat( 100 icu::SimpleDateFormat* CreateICUDateFormat(
104 Isolate* isolate, 101 Isolate* isolate,
105 const icu::Locale& icu_locale, 102 const icu::Locale& icu_locale,
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1051
1055 1052
1056 void BreakIterator::DeleteBreakIterator( 1053 void BreakIterator::DeleteBreakIterator(
1057 const v8::WeakCallbackData<v8::Value, void>& data) { 1054 const v8::WeakCallbackData<v8::Value, void>& data) {
1058 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); 1055 DeleteNativeObjectAt<icu::BreakIterator>(data, 0);
1059 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); 1056 DeleteNativeObjectAt<icu::UnicodeString>(data, 1);
1060 DestroyGlobalHandle(data); 1057 DestroyGlobalHandle(data);
1061 } 1058 }
1062 1059
1063 } } // namespace v8::internal 1060 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698