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

Side by Side Diff: src/extensions/i18n/i18n-extension.cc

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 Created 7 years, 4 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/date-format.js ('k') | src/extensions/i18n/i18n-utils.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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 // limitations under the License. 27 // limitations under the License.
28 28
29 #include "i18n-extension.h" 29 #include "i18n-extension.h"
30 30
31 #include "break-iterator.h" 31 #include "break-iterator.h"
32 #include "collator.h" 32 #include "collator.h"
33 #include "date-format.h"
34 #include "locale.h"
33 #include "natives.h" 35 #include "natives.h"
34 #include "number-format.h" 36 #include "number-format.h"
35 37
36 using v8::internal::I18NNatives; 38 using v8::internal::I18NNatives;
37 39
38 namespace v8_i18n { 40 namespace v8_i18n {
39 41
40 Extension::Extension() 42 Extension::Extension()
41 : v8::Extension("v8/i18n", 43 : v8::Extension("v8/i18n",
42 reinterpret_cast<const char*>( 44 reinterpret_cast<const char*>(
43 I18NNatives::GetScriptsSource().start()), 45 I18NNatives::GetScriptsSource().start()),
44 0, 46 0,
45 0, 47 0,
46 I18NNatives::GetScriptsSource().length()) {} 48 I18NNatives::GetScriptsSource().length()) {}
47 49
48 v8::Handle<v8::FunctionTemplate> Extension::GetNativeFunction( 50 v8::Handle<v8::FunctionTemplate> Extension::GetNativeFunction(
49 v8::Handle<v8::String> name) { 51 v8::Handle<v8::String> name) {
52 // Standalone, helper methods.
53 if (name->Equals(v8::String::New("NativeJSCanonicalizeLanguageTag"))) {
54 return v8::FunctionTemplate::New(JSCanonicalizeLanguageTag);
55 } else if (name->Equals(v8::String::New("NativeJSAvailableLocalesOf"))) {
56 return v8::FunctionTemplate::New(JSAvailableLocalesOf);
57 } else if (name->Equals(v8::String::New("NativeJSGetDefaultICULocale"))) {
58 return v8::FunctionTemplate::New(JSGetDefaultICULocale);
59 } else if (name->Equals(v8::String::New("NativeJSGetLanguageTagVariants"))) {
60 return v8::FunctionTemplate::New(JSGetLanguageTagVariants);
61 }
62
63 // Date format and parse.
64 if (name->Equals(v8::String::New("NativeJSCreateDateTimeFormat"))) {
65 return v8::FunctionTemplate::New(DateFormat::JSCreateDateTimeFormat);
66 } else if (name->Equals(v8::String::New("NativeJSInternalDateFormat"))) {
67 return v8::FunctionTemplate::New(DateFormat::JSInternalFormat);
68 } else if (name->Equals(v8::String::New("NativeJSInternalDateParse"))) {
69 return v8::FunctionTemplate::New(DateFormat::JSInternalParse);
70 }
71
50 // Number format and parse. 72 // Number format and parse.
51 if (name->Equals(v8::String::New("NativeJSCreateNumberFormat"))) { 73 if (name->Equals(v8::String::New("NativeJSCreateNumberFormat"))) {
52 return v8::FunctionTemplate::New(NumberFormat::JSCreateNumberFormat); 74 return v8::FunctionTemplate::New(NumberFormat::JSCreateNumberFormat);
53 } else if (name->Equals(v8::String::New("NativeJSInternalNumberFormat"))) { 75 } else if (name->Equals(v8::String::New("NativeJSInternalNumberFormat"))) {
54 return v8::FunctionTemplate::New(NumberFormat::JSInternalFormat); 76 return v8::FunctionTemplate::New(NumberFormat::JSInternalFormat);
55 } else if (name->Equals(v8::String::New("NativeJSInternalNumberParse"))) { 77 } else if (name->Equals(v8::String::New("NativeJSInternalNumberParse"))) {
56 return v8::FunctionTemplate::New(NumberFormat::JSInternalParse); 78 return v8::FunctionTemplate::New(NumberFormat::JSInternalParse);
57 } 79 }
58 80
59 // Collator. 81 // Collator.
(...skipping 26 matching lines...) Expand all
86 return v8::Handle<v8::FunctionTemplate>(); 108 return v8::Handle<v8::FunctionTemplate>();
87 } 109 }
88 110
89 111
90 void Extension::Register() { 112 void Extension::Register() {
91 static Extension i18n_extension; 113 static Extension i18n_extension;
92 static v8::DeclareExtension extension_declaration(&i18n_extension); 114 static v8::DeclareExtension extension_declaration(&i18n_extension);
93 } 115 }
94 116
95 } // namespace v8_i18n 117 } // namespace v8_i18n
OLDNEW
« no previous file with comments | « src/extensions/i18n/date-format.js ('k') | src/extensions/i18n/i18n-utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698