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

Side by Side Diff: include/v8.h

Issue 2272063002: [api] Disable copy constructors using = delete. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix depends on problem Created 4 years, 3 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 873
874 /** 874 /**
875 * Counts the number of allocated handles. 875 * Counts the number of allocated handles.
876 */ 876 */
877 static int NumberOfHandles(Isolate* isolate); 877 static int NumberOfHandles(Isolate* isolate);
878 878
879 V8_INLINE Isolate* GetIsolate() const { 879 V8_INLINE Isolate* GetIsolate() const {
880 return reinterpret_cast<Isolate*>(isolate_); 880 return reinterpret_cast<Isolate*>(isolate_);
881 } 881 }
882 882
883 HandleScope(const HandleScope&) = delete;
884 void operator=(const HandleScope&) = delete;
885
883 protected: 886 protected:
884 V8_INLINE HandleScope() {} 887 V8_INLINE HandleScope() {}
885 888
886 void Initialize(Isolate* isolate); 889 void Initialize(Isolate* isolate);
887 890
888 static internal::Object** CreateHandle(internal::Isolate* isolate, 891 static internal::Object** CreateHandle(internal::Isolate* isolate,
889 internal::Object* value); 892 internal::Object* value);
890 893
891 private: 894 private:
892 // Uses heap_object to obtain the current Isolate. 895 // Uses heap_object to obtain the current Isolate.
893 static internal::Object** CreateHandle(internal::HeapObject* heap_object, 896 static internal::Object** CreateHandle(internal::HeapObject* heap_object,
894 internal::Object* value); 897 internal::Object* value);
895 898
896 // Make it hard to create heap-allocated or illegal handle scopes by 899 // Make it hard to create heap-allocated or illegal handle scopes by
897 // disallowing certain operations. 900 // disallowing certain operations.
898 HandleScope(const HandleScope&);
899 void operator=(const HandleScope&);
900 void* operator new(size_t size); 901 void* operator new(size_t size);
901 void operator delete(void*, size_t); 902 void operator delete(void*, size_t);
902 903
903 internal::Isolate* isolate_; 904 internal::Isolate* isolate_;
904 internal::Object** prev_next_; 905 internal::Object** prev_next_;
905 internal::Object** prev_limit_; 906 internal::Object** prev_limit_;
906 907
907 // Local::New uses CreateHandle with an Isolate* parameter. 908 // Local::New uses CreateHandle with an Isolate* parameter.
908 template<class F> friend class Local; 909 template<class F> friend class Local;
909 910
(...skipping 17 matching lines...) Expand all
927 * Pushes the value into the previous scope and returns a handle to it. 928 * Pushes the value into the previous scope and returns a handle to it.
928 * Cannot be called twice. 929 * Cannot be called twice.
929 */ 930 */
930 template <class T> 931 template <class T>
931 V8_INLINE Local<T> Escape(Local<T> value) { 932 V8_INLINE Local<T> Escape(Local<T> value) {
932 internal::Object** slot = 933 internal::Object** slot =
933 Escape(reinterpret_cast<internal::Object**>(*value)); 934 Escape(reinterpret_cast<internal::Object**>(*value));
934 return Local<T>(reinterpret_cast<T*>(slot)); 935 return Local<T>(reinterpret_cast<T*>(slot));
935 } 936 }
936 937
938 EscapableHandleScope(const EscapableHandleScope&) = delete;
939 void operator=(const EscapableHandleScope&) = delete;
940
937 private: 941 private:
938 internal::Object** Escape(internal::Object** escape_value); 942 internal::Object** Escape(internal::Object** escape_value);
939 943
940 // Make it hard to create heap-allocated or illegal handle scopes by 944 // Make it hard to create heap-allocated or illegal handle scopes by
941 // disallowing certain operations. 945 // disallowing certain operations.
942 EscapableHandleScope(const EscapableHandleScope&);
943 void operator=(const EscapableHandleScope&);
944 void* operator new(size_t size); 946 void* operator new(size_t size);
945 void operator delete(void*, size_t); 947 void operator delete(void*, size_t);
946 948
947 internal::Object** escape_slot_; 949 internal::Object** escape_slot_;
948 }; 950 };
949 951
950 class V8_EXPORT SealHandleScope { 952 class V8_EXPORT SealHandleScope {
951 public: 953 public:
952 SealHandleScope(Isolate* isolate); 954 SealHandleScope(Isolate* isolate);
953 ~SealHandleScope(); 955 ~SealHandleScope();
954 956
957 SealHandleScope(const SealHandleScope&) = delete;
958 void operator=(const SealHandleScope&) = delete;
959
955 private: 960 private:
956 // Make it hard to create heap-allocated or illegal handle scopes by 961 // Make it hard to create heap-allocated or illegal handle scopes by
957 // disallowing certain operations. 962 // disallowing certain operations.
958 SealHandleScope(const SealHandleScope&);
959 void operator=(const SealHandleScope&);
960 void* operator new(size_t size); 963 void* operator new(size_t size);
961 void operator delete(void*, size_t); 964 void operator delete(void*, size_t);
962 965
963 internal::Isolate* const isolate_; 966 internal::Isolate* const isolate_;
964 internal::Object** prev_limit_; 967 internal::Object** prev_limit_;
965 int prev_sealed_level_; 968 int prev_sealed_level_;
966 }; 969 };
967 970
968 971
969 // --- Special objects --- 972 // --- Special objects ---
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 CachedData(const uint8_t* data, int length, 1146 CachedData(const uint8_t* data, int length,
1144 BufferPolicy buffer_policy = BufferNotOwned); 1147 BufferPolicy buffer_policy = BufferNotOwned);
1145 ~CachedData(); 1148 ~CachedData();
1146 // TODO(marja): Async compilation; add constructors which take a callback 1149 // TODO(marja): Async compilation; add constructors which take a callback
1147 // which will be called when V8 no longer needs the data. 1150 // which will be called when V8 no longer needs the data.
1148 const uint8_t* data; 1151 const uint8_t* data;
1149 int length; 1152 int length;
1150 bool rejected; 1153 bool rejected;
1151 BufferPolicy buffer_policy; 1154 BufferPolicy buffer_policy;
1152 1155
1153 private: 1156 // Prevent copying.
1154 // Prevent copying. Not implemented. 1157 CachedData(const CachedData&) = delete;
1155 CachedData(const CachedData&); 1158 CachedData& operator=(const CachedData&) = delete;
1156 CachedData& operator=(const CachedData&);
1157 }; 1159 };
1158 1160
1159 /** 1161 /**
1160 * Source code which can be then compiled to a UnboundScript or Script. 1162 * Source code which can be then compiled to a UnboundScript or Script.
1161 */ 1163 */
1162 class Source { 1164 class Source {
1163 public: 1165 public:
1164 // Source takes ownership of CachedData. 1166 // Source takes ownership of CachedData.
1165 V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin, 1167 V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin,
1166 CachedData* cached_data = NULL); 1168 CachedData* cached_data = NULL);
1167 V8_INLINE Source(Local<String> source_string, 1169 V8_INLINE Source(Local<String> source_string,
1168 CachedData* cached_data = NULL); 1170 CachedData* cached_data = NULL);
1169 V8_INLINE ~Source(); 1171 V8_INLINE ~Source();
1170 1172
1171 // Ownership of the CachedData or its buffers is *not* transferred to the 1173 // Ownership of the CachedData or its buffers is *not* transferred to the
1172 // caller. The CachedData object is alive as long as the Source object is 1174 // caller. The CachedData object is alive as long as the Source object is
1173 // alive. 1175 // alive.
1174 V8_INLINE const CachedData* GetCachedData() const; 1176 V8_INLINE const CachedData* GetCachedData() const;
1175 1177
1178 // Prevent copying.
1179 Source(const Source&) = delete;
1180 Source& operator=(const Source&) = delete;
1181
1176 private: 1182 private:
1177 friend class ScriptCompiler; 1183 friend class ScriptCompiler;
1178 // Prevent copying. Not implemented.
1179 Source(const Source&);
1180 Source& operator=(const Source&);
1181 1184
1182 Local<String> source_string; 1185 Local<String> source_string;
1183 1186
1184 // Origin information 1187 // Origin information
1185 Local<Value> resource_name; 1188 Local<Value> resource_name;
1186 Local<Integer> resource_line_offset; 1189 Local<Integer> resource_line_offset;
1187 Local<Integer> resource_column_offset; 1190 Local<Integer> resource_column_offset;
1188 ScriptOriginOptions resource_options; 1191 ScriptOriginOptions resource_options;
1189 Local<Value> source_map_url; 1192 Local<Value> source_map_url;
1190 1193
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 StreamedSource(ExternalSourceStream* source_stream, Encoding encoding); 1256 StreamedSource(ExternalSourceStream* source_stream, Encoding encoding);
1254 ~StreamedSource(); 1257 ~StreamedSource();
1255 1258
1256 // Ownership of the CachedData or its buffers is *not* transferred to the 1259 // Ownership of the CachedData or its buffers is *not* transferred to the
1257 // caller. The CachedData object is alive as long as the StreamedSource 1260 // caller. The CachedData object is alive as long as the StreamedSource
1258 // object is alive. 1261 // object is alive.
1259 const CachedData* GetCachedData() const; 1262 const CachedData* GetCachedData() const;
1260 1263
1261 internal::StreamedSource* impl() const { return impl_; } 1264 internal::StreamedSource* impl() const { return impl_; }
1262 1265
1266 // Prevent copying.
1267 StreamedSource(const StreamedSource&) = delete;
1268 StreamedSource& operator=(const StreamedSource&) = delete;
1269
1263 private: 1270 private:
1264 // Prevent copying. Not implemented.
1265 StreamedSource(const StreamedSource&);
1266 StreamedSource& operator=(const StreamedSource&);
1267
1268 internal::StreamedSource* impl_; 1271 internal::StreamedSource* impl_;
1269 }; 1272 };
1270 1273
1271 /** 1274 /**
1272 * A streaming task which the embedder must run on a background thread to 1275 * A streaming task which the embedder must run on a background thread to
1273 * stream scripts into V8. Returned by ScriptCompiler::StartStreamingScript. 1276 * stream scripts into V8. Returned by ScriptCompiler::StartStreamingScript.
1274 */ 1277 */
1275 class ScriptStreamingTask { 1278 class ScriptStreamingTask {
1276 public: 1279 public:
1277 virtual ~ScriptStreamingTask() {} 1280 virtual ~ScriptStreamingTask() {}
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 ExternalStringResourceBase() {} 2205 ExternalStringResourceBase() {}
2203 2206
2204 /** 2207 /**
2205 * Internally V8 will call this Dispose method when the external string 2208 * Internally V8 will call this Dispose method when the external string
2206 * resource is no longer needed. The default implementation will use the 2209 * resource is no longer needed. The default implementation will use the
2207 * delete operator. This method can be overridden in subclasses to 2210 * delete operator. This method can be overridden in subclasses to
2208 * control how allocated external string resources are disposed. 2211 * control how allocated external string resources are disposed.
2209 */ 2212 */
2210 virtual void Dispose() { delete this; } 2213 virtual void Dispose() { delete this; }
2211 2214
2215 // Disallow copying and assigning.
2216 ExternalStringResourceBase(const ExternalStringResourceBase&) = delete;
2217 void operator=(const ExternalStringResourceBase&) = delete;
2218
2212 private: 2219 private:
2213 // Disallow copying and assigning.
2214 ExternalStringResourceBase(const ExternalStringResourceBase&);
2215 void operator=(const ExternalStringResourceBase&);
2216
2217 friend class v8::internal::Heap; 2220 friend class v8::internal::Heap;
2218 }; 2221 };
2219 2222
2220 /** 2223 /**
2221 * An ExternalStringResource is a wrapper around a two-byte string 2224 * An ExternalStringResource is a wrapper around a two-byte string
2222 * buffer that resides outside V8's heap. Implement an 2225 * buffer that resides outside V8's heap. Implement an
2223 * ExternalStringResource to manage the life cycle of the underlying 2226 * ExternalStringResource to manage the life cycle of the underlying
2224 * buffer. Note that the string data must be immutable. 2227 * buffer. Note that the string data must be immutable.
2225 */ 2228 */
2226 class V8_EXPORT ExternalStringResource 2229 class V8_EXPORT ExternalStringResource
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 * then the length() method returns 0 and the * operator returns 2411 * then the length() method returns 0 and the * operator returns
2409 * NULL. 2412 * NULL.
2410 */ 2413 */
2411 class V8_EXPORT Utf8Value { 2414 class V8_EXPORT Utf8Value {
2412 public: 2415 public:
2413 explicit Utf8Value(Local<v8::Value> obj); 2416 explicit Utf8Value(Local<v8::Value> obj);
2414 ~Utf8Value(); 2417 ~Utf8Value();
2415 char* operator*() { return str_; } 2418 char* operator*() { return str_; }
2416 const char* operator*() const { return str_; } 2419 const char* operator*() const { return str_; }
2417 int length() const { return length_; } 2420 int length() const { return length_; }
2421
2422 // Disallow copying and assigning.
2423 Utf8Value(const Utf8Value&) = delete;
2424 void operator=(const Utf8Value&) = delete;
2425
2418 private: 2426 private:
2419 char* str_; 2427 char* str_;
2420 int length_; 2428 int length_;
2421
2422 // Disallow copying and assigning.
2423 Utf8Value(const Utf8Value&);
2424 void operator=(const Utf8Value&);
2425 }; 2429 };
2426 2430
2427 /** 2431 /**
2428 * Converts an object to a two-byte string. 2432 * Converts an object to a two-byte string.
2429 * If conversion to a string fails (eg. due to an exception in the toString() 2433 * If conversion to a string fails (eg. due to an exception in the toString()
2430 * method of the object) then the length() method returns 0 and the * operator 2434 * method of the object) then the length() method returns 0 and the * operator
2431 * returns NULL. 2435 * returns NULL.
2432 */ 2436 */
2433 class V8_EXPORT Value { 2437 class V8_EXPORT Value {
2434 public: 2438 public:
2435 explicit Value(Local<v8::Value> obj); 2439 explicit Value(Local<v8::Value> obj);
2436 ~Value(); 2440 ~Value();
2437 uint16_t* operator*() { return str_; } 2441 uint16_t* operator*() { return str_; }
2438 const uint16_t* operator*() const { return str_; } 2442 const uint16_t* operator*() const { return str_; }
2439 int length() const { return length_; } 2443 int length() const { return length_; }
2444
2445 // Disallow copying and assigning.
2446 Value(const Value&) = delete;
2447 void operator=(const Value&) = delete;
2448
2440 private: 2449 private:
2441 uint16_t* str_; 2450 uint16_t* str_;
2442 int length_; 2451 int length_;
2443
2444 // Disallow copying and assigning.
2445 Value(const Value&);
2446 void operator=(const Value&);
2447 }; 2452 };
2448 2453
2449 private: 2454 private:
2450 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v, 2455 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v,
2451 Encoding encoding) const; 2456 Encoding encoding) const;
2452 void VerifyExternalStringResource(ExternalStringResource* val) const; 2457 void VerifyExternalStringResource(ExternalStringResource* val) const;
2453 static void CheckCast(v8::Value* obj); 2458 static void CheckCast(v8::Value* obj);
2454 }; 2459 };
2455 2460
2456 2461
(...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after
4972 4977
4973 const char* name() const { return name_; } 4978 const char* name() const { return name_; }
4974 size_t source_length() const { return source_length_; } 4979 size_t source_length() const { return source_length_; }
4975 const String::ExternalOneByteStringResource* source() const { 4980 const String::ExternalOneByteStringResource* source() const {
4976 return &source_; } 4981 return &source_; }
4977 int dependency_count() { return dep_count_; } 4982 int dependency_count() { return dep_count_; }
4978 const char** dependencies() { return deps_; } 4983 const char** dependencies() { return deps_; }
4979 void set_auto_enable(bool value) { auto_enable_ = value; } 4984 void set_auto_enable(bool value) { auto_enable_ = value; }
4980 bool auto_enable() { return auto_enable_; } 4985 bool auto_enable() { return auto_enable_; }
4981 4986
4987 // Disallow copying and assigning.
4988 Extension(const Extension&) = delete;
4989 void operator=(const Extension&) = delete;
4990
4982 private: 4991 private:
4983 const char* name_; 4992 const char* name_;
4984 size_t source_length_; // expected to initialize before source_ 4993 size_t source_length_; // expected to initialize before source_
4985 ExternalOneByteStringResourceImpl source_; 4994 ExternalOneByteStringResourceImpl source_;
4986 int dep_count_; 4995 int dep_count_;
4987 const char** deps_; 4996 const char** deps_;
4988 bool auto_enable_; 4997 bool auto_enable_;
4989
4990 // Disallow copying and assigning.
4991 Extension(const Extension&);
4992 void operator=(const Extension&);
4993 }; 4998 };
4994 4999
4995 5000
4996 void V8_EXPORT RegisterExtension(Extension* extension); 5001 void V8_EXPORT RegisterExtension(Extension* extension);
4997 5002
4998 5003
4999 // --- Statics --- 5004 // --- Statics ---
5000 5005
5001 V8_INLINE Local<Primitive> Undefined(Isolate* isolate); 5006 V8_INLINE Local<Primitive> Undefined(Isolate* isolate);
5002 V8_INLINE Local<Primitive> Null(Isolate* isolate); 5007 V8_INLINE Local<Primitive> Null(Isolate* isolate);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
5208 /** 5213 /**
5209 * Returns current depth of nested kRunMicrotasks scopes. 5214 * Returns current depth of nested kRunMicrotasks scopes.
5210 */ 5215 */
5211 static int GetCurrentDepth(Isolate* isolate); 5216 static int GetCurrentDepth(Isolate* isolate);
5212 5217
5213 /** 5218 /**
5214 * Returns true while microtasks are being executed. 5219 * Returns true while microtasks are being executed.
5215 */ 5220 */
5216 static bool IsRunningMicrotasks(Isolate* isolate); 5221 static bool IsRunningMicrotasks(Isolate* isolate);
5217 5222
5223 // Prevent copying.
5224 MicrotasksScope(const MicrotasksScope&) = delete;
5225 MicrotasksScope& operator=(const MicrotasksScope&) = delete;
5226
5218 private: 5227 private:
5219 internal::Isolate* const isolate_; 5228 internal::Isolate* const isolate_;
5220 bool run_; 5229 bool run_;
5221
5222 // Prevent copying.
5223 MicrotasksScope(const MicrotasksScope&);
5224 MicrotasksScope& operator=(const MicrotasksScope&);
5225 }; 5230 };
5226 5231
5227 5232
5228 // --- Failed Access Check Callback --- 5233 // --- Failed Access Check Callback ---
5229 typedef void (*FailedAccessCheckCallback)(Local<Object> target, 5234 typedef void (*FailedAccessCheckCallback)(Local<Object> target,
5230 AccessType type, 5235 AccessType type,
5231 Local<Value> data); 5236 Local<Value> data);
5232 5237
5233 // --- AllowCodeGenerationFromStrings callbacks --- 5238 // --- AllowCodeGenerationFromStrings callbacks ---
5234 5239
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
5666 * executed within a local scope. 5671 * executed within a local scope.
5667 */ 5672 */
5668 class V8_EXPORT Scope { 5673 class V8_EXPORT Scope {
5669 public: 5674 public:
5670 explicit Scope(Isolate* isolate) : isolate_(isolate) { 5675 explicit Scope(Isolate* isolate) : isolate_(isolate) {
5671 isolate->Enter(); 5676 isolate->Enter();
5672 } 5677 }
5673 5678
5674 ~Scope() { isolate_->Exit(); } 5679 ~Scope() { isolate_->Exit(); }
5675 5680
5681 // Prevent copying of Scope objects.
5682 Scope(const Scope&) = delete;
5683 Scope& operator=(const Scope&) = delete;
5684
5676 private: 5685 private:
5677 Isolate* const isolate_; 5686 Isolate* const isolate_;
5678
5679 // Prevent copying of Scope objects.
5680 Scope(const Scope&);
5681 Scope& operator=(const Scope&);
5682 }; 5687 };
5683 5688
5684 5689
5685 /** 5690 /**
5686 * Assert that no Javascript code is invoked. 5691 * Assert that no Javascript code is invoked.
5687 */ 5692 */
5688 class V8_EXPORT DisallowJavascriptExecutionScope { 5693 class V8_EXPORT DisallowJavascriptExecutionScope {
5689 public: 5694 public:
5690 enum OnFailure { CRASH_ON_FAILURE, THROW_ON_FAILURE }; 5695 enum OnFailure { CRASH_ON_FAILURE, THROW_ON_FAILURE };
5691 5696
5692 DisallowJavascriptExecutionScope(Isolate* isolate, OnFailure on_failure); 5697 DisallowJavascriptExecutionScope(Isolate* isolate, OnFailure on_failure);
5693 ~DisallowJavascriptExecutionScope(); 5698 ~DisallowJavascriptExecutionScope();
5694 5699
5700 // Prevent copying of Scope objects.
5701 DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope&) =
5702 delete;
5703 DisallowJavascriptExecutionScope& operator=(
5704 const DisallowJavascriptExecutionScope&) = delete;
5705
5695 private: 5706 private:
5696 bool on_failure_; 5707 bool on_failure_;
5697 void* internal_; 5708 void* internal_;
5698
5699 // Prevent copying of Scope objects.
5700 DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope&);
5701 DisallowJavascriptExecutionScope& operator=(
5702 const DisallowJavascriptExecutionScope&);
5703 }; 5709 };
5704 5710
5705 5711
5706 /** 5712 /**
5707 * Introduce exception to DisallowJavascriptExecutionScope. 5713 * Introduce exception to DisallowJavascriptExecutionScope.
5708 */ 5714 */
5709 class V8_EXPORT AllowJavascriptExecutionScope { 5715 class V8_EXPORT AllowJavascriptExecutionScope {
5710 public: 5716 public:
5711 explicit AllowJavascriptExecutionScope(Isolate* isolate); 5717 explicit AllowJavascriptExecutionScope(Isolate* isolate);
5712 ~AllowJavascriptExecutionScope(); 5718 ~AllowJavascriptExecutionScope();
5713 5719
5720 // Prevent copying of Scope objects.
5721 AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope&) =
5722 delete;
5723 AllowJavascriptExecutionScope& operator=(
5724 const AllowJavascriptExecutionScope&) = delete;
5725
5714 private: 5726 private:
5715 void* internal_throws_; 5727 void* internal_throws_;
5716 void* internal_assert_; 5728 void* internal_assert_;
5717
5718 // Prevent copying of Scope objects.
5719 AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope&);
5720 AllowJavascriptExecutionScope& operator=(
5721 const AllowJavascriptExecutionScope&);
5722 }; 5729 };
5723 5730
5724 /** 5731 /**
5725 * Do not run microtasks while this scope is active, even if microtasks are 5732 * Do not run microtasks while this scope is active, even if microtasks are
5726 * automatically executed otherwise. 5733 * automatically executed otherwise.
5727 */ 5734 */
5728 class V8_EXPORT SuppressMicrotaskExecutionScope { 5735 class V8_EXPORT SuppressMicrotaskExecutionScope {
5729 public: 5736 public:
5730 explicit SuppressMicrotaskExecutionScope(Isolate* isolate); 5737 explicit SuppressMicrotaskExecutionScope(Isolate* isolate);
5731 ~SuppressMicrotaskExecutionScope(); 5738 ~SuppressMicrotaskExecutionScope();
5732 5739
5740 // Prevent copying of Scope objects.
5741 SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope&) =
5742 delete;
5743 SuppressMicrotaskExecutionScope& operator=(
5744 const SuppressMicrotaskExecutionScope&) = delete;
5745
5733 private: 5746 private:
5734 internal::Isolate* const isolate_; 5747 internal::Isolate* const isolate_;
5735
5736 // Prevent copying of Scope objects.
5737 SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope&);
5738 SuppressMicrotaskExecutionScope& operator=(
5739 const SuppressMicrotaskExecutionScope&);
5740 }; 5748 };
5741 5749
5742 /** 5750 /**
5743 * Types of garbage collections that can be requested via 5751 * Types of garbage collections that can be requested via
5744 * RequestGarbageCollectionForTesting. 5752 * RequestGarbageCollectionForTesting.
5745 */ 5753 */
5746 enum GarbageCollectionType { 5754 enum GarbageCollectionType {
5747 kFullGarbageCollection, 5755 kFullGarbageCollection,
5748 kMinorGarbageCollection 5756 kMinorGarbageCollection
5749 }; 5757 };
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
6455 * pending activity for the handle. 6463 * pending activity for the handle.
6456 */ 6464 */
6457 void VisitWeakHandles(PersistentHandleVisitor* visitor); 6465 void VisitWeakHandles(PersistentHandleVisitor* visitor);
6458 6466
6459 /** 6467 /**
6460 * Check if this isolate is in use. 6468 * Check if this isolate is in use.
6461 * True if at least one thread Enter'ed this isolate. 6469 * True if at least one thread Enter'ed this isolate.
6462 */ 6470 */
6463 bool IsInUse(); 6471 bool IsInUse();
6464 6472
6473 Isolate(const Isolate&) = delete;
6474 Isolate& operator=(const Isolate&) = delete;
6475
6465 private: 6476 private:
6466 template <class K, class V, class Traits> 6477 template <class K, class V, class Traits>
6467 friend class PersistentValueMapBase; 6478 friend class PersistentValueMapBase;
6468 6479
6469 Isolate(); 6480 Isolate();
6470 Isolate(const Isolate&);
6471 ~Isolate(); 6481 ~Isolate();
6472 Isolate& operator=(const Isolate&);
6473 void* operator new(size_t size); 6482 void* operator new(size_t size);
6474 void operator delete(void*, size_t); 6483 void operator delete(void*, size_t);
6475 6484
6476 void SetObjectGroupId(internal::Object** object, UniqueId id); 6485 void SetObjectGroupId(internal::Object** object, UniqueId id);
6477 void SetReferenceFromGroup(UniqueId id, internal::Object** object); 6486 void SetReferenceFromGroup(UniqueId id, internal::Object** object);
6478 void SetReference(internal::Object** parent, internal::Object** child); 6487 void SetReference(internal::Object** parent, internal::Object** child);
6479 void ReportExternalAllocationLimitReached(); 6488 void ReportExternalAllocationLimitReached();
6480 }; 6489 };
6481 6490
6482 class V8_EXPORT StartupData { 6491 class V8_EXPORT StartupData {
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
6920 /** 6929 /**
6921 * Created a snapshot data blob. 6930 * Created a snapshot data blob.
6922 * This must not be called from within a handle scope. 6931 * This must not be called from within a handle scope.
6923 * \param function_code_handling whether to include compiled function code 6932 * \param function_code_handling whether to include compiled function code
6924 * in the snapshot. 6933 * in the snapshot.
6925 * \returns { nullptr, 0 } on failure, and a startup snapshot on success. The 6934 * \returns { nullptr, 0 } on failure, and a startup snapshot on success. The
6926 * caller acquires ownership of the data array in the return value. 6935 * caller acquires ownership of the data array in the return value.
6927 */ 6936 */
6928 StartupData CreateBlob(FunctionCodeHandling function_code_handling); 6937 StartupData CreateBlob(FunctionCodeHandling function_code_handling);
6929 6938
6939 // Disallow copying and assigning.
6940 SnapshotCreator(const SnapshotCreator&) = delete;
6941 void operator=(const SnapshotCreator&) = delete;
6942
6930 private: 6943 private:
6931 void* data_; 6944 void* data_;
6932
6933 // Disallow copying and assigning.
6934 SnapshotCreator(const SnapshotCreator&);
6935 void operator=(const SnapshotCreator&);
6936 }; 6945 };
6937 6946
6938 /** 6947 /**
6939 * A simple Maybe type, representing an object which may or may not have a 6948 * A simple Maybe type, representing an object which may or may not have a
6940 * value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html. 6949 * value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html.
6941 * 6950 *
6942 * If an API method returns a Maybe<>, the API method can potentially fail 6951 * If an API method returns a Maybe<>, the API method can potentially fail
6943 * either because an exception is thrown, or because an exception is pending, 6952 * either because an exception is thrown, or because an exception is pending,
6944 * e.g. because a previous API call threw an exception that hasn't been caught 6953 * e.g. because a previous API call threw an exception that hasn't been caught
6945 * yet, or because a TerminateExecution exception was thrown. In that case, a 6954 * yet, or because a TerminateExecution exception was thrown. In that case, a
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
7129 * This method returns address that can be used for comparisons with 7138 * This method returns address that can be used for comparisons with
7130 * addresses into the JS stack. When neither simulator nor ASAN's 7139 * addresses into the JS stack. When neither simulator nor ASAN's
7131 * UseAfterReturn is enabled, then the address returned will be the address 7140 * UseAfterReturn is enabled, then the address returned will be the address
7132 * of the C++ try catch handler itself. 7141 * of the C++ try catch handler itself.
7133 */ 7142 */
7134 static void* JSStackComparableAddress(v8::TryCatch* handler) { 7143 static void* JSStackComparableAddress(v8::TryCatch* handler) {
7135 if (handler == NULL) return NULL; 7144 if (handler == NULL) return NULL;
7136 return handler->js_stack_comparable_address_; 7145 return handler->js_stack_comparable_address_;
7137 } 7146 }
7138 7147
7148 TryCatch(const TryCatch&) = delete;
7149 void operator=(const TryCatch&) = delete;
7150
7139 private: 7151 private:
7140 void ResetInternal(); 7152 void ResetInternal();
7141 7153
7142 // Make it hard to create heap-allocated TryCatch blocks. 7154 // Make it hard to create heap-allocated TryCatch blocks.
7143 TryCatch(const TryCatch&);
7144 void operator=(const TryCatch&);
7145 void* operator new(size_t size); 7155 void* operator new(size_t size);
7146 void operator delete(void*, size_t); 7156 void operator delete(void*, size_t);
7147 7157
7148 v8::internal::Isolate* isolate_; 7158 v8::internal::Isolate* isolate_;
7149 v8::TryCatch* next_; 7159 v8::TryCatch* next_;
7150 void* exception_; 7160 void* exception_;
7151 void* message_obj_; 7161 void* message_obj_;
7152 void* js_stack_comparable_address_; 7162 void* js_stack_comparable_address_;
7153 bool is_verbose_ : 1; 7163 bool is_verbose_ : 1;
7154 bool can_continue_ : 1; 7164 bool can_continue_ : 1;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
7493 * Returns whether or not the locker for a given isolate, is locked by the 7503 * Returns whether or not the locker for a given isolate, is locked by the
7494 * current thread. 7504 * current thread.
7495 */ 7505 */
7496 static bool IsLocked(Isolate* isolate); 7506 static bool IsLocked(Isolate* isolate);
7497 7507
7498 /** 7508 /**
7499 * Returns whether v8::Locker is being used by this V8 instance. 7509 * Returns whether v8::Locker is being used by this V8 instance.
7500 */ 7510 */
7501 static bool IsActive(); 7511 static bool IsActive();
7502 7512
7513 // Disallow copying and assigning.
7514 Locker(const Locker&) = delete;
7515 void operator=(const Locker&) = delete;
7516
7503 private: 7517 private:
7504 void Initialize(Isolate* isolate); 7518 void Initialize(Isolate* isolate);
7505 7519
7506 bool has_lock_; 7520 bool has_lock_;
7507 bool top_level_; 7521 bool top_level_;
7508 internal::Isolate* isolate_; 7522 internal::Isolate* isolate_;
7509
7510 // Disallow copying and assigning.
7511 Locker(const Locker&);
7512 void operator=(const Locker&);
7513 }; 7523 };
7514 7524
7515 7525
7516 // --- Implementation --- 7526 // --- Implementation ---
7517 7527
7518 7528
7519 namespace internal { 7529 namespace internal {
7520 7530
7521 const int kApiPointerSize = sizeof(void*); // NOLINT 7531 const int kApiPointerSize = sizeof(void*); // NOLINT
7522 const int kApiIntSize = sizeof(int); // NOLINT 7532 const int kApiIntSize = sizeof(int); // NOLINT
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
9008 */ 9018 */
9009 9019
9010 9020
9011 } // namespace v8 9021 } // namespace v8
9012 9022
9013 9023
9014 #undef TYPE_CHECK 9024 #undef TYPE_CHECK
9015 9025
9016 9026
9017 #endif // INCLUDE_V8_H_ 9027 #endif // INCLUDE_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