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

Side by Side Diff: include/v8.h

Issue 1135343005: Revert of [V8] Added Script::is_opaque flag for embedders (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/accessors.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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 /** 966 /**
967 * The superclass of values and API object templates. 967 * The superclass of values and API object templates.
968 */ 968 */
969 class V8_EXPORT Data { 969 class V8_EXPORT Data {
970 private: 970 private:
971 Data(); 971 Data();
972 }; 972 };
973 973
974 974
975 /** 975 /**
976 * The optional attributes of ScriptOrigin.
977 */
978 class ScriptOriginOptions {
979 public:
980 V8_INLINE ScriptOriginOptions(bool is_embedder_debug_script = false,
981 bool is_shared_cross_origin = false,
982 bool is_opaque = false)
983 : flags_((is_embedder_debug_script ? kIsEmbedderDebugScript : 0) |
984 (is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
985 (is_opaque ? kIsOpaque : 0)) {}
986 V8_INLINE ScriptOriginOptions(int flags)
987 : flags_(flags &
988 (kIsEmbedderDebugScript | kIsSharedCrossOrigin | kIsOpaque)) {}
989 bool IsEmbedderDebugScript() const { return flags_ & kIsEmbedderDebugScript; }
990 bool IsSharedCrossOrigin() const { return flags_ & kIsSharedCrossOrigin; }
991 bool IsOpaque() const { return flags_ & kIsOpaque; }
992 int Flags() const { return flags_; }
993
994 private:
995 enum {
996 kIsEmbedderDebugScript = 1,
997 kIsSharedCrossOrigin = 1 << 1,
998 kIsOpaque = 1 << 2
999 };
1000 const int flags_;
1001 };
1002
1003 /**
1004 * The origin, within a file, of a script. 976 * The origin, within a file, of a script.
1005 */ 977 */
1006 class ScriptOrigin { 978 class ScriptOrigin {
1007 public: 979 public:
1008 V8_INLINE ScriptOrigin( 980 V8_INLINE ScriptOrigin(
1009 Handle<Value> resource_name, 981 Handle<Value> resource_name,
1010 Handle<Integer> resource_line_offset = Handle<Integer>(), 982 Handle<Integer> resource_line_offset = Handle<Integer>(),
1011 Handle<Integer> resource_column_offset = Handle<Integer>(), 983 Handle<Integer> resource_column_offset = Handle<Integer>(),
1012 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>(), 984 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>(),
1013 Handle<Integer> script_id = Handle<Integer>(), 985 Handle<Integer> script_id = Handle<Integer>(),
1014 Handle<Boolean> resource_is_embedder_debug_script = Handle<Boolean>(), 986 Handle<Boolean> resource_is_embedder_debug_script = Handle<Boolean>(),
1015 Handle<Value> source_map_url = Handle<Value>(), 987 Handle<Value> source_map_url = Handle<Value>())
1016 Handle<Boolean> resource_is_opaque = Handle<Boolean>()); 988 : resource_name_(resource_name),
989 resource_line_offset_(resource_line_offset),
990 resource_column_offset_(resource_column_offset),
991 resource_is_embedder_debug_script_(resource_is_embedder_debug_script),
992 resource_is_shared_cross_origin_(resource_is_shared_cross_origin),
993 script_id_(script_id),
994 source_map_url_(source_map_url) {}
1017 V8_INLINE Handle<Value> ResourceName() const; 995 V8_INLINE Handle<Value> ResourceName() const;
1018 V8_INLINE Handle<Integer> ResourceLineOffset() const; 996 V8_INLINE Handle<Integer> ResourceLineOffset() const;
1019 V8_INLINE Handle<Integer> ResourceColumnOffset() const; 997 V8_INLINE Handle<Integer> ResourceColumnOffset() const;
1020 /** 998 /**
1021 * Returns true for embedder's debugger scripts 999 * Returns true for embedder's debugger scripts
1022 */ 1000 */
1001 V8_INLINE Handle<Boolean> ResourceIsEmbedderDebugScript() const;
1002 V8_INLINE Handle<Boolean> ResourceIsSharedCrossOrigin() const;
1023 V8_INLINE Handle<Integer> ScriptID() const; 1003 V8_INLINE Handle<Integer> ScriptID() const;
1024 V8_INLINE Handle<Value> SourceMapUrl() const; 1004 V8_INLINE Handle<Value> SourceMapUrl() const;
1025 V8_INLINE ScriptOriginOptions Options() const { return options_; }
1026 1005
1027 private: 1006 private:
1028 Handle<Value> resource_name_; 1007 Handle<Value> resource_name_;
1029 Handle<Integer> resource_line_offset_; 1008 Handle<Integer> resource_line_offset_;
1030 Handle<Integer> resource_column_offset_; 1009 Handle<Integer> resource_column_offset_;
1031 ScriptOriginOptions options_; 1010 Handle<Boolean> resource_is_embedder_debug_script_;
1011 Handle<Boolean> resource_is_shared_cross_origin_;
1032 Handle<Integer> script_id_; 1012 Handle<Integer> script_id_;
1033 Handle<Value> source_map_url_; 1013 Handle<Value> source_map_url_;
1034 }; 1014 };
1035 1015
1036 1016
1037 /** 1017 /**
1038 * A compiled JavaScript script, not yet tied to a Context. 1018 * A compiled JavaScript script, not yet tied to a Context.
1039 */ 1019 */
1040 class V8_EXPORT UnboundScript { 1020 class V8_EXPORT UnboundScript {
1041 public: 1021 public:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 // Prevent copying. Not implemented. 1153 // Prevent copying. Not implemented.
1174 Source(const Source&); 1154 Source(const Source&);
1175 Source& operator=(const Source&); 1155 Source& operator=(const Source&);
1176 1156
1177 Local<String> source_string; 1157 Local<String> source_string;
1178 1158
1179 // Origin information 1159 // Origin information
1180 Handle<Value> resource_name; 1160 Handle<Value> resource_name;
1181 Handle<Integer> resource_line_offset; 1161 Handle<Integer> resource_line_offset;
1182 Handle<Integer> resource_column_offset; 1162 Handle<Integer> resource_column_offset;
1183 ScriptOriginOptions resource_options; 1163 Handle<Boolean> resource_is_embedder_debug_script;
1164 Handle<Boolean> resource_is_shared_cross_origin;
1184 Handle<Value> source_map_url; 1165 Handle<Value> source_map_url;
1185 1166
1186 // Cached data from previous compilation (if a kConsume*Cache flag is 1167 // Cached data from previous compilation (if a kConsume*Cache flag is
1187 // set), or hold newly generated cache data (kProduce*Cache flags) are 1168 // set), or hold newly generated cache data (kProduce*Cache flags) are
1188 // set when calling a compile method. 1169 // set when calling a compile method.
1189 CachedData* cached_data; 1170 CachedData* cached_data;
1190 }; 1171 };
1191 1172
1192 /** 1173 /**
1193 * For streaming incomplete script data to V8. The embedder should implement a 1174 * For streaming incomplete script data to V8. The embedder should implement a
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 * the error occurred. 1443 * the error occurred.
1463 */ 1444 */
1464 V8_DEPRECATE_SOON("Use maybe version", int GetEndColumn() const); 1445 V8_DEPRECATE_SOON("Use maybe version", int GetEndColumn() const);
1465 V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const; 1446 V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const;
1466 1447
1467 /** 1448 /**
1468 * Passes on the value set by the embedder when it fed the script from which 1449 * Passes on the value set by the embedder when it fed the script from which
1469 * this Message was generated to V8. 1450 * this Message was generated to V8.
1470 */ 1451 */
1471 bool IsSharedCrossOrigin() const; 1452 bool IsSharedCrossOrigin() const;
1472 bool IsOpaque() const;
1473 1453
1474 // TODO(1245381): Print to a string instead of on a FILE. 1454 // TODO(1245381): Print to a string instead of on a FILE.
1475 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); 1455 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out);
1476 1456
1477 static const int kNoLineNumberInfo = 0; 1457 static const int kNoLineNumberInfo = 0;
1478 static const int kNoColumnInfo = 0; 1458 static const int kNoColumnInfo = 0;
1479 static const int kNoScriptIdInfo = 0; 1459 static const int kNoScriptIdInfo = 0;
1480 }; 1460 };
1481 1461
1482 1462
(...skipping 5756 matching lines...) Expand 10 before | Expand all | Expand 10 after
7239 bool FunctionCallbackInfo<T>::IsConstructCall() const { 7219 bool FunctionCallbackInfo<T>::IsConstructCall() const {
7240 return is_construct_call_ & 0x1; 7220 return is_construct_call_ & 0x1;
7241 } 7221 }
7242 7222
7243 7223
7244 template<typename T> 7224 template<typename T>
7245 int FunctionCallbackInfo<T>::Length() const { 7225 int FunctionCallbackInfo<T>::Length() const {
7246 return length_; 7226 return length_;
7247 } 7227 }
7248 7228
7249 ScriptOrigin::ScriptOrigin(Handle<Value> resource_name,
7250 Handle<Integer> resource_line_offset,
7251 Handle<Integer> resource_column_offset,
7252 Handle<Boolean> resource_is_shared_cross_origin,
7253 Handle<Integer> script_id,
7254 Handle<Boolean> resource_is_embedder_debug_script,
7255 Handle<Value> source_map_url,
7256 Handle<Boolean> resource_is_opaque)
7257 : resource_name_(resource_name),
7258 resource_line_offset_(resource_line_offset),
7259 resource_column_offset_(resource_column_offset),
7260 options_(!resource_is_embedder_debug_script.IsEmpty() &&
7261 resource_is_embedder_debug_script->IsTrue(),
7262 !resource_is_shared_cross_origin.IsEmpty() &&
7263 resource_is_shared_cross_origin->IsTrue(),
7264 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue()),
7265 script_id_(script_id),
7266 source_map_url_(source_map_url) {}
7267 7229
7268 Handle<Value> ScriptOrigin::ResourceName() const { 7230 Handle<Value> ScriptOrigin::ResourceName() const {
7269 return resource_name_; 7231 return resource_name_;
7270 } 7232 }
7271 7233
7272 7234
7273 Handle<Integer> ScriptOrigin::ResourceLineOffset() const { 7235 Handle<Integer> ScriptOrigin::ResourceLineOffset() const {
7274 return resource_line_offset_; 7236 return resource_line_offset_;
7275 } 7237 }
7276 7238
7277 7239
7278 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { 7240 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const {
7279 return resource_column_offset_; 7241 return resource_column_offset_;
7280 } 7242 }
7281 7243
7282 7244
7245 Handle<Boolean> ScriptOrigin::ResourceIsEmbedderDebugScript() const {
7246 return resource_is_embedder_debug_script_;
7247 }
7248
7249
7250 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const {
7251 return resource_is_shared_cross_origin_;
7252 }
7253
7254
7283 Handle<Integer> ScriptOrigin::ScriptID() const { 7255 Handle<Integer> ScriptOrigin::ScriptID() const {
7284 return script_id_; 7256 return script_id_;
7285 } 7257 }
7286 7258
7287 7259
7288 Handle<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; } 7260 Handle<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; }
7289 7261
7290 7262
7291 ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin, 7263 ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
7292 CachedData* data) 7264 CachedData* data)
7293 : source_string(string), 7265 : source_string(string),
7294 resource_name(origin.ResourceName()), 7266 resource_name(origin.ResourceName()),
7295 resource_line_offset(origin.ResourceLineOffset()), 7267 resource_line_offset(origin.ResourceLineOffset()),
7296 resource_column_offset(origin.ResourceColumnOffset()), 7268 resource_column_offset(origin.ResourceColumnOffset()),
7297 resource_options(origin.Options()), 7269 resource_is_embedder_debug_script(origin.ResourceIsEmbedderDebugScript()),
7270 resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()),
7298 source_map_url(origin.SourceMapUrl()), 7271 source_map_url(origin.SourceMapUrl()),
7299 cached_data(data) {} 7272 cached_data(data) {}
7300 7273
7301 7274
7302 ScriptCompiler::Source::Source(Local<String> string, 7275 ScriptCompiler::Source::Source(Local<String> string,
7303 CachedData* data) 7276 CachedData* data)
7304 : source_string(string), cached_data(data) {} 7277 : source_string(string), cached_data(data) {}
7305 7278
7306 7279
7307 ScriptCompiler::Source::~Source() { 7280 ScriptCompiler::Source::~Source() {
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
8051 */ 8024 */
8052 8025
8053 8026
8054 } // namespace v8 8027 } // namespace v8
8055 8028
8056 8029
8057 #undef TYPE_CHECK 8030 #undef TYPE_CHECK
8058 8031
8059 8032
8060 #endif // V8_H_ 8033 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/accessors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698