OLD | NEW |
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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 }; | 998 }; |
999 | 999 |
1000 | 1000 |
1001 /** | 1001 /** |
1002 * The optional attributes of ScriptOrigin. | 1002 * The optional attributes of ScriptOrigin. |
1003 */ | 1003 */ |
1004 class ScriptOriginOptions { | 1004 class ScriptOriginOptions { |
1005 public: | 1005 public: |
1006 V8_INLINE ScriptOriginOptions(bool is_embedder_debug_script = false, | 1006 V8_INLINE ScriptOriginOptions(bool is_embedder_debug_script = false, |
1007 bool is_shared_cross_origin = false, | 1007 bool is_shared_cross_origin = false, |
1008 bool is_opaque = false, | 1008 bool is_opaque = false) |
1009 bool allow_html_comments = false) | |
1010 : flags_((is_embedder_debug_script ? kIsEmbedderDebugScript : 0) | | 1009 : flags_((is_embedder_debug_script ? kIsEmbedderDebugScript : 0) | |
1011 (is_shared_cross_origin ? kIsSharedCrossOrigin : 0) | | 1010 (is_shared_cross_origin ? kIsSharedCrossOrigin : 0) | |
1012 (is_opaque ? kIsOpaque : 0) | | 1011 (is_opaque ? kIsOpaque : 0)) {} |
1013 (allow_html_comments ? kAllowHtmlComments : 0)) {} | |
1014 V8_INLINE ScriptOriginOptions(int flags) | 1012 V8_INLINE ScriptOriginOptions(int flags) |
1015 : flags_(flags & (kIsEmbedderDebugScript | kIsSharedCrossOrigin | | 1013 : flags_(flags & |
1016 kIsOpaque | kAllowHtmlComments)) {} | 1014 (kIsEmbedderDebugScript | kIsSharedCrossOrigin | kIsOpaque)) {} |
1017 bool IsEmbedderDebugScript() const { return HasFlag(kIsEmbedderDebugScript); } | 1015 bool IsEmbedderDebugScript() const { |
1018 bool IsSharedCrossOrigin() const { return HasFlag(kIsSharedCrossOrigin); } | 1016 return (flags_ & kIsEmbedderDebugScript) != 0; |
1019 bool IsOpaque() const { return HasFlag(kIsOpaque); } | 1017 } |
1020 bool AllowHtmlComments() const { return HasFlag(kAllowHtmlComments); } | 1018 bool IsSharedCrossOrigin() const { |
| 1019 return (flags_ & kIsSharedCrossOrigin) != 0; |
| 1020 } |
| 1021 bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; } |
1021 int Flags() const { return flags_; } | 1022 int Flags() const { return flags_; } |
1022 | 1023 |
1023 private: | 1024 private: |
1024 enum { | 1025 enum { |
1025 kIsEmbedderDebugScript = 1, | 1026 kIsEmbedderDebugScript = 1, |
1026 kIsSharedCrossOrigin = 1 << 1, | 1027 kIsSharedCrossOrigin = 1 << 1, |
1027 kIsOpaque = 1 << 2, | 1028 kIsOpaque = 1 << 2 |
1028 kAllowHtmlComments = 1 << 3 | |
1029 }; | 1029 }; |
1030 | |
1031 inline bool HasFlag(int flag) const { return (flags_ & flag) != 0; } | |
1032 | |
1033 const int flags_; | 1030 const int flags_; |
1034 }; | 1031 }; |
1035 | 1032 |
1036 /** | 1033 /** |
1037 * The origin, within a file, of a script. | 1034 * The origin, within a file, of a script. |
1038 */ | 1035 */ |
1039 class ScriptOrigin { | 1036 class ScriptOrigin { |
1040 public: | 1037 public: |
1041 V8_INLINE ScriptOrigin( | 1038 V8_INLINE ScriptOrigin( |
1042 Local<Value> resource_name, | 1039 Local<Value> resource_name, |
1043 Local<Integer> resource_line_offset = Local<Integer>(), | 1040 Local<Integer> resource_line_offset = Local<Integer>(), |
1044 Local<Integer> resource_column_offset = Local<Integer>(), | 1041 Local<Integer> resource_column_offset = Local<Integer>(), |
1045 Local<Boolean> resource_is_shared_cross_origin = Local<Boolean>(), | 1042 Local<Boolean> resource_is_shared_cross_origin = Local<Boolean>(), |
1046 Local<Integer> script_id = Local<Integer>(), | 1043 Local<Integer> script_id = Local<Integer>(), |
1047 Local<Boolean> resource_is_embedder_debug_script = Local<Boolean>(), | 1044 Local<Boolean> resource_is_embedder_debug_script = Local<Boolean>(), |
1048 Local<Value> source_map_url = Local<Value>(), | 1045 Local<Value> source_map_url = Local<Value>(), |
1049 Local<Boolean> resource_is_opaque = Local<Boolean>(), | 1046 Local<Boolean> resource_is_opaque = Local<Boolean>()); |
1050 Local<Boolean> allow_html_comments = Local<Boolean>()); | |
1051 V8_INLINE Local<Value> ResourceName() const; | 1047 V8_INLINE Local<Value> ResourceName() const; |
1052 V8_INLINE Local<Integer> ResourceLineOffset() const; | 1048 V8_INLINE Local<Integer> ResourceLineOffset() const; |
1053 V8_INLINE Local<Integer> ResourceColumnOffset() const; | 1049 V8_INLINE Local<Integer> ResourceColumnOffset() const; |
1054 /** | 1050 /** |
1055 * Returns true for embedder's debugger scripts | 1051 * Returns true for embedder's debugger scripts |
1056 */ | 1052 */ |
1057 V8_INLINE Local<Integer> ScriptID() const; | 1053 V8_INLINE Local<Integer> ScriptID() const; |
1058 V8_INLINE Local<Value> SourceMapUrl() const; | 1054 V8_INLINE Local<Value> SourceMapUrl() const; |
1059 V8_INLINE ScriptOriginOptions Options() const { return options_; } | 1055 V8_INLINE ScriptOriginOptions Options() const { return options_; } |
1060 | 1056 |
(...skipping 6764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7825 return length_; | 7821 return length_; |
7826 } | 7822 } |
7827 | 7823 |
7828 ScriptOrigin::ScriptOrigin(Local<Value> resource_name, | 7824 ScriptOrigin::ScriptOrigin(Local<Value> resource_name, |
7829 Local<Integer> resource_line_offset, | 7825 Local<Integer> resource_line_offset, |
7830 Local<Integer> resource_column_offset, | 7826 Local<Integer> resource_column_offset, |
7831 Local<Boolean> resource_is_shared_cross_origin, | 7827 Local<Boolean> resource_is_shared_cross_origin, |
7832 Local<Integer> script_id, | 7828 Local<Integer> script_id, |
7833 Local<Boolean> resource_is_embedder_debug_script, | 7829 Local<Boolean> resource_is_embedder_debug_script, |
7834 Local<Value> source_map_url, | 7830 Local<Value> source_map_url, |
7835 Local<Boolean> resource_is_opaque, | 7831 Local<Boolean> resource_is_opaque) |
7836 Local<Boolean> allow_html_comments) | |
7837 : resource_name_(resource_name), | 7832 : resource_name_(resource_name), |
7838 resource_line_offset_(resource_line_offset), | 7833 resource_line_offset_(resource_line_offset), |
7839 resource_column_offset_(resource_column_offset), | 7834 resource_column_offset_(resource_column_offset), |
7840 options_(!resource_is_embedder_debug_script.IsEmpty() && | 7835 options_(!resource_is_embedder_debug_script.IsEmpty() && |
7841 resource_is_embedder_debug_script->IsTrue(), | 7836 resource_is_embedder_debug_script->IsTrue(), |
7842 !resource_is_shared_cross_origin.IsEmpty() && | 7837 !resource_is_shared_cross_origin.IsEmpty() && |
7843 resource_is_shared_cross_origin->IsTrue(), | 7838 resource_is_shared_cross_origin->IsTrue(), |
7844 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(), | 7839 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue()), |
7845 allow_html_comments.IsEmpty() || allow_html_comments->IsTrue()), | |
7846 script_id_(script_id), | 7840 script_id_(script_id), |
7847 source_map_url_(source_map_url) {} | 7841 source_map_url_(source_map_url) {} |
7848 | 7842 |
7849 Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; } | 7843 Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; } |
7850 | 7844 |
7851 | 7845 |
7852 Local<Integer> ScriptOrigin::ResourceLineOffset() const { | 7846 Local<Integer> ScriptOrigin::ResourceLineOffset() const { |
7853 return resource_line_offset_; | 7847 return resource_line_offset_; |
7854 } | 7848 } |
7855 | 7849 |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8676 */ | 8670 */ |
8677 | 8671 |
8678 | 8672 |
8679 } // namespace v8 | 8673 } // namespace v8 |
8680 | 8674 |
8681 | 8675 |
8682 #undef TYPE_CHECK | 8676 #undef TYPE_CHECK |
8683 | 8677 |
8684 | 8678 |
8685 #endif // INCLUDE_V8_H_ | 8679 #endif // INCLUDE_V8_H_ |
OLD | NEW |