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

Side by Side Diff: src/i18n.cc

Issue 235083002: Reland "Handlify GetProperty." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix 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 | « src/handles.cc ('k') | src/isolate.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 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 Handle<Object> object = Object::GetProperty(options, str); 61 Handle<Object> object = Object::GetProperty(options, str).ToHandleChecked();
62 if (object->IsString()) { 62 if (object->IsString()) {
63 v8::String::Utf8Value utf8_string( 63 v8::String::Utf8Value utf8_string(
64 v8::Utils::ToLocal(Handle<String>::cast(object))); 64 v8::Utils::ToLocal(Handle<String>::cast(object)));
65 *setting = icu::UnicodeString::fromUTF8(*utf8_string); 65 *setting = icu::UnicodeString::fromUTF8(*utf8_string);
66 return true; 66 return true;
67 } 67 }
68 return false; 68 return false;
69 } 69 }
70 70
71 71
72 bool ExtractIntegerSetting(Isolate* isolate, 72 bool ExtractIntegerSetting(Isolate* isolate,
73 Handle<JSObject> options, 73 Handle<JSObject> options,
74 const char* key, 74 const char* key,
75 int32_t* value) { 75 int32_t* value) {
76 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key)); 76 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key));
77 Handle<Object> object = Object::GetProperty(options, str); 77 Handle<Object> object = Object::GetProperty(options, str).ToHandleChecked();
78 if (object->IsNumber()) { 78 if (object->IsNumber()) {
79 object->ToInt32(value); 79 object->ToInt32(value);
80 return true; 80 return true;
81 } 81 }
82 return false; 82 return false;
83 } 83 }
84 84
85 85
86 bool ExtractBooleanSetting(Isolate* isolate, 86 bool ExtractBooleanSetting(Isolate* isolate,
87 Handle<JSObject> options, 87 Handle<JSObject> options,
88 const char* key, 88 const char* key,
89 bool* value) { 89 bool* value) {
90 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key)); 90 Handle<String> str = isolate->factory()->NewStringFromAscii(CStrVector(key));
91 Handle<Object> object = Object::GetProperty(options, str); 91 Handle<Object> object = Object::GetProperty(options, str).ToHandleChecked();
92 if (object->IsBoolean()) { 92 if (object->IsBoolean()) {
93 *value = object->BooleanValue(); 93 *value = object->BooleanValue();
94 return true; 94 return true;
95 } 95 }
96 return false; 96 return false;
97 } 97 }
98 98
99 99
100 icu::SimpleDateFormat* CreateICUDateFormat( 100 icu::SimpleDateFormat* CreateICUDateFormat(
101 Isolate* isolate, 101 Isolate* isolate,
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 1051
1052 1052
1053 void BreakIterator::DeleteBreakIterator( 1053 void BreakIterator::DeleteBreakIterator(
1054 const v8::WeakCallbackData<v8::Value, void>& data) { 1054 const v8::WeakCallbackData<v8::Value, void>& data) {
1055 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); 1055 DeleteNativeObjectAt<icu::BreakIterator>(data, 0);
1056 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); 1056 DeleteNativeObjectAt<icu::UnicodeString>(data, 1);
1057 DestroyGlobalHandle(data); 1057 DestroyGlobalHandle(data);
1058 } 1058 }
1059 1059
1060 } } // namespace v8::internal 1060 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698