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

Side by Side Diff: include/v8.h

Issue 1224623004: Make v8::Handle as "deprecated soon" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 | include/v8-debug.h » ('j') | 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 */ 208 */
209 template <class T> 209 template <class T>
210 class Local { 210 class Local {
211 public: 211 public:
212 V8_INLINE Local() : val_(0) {} 212 V8_INLINE Local() : val_(0) {}
213 template <class S> 213 template <class S>
214 V8_INLINE Local(Local<S> that) 214 V8_INLINE Local(Local<S> that)
215 : val_(reinterpret_cast<T*>(*that)) { 215 : val_(reinterpret_cast<T*>(*that)) {
216 /** 216 /**
217 * This check fails when trying to convert between incompatible 217 * This check fails when trying to convert between incompatible
218 * handles. For example, converting from a Handle<String> to a 218 * handles. For example, converting from a Local<String> to a
219 * Handle<Number>. 219 * Local<Number>.
220 */ 220 */
221 TYPE_CHECK(T, S); 221 TYPE_CHECK(T, S);
222 } 222 }
223 223
224 /** 224 /**
225 * Returns true if the handle is empty. 225 * Returns true if the handle is empty.
226 */ 226 */
227 V8_INLINE bool IsEmpty() const { return val_ == 0; } 227 V8_INLINE bool IsEmpty() const { return val_ == 0; }
228 228
229 /** 229 /**
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 template<class F1, class F2> friend class PersistentValueVector; 323 template<class F1, class F2> friend class PersistentValueVector;
324 324
325 template <class S> 325 template <class S>
326 V8_INLINE Local(S* that) 326 V8_INLINE Local(S* that)
327 : val_(that) {} 327 : val_(that) {}
328 V8_INLINE static Local<T> New(Isolate* isolate, T* that); 328 V8_INLINE static Local<T> New(Isolate* isolate, T* that);
329 T* val_; 329 T* val_;
330 }; 330 };
331 331
332 332
333 // Handle is an alias for Local for historical reasons. 333 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
334 // Local is an alias for Local for historical reasons.
334 template <class T> 335 template <class T>
335 using Handle = Local<T>; 336 using Handle = Local<T>;
337 #endif
336 338
337 339
338 /** 340 /**
339 * A MaybeLocal<> is a wrapper around Local<> that enforces a check whether 341 * A MaybeLocal<> is a wrapper around Local<> that enforces a check whether
340 * the Local<> is empty before it can be used. 342 * the Local<> is empty before it can be used.
341 * 343 *
342 * If an API method returns a MaybeLocal<>, the API method can potentially fail 344 * If an API method returns a MaybeLocal<>, the API method can potentially fail
343 * either because an exception is thrown, or because an exception is pending, 345 * either because an exception is thrown, or because an exception is pending,
344 * e.g. because a previous API call threw an exception that hasn't been caught 346 * e.g. because a previous API call threw an exception that hasn't been caught
345 * yet, or because a TerminateExecution exception was thrown. In that case, an 347 * yet, or because a TerminateExecution exception was thrown. In that case, an
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 /** 490 /**
489 * If non-empty, destroy the underlying storage cell 491 * If non-empty, destroy the underlying storage cell
490 * IsEmpty() will return true after this call. 492 * IsEmpty() will return true after this call.
491 */ 493 */
492 V8_INLINE void Reset(); 494 V8_INLINE void Reset();
493 /** 495 /**
494 * If non-empty, destroy the underlying storage cell 496 * If non-empty, destroy the underlying storage cell
495 * and create a new one with the contents of other if other is non empty 497 * and create a new one with the contents of other if other is non empty
496 */ 498 */
497 template <class S> 499 template <class S>
498 V8_INLINE void Reset(Isolate* isolate, const Handle<S>& other); 500 V8_INLINE void Reset(Isolate* isolate, const Local<S>& other);
499 501
500 /** 502 /**
501 * If non-empty, destroy the underlying storage cell 503 * If non-empty, destroy the underlying storage cell
502 * and create a new one with the contents of other if other is non empty 504 * and create a new one with the contents of other if other is non empty
503 */ 505 */
504 template <class S> 506 template <class S>
505 V8_INLINE void Reset(Isolate* isolate, const PersistentBase<S>& other); 507 V8_INLINE void Reset(Isolate* isolate, const PersistentBase<S>& other);
506 508
507 V8_INLINE bool IsEmpty() const { return val_ == NULL; } 509 V8_INLINE bool IsEmpty() const { return val_ == NULL; }
508 V8_INLINE void Empty() { val_ = 0; } 510 V8_INLINE void Empty() { val_ = 0; }
509 511
510 template <class S> 512 template <class S>
511 V8_INLINE bool operator==(const PersistentBase<S>& that) const { 513 V8_INLINE bool operator==(const PersistentBase<S>& that) const {
512 internal::Object** a = reinterpret_cast<internal::Object**>(this->val_); 514 internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
513 internal::Object** b = reinterpret_cast<internal::Object**>(that.val_); 515 internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
514 if (a == NULL) return b == NULL; 516 if (a == NULL) return b == NULL;
515 if (b == NULL) return false; 517 if (b == NULL) return false;
516 return *a == *b; 518 return *a == *b;
517 } 519 }
518 520
519 template <class S> V8_INLINE bool operator==(const Handle<S>& that) const { 521 template <class S>
522 V8_INLINE bool operator==(const Local<S>& that) const {
520 internal::Object** a = reinterpret_cast<internal::Object**>(this->val_); 523 internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
521 internal::Object** b = reinterpret_cast<internal::Object**>(that.val_); 524 internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
522 if (a == NULL) return b == NULL; 525 if (a == NULL) return b == NULL;
523 if (b == NULL) return false; 526 if (b == NULL) return false;
524 return *a == *b; 527 return *a == *b;
525 } 528 }
526 529
527 template <class S> 530 template <class S>
528 V8_INLINE bool operator!=(const PersistentBase<S>& that) const { 531 V8_INLINE bool operator!=(const PersistentBase<S>& that) const {
529 return !operator==(that); 532 return !operator==(that);
530 } 533 }
531 534
532 template <class S> V8_INLINE bool operator!=(const Handle<S>& that) const { 535 template <class S>
536 V8_INLINE bool operator!=(const Local<S>& that) const {
533 return !operator==(that); 537 return !operator==(that);
534 } 538 }
535 539
536 /** 540 /**
537 * Install a finalization callback on this object. 541 * Install a finalization callback on this object.
538 * NOTE: There is no guarantee as to *when* or even *if* the callback is 542 * NOTE: There is no guarantee as to *when* or even *if* the callback is
539 * invoked. The invocation is performed solely on a best effort basis. 543 * invoked. The invocation is performed solely on a best effort basis.
540 * As always, GC-based finalization should *not* be relied upon for any 544 * As always, GC-based finalization should *not* be relied upon for any
541 * critical form of resource management! 545 * critical form of resource management!
542 */ 546 */
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 * 689 *
686 * Note: Persistent class hierarchy is subject to future changes. 690 * Note: Persistent class hierarchy is subject to future changes.
687 */ 691 */
688 template <class T, class M> class Persistent : public PersistentBase<T> { 692 template <class T, class M> class Persistent : public PersistentBase<T> {
689 public: 693 public:
690 /** 694 /**
691 * A Persistent with no storage cell. 695 * A Persistent with no storage cell.
692 */ 696 */
693 V8_INLINE Persistent() : PersistentBase<T>(0) { } 697 V8_INLINE Persistent() : PersistentBase<T>(0) { }
694 /** 698 /**
695 * Construct a Persistent from a Handle. 699 * Construct a Persistent from a Local.
696 * When the Handle is non-empty, a new storage cell is created 700 * When the Local is non-empty, a new storage cell is created
697 * pointing to the same object, and no flags are set. 701 * pointing to the same object, and no flags are set.
698 */ 702 */
699 template <class S> V8_INLINE Persistent(Isolate* isolate, Handle<S> that) 703 template <class S>
704 V8_INLINE Persistent(Isolate* isolate, Local<S> that)
700 : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) { 705 : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) {
701 TYPE_CHECK(T, S); 706 TYPE_CHECK(T, S);
702 } 707 }
703 /** 708 /**
704 * Construct a Persistent from a Persistent. 709 * Construct a Persistent from a Persistent.
705 * When the Persistent is non-empty, a new storage cell is created 710 * When the Persistent is non-empty, a new storage cell is created
706 * pointing to the same object, and no flags are set. 711 * pointing to the same object, and no flags are set.
707 */ 712 */
708 template <class S, class M2> 713 template <class S, class M2>
709 V8_INLINE Persistent(Isolate* isolate, const Persistent<S, M2>& that) 714 V8_INLINE Persistent(Isolate* isolate, const Persistent<S, M2>& that)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 * Note: Persistent class hierarchy is subject to future changes. 782 * Note: Persistent class hierarchy is subject to future changes.
778 */ 783 */
779 template <class T> 784 template <class T>
780 class Global : public PersistentBase<T> { 785 class Global : public PersistentBase<T> {
781 public: 786 public:
782 /** 787 /**
783 * A Global with no storage cell. 788 * A Global with no storage cell.
784 */ 789 */
785 V8_INLINE Global() : PersistentBase<T>(nullptr) {} 790 V8_INLINE Global() : PersistentBase<T>(nullptr) {}
786 /** 791 /**
787 * Construct a Global from a Handle. 792 * Construct a Global from a Local.
788 * When the Handle is non-empty, a new storage cell is created 793 * When the Local is non-empty, a new storage cell is created
789 * pointing to the same object, and no flags are set. 794 * pointing to the same object, and no flags are set.
790 */ 795 */
791 template <class S> 796 template <class S>
792 V8_INLINE Global(Isolate* isolate, Handle<S> that) 797 V8_INLINE Global(Isolate* isolate, Local<S> that)
793 : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) { 798 : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) {
794 TYPE_CHECK(T, S); 799 TYPE_CHECK(T, S);
795 } 800 }
796 /** 801 /**
797 * Construct a Global from a PersistentBase. 802 * Construct a Global from a PersistentBase.
798 * When the Persistent is non-empty, a new storage cell is created 803 * When the Persistent is non-empty, a new storage cell is created
799 * pointing to the same object, and no flags are set. 804 * pointing to the same object, and no flags are set.
800 */ 805 */
801 template <class S> 806 template <class S>
802 V8_INLINE Global(Isolate* isolate, const PersistentBase<S>& that) 807 V8_INLINE Global(Isolate* isolate, const PersistentBase<S>& that)
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 }; 1010 };
1006 const int flags_; 1011 const int flags_;
1007 }; 1012 };
1008 1013
1009 /** 1014 /**
1010 * The origin, within a file, of a script. 1015 * The origin, within a file, of a script.
1011 */ 1016 */
1012 class ScriptOrigin { 1017 class ScriptOrigin {
1013 public: 1018 public:
1014 V8_INLINE ScriptOrigin( 1019 V8_INLINE ScriptOrigin(
1015 Handle<Value> resource_name, 1020 Local<Value> resource_name,
1016 Handle<Integer> resource_line_offset = Handle<Integer>(), 1021 Local<Integer> resource_line_offset = Local<Integer>(),
1017 Handle<Integer> resource_column_offset = Handle<Integer>(), 1022 Local<Integer> resource_column_offset = Local<Integer>(),
1018 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>(), 1023 Local<Boolean> resource_is_shared_cross_origin = Local<Boolean>(),
1019 Handle<Integer> script_id = Handle<Integer>(), 1024 Local<Integer> script_id = Local<Integer>(),
1020 Handle<Boolean> resource_is_embedder_debug_script = Handle<Boolean>(), 1025 Local<Boolean> resource_is_embedder_debug_script = Local<Boolean>(),
1021 Handle<Value> source_map_url = Handle<Value>(), 1026 Local<Value> source_map_url = Local<Value>(),
1022 Handle<Boolean> resource_is_opaque = Handle<Boolean>()); 1027 Local<Boolean> resource_is_opaque = Local<Boolean>());
1023 V8_INLINE Handle<Value> ResourceName() const; 1028 V8_INLINE Local<Value> ResourceName() const;
1024 V8_INLINE Handle<Integer> ResourceLineOffset() const; 1029 V8_INLINE Local<Integer> ResourceLineOffset() const;
1025 V8_INLINE Handle<Integer> ResourceColumnOffset() const; 1030 V8_INLINE Local<Integer> ResourceColumnOffset() const;
1026 /** 1031 /**
1027 * Returns true for embedder's debugger scripts 1032 * Returns true for embedder's debugger scripts
1028 */ 1033 */
1029 V8_INLINE Handle<Integer> ScriptID() const; 1034 V8_INLINE Local<Integer> ScriptID() const;
1030 V8_INLINE Handle<Value> SourceMapUrl() const; 1035 V8_INLINE Local<Value> SourceMapUrl() const;
1031 V8_INLINE ScriptOriginOptions Options() const { return options_; } 1036 V8_INLINE ScriptOriginOptions Options() const { return options_; }
1032 1037
1033 private: 1038 private:
1034 Handle<Value> resource_name_; 1039 Local<Value> resource_name_;
1035 Handle<Integer> resource_line_offset_; 1040 Local<Integer> resource_line_offset_;
1036 Handle<Integer> resource_column_offset_; 1041 Local<Integer> resource_column_offset_;
1037 ScriptOriginOptions options_; 1042 ScriptOriginOptions options_;
1038 Handle<Integer> script_id_; 1043 Local<Integer> script_id_;
1039 Handle<Value> source_map_url_; 1044 Local<Value> source_map_url_;
1040 }; 1045 };
1041 1046
1042 1047
1043 /** 1048 /**
1044 * A compiled JavaScript script, not yet tied to a Context. 1049 * A compiled JavaScript script, not yet tied to a Context.
1045 */ 1050 */
1046 class V8_EXPORT UnboundScript { 1051 class V8_EXPORT UnboundScript {
1047 public: 1052 public:
1048 /** 1053 /**
1049 * Binds the script to the currently entered context. 1054 * Binds the script to the currently entered context.
1050 */ 1055 */
1051 Local<Script> BindToCurrentContext(); 1056 Local<Script> BindToCurrentContext();
1052 1057
1053 int GetId(); 1058 int GetId();
1054 Handle<Value> GetScriptName(); 1059 Local<Value> GetScriptName();
1055 1060
1056 /** 1061 /**
1057 * Data read from magic sourceURL comments. 1062 * Data read from magic sourceURL comments.
1058 */ 1063 */
1059 Handle<Value> GetSourceURL(); 1064 Local<Value> GetSourceURL();
1060 /** 1065 /**
1061 * Data read from magic sourceMappingURL comments. 1066 * Data read from magic sourceMappingURL comments.
1062 */ 1067 */
1063 Handle<Value> GetSourceMappingURL(); 1068 Local<Value> GetSourceMappingURL();
1064 1069
1065 /** 1070 /**
1066 * Returns zero based line number of the code_pos location in the script. 1071 * Returns zero based line number of the code_pos location in the script.
1067 * -1 will be returned if no information available. 1072 * -1 will be returned if no information available.
1068 */ 1073 */
1069 int GetLineNumber(int code_pos); 1074 int GetLineNumber(int code_pos);
1070 1075
1071 static const int kNoScriptId = 0; 1076 static const int kNoScriptId = 0;
1072 }; 1077 };
1073 1078
1074 1079
1075 /** 1080 /**
1076 * A compiled JavaScript script, tied to a Context which was active when the 1081 * A compiled JavaScript script, tied to a Context which was active when the
1077 * script was compiled. 1082 * script was compiled.
1078 */ 1083 */
1079 class V8_EXPORT Script { 1084 class V8_EXPORT Script {
1080 public: 1085 public:
1081 /** 1086 /**
1082 * A shorthand for ScriptCompiler::Compile(). 1087 * A shorthand for ScriptCompiler::Compile().
1083 */ 1088 */
1084 static V8_DEPRECATE_SOON( 1089 static V8_DEPRECATE_SOON(
1085 "Use maybe version", 1090 "Use maybe version",
1086 Local<Script> Compile(Handle<String> source, 1091 Local<Script> Compile(Local<String> source,
1087 ScriptOrigin* origin = nullptr)); 1092 ScriptOrigin* origin = nullptr));
1088 static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile( 1093 static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
1089 Local<Context> context, Handle<String> source, 1094 Local<Context> context, Local<String> source,
1090 ScriptOrigin* origin = nullptr); 1095 ScriptOrigin* origin = nullptr);
1091 1096
1092 static Local<Script> V8_DEPRECATE_SOON("Use maybe version", 1097 static Local<Script> V8_DEPRECATE_SOON("Use maybe version",
1093 Compile(Handle<String> source, 1098 Compile(Local<String> source,
1094 Handle<String> file_name)); 1099 Local<String> file_name));
1095 1100
1096 /** 1101 /**
1097 * Runs the script returning the resulting value. It will be run in the 1102 * Runs the script returning the resulting value. It will be run in the
1098 * context in which it was created (ScriptCompiler::CompileBound or 1103 * context in which it was created (ScriptCompiler::CompileBound or
1099 * UnboundScript::BindToCurrentContext()). 1104 * UnboundScript::BindToCurrentContext()).
1100 */ 1105 */
1101 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Run()); 1106 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Run());
1102 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context); 1107 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context);
1103 1108
1104 /** 1109 /**
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 1181
1177 private: 1182 private:
1178 friend class ScriptCompiler; 1183 friend class ScriptCompiler;
1179 // Prevent copying. Not implemented. 1184 // Prevent copying. Not implemented.
1180 Source(const Source&); 1185 Source(const Source&);
1181 Source& operator=(const Source&); 1186 Source& operator=(const Source&);
1182 1187
1183 Local<String> source_string; 1188 Local<String> source_string;
1184 1189
1185 // Origin information 1190 // Origin information
1186 Handle<Value> resource_name; 1191 Local<Value> resource_name;
1187 Handle<Integer> resource_line_offset; 1192 Local<Integer> resource_line_offset;
1188 Handle<Integer> resource_column_offset; 1193 Local<Integer> resource_column_offset;
1189 ScriptOriginOptions resource_options; 1194 ScriptOriginOptions resource_options;
1190 Handle<Value> source_map_url; 1195 Local<Value> source_map_url;
1191 1196
1192 // Cached data from previous compilation (if a kConsume*Cache flag is 1197 // Cached data from previous compilation (if a kConsume*Cache flag is
1193 // set), or hold newly generated cache data (kProduce*Cache flags) are 1198 // set), or hold newly generated cache data (kProduce*Cache flags) are
1194 // set when calling a compile method. 1199 // set when calling a compile method.
1195 CachedData* cached_data; 1200 CachedData* cached_data;
1196 }; 1201 };
1197 1202
1198 /** 1203 /**
1199 * For streaming incomplete script data to V8. The embedder should implement a 1204 * For streaming incomplete script data to V8. The embedder should implement a
1200 * subclass of this class. 1205 * subclass of this class.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 /** 1350 /**
1346 * Compiles a streamed script (bound to current context). 1351 * Compiles a streamed script (bound to current context).
1347 * 1352 *
1348 * This can only be called after the streaming has finished 1353 * This can only be called after the streaming has finished
1349 * (ScriptStreamingTask has been run). V8 doesn't construct the source string 1354 * (ScriptStreamingTask has been run). V8 doesn't construct the source string
1350 * during streaming, so the embedder needs to pass the full source here. 1355 * during streaming, so the embedder needs to pass the full source here.
1351 */ 1356 */
1352 static V8_DEPRECATE_SOON( 1357 static V8_DEPRECATE_SOON(
1353 "Use maybe version", 1358 "Use maybe version",
1354 Local<Script> Compile(Isolate* isolate, StreamedSource* source, 1359 Local<Script> Compile(Isolate* isolate, StreamedSource* source,
1355 Handle<String> full_source_string, 1360 Local<String> full_source_string,
1356 const ScriptOrigin& origin)); 1361 const ScriptOrigin& origin));
1357 static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile( 1362 static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
1358 Local<Context> context, StreamedSource* source, 1363 Local<Context> context, StreamedSource* source,
1359 Handle<String> full_source_string, const ScriptOrigin& origin); 1364 Local<String> full_source_string, const ScriptOrigin& origin);
1360 1365
1361 /** 1366 /**
1362 * Return a version tag for CachedData for the current V8 version & flags. 1367 * Return a version tag for CachedData for the current V8 version & flags.
1363 * 1368 *
1364 * This value is meant only for determining whether a previously generated 1369 * This value is meant only for determining whether a previously generated
1365 * CachedData instance is still valid; the tag has no other meaing. 1370 * CachedData instance is still valid; the tag has no other meaing.
1366 * 1371 *
1367 * Background: The data carried by CachedData may depend on the exact 1372 * Background: The data carried by CachedData may depend on the exact
1368 * V8 version number or currently compiler flags. This means when 1373 * V8 version number or currently compiler flags. This means when
1369 * persisting CachedData, the embedder must take care to not pass in 1374 * persisting CachedData, the embedder must take care to not pass in
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 /** 1441 /**
1437 * Returns the origin for the script from where the function causing the 1442 * Returns the origin for the script from where the function causing the
1438 * error originates. 1443 * error originates.
1439 */ 1444 */
1440 ScriptOrigin GetScriptOrigin() const; 1445 ScriptOrigin GetScriptOrigin() const;
1441 1446
1442 /** 1447 /**
1443 * Returns the resource name for the script from where the function causing 1448 * Returns the resource name for the script from where the function causing
1444 * the error originates. 1449 * the error originates.
1445 */ 1450 */
1446 Handle<Value> GetScriptResourceName() const; 1451 Local<Value> GetScriptResourceName() const;
1447 1452
1448 /** 1453 /**
1449 * Exception stack trace. By default stack traces are not captured for 1454 * Exception stack trace. By default stack traces are not captured for
1450 * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows 1455 * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows
1451 * to change this option. 1456 * to change this option.
1452 */ 1457 */
1453 Handle<StackTrace> GetStackTrace() const; 1458 Local<StackTrace> GetStackTrace() const;
1454 1459
1455 /** 1460 /**
1456 * Returns the number, 1-based, of the line where the error occurred. 1461 * Returns the number, 1-based, of the line where the error occurred.
1457 */ 1462 */
1458 V8_DEPRECATE_SOON("Use maybe version", int GetLineNumber() const); 1463 V8_DEPRECATE_SOON("Use maybe version", int GetLineNumber() const);
1459 V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const; 1464 V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const;
1460 1465
1461 /** 1466 /**
1462 * Returns the index within the script of the first character where 1467 * Returns the index within the script of the first character where
1463 * the error occurred. 1468 * the error occurred.
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 1663
1659 1664
1660 /** 1665 /**
1661 * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap 1666 * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap
1662 * but can be created without entering a v8::Context and hence shouldn't 1667 * but can be created without entering a v8::Context and hence shouldn't
1663 * escape to JavaScript. 1668 * escape to JavaScript.
1664 */ 1669 */
1665 class V8_EXPORT NativeWeakMap : public Data { 1670 class V8_EXPORT NativeWeakMap : public Data {
1666 public: 1671 public:
1667 static Local<NativeWeakMap> New(Isolate* isolate); 1672 static Local<NativeWeakMap> New(Isolate* isolate);
1668 void Set(Handle<Value> key, Handle<Value> value); 1673 void Set(Local<Value> key, Local<Value> value);
1669 Local<Value> Get(Handle<Value> key); 1674 Local<Value> Get(Local<Value> key);
1670 bool Has(Handle<Value> key); 1675 bool Has(Local<Value> key);
1671 bool Delete(Handle<Value> key); 1676 bool Delete(Local<Value> key);
1672 }; 1677 };
1673 1678
1674 1679
1675 // --- Value --- 1680 // --- Value ---
1676 1681
1677 1682
1678 /** 1683 /**
1679 * The superclass of all JavaScript values and objects. 1684 * The superclass of all JavaScript values and objects.
1680 */ 1685 */
1681 class V8_EXPORT Value : public Data { 1686 class V8_EXPORT Value : public Data {
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 Local<Context> context) const; 2006 Local<Context> context) const;
2002 V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const; 2007 V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
2003 2008
2004 V8_DEPRECATE_SOON("Use maybe version", bool BooleanValue() const); 2009 V8_DEPRECATE_SOON("Use maybe version", bool BooleanValue() const);
2005 V8_DEPRECATE_SOON("Use maybe version", double NumberValue() const); 2010 V8_DEPRECATE_SOON("Use maybe version", double NumberValue() const);
2006 V8_DEPRECATE_SOON("Use maybe version", int64_t IntegerValue() const); 2011 V8_DEPRECATE_SOON("Use maybe version", int64_t IntegerValue() const);
2007 V8_DEPRECATE_SOON("Use maybe version", uint32_t Uint32Value() const); 2012 V8_DEPRECATE_SOON("Use maybe version", uint32_t Uint32Value() const);
2008 V8_DEPRECATE_SOON("Use maybe version", int32_t Int32Value() const); 2013 V8_DEPRECATE_SOON("Use maybe version", int32_t Int32Value() const);
2009 2014
2010 /** JS == */ 2015 /** JS == */
2011 V8_DEPRECATE_SOON("Use maybe version", bool Equals(Handle<Value> that) const); 2016 V8_DEPRECATE_SOON("Use maybe version", bool Equals(Local<Value> that) const);
2012 V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context, 2017 V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
2013 Handle<Value> that) const; 2018 Local<Value> that) const;
2014 bool StrictEquals(Handle<Value> that) const; 2019 bool StrictEquals(Local<Value> that) const;
2015 bool SameValue(Handle<Value> that) const; 2020 bool SameValue(Local<Value> that) const;
2016 2021
2017 template <class T> V8_INLINE static Value* Cast(T* value); 2022 template <class T> V8_INLINE static Value* Cast(T* value);
2018 2023
2019 private: 2024 private:
2020 V8_INLINE bool QuickIsUndefined() const; 2025 V8_INLINE bool QuickIsUndefined() const;
2021 V8_INLINE bool QuickIsNull() const; 2026 V8_INLINE bool QuickIsNull() const;
2022 V8_INLINE bool QuickIsString() const; 2027 V8_INLINE bool QuickIsString() const;
2023 bool FullIsUndefined() const; 2028 bool FullIsUndefined() const;
2024 bool FullIsNull() const; 2029 bool FullIsNull() const;
2025 bool FullIsString() const; 2030 bool FullIsString() const;
2026 }; 2031 };
2027 2032
2028 2033
2029 /** 2034 /**
2030 * The superclass of primitive values. See ECMA-262 4.3.2. 2035 * The superclass of primitive values. See ECMA-262 4.3.2.
2031 */ 2036 */
2032 class V8_EXPORT Primitive : public Value { }; 2037 class V8_EXPORT Primitive : public Value { };
2033 2038
2034 2039
2035 /** 2040 /**
2036 * A primitive boolean value (ECMA-262, 4.3.14). Either the true 2041 * A primitive boolean value (ECMA-262, 4.3.14). Either the true
2037 * or false value. 2042 * or false value.
2038 */ 2043 */
2039 class V8_EXPORT Boolean : public Primitive { 2044 class V8_EXPORT Boolean : public Primitive {
2040 public: 2045 public:
2041 bool Value() const; 2046 bool Value() const;
2042 V8_INLINE static Boolean* Cast(v8::Value* obj); 2047 V8_INLINE static Boolean* Cast(v8::Value* obj);
2043 V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value); 2048 V8_INLINE static Local<Boolean> New(Isolate* isolate, bool value);
2049
2044 private: 2050 private:
2045 static void CheckCast(v8::Value* obj); 2051 static void CheckCast(v8::Value* obj);
2046 }; 2052 };
2047 2053
2048 2054
2049 /** 2055 /**
2050 * A superclass for symbols and strings. 2056 * A superclass for symbols and strings.
2051 */ 2057 */
2052 class V8_EXPORT Name : public Primitive { 2058 class V8_EXPORT Name : public Primitive {
2053 public: 2059 public:
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 /** Allocates a new string from UTF-16 data. Only returns an empty value when 2320 /** Allocates a new string from UTF-16 data. Only returns an empty value when
2315 * length > kMaxLength. **/ 2321 * length > kMaxLength. **/
2316 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte( 2322 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
2317 Isolate* isolate, const uint16_t* data, v8::NewStringType type, 2323 Isolate* isolate, const uint16_t* data, v8::NewStringType type,
2318 int length = -1); 2324 int length = -1);
2319 2325
2320 /** 2326 /**
2321 * Creates a new string by concatenating the left and the right strings 2327 * Creates a new string by concatenating the left and the right strings
2322 * passed in as parameters. 2328 * passed in as parameters.
2323 */ 2329 */
2324 static Local<String> Concat(Handle<String> left, Handle<String> right); 2330 static Local<String> Concat(Local<String> left, Local<String> right);
2325 2331
2326 /** 2332 /**
2327 * Creates a new external string using the data defined in the given 2333 * Creates a new external string using the data defined in the given
2328 * resource. When the external string is no longer live on V8's heap the 2334 * resource. When the external string is no longer live on V8's heap the
2329 * resource will be disposed by calling its Dispose method. The caller of 2335 * resource will be disposed by calling its Dispose method. The caller of
2330 * this function should not otherwise delete or modify the resource. Neither 2336 * this function should not otherwise delete or modify the resource. Neither
2331 * should the underlying buffer be deallocated or modified except through the 2337 * should the underlying buffer be deallocated or modified except through the
2332 * destructor of the external string resource. 2338 * destructor of the external string resource.
2333 */ 2339 */
2334 static V8_DEPRECATE_SOON( 2340 static V8_DEPRECATE_SOON(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2382 2388
2383 /** 2389 /**
2384 * Converts an object to a UTF-8-encoded character array. Useful if 2390 * Converts an object to a UTF-8-encoded character array. Useful if
2385 * you want to print the object. If conversion to a string fails 2391 * you want to print the object. If conversion to a string fails
2386 * (e.g. due to an exception in the toString() method of the object) 2392 * (e.g. due to an exception in the toString() method of the object)
2387 * then the length() method returns 0 and the * operator returns 2393 * then the length() method returns 0 and the * operator returns
2388 * NULL. 2394 * NULL.
2389 */ 2395 */
2390 class V8_EXPORT Utf8Value { 2396 class V8_EXPORT Utf8Value {
2391 public: 2397 public:
2392 explicit Utf8Value(Handle<v8::Value> obj); 2398 explicit Utf8Value(Local<v8::Value> obj);
2393 ~Utf8Value(); 2399 ~Utf8Value();
2394 char* operator*() { return str_; } 2400 char* operator*() { return str_; }
2395 const char* operator*() const { return str_; } 2401 const char* operator*() const { return str_; }
2396 int length() const { return length_; } 2402 int length() const { return length_; }
2397 private: 2403 private:
2398 char* str_; 2404 char* str_;
2399 int length_; 2405 int length_;
2400 2406
2401 // Disallow copying and assigning. 2407 // Disallow copying and assigning.
2402 Utf8Value(const Utf8Value&); 2408 Utf8Value(const Utf8Value&);
2403 void operator=(const Utf8Value&); 2409 void operator=(const Utf8Value&);
2404 }; 2410 };
2405 2411
2406 /** 2412 /**
2407 * Converts an object to a two-byte string. 2413 * Converts an object to a two-byte string.
2408 * If conversion to a string fails (eg. due to an exception in the toString() 2414 * If conversion to a string fails (eg. due to an exception in the toString()
2409 * method of the object) then the length() method returns 0 and the * operator 2415 * method of the object) then the length() method returns 0 and the * operator
2410 * returns NULL. 2416 * returns NULL.
2411 */ 2417 */
2412 class V8_EXPORT Value { 2418 class V8_EXPORT Value {
2413 public: 2419 public:
2414 explicit Value(Handle<v8::Value> obj); 2420 explicit Value(Local<v8::Value> obj);
2415 ~Value(); 2421 ~Value();
2416 uint16_t* operator*() { return str_; } 2422 uint16_t* operator*() { return str_; }
2417 const uint16_t* operator*() const { return str_; } 2423 const uint16_t* operator*() const { return str_; }
2418 int length() const { return length_; } 2424 int length() const { return length_; }
2419 private: 2425 private:
2420 uint16_t* str_; 2426 uint16_t* str_;
2421 int length_; 2427 int length_;
2422 2428
2423 // Disallow copying and assigning. 2429 // Disallow copying and assigning.
2424 Value(const Value&); 2430 Value(const Value&);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 PROHIBITS_OVERWRITING = 1 << 2 2580 PROHIBITS_OVERWRITING = 1 << 2
2575 }; 2581 };
2576 2582
2577 2583
2578 /** 2584 /**
2579 * A JavaScript object (ECMA-262, 4.3.3) 2585 * A JavaScript object (ECMA-262, 4.3.3)
2580 */ 2586 */
2581 class V8_EXPORT Object : public Value { 2587 class V8_EXPORT Object : public Value {
2582 public: 2588 public:
2583 V8_DEPRECATE_SOON("Use maybe version", 2589 V8_DEPRECATE_SOON("Use maybe version",
2584 bool Set(Handle<Value> key, Handle<Value> value)); 2590 bool Set(Local<Value> key, Local<Value> value));
2585 V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, 2591 V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
2586 Local<Value> key, Local<Value> value); 2592 Local<Value> key, Local<Value> value);
2587 2593
2588 V8_DEPRECATE_SOON("Use maybe version", 2594 V8_DEPRECATE_SOON("Use maybe version",
2589 bool Set(uint32_t index, Handle<Value> value)); 2595 bool Set(uint32_t index, Local<Value> value));
2590 V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index, 2596 V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
2591 Local<Value> value); 2597 Local<Value> value);
2592 2598
2593 // Implements CreateDataProperty (ECMA-262, 7.3.4). 2599 // Implements CreateDataProperty (ECMA-262, 7.3.4).
2594 // 2600 //
2595 // Defines a configurable, writable, enumerable property with the given value 2601 // Defines a configurable, writable, enumerable property with the given value
2596 // on the object unless the property already exists and is not configurable 2602 // on the object unless the property already exists and is not configurable
2597 // or the object is not extensible. 2603 // or the object is not extensible.
2598 // 2604 //
2599 // Returns true on success. 2605 // Returns true on success.
(...skipping 16 matching lines...) Expand all
2616 2622
2617 // Sets an own property on this object bypassing interceptors and 2623 // Sets an own property on this object bypassing interceptors and
2618 // overriding accessors or read-only properties. 2624 // overriding accessors or read-only properties.
2619 // 2625 //
2620 // Note that if the object has an interceptor the property will be set 2626 // Note that if the object has an interceptor the property will be set
2621 // locally, but since the interceptor takes precedence the local property 2627 // locally, but since the interceptor takes precedence the local property
2622 // will only be returned if the interceptor doesn't return a value. 2628 // will only be returned if the interceptor doesn't return a value.
2623 // 2629 //
2624 // Note also that this only works for named properties. 2630 // Note also that this only works for named properties.
2625 V8_DEPRECATE_SOON("Use CreateDataProperty", 2631 V8_DEPRECATE_SOON("Use CreateDataProperty",
2626 bool ForceSet(Handle<Value> key, Handle<Value> value, 2632 bool ForceSet(Local<Value> key, Local<Value> value,
2627 PropertyAttribute attribs = None)); 2633 PropertyAttribute attribs = None));
2628 V8_DEPRECATE_SOON("Use CreateDataProperty", 2634 V8_DEPRECATE_SOON("Use CreateDataProperty",
2629 Maybe<bool> ForceSet(Local<Context> context, 2635 Maybe<bool> ForceSet(Local<Context> context,
2630 Local<Value> key, Local<Value> value, 2636 Local<Value> key, Local<Value> value,
2631 PropertyAttribute attribs = None)); 2637 PropertyAttribute attribs = None));
2632 2638
2633 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Handle<Value> key)); 2639 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Local<Value> key));
2634 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, 2640 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
2635 Local<Value> key); 2641 Local<Value> key);
2636 2642
2637 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(uint32_t index)); 2643 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(uint32_t index));
2638 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, 2644 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
2639 uint32_t index); 2645 uint32_t index);
2640 2646
2641 /** 2647 /**
2642 * Gets the property attributes of a property which can be None or 2648 * Gets the property attributes of a property which can be None or
2643 * any combination of ReadOnly, DontEnum and DontDelete. Returns 2649 * any combination of ReadOnly, DontEnum and DontDelete. Returns
2644 * None when the property doesn't exist. 2650 * None when the property doesn't exist.
2645 */ 2651 */
2646 V8_DEPRECATE_SOON("Use maybe version", 2652 V8_DEPRECATE_SOON("Use maybe version",
2647 PropertyAttribute GetPropertyAttributes(Handle<Value> key)); 2653 PropertyAttribute GetPropertyAttributes(Local<Value> key));
2648 V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetPropertyAttributes( 2654 V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetPropertyAttributes(
2649 Local<Context> context, Local<Value> key); 2655 Local<Context> context, Local<Value> key);
2650 2656
2651 /** 2657 /**
2652 * Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3. 2658 * Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3.
2653 */ 2659 */
2654 V8_DEPRECATE_SOON("Use maybe version", 2660 V8_DEPRECATE_SOON("Use maybe version",
2655 Local<Value> GetOwnPropertyDescriptor(Local<String> key)); 2661 Local<Value> GetOwnPropertyDescriptor(Local<String> key));
2656 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetOwnPropertyDescriptor( 2662 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetOwnPropertyDescriptor(
2657 Local<Context> context, Local<String> key); 2663 Local<Context> context, Local<String> key);
2658 2664
2659 V8_DEPRECATE_SOON("Use maybe version", bool Has(Handle<Value> key)); 2665 V8_DEPRECATE_SOON("Use maybe version", bool Has(Local<Value> key));
2660 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, 2666 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context,
2661 Local<Value> key); 2667 Local<Value> key);
2662 2668
2663 V8_DEPRECATE_SOON("Use maybe version", bool Delete(Handle<Value> key)); 2669 V8_DEPRECATE_SOON("Use maybe version", bool Delete(Local<Value> key));
2664 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT 2670 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
2665 Maybe<bool> Delete(Local<Context> context, Local<Value> key); 2671 Maybe<bool> Delete(Local<Context> context, Local<Value> key);
2666 2672
2667 V8_DEPRECATE_SOON("Use maybe version", bool Has(uint32_t index)); 2673 V8_DEPRECATE_SOON("Use maybe version", bool Has(uint32_t index));
2668 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, uint32_t index); 2674 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, uint32_t index);
2669 2675
2670 V8_DEPRECATE_SOON("Use maybe version", bool Delete(uint32_t index)); 2676 V8_DEPRECATE_SOON("Use maybe version", bool Delete(uint32_t index));
2671 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT 2677 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
2672 Maybe<bool> Delete(Local<Context> context, uint32_t index); 2678 Maybe<bool> Delete(Local<Context> context, uint32_t index);
2673 2679
2674 V8_DEPRECATE_SOON("Use maybe version", 2680 V8_DEPRECATE_SOON("Use maybe version",
2675 bool SetAccessor(Handle<String> name, 2681 bool SetAccessor(Local<String> name,
2676 AccessorGetterCallback getter, 2682 AccessorGetterCallback getter,
2677 AccessorSetterCallback setter = 0, 2683 AccessorSetterCallback setter = 0,
2678 Handle<Value> data = Handle<Value>(), 2684 Local<Value> data = Local<Value>(),
2679 AccessControl settings = DEFAULT, 2685 AccessControl settings = DEFAULT,
2680 PropertyAttribute attribute = None)); 2686 PropertyAttribute attribute = None));
2681 V8_DEPRECATE_SOON("Use maybe version", 2687 V8_DEPRECATE_SOON("Use maybe version",
2682 bool SetAccessor(Handle<Name> name, 2688 bool SetAccessor(Local<Name> name,
2683 AccessorNameGetterCallback getter, 2689 AccessorNameGetterCallback getter,
2684 AccessorNameSetterCallback setter = 0, 2690 AccessorNameSetterCallback setter = 0,
2685 Handle<Value> data = Handle<Value>(), 2691 Local<Value> data = Local<Value>(),
2686 AccessControl settings = DEFAULT, 2692 AccessControl settings = DEFAULT,
2687 PropertyAttribute attribute = None)); 2693 PropertyAttribute attribute = None));
2688 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT 2694 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
2689 Maybe<bool> SetAccessor(Local<Context> context, Local<Name> name, 2695 Maybe<bool> SetAccessor(Local<Context> context, Local<Name> name,
2690 AccessorNameGetterCallback getter, 2696 AccessorNameGetterCallback getter,
2691 AccessorNameSetterCallback setter = 0, 2697 AccessorNameSetterCallback setter = 0,
2692 MaybeLocal<Value> data = MaybeLocal<Value>(), 2698 MaybeLocal<Value> data = MaybeLocal<Value>(),
2693 AccessControl settings = DEFAULT, 2699 AccessControl settings = DEFAULT,
2694 PropertyAttribute attribute = None); 2700 PropertyAttribute attribute = None);
2695 2701
2696 void SetAccessorProperty(Local<Name> name, 2702 void SetAccessorProperty(Local<Name> name, Local<Function> getter,
2697 Local<Function> getter, 2703 Local<Function> setter = Local<Function>(),
2698 Handle<Function> setter = Handle<Function>(),
2699 PropertyAttribute attribute = None, 2704 PropertyAttribute attribute = None,
2700 AccessControl settings = DEFAULT); 2705 AccessControl settings = DEFAULT);
2701 2706
2702 /** 2707 /**
2703 * Returns an array containing the names of the enumerable properties 2708 * Returns an array containing the names of the enumerable properties
2704 * of this object, including properties from prototype objects. The 2709 * of this object, including properties from prototype objects. The
2705 * array returned by this method contains the same values as would 2710 * array returned by this method contains the same values as would
2706 * be enumerated by a for-in statement over this object. 2711 * be enumerated by a for-in statement over this object.
2707 */ 2712 */
2708 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetPropertyNames()); 2713 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetPropertyNames());
(...skipping 15 matching lines...) Expand all
2724 * handler. 2729 * handler.
2725 */ 2730 */
2726 Local<Value> GetPrototype(); 2731 Local<Value> GetPrototype();
2727 2732
2728 /** 2733 /**
2729 * Set the prototype object. This does not skip objects marked to 2734 * Set the prototype object. This does not skip objects marked to
2730 * be skipped by __proto__ and it does not consult the security 2735 * be skipped by __proto__ and it does not consult the security
2731 * handler. 2736 * handler.
2732 */ 2737 */
2733 V8_DEPRECATE_SOON("Use maybe version", 2738 V8_DEPRECATE_SOON("Use maybe version",
2734 bool SetPrototype(Handle<Value> prototype)); 2739 bool SetPrototype(Local<Value> prototype));
2735 V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototype(Local<Context> context, 2740 V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototype(Local<Context> context,
2736 Local<Value> prototype); 2741 Local<Value> prototype);
2737 2742
2738 /** 2743 /**
2739 * Finds an instance of the given function template in the prototype 2744 * Finds an instance of the given function template in the prototype
2740 * chain. 2745 * chain.
2741 */ 2746 */
2742 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl); 2747 Local<Object> FindInstanceInPrototypeChain(Local<FunctionTemplate> tmpl);
2743 2748
2744 /** 2749 /**
2745 * Call builtin Object.prototype.toString on this object. 2750 * Call builtin Object.prototype.toString on this object.
2746 * This is different from Value::ToString() that may call 2751 * This is different from Value::ToString() that may call
2747 * user-defined toString function. This one does not. 2752 * user-defined toString function. This one does not.
2748 */ 2753 */
2749 V8_DEPRECATE_SOON("Use maybe version", Local<String> ObjectProtoToString()); 2754 V8_DEPRECATE_SOON("Use maybe version", Local<String> ObjectProtoToString());
2750 V8_WARN_UNUSED_RESULT MaybeLocal<String> ObjectProtoToString( 2755 V8_WARN_UNUSED_RESULT MaybeLocal<String> ObjectProtoToString(
2751 Local<Context> context); 2756 Local<Context> context);
2752 2757
2753 /** 2758 /**
2754 * Returns the name of the function invoked as a constructor for this object. 2759 * Returns the name of the function invoked as a constructor for this object.
2755 */ 2760 */
2756 Local<String> GetConstructorName(); 2761 Local<String> GetConstructorName();
2757 2762
2758 /** Gets the number of internal fields for this Object. */ 2763 /** Gets the number of internal fields for this Object. */
2759 int InternalFieldCount(); 2764 int InternalFieldCount();
2760 2765
2761 /** Same as above, but works for Persistents */ 2766 /** Same as above, but works for Persistents */
2762 V8_INLINE static int InternalFieldCount( 2767 V8_INLINE static int InternalFieldCount(
2763 const PersistentBase<Object>& object) { 2768 const PersistentBase<Object>& object) {
2764 return object.val_->InternalFieldCount(); 2769 return object.val_->InternalFieldCount();
2765 } 2770 }
2766 2771
2767 /** Gets the value from an internal field. */ 2772 /** Gets the value from an internal field. */
2768 V8_INLINE Local<Value> GetInternalField(int index); 2773 V8_INLINE Local<Value> GetInternalField(int index);
2769 2774
2770 /** Sets the value in an internal field. */ 2775 /** Sets the value in an internal field. */
2771 void SetInternalField(int index, Handle<Value> value); 2776 void SetInternalField(int index, Local<Value> value);
2772 2777
2773 /** 2778 /**
2774 * Gets a 2-byte-aligned native pointer from an internal field. This field 2779 * Gets a 2-byte-aligned native pointer from an internal field. This field
2775 * must have been set by SetAlignedPointerInInternalField, everything else 2780 * must have been set by SetAlignedPointerInInternalField, everything else
2776 * leads to undefined behavior. 2781 * leads to undefined behavior.
2777 */ 2782 */
2778 V8_INLINE void* GetAlignedPointerFromInternalField(int index); 2783 V8_INLINE void* GetAlignedPointerFromInternalField(int index);
2779 2784
2780 /** Same as above, but works for Persistents */ 2785 /** Same as above, but works for Persistents */
2781 V8_INLINE static void* GetAlignedPointerFromInternalField( 2786 V8_INLINE static void* GetAlignedPointerFromInternalField(
2782 const PersistentBase<Object>& object, int index) { 2787 const PersistentBase<Object>& object, int index) {
2783 return object.val_->GetAlignedPointerFromInternalField(index); 2788 return object.val_->GetAlignedPointerFromInternalField(index);
2784 } 2789 }
2785 2790
2786 /** 2791 /**
2787 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such 2792 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such
2788 * a field, GetAlignedPointerFromInternalField must be used, everything else 2793 * a field, GetAlignedPointerFromInternalField must be used, everything else
2789 * leads to undefined behavior. 2794 * leads to undefined behavior.
2790 */ 2795 */
2791 void SetAlignedPointerInInternalField(int index, void* value); 2796 void SetAlignedPointerInInternalField(int index, void* value);
2792 2797
2793 // Testers for local properties. 2798 // Testers for local properties.
2794 V8_DEPRECATE_SOON("Use maybe version", 2799 V8_DEPRECATE_SOON("Use maybe version",
2795 bool HasOwnProperty(Handle<String> key)); 2800 bool HasOwnProperty(Local<String> key));
2796 V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context, 2801 V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
2797 Local<Name> key); 2802 Local<Name> key);
2798 V8_DEPRECATE_SOON("Use maybe version", 2803 V8_DEPRECATE_SOON("Use maybe version",
2799 bool HasRealNamedProperty(Handle<String> key)); 2804 bool HasRealNamedProperty(Local<String> key));
2800 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context, 2805 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context,
2801 Local<Name> key); 2806 Local<Name> key);
2802 V8_DEPRECATE_SOON("Use maybe version", 2807 V8_DEPRECATE_SOON("Use maybe version",
2803 bool HasRealIndexedProperty(uint32_t index)); 2808 bool HasRealIndexedProperty(uint32_t index));
2804 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealIndexedProperty( 2809 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealIndexedProperty(
2805 Local<Context> context, uint32_t index); 2810 Local<Context> context, uint32_t index);
2806 V8_DEPRECATE_SOON("Use maybe version", 2811 V8_DEPRECATE_SOON("Use maybe version",
2807 bool HasRealNamedCallbackProperty(Handle<String> key)); 2812 bool HasRealNamedCallbackProperty(Local<String> key));
2808 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedCallbackProperty( 2813 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedCallbackProperty(
2809 Local<Context> context, Local<Name> key); 2814 Local<Context> context, Local<Name> key);
2810 2815
2811 /** 2816 /**
2812 * If result.IsEmpty() no real property was located in the prototype chain. 2817 * If result.IsEmpty() no real property was located in the prototype chain.
2813 * This means interceptors in the prototype chain are not called. 2818 * This means interceptors in the prototype chain are not called.
2814 */ 2819 */
2815 V8_DEPRECATE_SOON( 2820 V8_DEPRECATE_SOON(
2816 "Use maybe version", 2821 "Use maybe version",
2817 Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key)); 2822 Local<Value> GetRealNamedPropertyInPrototypeChain(Local<String> key));
2818 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedPropertyInPrototypeChain( 2823 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedPropertyInPrototypeChain(
2819 Local<Context> context, Local<Name> key); 2824 Local<Context> context, Local<Name> key);
2820 2825
2821 /** 2826 /**
2822 * Gets the property attributes of a real property in the prototype chain, 2827 * Gets the property attributes of a real property in the prototype chain,
2823 * which can be None or any combination of ReadOnly, DontEnum and DontDelete. 2828 * which can be None or any combination of ReadOnly, DontEnum and DontDelete.
2824 * Interceptors in the prototype chain are not called. 2829 * Interceptors in the prototype chain are not called.
2825 */ 2830 */
2826 V8_DEPRECATE_SOON( 2831 V8_DEPRECATE_SOON(
2827 "Use maybe version", 2832 "Use maybe version",
2828 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( 2833 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain(
2829 Handle<String> key)); 2834 Local<String> key));
2830 V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> 2835 V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute>
2831 GetRealNamedPropertyAttributesInPrototypeChain(Local<Context> context, 2836 GetRealNamedPropertyAttributesInPrototypeChain(Local<Context> context,
2832 Local<Name> key); 2837 Local<Name> key);
2833 2838
2834 /** 2839 /**
2835 * If result.IsEmpty() no real property was located on the object or 2840 * If result.IsEmpty() no real property was located on the object or
2836 * in the prototype chain. 2841 * in the prototype chain.
2837 * This means interceptors in the prototype chain are not called. 2842 * This means interceptors in the prototype chain are not called.
2838 */ 2843 */
2839 V8_DEPRECATE_SOON("Use maybe version", 2844 V8_DEPRECATE_SOON("Use maybe version",
2840 Local<Value> GetRealNamedProperty(Handle<String> key)); 2845 Local<Value> GetRealNamedProperty(Local<String> key));
2841 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedProperty( 2846 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedProperty(
2842 Local<Context> context, Local<Name> key); 2847 Local<Context> context, Local<Name> key);
2843 2848
2844 /** 2849 /**
2845 * Gets the property attributes of a real property which can be 2850 * Gets the property attributes of a real property which can be
2846 * None or any combination of ReadOnly, DontEnum and DontDelete. 2851 * None or any combination of ReadOnly, DontEnum and DontDelete.
2847 * Interceptors in the prototype chain are not called. 2852 * Interceptors in the prototype chain are not called.
2848 */ 2853 */
2849 V8_DEPRECATE_SOON("Use maybe version", 2854 V8_DEPRECATE_SOON("Use maybe version",
2850 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes( 2855 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(
2851 Handle<String> key)); 2856 Local<String> key));
2852 V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetRealNamedPropertyAttributes( 2857 V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(
2853 Local<Context> context, Local<Name> key); 2858 Local<Context> context, Local<Name> key);
2854 2859
2855 /** Tests for a named lookup interceptor.*/ 2860 /** Tests for a named lookup interceptor.*/
2856 bool HasNamedLookupInterceptor(); 2861 bool HasNamedLookupInterceptor();
2857 2862
2858 /** Tests for an index lookup interceptor.*/ 2863 /** Tests for an index lookup interceptor.*/
2859 bool HasIndexedLookupInterceptor(); 2864 bool HasIndexedLookupInterceptor();
2860 2865
2861 /** 2866 /**
2862 * Returns the identity hash for this object. The current implementation 2867 * Returns the identity hash for this object. The current implementation
2863 * uses a hidden property on the object to store the identity hash. 2868 * uses a hidden property on the object to store the identity hash.
2864 * 2869 *
2865 * The return value will never be 0. Also, it is not guaranteed to be 2870 * The return value will never be 0. Also, it is not guaranteed to be
2866 * unique. 2871 * unique.
2867 */ 2872 */
2868 int GetIdentityHash(); 2873 int GetIdentityHash();
2869 2874
2870 /** 2875 /**
2871 * Access hidden properties on JavaScript objects. These properties are 2876 * Access hidden properties on JavaScript objects. These properties are
2872 * hidden from the executing JavaScript and only accessible through the V8 2877 * hidden from the executing JavaScript and only accessible through the V8
2873 * C++ API. Hidden properties introduced by V8 internally (for example the 2878 * C++ API. Hidden properties introduced by V8 internally (for example the
2874 * identity hash) are prefixed with "v8::". 2879 * identity hash) are prefixed with "v8::".
2875 */ 2880 */
2876 // TODO(dcarney): convert these to take a isolate and optionally bailout? 2881 // TODO(dcarney): convert these to take a isolate and optionally bailout?
2877 bool SetHiddenValue(Handle<String> key, Handle<Value> value); 2882 bool SetHiddenValue(Local<String> key, Local<Value> value);
2878 Local<Value> GetHiddenValue(Handle<String> key); 2883 Local<Value> GetHiddenValue(Local<String> key);
2879 bool DeleteHiddenValue(Handle<String> key); 2884 bool DeleteHiddenValue(Local<String> key);
2880 2885
2881 /** 2886 /**
2882 * Clone this object with a fast but shallow copy. Values will point 2887 * Clone this object with a fast but shallow copy. Values will point
2883 * to the same values as the original object. 2888 * to the same values as the original object.
2884 */ 2889 */
2885 // TODO(dcarney): take an isolate and optionally bail out? 2890 // TODO(dcarney): take an isolate and optionally bail out?
2886 Local<Object> Clone(); 2891 Local<Object> Clone();
2887 2892
2888 /** 2893 /**
2889 * Returns the context in which the object was created. 2894 * Returns the context in which the object was created.
2890 */ 2895 */
2891 Local<Context> CreationContext(); 2896 Local<Context> CreationContext();
2892 2897
2893 /** 2898 /**
2894 * Checks whether a callback is set by the 2899 * Checks whether a callback is set by the
2895 * ObjectTemplate::SetCallAsFunctionHandler method. 2900 * ObjectTemplate::SetCallAsFunctionHandler method.
2896 * When an Object is callable this method returns true. 2901 * When an Object is callable this method returns true.
2897 */ 2902 */
2898 bool IsCallable(); 2903 bool IsCallable();
2899 2904
2900 /** 2905 /**
2901 * Call an Object as a function if a callback is set by the 2906 * Call an Object as a function if a callback is set by the
2902 * ObjectTemplate::SetCallAsFunctionHandler method. 2907 * ObjectTemplate::SetCallAsFunctionHandler method.
2903 */ 2908 */
2904 V8_DEPRECATE_SOON("Use maybe version", 2909 V8_DEPRECATE_SOON("Use maybe version",
2905 Local<Value> CallAsFunction(Handle<Value> recv, int argc, 2910 Local<Value> CallAsFunction(Local<Value> recv, int argc,
2906 Handle<Value> argv[])); 2911 Local<Value> argv[]));
2907 V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsFunction(Local<Context> context, 2912 V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsFunction(Local<Context> context,
2908 Handle<Value> recv, 2913 Local<Value> recv,
2909 int argc, 2914 int argc,
2910 Handle<Value> argv[]); 2915 Local<Value> argv[]);
2911 2916
2912 /** 2917 /**
2913 * Call an Object as a constructor if a callback is set by the 2918 * Call an Object as a constructor if a callback is set by the
2914 * ObjectTemplate::SetCallAsFunctionHandler method. 2919 * ObjectTemplate::SetCallAsFunctionHandler method.
2915 * Note: This method behaves like the Function::NewInstance method. 2920 * Note: This method behaves like the Function::NewInstance method.
2916 */ 2921 */
2917 V8_DEPRECATE_SOON("Use maybe version", 2922 V8_DEPRECATE_SOON("Use maybe version",
2918 Local<Value> CallAsConstructor(int argc, 2923 Local<Value> CallAsConstructor(int argc,
2919 Handle<Value> argv[])); 2924 Local<Value> argv[]));
2920 V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsConstructor( 2925 V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsConstructor(
2921 Local<Context> context, int argc, Local<Value> argv[]); 2926 Local<Context> context, int argc, Local<Value> argv[]);
2922 2927
2923 /** 2928 /**
2924 * Return the isolate to which the Object belongs to. 2929 * Return the isolate to which the Object belongs to.
2925 */ 2930 */
2926 V8_DEPRECATE_SOON("Keep track of isolate correctly", Isolate* GetIsolate()); 2931 V8_DEPRECATE_SOON("Keep track of isolate correctly", Isolate* GetIsolate());
2927 2932
2928 static Local<Object> New(Isolate* isolate); 2933 static Local<Object> New(Isolate* isolate);
2929 2934
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 }; 3054 };
3050 3055
3051 3056
3052 template<typename T> 3057 template<typename T>
3053 class ReturnValue { 3058 class ReturnValue {
3054 public: 3059 public:
3055 template <class S> V8_INLINE ReturnValue(const ReturnValue<S>& that) 3060 template <class S> V8_INLINE ReturnValue(const ReturnValue<S>& that)
3056 : value_(that.value_) { 3061 : value_(that.value_) {
3057 TYPE_CHECK(T, S); 3062 TYPE_CHECK(T, S);
3058 } 3063 }
3059 // Handle setters 3064 // Local setters
3060 template <typename S> 3065 template <typename S>
3061 V8_INLINE V8_DEPRECATE_SOON("Use Global<> instead", 3066 V8_INLINE V8_DEPRECATE_SOON("Use Global<> instead",
3062 void Set(const Persistent<S>& handle)); 3067 void Set(const Persistent<S>& handle));
3063 template <typename S> 3068 template <typename S>
3064 V8_INLINE void Set(const Global<S>& handle); 3069 V8_INLINE void Set(const Global<S>& handle);
3065 template <typename S> 3070 template <typename S>
3066 V8_INLINE void Set(const Local<S> handle); 3071 V8_INLINE void Set(const Local<S> handle);
3067 // Fast primitive setters 3072 // Fast primitive setters
3068 V8_INLINE void Set(bool value); 3073 V8_INLINE void Set(bool value);
3069 V8_INLINE void Set(double i); 3074 V8_INLINE void Set(double i);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 static MaybeLocal<Function> New(Local<Context> context, 3187 static MaybeLocal<Function> New(Local<Context> context,
3183 FunctionCallback callback, 3188 FunctionCallback callback,
3184 Local<Value> data = Local<Value>(), 3189 Local<Value> data = Local<Value>(),
3185 int length = 0); 3190 int length = 0);
3186 static V8_DEPRECATE_SOON( 3191 static V8_DEPRECATE_SOON(
3187 "Use maybe version", 3192 "Use maybe version",
3188 Local<Function> New(Isolate* isolate, FunctionCallback callback, 3193 Local<Function> New(Isolate* isolate, FunctionCallback callback,
3189 Local<Value> data = Local<Value>(), int length = 0)); 3194 Local<Value> data = Local<Value>(), int length = 0));
3190 3195
3191 V8_DEPRECATE_SOON("Use maybe version", 3196 V8_DEPRECATE_SOON("Use maybe version",
3192 Local<Object> NewInstance(int argc, Handle<Value> argv[]) 3197 Local<Object> NewInstance(int argc, Local<Value> argv[])
3193 const); 3198 const);
3194 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance( 3199 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
3195 Local<Context> context, int argc, Handle<Value> argv[]) const; 3200 Local<Context> context, int argc, Local<Value> argv[]) const;
3196 3201
3197 V8_DEPRECATE_SOON("Use maybe version", Local<Object> NewInstance() const); 3202 V8_DEPRECATE_SOON("Use maybe version", Local<Object> NewInstance() const);
3198 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance( 3203 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
3199 Local<Context> context) const { 3204 Local<Context> context) const {
3200 return NewInstance(context, 0, nullptr); 3205 return NewInstance(context, 0, nullptr);
3201 } 3206 }
3202 3207
3203 V8_DEPRECATE_SOON("Use maybe version", 3208 V8_DEPRECATE_SOON("Use maybe version",
3204 Local<Value> Call(Handle<Value> recv, int argc, 3209 Local<Value> Call(Local<Value> recv, int argc,
3205 Handle<Value> argv[])); 3210 Local<Value> argv[]));
3206 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(Local<Context> context, 3211 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(Local<Context> context,
3207 Handle<Value> recv, int argc, 3212 Local<Value> recv, int argc,
3208 Handle<Value> argv[]); 3213 Local<Value> argv[]);
3209 3214
3210 void SetName(Handle<String> name); 3215 void SetName(Local<String> name);
3211 Handle<Value> GetName() const; 3216 Local<Value> GetName() const;
3212 3217
3213 /** 3218 /**
3214 * Name inferred from variable or property assignment of this function. 3219 * Name inferred from variable or property assignment of this function.
3215 * Used to facilitate debugging and profiling of JavaScript code written 3220 * Used to facilitate debugging and profiling of JavaScript code written
3216 * in an OO style, where many functions are anonymous but are assigned 3221 * in an OO style, where many functions are anonymous but are assigned
3217 * to object properties. 3222 * to object properties.
3218 */ 3223 */
3219 Handle<Value> GetInferredName() const; 3224 Local<Value> GetInferredName() const;
3220 3225
3221 /** 3226 /**
3222 * User-defined name assigned to the "displayName" property of this function. 3227 * User-defined name assigned to the "displayName" property of this function.
3223 * Used to facilitate debugging and profiling of JavaScript code. 3228 * Used to facilitate debugging and profiling of JavaScript code.
3224 */ 3229 */
3225 Handle<Value> GetDisplayName() const; 3230 Local<Value> GetDisplayName() const;
3226 3231
3227 /** 3232 /**
3228 * Returns zero based line number of function body and 3233 * Returns zero based line number of function body and
3229 * kLineOffsetNotFound if no information available. 3234 * kLineOffsetNotFound if no information available.
3230 */ 3235 */
3231 int GetScriptLineNumber() const; 3236 int GetScriptLineNumber() const;
3232 /** 3237 /**
3233 * Returns zero based column number of function body and 3238 * Returns zero based column number of function body and
3234 * kLineOffsetNotFound if no information available. 3239 * kLineOffsetNotFound if no information available.
3235 */ 3240 */
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 3284
3280 /** 3285 /**
3281 * Extract the associated promise. 3286 * Extract the associated promise.
3282 */ 3287 */
3283 Local<Promise> GetPromise(); 3288 Local<Promise> GetPromise();
3284 3289
3285 /** 3290 /**
3286 * Resolve/reject the associated promise with a given value. 3291 * Resolve/reject the associated promise with a given value.
3287 * Ignored if the promise is no longer pending. 3292 * Ignored if the promise is no longer pending.
3288 */ 3293 */
3289 V8_DEPRECATE_SOON("Use maybe version", void Resolve(Handle<Value> value)); 3294 V8_DEPRECATE_SOON("Use maybe version", void Resolve(Local<Value> value));
3290 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT 3295 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
3291 Maybe<bool> Resolve(Local<Context> context, Handle<Value> value); 3296 Maybe<bool> Resolve(Local<Context> context, Local<Value> value);
3292 3297
3293 V8_DEPRECATE_SOON("Use maybe version", void Reject(Handle<Value> value)); 3298 V8_DEPRECATE_SOON("Use maybe version", void Reject(Local<Value> value));
3294 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT 3299 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
3295 Maybe<bool> Reject(Local<Context> context, Handle<Value> value); 3300 Maybe<bool> Reject(Local<Context> context, Local<Value> value);
3296 3301
3297 V8_INLINE static Resolver* Cast(Value* obj); 3302 V8_INLINE static Resolver* Cast(Value* obj);
3298 3303
3299 private: 3304 private:
3300 Resolver(); 3305 Resolver();
3301 static void CheckCast(Value* obj); 3306 static void CheckCast(Value* obj);
3302 }; 3307 };
3303 3308
3304 /** 3309 /**
3305 * Register a resolution/rejection handler with a promise. 3310 * Register a resolution/rejection handler with a promise.
3306 * The handler is given the respective resolution/rejection value as 3311 * The handler is given the respective resolution/rejection value as
3307 * an argument. If the promise is already resolved/rejected, the handler is 3312 * an argument. If the promise is already resolved/rejected, the handler is
3308 * invoked at the end of turn. 3313 * invoked at the end of turn.
3309 */ 3314 */
3310 V8_DEPRECATE_SOON("Use maybe version", 3315 V8_DEPRECATE_SOON("Use maybe version",
3311 Local<Promise> Chain(Handle<Function> handler)); 3316 Local<Promise> Chain(Local<Function> handler));
3312 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Chain(Local<Context> context, 3317 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Chain(Local<Context> context,
3313 Handle<Function> handler); 3318 Local<Function> handler);
3314 3319
3315 V8_DEPRECATE_SOON("Use maybe version", 3320 V8_DEPRECATE_SOON("Use maybe version",
3316 Local<Promise> Catch(Handle<Function> handler)); 3321 Local<Promise> Catch(Local<Function> handler));
3317 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context, 3322 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context,
3318 Handle<Function> handler); 3323 Local<Function> handler);
3319 3324
3320 V8_DEPRECATE_SOON("Use maybe version", 3325 V8_DEPRECATE_SOON("Use maybe version",
3321 Local<Promise> Then(Handle<Function> handler)); 3326 Local<Promise> Then(Local<Function> handler));
3322 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context, 3327 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context,
3323 Handle<Function> handler); 3328 Local<Function> handler);
3324 3329
3325 /** 3330 /**
3326 * Returns true if the promise has at least one derived promise, and 3331 * Returns true if the promise has at least one derived promise, and
3327 * therefore resolve/reject handlers (including default handler). 3332 * therefore resolve/reject handlers (including default handler).
3328 */ 3333 */
3329 bool HasHandler(); 3334 bool HasHandler();
3330 3335
3331 V8_INLINE static Promise* Cast(Value* obj); 3336 V8_INLINE static Promise* Cast(Value* obj);
3332 3337
3333 private: 3338 private:
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
3555 static void CheckCast(Value* obj); 3560 static void CheckCast(Value* obj);
3556 }; 3561 };
3557 3562
3558 3563
3559 /** 3564 /**
3560 * An instance of Uint8Array constructor (ES6 draft 15.13.6). 3565 * An instance of Uint8Array constructor (ES6 draft 15.13.6).
3561 * This API is experimental and may change significantly. 3566 * This API is experimental and may change significantly.
3562 */ 3567 */
3563 class V8_EXPORT Uint8Array : public TypedArray { 3568 class V8_EXPORT Uint8Array : public TypedArray {
3564 public: 3569 public:
3565 static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer, 3570 static Local<Uint8Array> New(Local<ArrayBuffer> array_buffer,
3566 size_t byte_offset, size_t length); 3571 size_t byte_offset, size_t length);
3567 static Local<Uint8Array> New(Handle<SharedArrayBuffer> shared_array_buffer, 3572 static Local<Uint8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
3568 size_t byte_offset, size_t length); 3573 size_t byte_offset, size_t length);
3569 V8_INLINE static Uint8Array* Cast(Value* obj); 3574 V8_INLINE static Uint8Array* Cast(Value* obj);
3570 3575
3571 private: 3576 private:
3572 Uint8Array(); 3577 Uint8Array();
3573 static void CheckCast(Value* obj); 3578 static void CheckCast(Value* obj);
3574 }; 3579 };
3575 3580
3576 3581
3577 /** 3582 /**
3578 * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6). 3583 * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6).
3579 * This API is experimental and may change significantly. 3584 * This API is experimental and may change significantly.
3580 */ 3585 */
3581 class V8_EXPORT Uint8ClampedArray : public TypedArray { 3586 class V8_EXPORT Uint8ClampedArray : public TypedArray {
3582 public: 3587 public:
3583 static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer, 3588 static Local<Uint8ClampedArray> New(Local<ArrayBuffer> array_buffer,
3584 size_t byte_offset, size_t length); 3589 size_t byte_offset, size_t length);
3585 static Local<Uint8ClampedArray> New( 3590 static Local<Uint8ClampedArray> New(
3586 Handle<SharedArrayBuffer> shared_array_buffer, size_t byte_offset, 3591 Local<SharedArrayBuffer> shared_array_buffer, size_t byte_offset,
3587 size_t length); 3592 size_t length);
3588 V8_INLINE static Uint8ClampedArray* Cast(Value* obj); 3593 V8_INLINE static Uint8ClampedArray* Cast(Value* obj);
3589 3594
3590 private: 3595 private:
3591 Uint8ClampedArray(); 3596 Uint8ClampedArray();
3592 static void CheckCast(Value* obj); 3597 static void CheckCast(Value* obj);
3593 }; 3598 };
3594 3599
3595 /** 3600 /**
3596 * An instance of Int8Array constructor (ES6 draft 15.13.6). 3601 * An instance of Int8Array constructor (ES6 draft 15.13.6).
3597 * This API is experimental and may change significantly. 3602 * This API is experimental and may change significantly.
3598 */ 3603 */
3599 class V8_EXPORT Int8Array : public TypedArray { 3604 class V8_EXPORT Int8Array : public TypedArray {
3600 public: 3605 public:
3601 static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer, 3606 static Local<Int8Array> New(Local<ArrayBuffer> array_buffer,
3602 size_t byte_offset, size_t length); 3607 size_t byte_offset, size_t length);
3603 static Local<Int8Array> New(Handle<SharedArrayBuffer> shared_array_buffer, 3608 static Local<Int8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
3604 size_t byte_offset, size_t length); 3609 size_t byte_offset, size_t length);
3605 V8_INLINE static Int8Array* Cast(Value* obj); 3610 V8_INLINE static Int8Array* Cast(Value* obj);
3606 3611
3607 private: 3612 private:
3608 Int8Array(); 3613 Int8Array();
3609 static void CheckCast(Value* obj); 3614 static void CheckCast(Value* obj);
3610 }; 3615 };
3611 3616
3612 3617
3613 /** 3618 /**
3614 * An instance of Uint16Array constructor (ES6 draft 15.13.6). 3619 * An instance of Uint16Array constructor (ES6 draft 15.13.6).
3615 * This API is experimental and may change significantly. 3620 * This API is experimental and may change significantly.
3616 */ 3621 */
3617 class V8_EXPORT Uint16Array : public TypedArray { 3622 class V8_EXPORT Uint16Array : public TypedArray {
3618 public: 3623 public:
3619 static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer, 3624 static Local<Uint16Array> New(Local<ArrayBuffer> array_buffer,
3620 size_t byte_offset, size_t length); 3625 size_t byte_offset, size_t length);
3621 static Local<Uint16Array> New(Handle<SharedArrayBuffer> shared_array_buffer, 3626 static Local<Uint16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
3622 size_t byte_offset, size_t length); 3627 size_t byte_offset, size_t length);
3623 V8_INLINE static Uint16Array* Cast(Value* obj); 3628 V8_INLINE static Uint16Array* Cast(Value* obj);
3624 3629
3625 private: 3630 private:
3626 Uint16Array(); 3631 Uint16Array();
3627 static void CheckCast(Value* obj); 3632 static void CheckCast(Value* obj);
3628 }; 3633 };
3629 3634
3630 3635
3631 /** 3636 /**
3632 * An instance of Int16Array constructor (ES6 draft 15.13.6). 3637 * An instance of Int16Array constructor (ES6 draft 15.13.6).
3633 * This API is experimental and may change significantly. 3638 * This API is experimental and may change significantly.
3634 */ 3639 */
3635 class V8_EXPORT Int16Array : public TypedArray { 3640 class V8_EXPORT Int16Array : public TypedArray {
3636 public: 3641 public:
3637 static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer, 3642 static Local<Int16Array> New(Local<ArrayBuffer> array_buffer,
3638 size_t byte_offset, size_t length); 3643 size_t byte_offset, size_t length);
3639 static Local<Int16Array> New(Handle<SharedArrayBuffer> shared_array_buffer, 3644 static Local<Int16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
3640 size_t byte_offset, size_t length); 3645 size_t byte_offset, size_t length);
3641 V8_INLINE static Int16Array* Cast(Value* obj); 3646 V8_INLINE static Int16Array* Cast(Value* obj);
3642 3647
3643 private: 3648 private:
3644 Int16Array(); 3649 Int16Array();
3645 static void CheckCast(Value* obj); 3650 static void CheckCast(Value* obj);
3646 }; 3651 };
3647 3652
3648 3653
3649 /** 3654 /**
3650 * An instance of Uint32Array constructor (ES6 draft 15.13.6). 3655 * An instance of Uint32Array constructor (ES6 draft 15.13.6).
3651 * This API is experimental and may change significantly. 3656 * This API is experimental and may change significantly.
3652 */ 3657 */
3653 class V8_EXPORT Uint32Array : public TypedArray { 3658 class V8_EXPORT Uint32Array : public TypedArray {
3654 public: 3659 public:
3655 static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer, 3660 static Local<Uint32Array> New(Local<ArrayBuffer> array_buffer,
3656 size_t byte_offset, size_t length); 3661 size_t byte_offset, size_t length);
3657 static Local<Uint32Array> New(Handle<SharedArrayBuffer> shared_array_buffer, 3662 static Local<Uint32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
3658 size_t byte_offset, size_t length); 3663 size_t byte_offset, size_t length);
3659 V8_INLINE static Uint32Array* Cast(Value* obj); 3664 V8_INLINE static Uint32Array* Cast(Value* obj);
3660 3665
3661 private: 3666 private:
3662 Uint32Array(); 3667 Uint32Array();
3663 static void CheckCast(Value* obj); 3668 static void CheckCast(Value* obj);
3664 }; 3669 };
3665 3670
3666 3671
3667 /** 3672 /**
3668 * An instance of Int32Array constructor (ES6 draft 15.13.6). 3673 * An instance of Int32Array constructor (ES6 draft 15.13.6).
3669 * This API is experimental and may change significantly. 3674 * This API is experimental and may change significantly.
3670 */ 3675 */
3671 class V8_EXPORT Int32Array : public TypedArray { 3676 class V8_EXPORT Int32Array : public TypedArray {
3672 public: 3677 public:
3673 static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer, 3678 static Local<Int32Array> New(Local<ArrayBuffer> array_buffer,
3674 size_t byte_offset, size_t length); 3679 size_t byte_offset, size_t length);
3675 static Local<Int32Array> New(Handle<SharedArrayBuffer> shared_array_buffer, 3680 static Local<Int32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
3676 size_t byte_offset, size_t length); 3681 size_t byte_offset, size_t length);
3677 V8_INLINE static Int32Array* Cast(Value* obj); 3682 V8_INLINE static Int32Array* Cast(Value* obj);
3678 3683
3679 private: 3684 private:
3680 Int32Array(); 3685 Int32Array();
3681 static void CheckCast(Value* obj); 3686 static void CheckCast(Value* obj);
3682 }; 3687 };
3683 3688
3684 3689
3685 /** 3690 /**
3686 * An instance of Float32Array constructor (ES6 draft 15.13.6). 3691 * An instance of Float32Array constructor (ES6 draft 15.13.6).
3687 * This API is experimental and may change significantly. 3692 * This API is experimental and may change significantly.
3688 */ 3693 */
3689 class V8_EXPORT Float32Array : public TypedArray { 3694 class V8_EXPORT Float32Array : public TypedArray {
3690 public: 3695 public:
3691 static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer, 3696 static Local<Float32Array> New(Local<ArrayBuffer> array_buffer,
3692 size_t byte_offset, size_t length); 3697 size_t byte_offset, size_t length);
3693 static Local<Float32Array> New(Handle<SharedArrayBuffer> shared_array_buffer, 3698 static Local<Float32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
3694 size_t byte_offset, size_t length); 3699 size_t byte_offset, size_t length);
3695 V8_INLINE static Float32Array* Cast(Value* obj); 3700 V8_INLINE static Float32Array* Cast(Value* obj);
3696 3701
3697 private: 3702 private:
3698 Float32Array(); 3703 Float32Array();
3699 static void CheckCast(Value* obj); 3704 static void CheckCast(Value* obj);
3700 }; 3705 };
3701 3706
3702 3707
3703 /** 3708 /**
3704 * An instance of Float64Array constructor (ES6 draft 15.13.6). 3709 * An instance of Float64Array constructor (ES6 draft 15.13.6).
3705 * This API is experimental and may change significantly. 3710 * This API is experimental and may change significantly.
3706 */ 3711 */
3707 class V8_EXPORT Float64Array : public TypedArray { 3712 class V8_EXPORT Float64Array : public TypedArray {
3708 public: 3713 public:
3709 static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer, 3714 static Local<Float64Array> New(Local<ArrayBuffer> array_buffer,
3710 size_t byte_offset, size_t length); 3715 size_t byte_offset, size_t length);
3711 static Local<Float64Array> New(Handle<SharedArrayBuffer> shared_array_buffer, 3716 static Local<Float64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
3712 size_t byte_offset, size_t length); 3717 size_t byte_offset, size_t length);
3713 V8_INLINE static Float64Array* Cast(Value* obj); 3718 V8_INLINE static Float64Array* Cast(Value* obj);
3714 3719
3715 private: 3720 private:
3716 Float64Array(); 3721 Float64Array();
3717 static void CheckCast(Value* obj); 3722 static void CheckCast(Value* obj);
3718 }; 3723 };
3719 3724
3720 3725
3721 /** 3726 /**
3722 * An instance of DataView constructor (ES6 draft 15.13.7). 3727 * An instance of DataView constructor (ES6 draft 15.13.7).
3723 * This API is experimental and may change significantly. 3728 * This API is experimental and may change significantly.
3724 */ 3729 */
3725 class V8_EXPORT DataView : public ArrayBufferView { 3730 class V8_EXPORT DataView : public ArrayBufferView {
3726 public: 3731 public:
3727 static Local<DataView> New(Handle<ArrayBuffer> array_buffer, 3732 static Local<DataView> New(Local<ArrayBuffer> array_buffer,
3728 size_t byte_offset, size_t length); 3733 size_t byte_offset, size_t length);
3729 static Local<DataView> New(Handle<SharedArrayBuffer> shared_array_buffer, 3734 static Local<DataView> New(Local<SharedArrayBuffer> shared_array_buffer,
3730 size_t byte_offset, size_t length); 3735 size_t byte_offset, size_t length);
3731 V8_INLINE static DataView* Cast(Value* obj); 3736 V8_INLINE static DataView* Cast(Value* obj);
3732 3737
3733 private: 3738 private:
3734 DataView(); 3739 DataView();
3735 static void CheckCast(Value* obj); 3740 static void CheckCast(Value* obj);
3736 }; 3741 };
3737 3742
3738 3743
3739 /** 3744 /**
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
3902 private: 3907 private:
3903 static void CheckCast(v8::Value* obj); 3908 static void CheckCast(v8::Value* obj);
3904 }; 3909 };
3905 3910
3906 3911
3907 /** 3912 /**
3908 * A String object (ECMA-262, 4.3.18). 3913 * A String object (ECMA-262, 4.3.18).
3909 */ 3914 */
3910 class V8_EXPORT StringObject : public Object { 3915 class V8_EXPORT StringObject : public Object {
3911 public: 3916 public:
3912 static Local<Value> New(Handle<String> value); 3917 static Local<Value> New(Local<String> value);
3913 3918
3914 Local<String> ValueOf() const; 3919 Local<String> ValueOf() const;
3915 3920
3916 V8_INLINE static StringObject* Cast(v8::Value* obj); 3921 V8_INLINE static StringObject* Cast(v8::Value* obj);
3917 3922
3918 private: 3923 private:
3919 static void CheckCast(v8::Value* obj); 3924 static void CheckCast(v8::Value* obj);
3920 }; 3925 };
3921 3926
3922 3927
3923 /** 3928 /**
3924 * A Symbol object (ECMA-262 edition 6). 3929 * A Symbol object (ECMA-262 edition 6).
3925 * 3930 *
3926 * This is an experimental feature. Use at your own risk. 3931 * This is an experimental feature. Use at your own risk.
3927 */ 3932 */
3928 class V8_EXPORT SymbolObject : public Object { 3933 class V8_EXPORT SymbolObject : public Object {
3929 public: 3934 public:
3930 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); 3935 static Local<Value> New(Isolate* isolate, Local<Symbol> value);
3931 3936
3932 Local<Symbol> ValueOf() const; 3937 Local<Symbol> ValueOf() const;
3933 3938
3934 V8_INLINE static SymbolObject* Cast(v8::Value* obj); 3939 V8_INLINE static SymbolObject* Cast(v8::Value* obj);
3935 3940
3936 private: 3941 private:
3937 static void CheckCast(v8::Value* obj); 3942 static void CheckCast(v8::Value* obj);
3938 }; 3943 };
3939 3944
3940 3945
(...skipping 17 matching lines...) Expand all
3958 * Creates a regular expression from the given pattern string and 3963 * Creates a regular expression from the given pattern string and
3959 * the flags bit field. May throw a JavaScript exception as 3964 * the flags bit field. May throw a JavaScript exception as
3960 * described in ECMA-262, 15.10.4.1. 3965 * described in ECMA-262, 15.10.4.1.
3961 * 3966 *
3962 * For example, 3967 * For example,
3963 * RegExp::New(v8::String::New("foo"), 3968 * RegExp::New(v8::String::New("foo"),
3964 * static_cast<RegExp::Flags>(kGlobal | kMultiline)) 3969 * static_cast<RegExp::Flags>(kGlobal | kMultiline))
3965 * is equivalent to evaluating "/foo/gm". 3970 * is equivalent to evaluating "/foo/gm".
3966 */ 3971 */
3967 static V8_DEPRECATE_SOON("Use maybe version", 3972 static V8_DEPRECATE_SOON("Use maybe version",
3968 Local<RegExp> New(Handle<String> pattern, 3973 Local<RegExp> New(Local<String> pattern,
3969 Flags flags)); 3974 Flags flags));
3970 static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> New(Local<Context> context, 3975 static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> New(Local<Context> context,
3971 Handle<String> pattern, 3976 Local<String> pattern,
3972 Flags flags); 3977 Flags flags);
3973 3978
3974 /** 3979 /**
3975 * Returns the value of the source property: a string representing 3980 * Returns the value of the source property: a string representing
3976 * the regular expression. 3981 * the regular expression.
3977 */ 3982 */
3978 Local<String> GetSource() const; 3983 Local<String> GetSource() const;
3979 3984
3980 /** 3985 /**
3981 * Returns the flags bit field. 3986 * Returns the flags bit field.
(...skipping 23 matching lines...) Expand all
4005 4010
4006 // --- Templates --- 4011 // --- Templates ---
4007 4012
4008 4013
4009 /** 4014 /**
4010 * The superclass of object and function templates. 4015 * The superclass of object and function templates.
4011 */ 4016 */
4012 class V8_EXPORT Template : public Data { 4017 class V8_EXPORT Template : public Data {
4013 public: 4018 public:
4014 /** Adds a property to each instance created by this template.*/ 4019 /** Adds a property to each instance created by this template.*/
4015 void Set(Handle<Name> name, Handle<Data> value, 4020 void Set(Local<Name> name, Local<Data> value,
4016 PropertyAttribute attributes = None); 4021 PropertyAttribute attributes = None);
4017 V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value); 4022 V8_INLINE void Set(Isolate* isolate, const char* name, Local<Data> value);
4018 4023
4019 void SetAccessorProperty( 4024 void SetAccessorProperty(
4020 Local<Name> name, 4025 Local<Name> name,
4021 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), 4026 Local<FunctionTemplate> getter = Local<FunctionTemplate>(),
4022 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), 4027 Local<FunctionTemplate> setter = Local<FunctionTemplate>(),
4023 PropertyAttribute attribute = None, 4028 PropertyAttribute attribute = None,
4024 AccessControl settings = DEFAULT); 4029 AccessControl settings = DEFAULT);
4025 4030
4026 /** 4031 /**
4027 * Whenever the property with the given name is accessed on objects 4032 * Whenever the property with the given name is accessed on objects
(...skipping 15 matching lines...) Expand all
4043 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all 4048 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
4044 * cross-context access. 4049 * cross-context access.
4045 * \param attribute The attributes of the property for which an accessor 4050 * \param attribute The attributes of the property for which an accessor
4046 * is added. 4051 * is added.
4047 * \param signature The signature describes valid receivers for the accessor 4052 * \param signature The signature describes valid receivers for the accessor
4048 * and is used to perform implicit instance checks against them. If the 4053 * and is used to perform implicit instance checks against them. If the
4049 * receiver is incompatible (i.e. is not an instance of the constructor as 4054 * receiver is incompatible (i.e. is not an instance of the constructor as
4050 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is 4055 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
4051 * thrown and no callback is invoked. 4056 * thrown and no callback is invoked.
4052 */ 4057 */
4053 void SetNativeDataProperty(Local<String> name, 4058 void SetNativeDataProperty(
4054 AccessorGetterCallback getter, 4059 Local<String> name, AccessorGetterCallback getter,
4055 AccessorSetterCallback setter = 0, 4060 AccessorSetterCallback setter = 0,
4056 // TODO(dcarney): gcc can't handle Local below 4061 // TODO(dcarney): gcc can't handle Local below
4057 Handle<Value> data = Handle<Value>(), 4062 Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
4058 PropertyAttribute attribute = None, 4063 Local<AccessorSignature> signature = Local<AccessorSignature>(),
4059 Local<AccessorSignature> signature = 4064 AccessControl settings = DEFAULT);
4060 Local<AccessorSignature>(), 4065 void SetNativeDataProperty(
4061 AccessControl settings = DEFAULT); 4066 Local<Name> name, AccessorNameGetterCallback getter,
4062 void SetNativeDataProperty(Local<Name> name, 4067 AccessorNameSetterCallback setter = 0,
4063 AccessorNameGetterCallback getter, 4068 // TODO(dcarney): gcc can't handle Local below
4064 AccessorNameSetterCallback setter = 0, 4069 Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
4065 // TODO(dcarney): gcc can't handle Local below 4070 Local<AccessorSignature> signature = Local<AccessorSignature>(),
4066 Handle<Value> data = Handle<Value>(), 4071 AccessControl settings = DEFAULT);
4067 PropertyAttribute attribute = None,
4068 Local<AccessorSignature> signature =
4069 Local<AccessorSignature>(),
4070 AccessControl settings = DEFAULT);
4071 4072
4072 private: 4073 private:
4073 Template(); 4074 Template();
4074 4075
4075 friend class ObjectTemplate; 4076 friend class ObjectTemplate;
4076 friend class FunctionTemplate; 4077 friend class FunctionTemplate;
4077 }; 4078 };
4078 4079
4079 4080
4080 /** 4081 /**
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
4339 * \code 4340 * \code
4340 * child_func.prototype.__proto__ == function.prototype; 4341 * child_func.prototype.__proto__ == function.prototype;
4341 * child_instance.instance_accessor calls 'InstanceAccessorCallback' 4342 * child_instance.instance_accessor calls 'InstanceAccessorCallback'
4342 * child_instance.instance_property == 3; 4343 * child_instance.instance_property == 3;
4343 * \endcode 4344 * \endcode
4344 */ 4345 */
4345 class V8_EXPORT FunctionTemplate : public Template { 4346 class V8_EXPORT FunctionTemplate : public Template {
4346 public: 4347 public:
4347 /** Creates a function template.*/ 4348 /** Creates a function template.*/
4348 static Local<FunctionTemplate> New( 4349 static Local<FunctionTemplate> New(
4349 Isolate* isolate, 4350 Isolate* isolate, FunctionCallback callback = 0,
4350 FunctionCallback callback = 0, 4351 Local<Value> data = Local<Value>(),
4351 Handle<Value> data = Handle<Value>(), 4352 Local<Signature> signature = Local<Signature>(), int length = 0);
4352 Handle<Signature> signature = Handle<Signature>(),
4353 int length = 0);
4354 4353
4355 /** Returns the unique function instance in the current execution context.*/ 4354 /** Returns the unique function instance in the current execution context.*/
4356 V8_DEPRECATE_SOON("Use maybe version", Local<Function> GetFunction()); 4355 V8_DEPRECATE_SOON("Use maybe version", Local<Function> GetFunction());
4357 V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction( 4356 V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
4358 Local<Context> context); 4357 Local<Context> context);
4359 4358
4360 /** 4359 /**
4361 * Set the call-handler callback for a FunctionTemplate. This 4360 * Set the call-handler callback for a FunctionTemplate. This
4362 * callback is called whenever the function created from this 4361 * callback is called whenever the function created from this
4363 * FunctionTemplate is called. 4362 * FunctionTemplate is called.
4364 */ 4363 */
4365 void SetCallHandler(FunctionCallback callback, 4364 void SetCallHandler(FunctionCallback callback,
4366 Handle<Value> data = Handle<Value>()); 4365 Local<Value> data = Local<Value>());
4367 4366
4368 /** Set the predefined length property for the FunctionTemplate. */ 4367 /** Set the predefined length property for the FunctionTemplate. */
4369 void SetLength(int length); 4368 void SetLength(int length);
4370 4369
4371 /** Get the InstanceTemplate. */ 4370 /** Get the InstanceTemplate. */
4372 Local<ObjectTemplate> InstanceTemplate(); 4371 Local<ObjectTemplate> InstanceTemplate();
4373 4372
4374 /** Causes the function template to inherit from a parent function template.*/ 4373 /** Causes the function template to inherit from a parent function template.*/
4375 void Inherit(Handle<FunctionTemplate> parent); 4374 void Inherit(Local<FunctionTemplate> parent);
4376 4375
4377 /** 4376 /**
4378 * A PrototypeTemplate is the template used to create the prototype object 4377 * A PrototypeTemplate is the template used to create the prototype object
4379 * of the function created by this template. 4378 * of the function created by this template.
4380 */ 4379 */
4381 Local<ObjectTemplate> PrototypeTemplate(); 4380 Local<ObjectTemplate> PrototypeTemplate();
4382 4381
4383 /** 4382 /**
4384 * Set the class name of the FunctionTemplate. This is used for 4383 * Set the class name of the FunctionTemplate. This is used for
4385 * printing objects created with the function created from the 4384 * printing objects created with the function created from the
4386 * FunctionTemplate as its constructor. 4385 * FunctionTemplate as its constructor.
4387 */ 4386 */
4388 void SetClassName(Handle<String> name); 4387 void SetClassName(Local<String> name);
4389 4388
4390 4389
4391 /** 4390 /**
4392 * When set to true, no access check will be performed on the receiver of a 4391 * When set to true, no access check will be performed on the receiver of a
4393 * function call. Currently defaults to true, but this is subject to change. 4392 * function call. Currently defaults to true, but this is subject to change.
4394 */ 4393 */
4395 void SetAcceptAnyReceiver(bool value); 4394 void SetAcceptAnyReceiver(bool value);
4396 4395
4397 /** 4396 /**
4398 * Determines whether the __proto__ accessor ignores instances of 4397 * Determines whether the __proto__ accessor ignores instances of
(...skipping 18 matching lines...) Expand all
4417 /** 4416 /**
4418 * Removes the prototype property from functions created from this 4417 * Removes the prototype property from functions created from this
4419 * FunctionTemplate. 4418 * FunctionTemplate.
4420 */ 4419 */
4421 void RemovePrototype(); 4420 void RemovePrototype();
4422 4421
4423 /** 4422 /**
4424 * Returns true if the given object is an instance of this function 4423 * Returns true if the given object is an instance of this function
4425 * template. 4424 * template.
4426 */ 4425 */
4427 bool HasInstance(Handle<Value> object); 4426 bool HasInstance(Local<Value> object);
4428 4427
4429 private: 4428 private:
4430 FunctionTemplate(); 4429 FunctionTemplate();
4431 friend class Context; 4430 friend class Context;
4432 friend class ObjectTemplate; 4431 friend class ObjectTemplate;
4433 }; 4432 };
4434 4433
4435 4434
4436 enum class PropertyHandlerFlags { 4435 enum class PropertyHandlerFlags {
4437 kNone = 0, 4436 kNone = 0,
4438 // See ALL_CAN_READ above. 4437 // See ALL_CAN_READ above.
4439 kAllCanRead = 1, 4438 kAllCanRead = 1,
4440 // Will not call into interceptor for properties on the receiver or prototype 4439 // Will not call into interceptor for properties on the receiver or prototype
4441 // chain. Currently only valid for named interceptors. 4440 // chain. Currently only valid for named interceptors.
4442 kNonMasking = 1 << 1, 4441 kNonMasking = 1 << 1,
4443 // Will not call into interceptor for symbol lookup. Only meaningful for 4442 // Will not call into interceptor for symbol lookup. Only meaningful for
4444 // named interceptors. 4443 // named interceptors.
4445 kOnlyInterceptStrings = 1 << 2, 4444 kOnlyInterceptStrings = 1 << 2,
4446 }; 4445 };
4447 4446
4448 4447
4449 struct NamedPropertyHandlerConfiguration { 4448 struct NamedPropertyHandlerConfiguration {
4450 NamedPropertyHandlerConfiguration( 4449 NamedPropertyHandlerConfiguration(
4451 /** Note: getter is required **/ 4450 /** Note: getter is required **/
4452 GenericNamedPropertyGetterCallback getter = 0, 4451 GenericNamedPropertyGetterCallback getter = 0,
4453 GenericNamedPropertySetterCallback setter = 0, 4452 GenericNamedPropertySetterCallback setter = 0,
4454 GenericNamedPropertyQueryCallback query = 0, 4453 GenericNamedPropertyQueryCallback query = 0,
4455 GenericNamedPropertyDeleterCallback deleter = 0, 4454 GenericNamedPropertyDeleterCallback deleter = 0,
4456 GenericNamedPropertyEnumeratorCallback enumerator = 0, 4455 GenericNamedPropertyEnumeratorCallback enumerator = 0,
4457 Handle<Value> data = Handle<Value>(), 4456 Local<Value> data = Local<Value>(),
4458 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) 4457 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
4459 : getter(getter), 4458 : getter(getter),
4460 setter(setter), 4459 setter(setter),
4461 query(query), 4460 query(query),
4462 deleter(deleter), 4461 deleter(deleter),
4463 enumerator(enumerator), 4462 enumerator(enumerator),
4464 data(data), 4463 data(data),
4465 flags(flags) {} 4464 flags(flags) {}
4466 4465
4467 GenericNamedPropertyGetterCallback getter; 4466 GenericNamedPropertyGetterCallback getter;
4468 GenericNamedPropertySetterCallback setter; 4467 GenericNamedPropertySetterCallback setter;
4469 GenericNamedPropertyQueryCallback query; 4468 GenericNamedPropertyQueryCallback query;
4470 GenericNamedPropertyDeleterCallback deleter; 4469 GenericNamedPropertyDeleterCallback deleter;
4471 GenericNamedPropertyEnumeratorCallback enumerator; 4470 GenericNamedPropertyEnumeratorCallback enumerator;
4472 Handle<Value> data; 4471 Local<Value> data;
4473 PropertyHandlerFlags flags; 4472 PropertyHandlerFlags flags;
4474 }; 4473 };
4475 4474
4476 4475
4477 struct IndexedPropertyHandlerConfiguration { 4476 struct IndexedPropertyHandlerConfiguration {
4478 IndexedPropertyHandlerConfiguration( 4477 IndexedPropertyHandlerConfiguration(
4479 /** Note: getter is required **/ 4478 /** Note: getter is required **/
4480 IndexedPropertyGetterCallback getter = 0, 4479 IndexedPropertyGetterCallback getter = 0,
4481 IndexedPropertySetterCallback setter = 0, 4480 IndexedPropertySetterCallback setter = 0,
4482 IndexedPropertyQueryCallback query = 0, 4481 IndexedPropertyQueryCallback query = 0,
4483 IndexedPropertyDeleterCallback deleter = 0, 4482 IndexedPropertyDeleterCallback deleter = 0,
4484 IndexedPropertyEnumeratorCallback enumerator = 0, 4483 IndexedPropertyEnumeratorCallback enumerator = 0,
4485 Handle<Value> data = Handle<Value>(), 4484 Local<Value> data = Local<Value>(),
4486 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) 4485 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
4487 : getter(getter), 4486 : getter(getter),
4488 setter(setter), 4487 setter(setter),
4489 query(query), 4488 query(query),
4490 deleter(deleter), 4489 deleter(deleter),
4491 enumerator(enumerator), 4490 enumerator(enumerator),
4492 data(data), 4491 data(data),
4493 flags(flags) {} 4492 flags(flags) {}
4494 4493
4495 IndexedPropertyGetterCallback getter; 4494 IndexedPropertyGetterCallback getter;
4496 IndexedPropertySetterCallback setter; 4495 IndexedPropertySetterCallback setter;
4497 IndexedPropertyQueryCallback query; 4496 IndexedPropertyQueryCallback query;
4498 IndexedPropertyDeleterCallback deleter; 4497 IndexedPropertyDeleterCallback deleter;
4499 IndexedPropertyEnumeratorCallback enumerator; 4498 IndexedPropertyEnumeratorCallback enumerator;
4500 Handle<Value> data; 4499 Local<Value> data;
4501 PropertyHandlerFlags flags; 4500 PropertyHandlerFlags flags;
4502 }; 4501 };
4503 4502
4504 4503
4505 /** 4504 /**
4506 * An ObjectTemplate is used to create objects at runtime. 4505 * An ObjectTemplate is used to create objects at runtime.
4507 * 4506 *
4508 * Properties added to an ObjectTemplate are added to each object 4507 * Properties added to an ObjectTemplate are added to each object
4509 * created from the ObjectTemplate. 4508 * created from the ObjectTemplate.
4510 */ 4509 */
4511 class V8_EXPORT ObjectTemplate : public Template { 4510 class V8_EXPORT ObjectTemplate : public Template {
4512 public: 4511 public:
4513 /** Creates an ObjectTemplate. */ 4512 /** Creates an ObjectTemplate. */
4514 static Local<ObjectTemplate> New( 4513 static Local<ObjectTemplate> New(
4515 Isolate* isolate, 4514 Isolate* isolate,
4516 Handle<FunctionTemplate> constructor = Handle<FunctionTemplate>()); 4515 Local<FunctionTemplate> constructor = Local<FunctionTemplate>());
4517 static V8_DEPRECATE_SOON("Use isolate version", Local<ObjectTemplate> New()); 4516 static V8_DEPRECATE_SOON("Use isolate version", Local<ObjectTemplate> New());
4518 4517
4519 /** Creates a new instance of this template.*/ 4518 /** Creates a new instance of this template.*/
4520 V8_DEPRECATE_SOON("Use maybe version", Local<Object> NewInstance()); 4519 V8_DEPRECATE_SOON("Use maybe version", Local<Object> NewInstance());
4521 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context); 4520 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
4522 4521
4523 /** 4522 /**
4524 * Sets an accessor on the object template. 4523 * Sets an accessor on the object template.
4525 * 4524 *
4526 * Whenever the property with the given name is accessed on objects 4525 * Whenever the property with the given name is accessed on objects
(...skipping 15 matching lines...) Expand all
4542 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all 4541 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
4543 * cross-context access. 4542 * cross-context access.
4544 * \param attribute The attributes of the property for which an accessor 4543 * \param attribute The attributes of the property for which an accessor
4545 * is added. 4544 * is added.
4546 * \param signature The signature describes valid receivers for the accessor 4545 * \param signature The signature describes valid receivers for the accessor
4547 * and is used to perform implicit instance checks against them. If the 4546 * and is used to perform implicit instance checks against them. If the
4548 * receiver is incompatible (i.e. is not an instance of the constructor as 4547 * receiver is incompatible (i.e. is not an instance of the constructor as
4549 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is 4548 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
4550 * thrown and no callback is invoked. 4549 * thrown and no callback is invoked.
4551 */ 4550 */
4552 void SetAccessor(Handle<String> name, 4551 void SetAccessor(
4553 AccessorGetterCallback getter, 4552 Local<String> name, AccessorGetterCallback getter,
4554 AccessorSetterCallback setter = 0, 4553 AccessorSetterCallback setter = 0, Local<Value> data = Local<Value>(),
4555 Handle<Value> data = Handle<Value>(), 4554 AccessControl settings = DEFAULT, PropertyAttribute attribute = None,
4556 AccessControl settings = DEFAULT, 4555 Local<AccessorSignature> signature = Local<AccessorSignature>());
4557 PropertyAttribute attribute = None, 4556 void SetAccessor(
4558 Handle<AccessorSignature> signature = 4557 Local<Name> name, AccessorNameGetterCallback getter,
4559 Handle<AccessorSignature>()); 4558 AccessorNameSetterCallback setter = 0, Local<Value> data = Local<Value>(),
4560 void SetAccessor(Handle<Name> name, 4559 AccessControl settings = DEFAULT, PropertyAttribute attribute = None,
4561 AccessorNameGetterCallback getter, 4560 Local<AccessorSignature> signature = Local<AccessorSignature>());
4562 AccessorNameSetterCallback setter = 0,
4563 Handle<Value> data = Handle<Value>(),
4564 AccessControl settings = DEFAULT,
4565 PropertyAttribute attribute = None,
4566 Handle<AccessorSignature> signature =
4567 Handle<AccessorSignature>());
4568 4561
4569 /** 4562 /**
4570 * Sets a named property handler on the object template. 4563 * Sets a named property handler on the object template.
4571 * 4564 *
4572 * Whenever a property whose name is a string is accessed on objects created 4565 * Whenever a property whose name is a string is accessed on objects created
4573 * from this object template, the provided callback is invoked instead of 4566 * from this object template, the provided callback is invoked instead of
4574 * accessing the property directly on the JavaScript object. 4567 * accessing the property directly on the JavaScript object.
4575 * 4568 *
4576 * Note that new code should use the second version that can intercept 4569 * Note that new code should use the second version that can intercept
4577 * symbol-named properties as well as string-named properties. 4570 * symbol-named properties as well as string-named properties.
4578 * 4571 *
4579 * \param getter The callback to invoke when getting a property. 4572 * \param getter The callback to invoke when getting a property.
4580 * \param setter The callback to invoke when setting a property. 4573 * \param setter The callback to invoke when setting a property.
4581 * \param query The callback to invoke to check if a property is present, 4574 * \param query The callback to invoke to check if a property is present,
4582 * and if present, get its attributes. 4575 * and if present, get its attributes.
4583 * \param deleter The callback to invoke when deleting a property. 4576 * \param deleter The callback to invoke when deleting a property.
4584 * \param enumerator The callback to invoke to enumerate all the named 4577 * \param enumerator The callback to invoke to enumerate all the named
4585 * properties of an object. 4578 * properties of an object.
4586 * \param data A piece of data that will be passed to the callbacks 4579 * \param data A piece of data that will be passed to the callbacks
4587 * whenever they are invoked. 4580 * whenever they are invoked.
4588 */ 4581 */
4589 // TODO(dcarney): deprecate 4582 // TODO(dcarney): deprecate
4590 void SetNamedPropertyHandler( 4583 void SetNamedPropertyHandler(NamedPropertyGetterCallback getter,
4591 NamedPropertyGetterCallback getter, 4584 NamedPropertySetterCallback setter = 0,
4592 NamedPropertySetterCallback setter = 0, 4585 NamedPropertyQueryCallback query = 0,
4593 NamedPropertyQueryCallback query = 0, 4586 NamedPropertyDeleterCallback deleter = 0,
4594 NamedPropertyDeleterCallback deleter = 0, 4587 NamedPropertyEnumeratorCallback enumerator = 0,
4595 NamedPropertyEnumeratorCallback enumerator = 0, 4588 Local<Value> data = Local<Value>());
4596 Handle<Value> data = Handle<Value>());
4597 void SetHandler(const NamedPropertyHandlerConfiguration& configuration); 4589 void SetHandler(const NamedPropertyHandlerConfiguration& configuration);
4598 4590
4599 /** 4591 /**
4600 * Sets an indexed property handler on the object template. 4592 * Sets an indexed property handler on the object template.
4601 * 4593 *
4602 * Whenever an indexed property is accessed on objects created from 4594 * Whenever an indexed property is accessed on objects created from
4603 * this object template, the provided callback is invoked instead of 4595 * this object template, the provided callback is invoked instead of
4604 * accessing the property directly on the JavaScript object. 4596 * accessing the property directly on the JavaScript object.
4605 * 4597 *
4606 * \param getter The callback to invoke when getting a property. 4598 * \param getter The callback to invoke when getting a property.
4607 * \param setter The callback to invoke when setting a property. 4599 * \param setter The callback to invoke when setting a property.
4608 * \param query The callback to invoke to check if an object has a property. 4600 * \param query The callback to invoke to check if an object has a property.
4609 * \param deleter The callback to invoke when deleting a property. 4601 * \param deleter The callback to invoke when deleting a property.
4610 * \param enumerator The callback to invoke to enumerate all the indexed 4602 * \param enumerator The callback to invoke to enumerate all the indexed
4611 * properties of an object. 4603 * properties of an object.
4612 * \param data A piece of data that will be passed to the callbacks 4604 * \param data A piece of data that will be passed to the callbacks
4613 * whenever they are invoked. 4605 * whenever they are invoked.
4614 */ 4606 */
4615 void SetHandler(const IndexedPropertyHandlerConfiguration& configuration); 4607 void SetHandler(const IndexedPropertyHandlerConfiguration& configuration);
4616 // TODO(dcarney): deprecate 4608 // TODO(dcarney): deprecate
4617 void SetIndexedPropertyHandler( 4609 void SetIndexedPropertyHandler(
4618 IndexedPropertyGetterCallback getter, 4610 IndexedPropertyGetterCallback getter,
4619 IndexedPropertySetterCallback setter = 0, 4611 IndexedPropertySetterCallback setter = 0,
4620 IndexedPropertyQueryCallback query = 0, 4612 IndexedPropertyQueryCallback query = 0,
4621 IndexedPropertyDeleterCallback deleter = 0, 4613 IndexedPropertyDeleterCallback deleter = 0,
4622 IndexedPropertyEnumeratorCallback enumerator = 0, 4614 IndexedPropertyEnumeratorCallback enumerator = 0,
4623 Handle<Value> data = Handle<Value>()) { 4615 Local<Value> data = Local<Value>()) {
4624 SetHandler(IndexedPropertyHandlerConfiguration(getter, setter, query, 4616 SetHandler(IndexedPropertyHandlerConfiguration(getter, setter, query,
4625 deleter, enumerator, data)); 4617 deleter, enumerator, data));
4626 } 4618 }
4627 /** 4619 /**
4628 * Sets the callback to be used when calling instances created from 4620 * Sets the callback to be used when calling instances created from
4629 * this template as a function. If no callback is set, instances 4621 * this template as a function. If no callback is set, instances
4630 * behave like normal JavaScript objects that cannot be called as a 4622 * behave like normal JavaScript objects that cannot be called as a
4631 * function. 4623 * function.
4632 */ 4624 */
4633 void SetCallAsFunctionHandler(FunctionCallback callback, 4625 void SetCallAsFunctionHandler(FunctionCallback callback,
4634 Handle<Value> data = Handle<Value>()); 4626 Local<Value> data = Local<Value>());
4635 4627
4636 /** 4628 /**
4637 * Mark object instances of the template as undetectable. 4629 * Mark object instances of the template as undetectable.
4638 * 4630 *
4639 * In many ways, undetectable objects behave as though they are not 4631 * In many ways, undetectable objects behave as though they are not
4640 * there. They behave like 'undefined' in conditionals and when 4632 * there. They behave like 'undefined' in conditionals and when
4641 * printed. However, properties can be accessed and called as on 4633 * printed. However, properties can be accessed and called as on
4642 * normal objects. 4634 * normal objects.
4643 */ 4635 */
4644 void MarkAsUndetectable(); 4636 void MarkAsUndetectable();
4645 4637
4646 /** 4638 /**
4647 * Sets access check callbacks on the object template and enables 4639 * Sets access check callbacks on the object template and enables
4648 * access checks. 4640 * access checks.
4649 * 4641 *
4650 * When accessing properties on instances of this object template, 4642 * When accessing properties on instances of this object template,
4651 * the access check callback will be called to determine whether or 4643 * the access check callback will be called to determine whether or
4652 * not to allow cross-context access to the properties. 4644 * not to allow cross-context access to the properties.
4653 */ 4645 */
4654 void SetAccessCheckCallbacks(NamedSecurityCallback named_handler, 4646 void SetAccessCheckCallbacks(NamedSecurityCallback named_handler,
4655 IndexedSecurityCallback indexed_handler, 4647 IndexedSecurityCallback indexed_handler,
4656 Handle<Value> data = Handle<Value>()); 4648 Local<Value> data = Local<Value>());
4657 4649
4658 /** 4650 /**
4659 * Gets the number of internal fields for objects generated from 4651 * Gets the number of internal fields for objects generated from
4660 * this template. 4652 * this template.
4661 */ 4653 */
4662 int InternalFieldCount(); 4654 int InternalFieldCount();
4663 4655
4664 /** 4656 /**
4665 * Sets the number of internal fields for objects generated from 4657 * Sets the number of internal fields for objects generated from
4666 * this template. 4658 * this template.
4667 */ 4659 */
4668 void SetInternalFieldCount(int value); 4660 void SetInternalFieldCount(int value);
4669 4661
4670 private: 4662 private:
4671 ObjectTemplate(); 4663 ObjectTemplate();
4672 static Local<ObjectTemplate> New(internal::Isolate* isolate, 4664 static Local<ObjectTemplate> New(internal::Isolate* isolate,
4673 Handle<FunctionTemplate> constructor); 4665 Local<FunctionTemplate> constructor);
4674 friend class FunctionTemplate; 4666 friend class FunctionTemplate;
4675 }; 4667 };
4676 4668
4677 4669
4678 /** 4670 /**
4679 * A Signature specifies which receiver is valid for a function. 4671 * A Signature specifies which receiver is valid for a function.
4680 */ 4672 */
4681 class V8_EXPORT Signature : public Data { 4673 class V8_EXPORT Signature : public Data {
4682 public: 4674 public:
4683 static Local<Signature> New( 4675 static Local<Signature> New(
4684 Isolate* isolate, 4676 Isolate* isolate,
4685 Handle<FunctionTemplate> receiver = Handle<FunctionTemplate>()); 4677 Local<FunctionTemplate> receiver = Local<FunctionTemplate>());
4686 4678
4687 private: 4679 private:
4688 Signature(); 4680 Signature();
4689 }; 4681 };
4690 4682
4691 4683
4692 /** 4684 /**
4693 * An AccessorSignature specifies which receivers are valid parameters 4685 * An AccessorSignature specifies which receivers are valid parameters
4694 * to an accessor callback. 4686 * to an accessor callback.
4695 */ 4687 */
4696 class V8_EXPORT AccessorSignature : public Data { 4688 class V8_EXPORT AccessorSignature : public Data {
4697 public: 4689 public:
4698 static Local<AccessorSignature> New(Isolate* isolate, 4690 static Local<AccessorSignature> New(
4699 Handle<FunctionTemplate> receiver = 4691 Isolate* isolate,
4700 Handle<FunctionTemplate>()); 4692 Local<FunctionTemplate> receiver = Local<FunctionTemplate>());
4701 4693
4702 private: 4694 private:
4703 AccessorSignature(); 4695 AccessorSignature();
4704 }; 4696 };
4705 4697
4706 4698
4707 /** 4699 /**
4708 * A utility for determining the type of objects based on the template 4700 * A utility for determining the type of objects based on the template
4709 * they were constructed from. 4701 * they were constructed from.
4710 */ 4702 */
4711 class V8_EXPORT TypeSwitch : public Data { 4703 class V8_EXPORT TypeSwitch : public Data {
4712 public: 4704 public:
4713 static Local<TypeSwitch> New(Handle<FunctionTemplate> type); 4705 static Local<TypeSwitch> New(Local<FunctionTemplate> type);
4714 static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]); 4706 static Local<TypeSwitch> New(int argc, Local<FunctionTemplate> types[]);
4715 int match(Handle<Value> value); 4707 int match(Local<Value> value);
4708
4716 private: 4709 private:
4717 TypeSwitch(); 4710 TypeSwitch();
4718 }; 4711 };
4719 4712
4720 4713
4721 // --- Extensions --- 4714 // --- Extensions ---
4722 4715
4723 class V8_EXPORT ExternalOneByteStringResourceImpl 4716 class V8_EXPORT ExternalOneByteStringResourceImpl
4724 : public String::ExternalOneByteStringResource { 4717 : public String::ExternalOneByteStringResource {
4725 public: 4718 public:
(...skipping 14 matching lines...) Expand all
4740 class V8_EXPORT Extension { // NOLINT 4733 class V8_EXPORT Extension { // NOLINT
4741 public: 4734 public:
4742 // Note that the strings passed into this constructor must live as long 4735 // Note that the strings passed into this constructor must live as long
4743 // as the Extension itself. 4736 // as the Extension itself.
4744 Extension(const char* name, 4737 Extension(const char* name,
4745 const char* source = 0, 4738 const char* source = 0,
4746 int dep_count = 0, 4739 int dep_count = 0,
4747 const char** deps = 0, 4740 const char** deps = 0,
4748 int source_length = -1); 4741 int source_length = -1);
4749 virtual ~Extension() { } 4742 virtual ~Extension() { }
4750 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( 4743 virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
4751 v8::Isolate* isolate, v8::Handle<v8::String> name) { 4744 v8::Isolate* isolate, v8::Local<v8::String> name) {
4752 return v8::Handle<v8::FunctionTemplate>(); 4745 return v8::Local<v8::FunctionTemplate>();
4753 } 4746 }
4754 4747
4755 const char* name() const { return name_; } 4748 const char* name() const { return name_; }
4756 size_t source_length() const { return source_length_; } 4749 size_t source_length() const { return source_length_; }
4757 const String::ExternalOneByteStringResource* source() const { 4750 const String::ExternalOneByteStringResource* source() const {
4758 return &source_; } 4751 return &source_; }
4759 int dependency_count() { return dep_count_; } 4752 int dependency_count() { return dep_count_; }
4760 const char** dependencies() { return deps_; } 4753 const char** dependencies() { return deps_; }
4761 void set_auto_enable(bool value) { auto_enable_ = value; } 4754 void set_auto_enable(bool value) { auto_enable_ = value; }
4762 bool auto_enable() { return auto_enable_; } 4755 bool auto_enable() { return auto_enable_; }
(...skipping 10 matching lines...) Expand all
4773 Extension(const Extension&); 4766 Extension(const Extension&);
4774 void operator=(const Extension&); 4767 void operator=(const Extension&);
4775 }; 4768 };
4776 4769
4777 4770
4778 void V8_EXPORT RegisterExtension(Extension* extension); 4771 void V8_EXPORT RegisterExtension(Extension* extension);
4779 4772
4780 4773
4781 // --- Statics --- 4774 // --- Statics ---
4782 4775
4783 V8_INLINE Handle<Primitive> Undefined(Isolate* isolate); 4776 V8_INLINE Local<Primitive> Undefined(Isolate* isolate);
4784 V8_INLINE Handle<Primitive> Null(Isolate* isolate); 4777 V8_INLINE Local<Primitive> Null(Isolate* isolate);
4785 V8_INLINE Handle<Boolean> True(Isolate* isolate); 4778 V8_INLINE Local<Boolean> True(Isolate* isolate);
4786 V8_INLINE Handle<Boolean> False(Isolate* isolate); 4779 V8_INLINE Local<Boolean> False(Isolate* isolate);
4787 4780
4788 4781
4789 /** 4782 /**
4790 * A set of constraints that specifies the limits of the runtime's memory use. 4783 * A set of constraints that specifies the limits of the runtime's memory use.
4791 * You must set the heap size before initializing the VM - the size cannot be 4784 * You must set the heap size before initializing the VM - the size cannot be
4792 * adjusted after the VM is initialized. 4785 * adjusted after the VM is initialized.
4793 * 4786 *
4794 * If you are using threads then you should hold the V8::Locker lock while 4787 * If you are using threads then you should hold the V8::Locker lock while
4795 * setting the stack limit and you must set a non-default stack limit separately 4788 * setting the stack limit and you must set a non-default stack limit separately
4796 * for each thread. 4789 * for each thread.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4848 size_t code_range_size_; 4841 size_t code_range_size_;
4849 }; 4842 };
4850 4843
4851 4844
4852 // --- Exceptions --- 4845 // --- Exceptions ---
4853 4846
4854 4847
4855 typedef void (*FatalErrorCallback)(const char* location, const char* message); 4848 typedef void (*FatalErrorCallback)(const char* location, const char* message);
4856 4849
4857 4850
4858 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); 4851 typedef void (*MessageCallback)(Local<Message> message, Local<Value> error);
4859 4852
4860 // --- Tracing --- 4853 // --- Tracing ---
4861 4854
4862 typedef void (*LogEventCallback)(const char* name, int event); 4855 typedef void (*LogEventCallback)(const char* name, int event);
4863 4856
4864 /** 4857 /**
4865 * Create new error objects by calling the corresponding error object 4858 * Create new error objects by calling the corresponding error object
4866 * constructor with the message. 4859 * constructor with the message.
4867 */ 4860 */
4868 class V8_EXPORT Exception { 4861 class V8_EXPORT Exception {
4869 public: 4862 public:
4870 static Local<Value> RangeError(Handle<String> message); 4863 static Local<Value> RangeError(Local<String> message);
4871 static Local<Value> ReferenceError(Handle<String> message); 4864 static Local<Value> ReferenceError(Local<String> message);
4872 static Local<Value> SyntaxError(Handle<String> message); 4865 static Local<Value> SyntaxError(Local<String> message);
4873 static Local<Value> TypeError(Handle<String> message); 4866 static Local<Value> TypeError(Local<String> message);
4874 static Local<Value> Error(Handle<String> message); 4867 static Local<Value> Error(Local<String> message);
4875 4868
4876 /** 4869 /**
4877 * Creates an error message for the given exception. 4870 * Creates an error message for the given exception.
4878 * Will try to reconstruct the original stack trace from the exception value, 4871 * Will try to reconstruct the original stack trace from the exception value,
4879 * or capture the current stack trace if not available. 4872 * or capture the current stack trace if not available.
4880 */ 4873 */
4881 static Local<Message> CreateMessage(Handle<Value> exception); 4874 static Local<Message> CreateMessage(Local<Value> exception);
4882 4875
4883 /** 4876 /**
4884 * Returns the original stack trace that was captured at the creation time 4877 * Returns the original stack trace that was captured at the creation time
4885 * of a given exception, or an empty handle if not available. 4878 * of a given exception, or an empty handle if not available.
4886 */ 4879 */
4887 static Local<StackTrace> GetStackTrace(Handle<Value> exception); 4880 static Local<StackTrace> GetStackTrace(Local<Value> exception);
4888 }; 4881 };
4889 4882
4890 4883
4891 // --- Counters Callbacks --- 4884 // --- Counters Callbacks ---
4892 4885
4893 typedef int* (*CounterLookupCallback)(const char* name); 4886 typedef int* (*CounterLookupCallback)(const char* name);
4894 4887
4895 typedef void* (*CreateHistogramCallback)(const char* name, 4888 typedef void* (*CreateHistogramCallback)(const char* name,
4896 int min, 4889 int min,
4897 int max, 4890 int max,
(...skipping 27 matching lines...) Expand all
4925 typedef void (*CallCompletedCallback)(); 4918 typedef void (*CallCompletedCallback)();
4926 4919
4927 // --- Promise Reject Callback --- 4920 // --- Promise Reject Callback ---
4928 enum PromiseRejectEvent { 4921 enum PromiseRejectEvent {
4929 kPromiseRejectWithNoHandler = 0, 4922 kPromiseRejectWithNoHandler = 0,
4930 kPromiseHandlerAddedAfterReject = 1 4923 kPromiseHandlerAddedAfterReject = 1
4931 }; 4924 };
4932 4925
4933 class PromiseRejectMessage { 4926 class PromiseRejectMessage {
4934 public: 4927 public:
4935 PromiseRejectMessage(Handle<Promise> promise, PromiseRejectEvent event, 4928 PromiseRejectMessage(Local<Promise> promise, PromiseRejectEvent event,
4936 Handle<Value> value, Handle<StackTrace> stack_trace) 4929 Local<Value> value, Local<StackTrace> stack_trace)
4937 : promise_(promise), 4930 : promise_(promise),
4938 event_(event), 4931 event_(event),
4939 value_(value), 4932 value_(value),
4940 stack_trace_(stack_trace) {} 4933 stack_trace_(stack_trace) {}
4941 4934
4942 V8_INLINE Handle<Promise> GetPromise() const { return promise_; } 4935 V8_INLINE Local<Promise> GetPromise() const { return promise_; }
4943 V8_INLINE PromiseRejectEvent GetEvent() const { return event_; } 4936 V8_INLINE PromiseRejectEvent GetEvent() const { return event_; }
4944 V8_INLINE Handle<Value> GetValue() const { return value_; } 4937 V8_INLINE Local<Value> GetValue() const { return value_; }
4945 4938
4946 // DEPRECATED. Use v8::Exception::CreateMessage(GetValue())->GetStackTrace() 4939 // DEPRECATED. Use v8::Exception::CreateMessage(GetValue())->GetStackTrace()
4947 V8_INLINE Handle<StackTrace> GetStackTrace() const { return stack_trace_; } 4940 V8_INLINE Local<StackTrace> GetStackTrace() const { return stack_trace_; }
4948 4941
4949 private: 4942 private:
4950 Handle<Promise> promise_; 4943 Local<Promise> promise_;
4951 PromiseRejectEvent event_; 4944 PromiseRejectEvent event_;
4952 Handle<Value> value_; 4945 Local<Value> value_;
4953 Handle<StackTrace> stack_trace_; 4946 Local<StackTrace> stack_trace_;
4954 }; 4947 };
4955 4948
4956 typedef void (*PromiseRejectCallback)(PromiseRejectMessage message); 4949 typedef void (*PromiseRejectCallback)(PromiseRejectMessage message);
4957 4950
4958 // --- Microtask Callback --- 4951 // --- Microtask Callback ---
4959 typedef void (*MicrotaskCallback)(void* data); 4952 typedef void (*MicrotaskCallback)(void* data);
4960 4953
4961 // --- Failed Access Check Callback --- 4954 // --- Failed Access Check Callback ---
4962 typedef void (*FailedAccessCheckCallback)(Local<Object> target, 4955 typedef void (*FailedAccessCheckCallback)(Local<Object> target,
4963 AccessType type, 4956 AccessType type,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
5104 // statement, and is used to indicate possible break locations. 5097 // statement, and is used to indicate possible break locations.
5105 enum PositionType { POSITION, STATEMENT_POSITION }; 5098 enum PositionType { POSITION, STATEMENT_POSITION };
5106 5099
5107 // Type of event. 5100 // Type of event.
5108 EventType type; 5101 EventType type;
5109 // Start of the instructions. 5102 // Start of the instructions.
5110 void* code_start; 5103 void* code_start;
5111 // Size of the instructions. 5104 // Size of the instructions.
5112 size_t code_len; 5105 size_t code_len;
5113 // Script info for CODE_ADDED event. 5106 // Script info for CODE_ADDED event.
5114 Handle<UnboundScript> script; 5107 Local<UnboundScript> script;
5115 // User-defined data for *_LINE_INFO_* event. It's used to hold the source 5108 // User-defined data for *_LINE_INFO_* event. It's used to hold the source
5116 // code line information which is returned from the 5109 // code line information which is returned from the
5117 // CODE_START_LINE_INFO_RECORDING event. And it's passed to subsequent 5110 // CODE_START_LINE_INFO_RECORDING event. And it's passed to subsequent
5118 // CODE_ADD_LINE_POS_INFO and CODE_END_LINE_INFO_RECORDING events. 5111 // CODE_ADD_LINE_POS_INFO and CODE_END_LINE_INFO_RECORDING events.
5119 void* user_data; 5112 void* user_data;
5120 5113
5121 struct name_t { 5114 struct name_t {
5122 // Name of the object associated with the code, note that the string is not 5115 // Name of the object associated with the code, note that the string is not
5123 // zero-terminated. 5116 // zero-terminated.
5124 const char* str; 5117 const char* str;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 */ 5157 */
5165 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); 5158 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event);
5166 5159
5167 5160
5168 /** 5161 /**
5169 * Interface for iterating through all external resources in the heap. 5162 * Interface for iterating through all external resources in the heap.
5170 */ 5163 */
5171 class V8_EXPORT ExternalResourceVisitor { // NOLINT 5164 class V8_EXPORT ExternalResourceVisitor { // NOLINT
5172 public: 5165 public:
5173 virtual ~ExternalResourceVisitor() {} 5166 virtual ~ExternalResourceVisitor() {}
5174 virtual void VisitExternalString(Handle<String> string) {} 5167 virtual void VisitExternalString(Local<String> string) {}
5175 }; 5168 };
5176 5169
5177 5170
5178 /** 5171 /**
5179 * Interface for iterating through all the persistent handles in the heap. 5172 * Interface for iterating through all the persistent handles in the heap.
5180 */ 5173 */
5181 class V8_EXPORT PersistentHandleVisitor { // NOLINT 5174 class V8_EXPORT PersistentHandleVisitor { // NOLINT
5182 public: 5175 public:
5183 virtual ~PersistentHandleVisitor() {} 5176 virtual ~PersistentHandleVisitor() {}
5184 virtual void VisitPersistentHandle(Persistent<Value>* value, 5177 virtual void VisitPersistentHandle(Persistent<Value>* value,
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
5701 5694
5702 /** 5695 /**
5703 * Experimental: Runs the Microtask Work Queue until empty 5696 * Experimental: Runs the Microtask Work Queue until empty
5704 * Any exceptions thrown by microtask callbacks are swallowed. 5697 * Any exceptions thrown by microtask callbacks are swallowed.
5705 */ 5698 */
5706 void RunMicrotasks(); 5699 void RunMicrotasks();
5707 5700
5708 /** 5701 /**
5709 * Experimental: Enqueues the callback to the Microtask Work Queue 5702 * Experimental: Enqueues the callback to the Microtask Work Queue
5710 */ 5703 */
5711 void EnqueueMicrotask(Handle<Function> microtask); 5704 void EnqueueMicrotask(Local<Function> microtask);
5712 5705
5713 /** 5706 /**
5714 * Experimental: Enqueues the callback to the Microtask Work Queue 5707 * Experimental: Enqueues the callback to the Microtask Work Queue
5715 */ 5708 */
5716 void EnqueueMicrotask(MicrotaskCallback microtask, void* data = NULL); 5709 void EnqueueMicrotask(MicrotaskCallback microtask, void* data = NULL);
5717 5710
5718 /** 5711 /**
5719 * Experimental: Controls whether the Microtask Work Queue is automatically 5712 * Experimental: Controls whether the Microtask Work Queue is automatically
5720 * run when the script call depth decrements to zero. 5713 * run when the script call depth decrements to zero.
5721 */ 5714 */
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
5853 /** 5846 /**
5854 * Adds a message listener. 5847 * Adds a message listener.
5855 * 5848 *
5856 * The same message listener can be added more than once and in that 5849 * The same message listener can be added more than once and in that
5857 * case it will be called more than once for each message. 5850 * case it will be called more than once for each message.
5858 * 5851 *
5859 * If data is specified, it will be passed to the callback when it is called. 5852 * If data is specified, it will be passed to the callback when it is called.
5860 * Otherwise, the exception object will be passed to the callback instead. 5853 * Otherwise, the exception object will be passed to the callback instead.
5861 */ 5854 */
5862 bool AddMessageListener(MessageCallback that, 5855 bool AddMessageListener(MessageCallback that,
5863 Handle<Value> data = Handle<Value>()); 5856 Local<Value> data = Local<Value>());
5864 5857
5865 /** 5858 /**
5866 * Remove all message listeners from the specified callback function. 5859 * Remove all message listeners from the specified callback function.
5867 */ 5860 */
5868 void RemoveMessageListeners(MessageCallback that); 5861 void RemoveMessageListeners(MessageCallback that);
5869 5862
5870 /** Callback function for reporting failed access checks.*/ 5863 /** Callback function for reporting failed access checks.*/
5871 void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback); 5864 void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
5872 5865
5873 /** 5866 /**
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
6024 * 6017 *
6025 * The same message listener can be added more than once and in that 6018 * The same message listener can be added more than once and in that
6026 * case it will be called more than once for each message. 6019 * case it will be called more than once for each message.
6027 * 6020 *
6028 * If data is specified, it will be passed to the callback when it is called. 6021 * If data is specified, it will be passed to the callback when it is called.
6029 * Otherwise, the exception object will be passed to the callback instead. 6022 * Otherwise, the exception object will be passed to the callback instead.
6030 */ 6023 */
6031 V8_INLINE static V8_DEPRECATE_SOON( 6024 V8_INLINE static V8_DEPRECATE_SOON(
6032 "Use isolate version", 6025 "Use isolate version",
6033 bool AddMessageListener(MessageCallback that, 6026 bool AddMessageListener(MessageCallback that,
6034 Handle<Value> data = Handle<Value>())); 6027 Local<Value> data = Local<Value>()));
6035 6028
6036 /** 6029 /**
6037 * Remove all message listeners from the specified callback function. 6030 * Remove all message listeners from the specified callback function.
6038 */ 6031 */
6039 V8_INLINE static V8_DEPRECATE_SOON( 6032 V8_INLINE static V8_DEPRECATE_SOON(
6040 "Use isolate version", void RemoveMessageListeners(MessageCallback that)); 6033 "Use isolate version", void RemoveMessageListeners(MessageCallback that));
6041 6034
6042 /** 6035 /**
6043 * Tells V8 to capture current stack trace when uncaught exception occurs 6036 * Tells V8 to capture current stack trace when uncaught exception occurs
6044 * and report it to the message listeners. The option is off by default. 6037 * and report it to the message listeners. The option is off by default.
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
6422 */ 6415 */
6423 bool HasTerminated() const; 6416 bool HasTerminated() const;
6424 6417
6425 /** 6418 /**
6426 * Throws the exception caught by this TryCatch in a way that avoids 6419 * Throws the exception caught by this TryCatch in a way that avoids
6427 * it being caught again by this same TryCatch. As with ThrowException 6420 * it being caught again by this same TryCatch. As with ThrowException
6428 * it is illegal to execute any JavaScript operations after calling 6421 * it is illegal to execute any JavaScript operations after calling
6429 * ReThrow; the caller must return immediately to where the exception 6422 * ReThrow; the caller must return immediately to where the exception
6430 * is caught. 6423 * is caught.
6431 */ 6424 */
6432 Handle<Value> ReThrow(); 6425 Local<Value> ReThrow();
6433 6426
6434 /** 6427 /**
6435 * Returns the exception caught by this try/catch block. If no exception has 6428 * Returns the exception caught by this try/catch block. If no exception has
6436 * been caught an empty handle is returned. 6429 * been caught an empty handle is returned.
6437 * 6430 *
6438 * The returned handle is valid until this TryCatch block has been destroyed. 6431 * The returned handle is valid until this TryCatch block has been destroyed.
6439 */ 6432 */
6440 Local<Value> Exception() const; 6433 Local<Value> Exception() const;
6441 6434
6442 /** 6435 /**
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
6584 * \param global_template An optional object template from which the 6577 * \param global_template An optional object template from which the
6585 * global object for the newly created context will be created. 6578 * global object for the newly created context will be created.
6586 * 6579 *
6587 * \param global_object An optional global object to be reused for 6580 * \param global_object An optional global object to be reused for
6588 * the newly created context. This global object must have been 6581 * the newly created context. This global object must have been
6589 * created by a previous call to Context::New with the same global 6582 * created by a previous call to Context::New with the same global
6590 * template. The state of the global object will be completely reset 6583 * template. The state of the global object will be completely reset
6591 * and only object identify will remain. 6584 * and only object identify will remain.
6592 */ 6585 */
6593 static Local<Context> New( 6586 static Local<Context> New(
6594 Isolate* isolate, 6587 Isolate* isolate, ExtensionConfiguration* extensions = NULL,
6595 ExtensionConfiguration* extensions = NULL, 6588 Local<ObjectTemplate> global_template = Local<ObjectTemplate>(),
6596 Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), 6589 Local<Value> global_object = Local<Value>());
6597 Handle<Value> global_object = Handle<Value>());
6598 6590
6599 /** 6591 /**
6600 * Sets the security token for the context. To access an object in 6592 * Sets the security token for the context. To access an object in
6601 * another context, the security tokens must match. 6593 * another context, the security tokens must match.
6602 */ 6594 */
6603 void SetSecurityToken(Handle<Value> token); 6595 void SetSecurityToken(Local<Value> token);
6604 6596
6605 /** Restores the security token to the default value. */ 6597 /** Restores the security token to the default value. */
6606 void UseDefaultSecurityToken(); 6598 void UseDefaultSecurityToken();
6607 6599
6608 /** Returns the security token of this context.*/ 6600 /** Returns the security token of this context.*/
6609 Handle<Value> GetSecurityToken(); 6601 Local<Value> GetSecurityToken();
6610 6602
6611 /** 6603 /**
6612 * Enter this context. After entering a context, all code compiled 6604 * Enter this context. After entering a context, all code compiled
6613 * and run is compiled and run in this context. If another context 6605 * and run is compiled and run in this context. If another context
6614 * is already entered, this old context is saved so it can be 6606 * is already entered, this old context is saved so it can be
6615 * restored when the new context is exited. 6607 * restored when the new context is exited.
6616 */ 6608 */
6617 void Enter(); 6609 void Enter();
6618 6610
6619 /** 6611 /**
(...skipping 23 matching lines...) Expand all
6643 * Gets the exports object used by V8 extras. Extra natives get a reference 6635 * Gets the exports object used by V8 extras. Extra natives get a reference
6644 * to this object and can use it to export functionality. 6636 * to this object and can use it to export functionality.
6645 */ 6637 */
6646 Local<Object> GetExtrasExportsObject(); 6638 Local<Object> GetExtrasExportsObject();
6647 6639
6648 /** 6640 /**
6649 * Sets the embedder data with the given index, growing the data as 6641 * Sets the embedder data with the given index, growing the data as
6650 * needed. Note that index 0 currently has a special meaning for Chrome's 6642 * needed. Note that index 0 currently has a special meaning for Chrome's
6651 * debugger. 6643 * debugger.
6652 */ 6644 */
6653 void SetEmbedderData(int index, Handle<Value> value); 6645 void SetEmbedderData(int index, Local<Value> value);
6654 6646
6655 /** 6647 /**
6656 * Gets a 2-byte-aligned native pointer from the embedder data with the given 6648 * Gets a 2-byte-aligned native pointer from the embedder data with the given
6657 * index, which must have bees set by a previous call to 6649 * index, which must have bees set by a previous call to
6658 * SetAlignedPointerInEmbedderData with the same index. Note that index 0 6650 * SetAlignedPointerInEmbedderData with the same index. Note that index 0
6659 * currently has a special meaning for Chrome's debugger. 6651 * currently has a special meaning for Chrome's debugger.
6660 */ 6652 */
6661 V8_INLINE void* GetAlignedPointerFromEmbedderData(int index); 6653 V8_INLINE void* GetAlignedPointerFromEmbedderData(int index);
6662 6654
6663 /** 6655 /**
(...skipping 22 matching lines...) Expand all
6686 * Returns true if code generation from strings is allowed for the context. 6678 * Returns true if code generation from strings is allowed for the context.
6687 * For more details see AllowCodeGenerationFromStrings(bool) documentation. 6679 * For more details see AllowCodeGenerationFromStrings(bool) documentation.
6688 */ 6680 */
6689 bool IsCodeGenerationFromStringsAllowed(); 6681 bool IsCodeGenerationFromStringsAllowed();
6690 6682
6691 /** 6683 /**
6692 * Sets the error description for the exception that is thrown when 6684 * Sets the error description for the exception that is thrown when
6693 * code generation from strings is not allowed and 'eval' or the 'Function' 6685 * code generation from strings is not allowed and 'eval' or the 'Function'
6694 * constructor are called. 6686 * constructor are called.
6695 */ 6687 */
6696 void SetErrorMessageForCodeGenerationFromStrings(Handle<String> message); 6688 void SetErrorMessageForCodeGenerationFromStrings(Local<String> message);
6697 6689
6698 /** 6690 /**
6699 * Stack-allocated class which sets the execution context for all 6691 * Stack-allocated class which sets the execution context for all
6700 * operations executed within a local scope. 6692 * operations executed within a local scope.
6701 */ 6693 */
6702 class Scope { 6694 class Scope {
6703 public: 6695 public:
6704 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { 6696 explicit V8_INLINE Scope(Local<Context> context) : context_(context) {
6705 context_->Enter(); 6697 context_->Enter();
6706 } 6698 }
6707 V8_INLINE ~Scope() { context_->Exit(); } 6699 V8_INLINE ~Scope() { context_->Exit(); }
6708 6700
6709 private: 6701 private:
6710 Handle<Context> context_; 6702 Local<Context> context_;
6711 }; 6703 };
6712 6704
6713 private: 6705 private:
6714 friend class Value; 6706 friend class Value;
6715 friend class Script; 6707 friend class Script;
6716 friend class Object; 6708 friend class Object;
6717 friend class Function; 6709 friend class Function;
6718 6710
6719 Local<Value> SlowGetEmbedderData(int index); 6711 Local<Value> SlowGetEmbedderData(int index);
6720 void* SlowGetAlignedPointerFromEmbedderData(int index); 6712 void* SlowGetAlignedPointerFromEmbedderData(int index);
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
7207 template <class T> 7199 template <class T>
7208 void PersistentBase<T>::Reset() { 7200 void PersistentBase<T>::Reset() {
7209 if (this->IsEmpty()) return; 7201 if (this->IsEmpty()) return;
7210 V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_)); 7202 V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_));
7211 val_ = 0; 7203 val_ = 0;
7212 } 7204 }
7213 7205
7214 7206
7215 template <class T> 7207 template <class T>
7216 template <class S> 7208 template <class S>
7217 void PersistentBase<T>::Reset(Isolate* isolate, const Handle<S>& other) { 7209 void PersistentBase<T>::Reset(Isolate* isolate, const Local<S>& other) {
7218 TYPE_CHECK(T, S); 7210 TYPE_CHECK(T, S);
7219 Reset(); 7211 Reset();
7220 if (other.IsEmpty()) return; 7212 if (other.IsEmpty()) return;
7221 this->val_ = New(isolate, other.val_); 7213 this->val_ = New(isolate, other.val_);
7222 } 7214 }
7223 7215
7224 7216
7225 template <class T> 7217 template <class T>
7226 template <class S> 7218 template <class S>
7227 void PersistentBase<T>::Reset(Isolate* isolate, 7219 void PersistentBase<T>::Reset(Isolate* isolate,
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
7504 bool FunctionCallbackInfo<T>::IsConstructCall() const { 7496 bool FunctionCallbackInfo<T>::IsConstructCall() const {
7505 return is_construct_call_ & 0x1; 7497 return is_construct_call_ & 0x1;
7506 } 7498 }
7507 7499
7508 7500
7509 template<typename T> 7501 template<typename T>
7510 int FunctionCallbackInfo<T>::Length() const { 7502 int FunctionCallbackInfo<T>::Length() const {
7511 return length_; 7503 return length_;
7512 } 7504 }
7513 7505
7514 ScriptOrigin::ScriptOrigin(Handle<Value> resource_name, 7506 ScriptOrigin::ScriptOrigin(Local<Value> resource_name,
7515 Handle<Integer> resource_line_offset, 7507 Local<Integer> resource_line_offset,
7516 Handle<Integer> resource_column_offset, 7508 Local<Integer> resource_column_offset,
7517 Handle<Boolean> resource_is_shared_cross_origin, 7509 Local<Boolean> resource_is_shared_cross_origin,
7518 Handle<Integer> script_id, 7510 Local<Integer> script_id,
7519 Handle<Boolean> resource_is_embedder_debug_script, 7511 Local<Boolean> resource_is_embedder_debug_script,
7520 Handle<Value> source_map_url, 7512 Local<Value> source_map_url,
7521 Handle<Boolean> resource_is_opaque) 7513 Local<Boolean> resource_is_opaque)
7522 : resource_name_(resource_name), 7514 : resource_name_(resource_name),
7523 resource_line_offset_(resource_line_offset), 7515 resource_line_offset_(resource_line_offset),
7524 resource_column_offset_(resource_column_offset), 7516 resource_column_offset_(resource_column_offset),
7525 options_(!resource_is_embedder_debug_script.IsEmpty() && 7517 options_(!resource_is_embedder_debug_script.IsEmpty() &&
7526 resource_is_embedder_debug_script->IsTrue(), 7518 resource_is_embedder_debug_script->IsTrue(),
7527 !resource_is_shared_cross_origin.IsEmpty() && 7519 !resource_is_shared_cross_origin.IsEmpty() &&
7528 resource_is_shared_cross_origin->IsTrue(), 7520 resource_is_shared_cross_origin->IsTrue(),
7529 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue()), 7521 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue()),
7530 script_id_(script_id), 7522 script_id_(script_id),
7531 source_map_url_(source_map_url) {} 7523 source_map_url_(source_map_url) {}
7532 7524
7533 Handle<Value> ScriptOrigin::ResourceName() const { 7525 Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; }
7534 return resource_name_;
7535 }
7536 7526
7537 7527
7538 Handle<Integer> ScriptOrigin::ResourceLineOffset() const { 7528 Local<Integer> ScriptOrigin::ResourceLineOffset() const {
7539 return resource_line_offset_; 7529 return resource_line_offset_;
7540 } 7530 }
7541 7531
7542 7532
7543 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { 7533 Local<Integer> ScriptOrigin::ResourceColumnOffset() const {
7544 return resource_column_offset_; 7534 return resource_column_offset_;
7545 } 7535 }
7546 7536
7547 7537
7548 Handle<Integer> ScriptOrigin::ScriptID() const { 7538 Local<Integer> ScriptOrigin::ScriptID() const { return script_id_; }
7549 return script_id_;
7550 }
7551 7539
7552 7540
7553 Handle<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; } 7541 Local<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; }
7554 7542
7555 7543
7556 ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin, 7544 ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
7557 CachedData* data) 7545 CachedData* data)
7558 : source_string(string), 7546 : source_string(string),
7559 resource_name(origin.ResourceName()), 7547 resource_name(origin.ResourceName()),
7560 resource_line_offset(origin.ResourceLineOffset()), 7548 resource_line_offset(origin.ResourceLineOffset()),
7561 resource_column_offset(origin.ResourceColumnOffset()), 7549 resource_column_offset(origin.ResourceColumnOffset()),
7562 resource_options(origin.Options()), 7550 resource_options(origin.Options()),
7563 source_map_url(origin.SourceMapUrl()), 7551 source_map_url(origin.SourceMapUrl()),
7564 cached_data(data) {} 7552 cached_data(data) {}
7565 7553
7566 7554
7567 ScriptCompiler::Source::Source(Local<String> string, 7555 ScriptCompiler::Source::Source(Local<String> string,
7568 CachedData* data) 7556 CachedData* data)
7569 : source_string(string), cached_data(data) {} 7557 : source_string(string), cached_data(data) {}
7570 7558
7571 7559
7572 ScriptCompiler::Source::~Source() { 7560 ScriptCompiler::Source::~Source() {
7573 delete cached_data; 7561 delete cached_data;
7574 } 7562 }
7575 7563
7576 7564
7577 const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData() 7565 const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData()
7578 const { 7566 const {
7579 return cached_data; 7567 return cached_data;
7580 } 7568 }
7581 7569
7582 7570
7583 Handle<Boolean> Boolean::New(Isolate* isolate, bool value) { 7571 Local<Boolean> Boolean::New(Isolate* isolate, bool value) {
7584 return value ? True(isolate) : False(isolate); 7572 return value ? True(isolate) : False(isolate);
7585 } 7573 }
7586 7574
7587 7575
7588 void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> value) { 7576 void Template::Set(Isolate* isolate, const char* name, v8::Local<Data> value) {
7589 Set(v8::String::NewFromUtf8(isolate, name, NewStringType::kNormal) 7577 Set(v8::String::NewFromUtf8(isolate, name, NewStringType::kNormal)
7590 .ToLocalChecked(), 7578 .ToLocalChecked(),
7591 value); 7579 value);
7592 } 7580 }
7593 7581
7594 7582
7595 Local<Value> Object::GetInternalField(int index) { 7583 Local<Value> Object::GetInternalField(int index) {
7596 #ifndef V8_ENABLE_CHECKS 7584 #ifndef V8_ENABLE_CHECKS
7597 typedef internal::Object O; 7585 typedef internal::Object O;
7598 typedef internal::HeapObject HO; 7586 typedef internal::HeapObject HO;
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
8091 return Local<Object>(reinterpret_cast<Object*>(&args_[kHolderIndex])); 8079 return Local<Object>(reinterpret_cast<Object*>(&args_[kHolderIndex]));
8092 } 8080 }
8093 8081
8094 8082
8095 template<typename T> 8083 template<typename T>
8096 ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const { 8084 ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const {
8097 return ReturnValue<T>(&args_[kReturnValueIndex]); 8085 return ReturnValue<T>(&args_[kReturnValueIndex]);
8098 } 8086 }
8099 8087
8100 8088
8101 Handle<Primitive> Undefined(Isolate* isolate) { 8089 Local<Primitive> Undefined(Isolate* isolate) {
8102 typedef internal::Object* S; 8090 typedef internal::Object* S;
8103 typedef internal::Internals I; 8091 typedef internal::Internals I;
8104 I::CheckInitialized(isolate); 8092 I::CheckInitialized(isolate);
8105 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex); 8093 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
8106 return Handle<Primitive>(reinterpret_cast<Primitive*>(slot)); 8094 return Local<Primitive>(reinterpret_cast<Primitive*>(slot));
8107 } 8095 }
8108 8096
8109 8097
8110 Handle<Primitive> Null(Isolate* isolate) { 8098 Local<Primitive> Null(Isolate* isolate) {
8111 typedef internal::Object* S; 8099 typedef internal::Object* S;
8112 typedef internal::Internals I; 8100 typedef internal::Internals I;
8113 I::CheckInitialized(isolate); 8101 I::CheckInitialized(isolate);
8114 S* slot = I::GetRoot(isolate, I::kNullValueRootIndex); 8102 S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
8115 return Handle<Primitive>(reinterpret_cast<Primitive*>(slot)); 8103 return Local<Primitive>(reinterpret_cast<Primitive*>(slot));
8116 } 8104 }
8117 8105
8118 8106
8119 Handle<Boolean> True(Isolate* isolate) { 8107 Local<Boolean> True(Isolate* isolate) {
8120 typedef internal::Object* S; 8108 typedef internal::Object* S;
8121 typedef internal::Internals I; 8109 typedef internal::Internals I;
8122 I::CheckInitialized(isolate); 8110 I::CheckInitialized(isolate);
8123 S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex); 8111 S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
8124 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); 8112 return Local<Boolean>(reinterpret_cast<Boolean*>(slot));
8125 } 8113 }
8126 8114
8127 8115
8128 Handle<Boolean> False(Isolate* isolate) { 8116 Local<Boolean> False(Isolate* isolate) {
8129 typedef internal::Object* S; 8117 typedef internal::Object* S;
8130 typedef internal::Internals I; 8118 typedef internal::Internals I;
8131 I::CheckInitialized(isolate); 8119 I::CheckInitialized(isolate);
8132 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); 8120 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
8133 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); 8121 return Local<Boolean>(reinterpret_cast<Boolean*>(slot));
8134 } 8122 }
8135 8123
8136 8124
8137 void Isolate::SetData(uint32_t slot, void* data) { 8125 void Isolate::SetData(uint32_t slot, void* data) {
8138 typedef internal::Internals I; 8126 typedef internal::Internals I;
8139 I::SetEmbedderData(this, slot, data); 8127 I::SetEmbedderData(this, slot, data);
8140 } 8128 }
8141 8129
8142 8130
8143 void* Isolate::GetData(uint32_t slot) { 8131 void* Isolate::GetData(uint32_t slot) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
8231 isolate->SetAllowCodeGenerationFromStringsCallback(callback); 8219 isolate->SetAllowCodeGenerationFromStringsCallback(callback);
8232 } 8220 }
8233 8221
8234 8222
8235 bool V8::IsDead() { 8223 bool V8::IsDead() {
8236 Isolate* isolate = Isolate::GetCurrent(); 8224 Isolate* isolate = Isolate::GetCurrent();
8237 return isolate->IsDead(); 8225 return isolate->IsDead();
8238 } 8226 }
8239 8227
8240 8228
8241 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) { 8229 bool V8::AddMessageListener(MessageCallback that, Local<Value> data) {
8242 Isolate* isolate = Isolate::GetCurrent(); 8230 Isolate* isolate = Isolate::GetCurrent();
8243 return isolate->AddMessageListener(that, data); 8231 return isolate->AddMessageListener(that, data);
8244 } 8232 }
8245 8233
8246 8234
8247 void V8::RemoveMessageListeners(MessageCallback that) { 8235 void V8::RemoveMessageListeners(MessageCallback that) {
8248 Isolate* isolate = Isolate::GetCurrent(); 8236 Isolate* isolate = Isolate::GetCurrent();
8249 isolate->RemoveMessageListeners(that); 8237 isolate->RemoveMessageListeners(that);
8250 } 8238 }
8251 8239
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
8350 */ 8338 */
8351 8339
8352 8340
8353 } // namespace v8 8341 } // namespace v8
8354 8342
8355 8343
8356 #undef TYPE_CHECK 8344 #undef TYPE_CHECK
8357 8345
8358 8346
8359 #endif // V8_H_ 8347 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | include/v8-debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698