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

Side by Side Diff: src/extensions/i18n/locale.cc

Issue 18509003: Keep two empty lines between declarations for cpp files (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 5 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/extensions/i18n/i18n-utils.cc ('k') | src/factory.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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 uloc_toLanguageTag(icu_result, result, ULOC_FULLNAME_CAPACITY, TRUE, &error); 75 uloc_toLanguageTag(icu_result, result, ULOC_FULLNAME_CAPACITY, TRUE, &error);
76 76
77 if (U_FAILURE(error)) { 77 if (U_FAILURE(error)) {
78 args.GetReturnValue().Set(v8::String::New(kInvalidTag)); 78 args.GetReturnValue().Set(v8::String::New(kInvalidTag));
79 return; 79 return;
80 } 80 }
81 81
82 args.GetReturnValue().Set(v8::String::New(result)); 82 args.GetReturnValue().Set(v8::String::New(result));
83 } 83 }
84 84
85
85 void JSAvailableLocalesOf(const v8::FunctionCallbackInfo<v8::Value>& args) { 86 void JSAvailableLocalesOf(const v8::FunctionCallbackInfo<v8::Value>& args) {
86 // Expect service name which is a string. 87 // Expect service name which is a string.
87 if (args.Length() != 1 || !args[0]->IsString()) { 88 if (args.Length() != 1 || !args[0]->IsString()) {
88 v8::ThrowException(v8::Exception::SyntaxError( 89 v8::ThrowException(v8::Exception::SyntaxError(
89 v8::String::New("Service identifier, as a string, is required."))); 90 v8::String::New("Service identifier, as a string, is required.")));
90 return; 91 return;
91 } 92 }
92 93
93 const icu::Locale* available_locales = NULL; 94 const icu::Locale* available_locales = NULL;
94 95
(...skipping 29 matching lines...) Expand all
124 locales->Set(v8::String::New(result), v8::Integer::New(i)); 125 locales->Set(v8::String::New(result), v8::Integer::New(i));
125 if (try_catch.HasCaught()) { 126 if (try_catch.HasCaught()) {
126 // Ignore error, but stop processing and return. 127 // Ignore error, but stop processing and return.
127 break; 128 break;
128 } 129 }
129 } 130 }
130 131
131 args.GetReturnValue().Set(locales); 132 args.GetReturnValue().Set(locales);
132 } 133 }
133 134
135
134 void JSGetDefaultICULocale(const v8::FunctionCallbackInfo<v8::Value>& args) { 136 void JSGetDefaultICULocale(const v8::FunctionCallbackInfo<v8::Value>& args) {
135 icu::Locale default_locale; 137 icu::Locale default_locale;
136 138
137 // Set the locale 139 // Set the locale
138 char result[ULOC_FULLNAME_CAPACITY]; 140 char result[ULOC_FULLNAME_CAPACITY];
139 UErrorCode status = U_ZERO_ERROR; 141 UErrorCode status = U_ZERO_ERROR;
140 uloc_toLanguageTag( 142 uloc_toLanguageTag(
141 default_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); 143 default_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status);
142 if (U_SUCCESS(status)) { 144 if (U_SUCCESS(status)) {
143 args.GetReturnValue().Set(v8::String::New(result)); 145 args.GetReturnValue().Set(v8::String::New(result));
144 return; 146 return;
145 } 147 }
146 148
147 args.GetReturnValue().Set(v8::String::New("und")); 149 args.GetReturnValue().Set(v8::String::New("und"));
148 } 150 }
149 151
152
150 void JSGetLanguageTagVariants(const v8::FunctionCallbackInfo<v8::Value>& args) { 153 void JSGetLanguageTagVariants(const v8::FunctionCallbackInfo<v8::Value>& args) {
151 v8::TryCatch try_catch; 154 v8::TryCatch try_catch;
152 155
153 // Expect an array of strings. 156 // Expect an array of strings.
154 if (args.Length() != 1 || !args[0]->IsArray()) { 157 if (args.Length() != 1 || !args[0]->IsArray()) {
155 v8::ThrowException(v8::Exception::SyntaxError( 158 v8::ThrowException(v8::Exception::SyntaxError(
156 v8::String::New("Internal error. Expected Array<String>."))); 159 v8::String::New("Internal error. Expected Array<String>.")));
157 return; 160 return;
158 } 161 }
159 162
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 output->Set(i, result); 242 output->Set(i, result);
240 if (try_catch.HasCaught()) { 243 if (try_catch.HasCaught()) {
241 break; 244 break;
242 } 245 }
243 } 246 }
244 247
245 args.GetReturnValue().Set(output); 248 args.GetReturnValue().Set(output);
246 } 249 }
247 250
248 } // namespace v8_i18n 251 } // namespace v8_i18n
OLDNEW
« no previous file with comments | « src/extensions/i18n/i18n-utils.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698