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

Side by Side Diff: include/v8.h

Issue 467037: External string table. (Closed)
Patch Set: Created 11 years 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 | « no previous file | src/api.cc » ('j') | src/heap.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 826
827 /** 827 /**
828 * Returns true if the string is external 828 * Returns true if the string is external
829 */ 829 */
830 bool IsExternal() const; 830 bool IsExternal() const;
831 831
832 /** 832 /**
833 * Returns true if the string is both external and ascii 833 * Returns true if the string is both external and ascii
834 */ 834 */
835 bool IsExternalAscii() const; 835 bool IsExternalAscii() const;
836
837 class V8EXPORT ExternalStringResourceBase {
838 public:
839 virtual ~ExternalStringResourceBase() {}
840 protected:
841 ExternalStringResourceBase() {}
842 private:
843 // Disallow copying and assigning.
844 ExternalStringResourceBase(const ExternalStringResourceBase&);
845 void operator=(const ExternalStringResourceBase&);
846 };
847
836 /** 848 /**
837 * An ExternalStringResource is a wrapper around a two-byte string 849 * An ExternalStringResource is a wrapper around a two-byte string
838 * buffer that resides outside V8's heap. Implement an 850 * buffer that resides outside V8's heap. Implement an
839 * ExternalStringResource to manage the life cycle of the underlying 851 * ExternalStringResource to manage the life cycle of the underlying
840 * buffer. Note that the string data must be immutable. 852 * buffer. Note that the string data must be immutable.
841 */ 853 */
842 class V8EXPORT ExternalStringResource { // NOLINT 854 class V8EXPORT ExternalStringResource
855 : public ExternalStringResourceBase {
843 public: 856 public:
844 /** 857 /**
845 * Override the destructor to manage the life cycle of the underlying 858 * Override the destructor to manage the life cycle of the underlying
846 * buffer. 859 * buffer.
847 */ 860 */
848 virtual ~ExternalStringResource() {} 861 virtual ~ExternalStringResource() {}
849 /** The string data from the underlying buffer.*/ 862 /** The string data from the underlying buffer.*/
850 virtual const uint16_t* data() const = 0; 863 virtual const uint16_t* data() const = 0;
851 /** The length of the string. That is, the number of two-byte characters.*/ 864 /** The length of the string. That is, the number of two-byte characters.*/
852 virtual size_t length() const = 0; 865 virtual size_t length() const = 0;
853 protected: 866 protected:
854 ExternalStringResource() {} 867 ExternalStringResource() {}
855 private:
856 // Disallow copying and assigning.
857 ExternalStringResource(const ExternalStringResource&);
858 void operator=(const ExternalStringResource&);
859 }; 868 };
860 869
861 /** 870 /**
862 * An ExternalAsciiStringResource is a wrapper around an ascii 871 * An ExternalAsciiStringResource is a wrapper around an ascii
863 * string buffer that resides outside V8's heap. Implement an 872 * string buffer that resides outside V8's heap. Implement an
864 * ExternalAsciiStringResource to manage the life cycle of the 873 * ExternalAsciiStringResource to manage the life cycle of the
865 * underlying buffer. Note that the string data must be immutable 874 * underlying buffer. Note that the string data must be immutable
866 * and that the data must be strict 7-bit ASCII, not Latin1 or 875 * and that the data must be strict 7-bit ASCII, not Latin1 or
867 * UTF-8, which would require special treatment internally in the 876 * UTF-8, which would require special treatment internally in the
868 * engine and, in the case of UTF-8, do not allow efficient indexing. 877 * engine and, in the case of UTF-8, do not allow efficient indexing.
869 * Use String::New or convert to 16 bit data for non-ASCII. 878 * Use String::New or convert to 16 bit data for non-ASCII.
870 */ 879 */
871 880
872 class V8EXPORT ExternalAsciiStringResource { // NOLINT 881 class V8EXPORT ExternalAsciiStringResource
882 : public ExternalStringResourceBase {
873 public: 883 public:
874 /** 884 /**
875 * Override the destructor to manage the life cycle of the underlying 885 * Override the destructor to manage the life cycle of the underlying
876 * buffer. 886 * buffer.
877 */ 887 */
878 virtual ~ExternalAsciiStringResource() {} 888 virtual ~ExternalAsciiStringResource() {}
879 /** The string data from the underlying buffer.*/ 889 /** The string data from the underlying buffer.*/
880 virtual const char* data() const = 0; 890 virtual const char* data() const = 0;
881 /** The number of ascii characters in the string.*/ 891 /** The number of ascii characters in the string.*/
882 virtual size_t length() const = 0; 892 virtual size_t length() const = 0;
883 protected: 893 protected:
884 ExternalAsciiStringResource() {} 894 ExternalAsciiStringResource() {}
885 private:
886 // Disallow copying and assigning.
887 ExternalAsciiStringResource(const ExternalAsciiStringResource&);
888 void operator=(const ExternalAsciiStringResource&);
889 }; 895 };
890 896
891 /** 897 /**
892 * Get the ExternalStringResource for an external string. Returns 898 * Get the ExternalStringResource for an external string. Returns
893 * NULL if IsExternal() doesn't return true. 899 * NULL if IsExternal() doesn't return true.
894 */ 900 */
895 inline ExternalStringResource* GetExternalStringResource() const; 901 inline ExternalStringResource* GetExternalStringResource() const;
896 902
897 /** 903 /**
898 * Get the ExternalAsciiStringResource for an external ascii string. 904 * Get the ExternalAsciiStringResource for an external ascii string.
(...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 3226
3221 } // namespace v8 3227 } // namespace v8
3222 3228
3223 3229
3224 #undef V8EXPORT 3230 #undef V8EXPORT
3225 #undef V8EXPORT_INLINE 3231 #undef V8EXPORT_INLINE
3226 #undef TYPE_CHECK 3232 #undef TYPE_CHECK
3227 3233
3228 3234
3229 #endif // V8_H_ 3235 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698