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

Side by Side Diff: src/i18n.cc

Issue 1775973002: Add GetProperty/GetElement to JSReceiver and use it where possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « src/debug/liveedit.cc ('k') | src/ic/ic.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 // 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
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
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
OLDNEW
« no previous file with comments | « src/debug/liveedit.cc ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698