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

Side by Side Diff: include/v8.h

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