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

Side by Side Diff: include/v8.h

Issue 4324: Disallow copy and assigning a few public objects. (Closed)
Patch Set: Created 12 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 * buffer. 776 * buffer.
777 */ 777 */
778 virtual ~ExternalStringResource() {} 778 virtual ~ExternalStringResource() {}
779 /** The string data from the underlying buffer.*/ 779 /** The string data from the underlying buffer.*/
780 virtual const uint16_t* data() const = 0; 780 virtual const uint16_t* data() const = 0;
781 /** The length of the string. That is, the number of two-byte characters.*/ 781 /** The length of the string. That is, the number of two-byte characters.*/
782 virtual size_t length() const = 0; 782 virtual size_t length() const = 0;
783 protected: 783 protected:
784 ExternalStringResource() {} 784 ExternalStringResource() {}
785 private: 785 private:
786 // Disallow copying and assigning.
786 ExternalStringResource(const ExternalStringResource&); 787 ExternalStringResource(const ExternalStringResource&);
787 void operator=(const ExternalStringResource&); 788 void operator=(const ExternalStringResource&);
788 }; 789 };
789 790
790 /** 791 /**
791 * An ExternalAsciiStringResource is a wrapper around an ascii 792 * An ExternalAsciiStringResource is a wrapper around an ascii
792 * string buffer that resides outside V8's heap. Implement an 793 * string buffer that resides outside V8's heap. Implement an
793 * ExternalAsciiStringResource to manage the life cycle of the 794 * ExternalAsciiStringResource to manage the life cycle of the
794 * underlying buffer. Note that the string data must be immutable 795 * underlying buffer. Note that the string data must be immutable
795 * and that the data must be strict 7-bit ASCII, not Latin1 or 796 * and that the data must be strict 7-bit ASCII, not Latin1 or
796 * UTF-8, which would require special treatment internally in the 797 * UTF-8, which would require special treatment internally in the
797 * engine and, in the case of UTF-8, do not allow efficient indexing. 798 * engine and, in the case of UTF-8, do not allow efficient indexing.
798 * Use String::New or convert to 16 bit data for non-ASCII. 799 * Use String::New or convert to 16 bit data for non-ASCII.
799 */ 800 */
800 801
801 class EXPORT ExternalAsciiStringResource { // NOLINT 802 class EXPORT ExternalAsciiStringResource { // NOLINT
802 public: 803 public:
803 /** 804 /**
804 * Override the destructor to manage the life cycle of the underlying 805 * Override the destructor to manage the life cycle of the underlying
805 * buffer. 806 * buffer.
806 */ 807 */
807 virtual ~ExternalAsciiStringResource() {} 808 virtual ~ExternalAsciiStringResource() {}
808 /** The string data from the underlying buffer.*/ 809 /** The string data from the underlying buffer.*/
809 virtual const char* data() const = 0; 810 virtual const char* data() const = 0;
810 /** The number of ascii characters in the string.*/ 811 /** The number of ascii characters in the string.*/
811 virtual size_t length() const = 0; 812 virtual size_t length() const = 0;
812 protected: 813 protected:
813 ExternalAsciiStringResource() {} 814 ExternalAsciiStringResource() {}
814 private: 815 private:
816 // Disallow copying and assigning.
815 ExternalAsciiStringResource(const ExternalAsciiStringResource&); 817 ExternalAsciiStringResource(const ExternalAsciiStringResource&);
816 void operator=(const ExternalAsciiStringResource&); 818 void operator=(const ExternalAsciiStringResource&);
817 }; 819 };
818 820
819 /** 821 /**
820 * Get the ExternalStringResource for an external string. Only 822 * Get the ExternalStringResource for an external string. Only
821 * valid if IsExternal() returns true. 823 * valid if IsExternal() returns true.
822 */ 824 */
823 ExternalStringResource* GetExternalStringResource(); 825 ExternalStringResource* GetExternalStringResource();
824 826
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 */ 881 */
880 class EXPORT Utf8Value { 882 class EXPORT Utf8Value {
881 public: 883 public:
882 explicit Utf8Value(Handle<v8::Value> obj); 884 explicit Utf8Value(Handle<v8::Value> obj);
883 ~Utf8Value(); 885 ~Utf8Value();
884 char* operator*() { return str_; } 886 char* operator*() { return str_; }
885 int length() { return length_; } 887 int length() { return length_; }
886 private: 888 private:
887 char* str_; 889 char* str_;
888 int length_; 890 int length_;
891
892 // Disallow copying and assigning.
893 Utf8Value(const Utf8Value&);
894 void operator=(const Utf8Value&);
889 }; 895 };
890 896
891 /** 897 /**
892 * Converts an object to an ascii string. 898 * Converts an object to an ascii string.
893 * Useful if you want to print the object. 899 * Useful if you want to print the object.
894 */ 900 */
895 class EXPORT AsciiValue { 901 class EXPORT AsciiValue {
896 public: 902 public:
897 explicit AsciiValue(Handle<v8::Value> obj); 903 explicit AsciiValue(Handle<v8::Value> obj);
898 ~AsciiValue(); 904 ~AsciiValue();
899 char* operator*() { return str_; } 905 char* operator*() { return str_; }
900 int length() { return length_; } 906 int length() { return length_; }
901 private: 907 private:
902 char* str_; 908 char* str_;
903 int length_; 909 int length_;
910
911 // Disallow copying and assigning.
912 AsciiValue(const AsciiValue&);
913 void operator=(const AsciiValue&);
904 }; 914 };
905 915
906 /** 916 /**
907 * Converts an object to a two-byte string. 917 * Converts an object to a two-byte string.
908 */ 918 */
909 class EXPORT Value { 919 class EXPORT Value {
910 public: 920 public:
911 explicit Value(Handle<v8::Value> obj); 921 explicit Value(Handle<v8::Value> obj);
912 ~Value(); 922 ~Value();
913 uint16_t* operator*() { return str_; } 923 uint16_t* operator*() { return str_; }
914 int length() { return length_; } 924 int length() { return length_; }
915 private: 925 private:
916 uint16_t* str_; 926 uint16_t* str_;
917 int length_; 927 int length_;
928
929 // Disallow copying and assigning.
930 Value(const Value&);
931 void operator=(const Value&);
918 }; 932 };
919 }; 933 };
920 934
921 935
922 /** 936 /**
923 * A JavaScript number value (ECMA-262, 4.3.20) 937 * A JavaScript number value (ECMA-262, 4.3.20)
924 */ 938 */
925 class EXPORT Number : public Primitive { 939 class EXPORT Number : public Primitive {
926 public: 940 public:
927 double Value(); 941 double Value();
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 const char** dependencies() { return deps_; } 1686 const char** dependencies() { return deps_; }
1673 void set_auto_enable(bool value) { auto_enable_ = value; } 1687 void set_auto_enable(bool value) { auto_enable_ = value; }
1674 bool auto_enable() { return auto_enable_; } 1688 bool auto_enable() { return auto_enable_; }
1675 1689
1676 private: 1690 private:
1677 const char* name_; 1691 const char* name_;
1678 const char* source_; 1692 const char* source_;
1679 int dep_count_; 1693 int dep_count_;
1680 const char** deps_; 1694 const char** deps_;
1681 bool auto_enable_; 1695 bool auto_enable_;
1696
1697 // Disallow copying and assigning.
1698 Extension(const Extension&);
1699 void operator=(const Extension&);
1682 }; 1700 };
1683 1701
1684 1702
1685 void EXPORT RegisterExtension(Extension* extension); 1703 void EXPORT RegisterExtension(Extension* extension);
1686 1704
1687 1705
1688 /** 1706 /**
1689 * Ignore 1707 * Ignore
1690 */ 1708 */
1691 class EXPORT DeclareExtension { 1709 class EXPORT DeclareExtension {
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 static void StopPreemption(); 2210 static void StopPreemption();
2193 2211
2194 /** 2212 /**
2195 * Returns whether or not the locker is locked by the current thread. 2213 * Returns whether or not the locker is locked by the current thread.
2196 */ 2214 */
2197 static bool IsLocked(); 2215 static bool IsLocked();
2198 2216
2199 private: 2217 private:
2200 bool has_lock_; 2218 bool has_lock_;
2201 bool top_level_; 2219 bool top_level_;
2220
2221 // Disallow copying and assigning.
2222 Locker(const Locker&);
2223 void operator=(const Locker&);
2202 }; 2224 };
2203 2225
2204 2226
2205 2227
2206 // --- I m p l e m e n t a t i o n --- 2228 // --- I m p l e m e n t a t i o n ---
2207 2229
2208 template <class T> 2230 template <class T>
2209 Handle<T>::Handle() : val_(0) { } 2231 Handle<T>::Handle() : val_(0) { }
2210 2232
2211 2233
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 2393
2372 } // namespace v8 2394 } // namespace v8
2373 2395
2374 2396
2375 #undef EXPORT 2397 #undef EXPORT
2376 #undef EXPORT_INLINE 2398 #undef EXPORT_INLINE
2377 #undef TYPE_CHECK 2399 #undef TYPE_CHECK
2378 2400
2379 2401
2380 #endif // V8_H_ 2402 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698