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

Side by Side Diff: include/v8.h

Issue 1801203002: Parser: Make skipping HTML comments optional. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanly expose the decision at the API. Created 4 years, 9 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 | src/api.cc » ('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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 is_skip_html_comments = true)
jochen (gone - plz use gerrit) 2016/03/18 10:50:29 can you drop the "is" prefix? Just skip_html_comme
vogelheim 2016/03/18 11:19:53 Done.
1009 : flags_((is_embedder_debug_script ? kIsEmbedderDebugScript : 0) | 1010 : flags_((is_embedder_debug_script ? kIsEmbedderDebugScript : 0) |
1010 (is_shared_cross_origin ? kIsSharedCrossOrigin : 0) | 1011 (is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
1011 (is_opaque ? kIsOpaque : 0)) {} 1012 (is_opaque ? kIsOpaque : 0) |
1013 (is_skip_html_comments ? kIsSkipHtmlComments : 0)) {}
1012 V8_INLINE ScriptOriginOptions(int flags) 1014 V8_INLINE ScriptOriginOptions(int flags)
1013 : flags_(flags & 1015 : flags_(flags & (kIsEmbedderDebugScript | kIsSharedCrossOrigin |
1014 (kIsEmbedderDebugScript | kIsSharedCrossOrigin | kIsOpaque)) {} 1016 kIsOpaque | kIsSkipHtmlComments)) {}
1015 bool IsEmbedderDebugScript() const { 1017 bool IsEmbedderDebugScript() const { return HasFlag(kIsEmbedderDebugScript); }
1016 return (flags_ & kIsEmbedderDebugScript) != 0; 1018 bool IsSharedCrossOrigin() const { return HasFlag(kIsSharedCrossOrigin); }
1017 } 1019 bool IsOpaque() const { return HasFlag(kIsOpaque); }
1018 bool IsSharedCrossOrigin() const { 1020 bool IsSkipHtmlComments() const { return HasFlag(kIsSkipHtmlComments); }
1019 return (flags_ & kIsSharedCrossOrigin) != 0;
1020 }
1021 bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; }
1022 int Flags() const { return flags_; } 1021 int Flags() const { return flags_; }
1023 1022
1024 private: 1023 private:
1025 enum { 1024 enum {
1026 kIsEmbedderDebugScript = 1, 1025 kIsEmbedderDebugScript = 1,
1027 kIsSharedCrossOrigin = 1 << 1, 1026 kIsSharedCrossOrigin = 1 << 1,
1028 kIsOpaque = 1 << 2 1027 kIsOpaque = 1 << 2,
1028 kIsSkipHtmlComments = 1 << 3
1029 }; 1029 };
1030
1031 inline bool HasFlag(int flag) const { return (flags_ & flag) != 0; }
1032
1030 const int flags_; 1033 const int flags_;
1031 }; 1034 };
1032 1035
1033 /** 1036 /**
1034 * The origin, within a file, of a script. 1037 * The origin, within a file, of a script.
1035 */ 1038 */
1036 class ScriptOrigin { 1039 class ScriptOrigin {
1037 public: 1040 public:
1038 V8_INLINE ScriptOrigin( 1041 V8_INLINE ScriptOrigin(
1039 Local<Value> resource_name, 1042 Local<Value> resource_name,
1040 Local<Integer> resource_line_offset = Local<Integer>(), 1043 Local<Integer> resource_line_offset = Local<Integer>(),
1041 Local<Integer> resource_column_offset = Local<Integer>(), 1044 Local<Integer> resource_column_offset = Local<Integer>(),
1042 Local<Boolean> resource_is_shared_cross_origin = Local<Boolean>(), 1045 Local<Boolean> resource_is_shared_cross_origin = Local<Boolean>(),
1043 Local<Integer> script_id = Local<Integer>(), 1046 Local<Integer> script_id = Local<Integer>(),
1044 Local<Boolean> resource_is_embedder_debug_script = Local<Boolean>(), 1047 Local<Boolean> resource_is_embedder_debug_script = Local<Boolean>(),
1045 Local<Value> source_map_url = Local<Value>(), 1048 Local<Value> source_map_url = Local<Value>(),
1046 Local<Boolean> resource_is_opaque = Local<Boolean>()); 1049 Local<Boolean> resource_is_opaque = Local<Boolean>(),
1050 Local<Boolean> skip_html_comments = Local<Boolean>());
1047 V8_INLINE Local<Value> ResourceName() const; 1051 V8_INLINE Local<Value> ResourceName() const;
1048 V8_INLINE Local<Integer> ResourceLineOffset() const; 1052 V8_INLINE Local<Integer> ResourceLineOffset() const;
1049 V8_INLINE Local<Integer> ResourceColumnOffset() const; 1053 V8_INLINE Local<Integer> ResourceColumnOffset() const;
1050 /** 1054 /**
1051 * Returns true for embedder's debugger scripts 1055 * Returns true for embedder's debugger scripts
1052 */ 1056 */
1053 V8_INLINE Local<Integer> ScriptID() const; 1057 V8_INLINE Local<Integer> ScriptID() const;
1054 V8_INLINE Local<Value> SourceMapUrl() const; 1058 V8_INLINE Local<Value> SourceMapUrl() const;
1055 V8_INLINE ScriptOriginOptions Options() const { return options_; } 1059 V8_INLINE ScriptOriginOptions Options() const { return options_; }
1056 1060
(...skipping 6752 matching lines...) Expand 10 before | Expand all | Expand 10 after
7809 return length_; 7813 return length_;
7810 } 7814 }
7811 7815
7812 ScriptOrigin::ScriptOrigin(Local<Value> resource_name, 7816 ScriptOrigin::ScriptOrigin(Local<Value> resource_name,
7813 Local<Integer> resource_line_offset, 7817 Local<Integer> resource_line_offset,
7814 Local<Integer> resource_column_offset, 7818 Local<Integer> resource_column_offset,
7815 Local<Boolean> resource_is_shared_cross_origin, 7819 Local<Boolean> resource_is_shared_cross_origin,
7816 Local<Integer> script_id, 7820 Local<Integer> script_id,
7817 Local<Boolean> resource_is_embedder_debug_script, 7821 Local<Boolean> resource_is_embedder_debug_script,
7818 Local<Value> source_map_url, 7822 Local<Value> source_map_url,
7819 Local<Boolean> resource_is_opaque) 7823 Local<Boolean> resource_is_opaque,
7824 Local<Boolean> skip_html_comments)
7820 : resource_name_(resource_name), 7825 : resource_name_(resource_name),
7821 resource_line_offset_(resource_line_offset), 7826 resource_line_offset_(resource_line_offset),
7822 resource_column_offset_(resource_column_offset), 7827 resource_column_offset_(resource_column_offset),
7823 options_(!resource_is_embedder_debug_script.IsEmpty() && 7828 options_(!resource_is_embedder_debug_script.IsEmpty() &&
7824 resource_is_embedder_debug_script->IsTrue(), 7829 resource_is_embedder_debug_script->IsTrue(),
7825 !resource_is_shared_cross_origin.IsEmpty() && 7830 !resource_is_shared_cross_origin.IsEmpty() &&
7826 resource_is_shared_cross_origin->IsTrue(), 7831 resource_is_shared_cross_origin->IsTrue(),
7827 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue()), 7832 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(),
7833 skip_html_comments.IsEmpty() || skip_html_comments->IsTrue()),
7828 script_id_(script_id), 7834 script_id_(script_id),
7829 source_map_url_(source_map_url) {} 7835 source_map_url_(source_map_url) {}
7830 7836
7831 Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; } 7837 Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; }
7832 7838
7833 7839
7834 Local<Integer> ScriptOrigin::ResourceLineOffset() const { 7840 Local<Integer> ScriptOrigin::ResourceLineOffset() const {
7835 return resource_line_offset_; 7841 return resource_line_offset_;
7836 } 7842 }
7837 7843
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
8658 */ 8664 */
8659 8665
8660 8666
8661 } // namespace v8 8667 } // namespace v8
8662 8668
8663 8669
8664 #undef TYPE_CHECK 8670 #undef TYPE_CHECK
8665 8671
8666 8672
8667 #endif // INCLUDE_V8_H_ 8673 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698