| OLD | NEW |
| 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 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 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" | |
| 32 #include "natives.h" | 31 #include "natives.h" |
| 33 | 32 |
| 34 using v8::internal::I18NNatives; | 33 using v8::internal::I18NNatives; |
| 35 | 34 |
| 36 namespace v8_i18n { | 35 namespace v8_i18n { |
| 37 | 36 |
| 38 Extension::Extension() | 37 Extension::Extension() |
| 39 : v8::Extension("v8/i18n", | 38 : v8::Extension("v8/i18n", |
| 40 reinterpret_cast<const char*>( | 39 reinterpret_cast<const char*>( |
| 41 I18NNatives::GetScriptsSource().start()), | 40 I18NNatives::GetScriptsSource().start()), |
| 42 0, | 41 0, |
| 43 0, | 42 0, |
| 44 I18NNatives::GetScriptsSource().length()) {} | 43 I18NNatives::GetScriptsSource().length()) {} |
| 45 | 44 |
| 46 v8::Handle<v8::FunctionTemplate> Extension::GetNativeFunction( | |
| 47 v8::Handle<v8::String> name) { | |
| 48 // Break iterator. | |
| 49 if (name->Equals(v8::String::New("NativeJSCreateBreakIterator"))) { | |
| 50 return v8::FunctionTemplate::New(BreakIterator::JSCreateBreakIterator); | |
| 51 } else if (name->Equals(v8::String::New("NativeJSBreakIteratorAdoptText"))) { | |
| 52 return v8::FunctionTemplate::New( | |
| 53 BreakIterator::JSInternalBreakIteratorAdoptText); | |
| 54 } else if (name->Equals(v8::String::New("NativeJSBreakIteratorFirst"))) { | |
| 55 return v8::FunctionTemplate::New( | |
| 56 BreakIterator::JSInternalBreakIteratorFirst); | |
| 57 } else if (name->Equals(v8::String::New("NativeJSBreakIteratorNext"))) { | |
| 58 return v8::FunctionTemplate::New( | |
| 59 BreakIterator::JSInternalBreakIteratorNext); | |
| 60 } else if (name->Equals(v8::String::New("NativeJSBreakIteratorCurrent"))) { | |
| 61 return v8::FunctionTemplate::New( | |
| 62 BreakIterator::JSInternalBreakIteratorCurrent); | |
| 63 } else if (name->Equals(v8::String::New("NativeJSBreakIteratorBreakType"))) { | |
| 64 return v8::FunctionTemplate::New( | |
| 65 BreakIterator::JSInternalBreakIteratorBreakType); | |
| 66 } | |
| 67 | |
| 68 return v8::Handle<v8::FunctionTemplate>(); | |
| 69 } | |
| 70 | |
| 71 | 45 |
| 72 void Extension::Register() { | 46 void Extension::Register() { |
| 73 static Extension i18n_extension; | 47 static Extension i18n_extension; |
| 74 static v8::DeclareExtension extension_declaration(&i18n_extension); | 48 static v8::DeclareExtension extension_declaration(&i18n_extension); |
| 75 } | 49 } |
| 76 | 50 |
| 77 } // namespace v8_i18n | 51 } // namespace v8_i18n |
| OLD | NEW |