OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 | 703 |
704 | 704 |
705 template <typename Char, typename Base> | 705 template <typename Char, typename Base> |
706 class SimpleStringResource : public Base { | 706 class SimpleStringResource : public Base { |
707 public: | 707 public: |
708 // Takes ownership of |data|. | 708 // Takes ownership of |data|. |
709 SimpleStringResource(Char* data, size_t length) | 709 SimpleStringResource(Char* data, size_t length) |
710 : data_(data), | 710 : data_(data), |
711 length_(length) {} | 711 length_(length) {} |
712 | 712 |
713 virtual ~SimpleStringResource() { delete data_; } | 713 virtual ~SimpleStringResource() { delete[] data_; } |
714 | 714 |
715 virtual const Char* data() const { return data_; } | 715 virtual const Char* data() const { return data_; } |
716 | 716 |
717 virtual size_t length() const { return length_; } | 717 virtual size_t length() const { return length_; } |
718 | 718 |
719 private: | 719 private: |
720 Char* const data_; | 720 Char* const data_; |
721 const size_t length_; | 721 const size_t length_; |
722 }; | 722 }; |
723 | 723 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 return Utils::OpenHandle(*args[0].As<v8::String>())->IsAsciiRepresentation() ? | 800 return Utils::OpenHandle(*args[0].As<v8::String>())->IsAsciiRepresentation() ? |
801 v8::True() : v8::False(); | 801 v8::True() : v8::False(); |
802 } | 802 } |
803 | 803 |
804 | 804 |
805 static ExternalizeStringExtension externalize_extension; | 805 static ExternalizeStringExtension externalize_extension; |
806 static v8::DeclareExtension externalize_extension_declaration( | 806 static v8::DeclareExtension externalize_extension_declaration( |
807 &externalize_extension); | 807 &externalize_extension); |
808 | 808 |
809 } } // namespace v8::internal | 809 } } // namespace v8::internal |
OLD | NEW |