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

Unified Diff: include/v8.h

Issue 2611643002: [modules] Add an IsModule flag to ScriptOriginOptions. (Closed)
Patch Set: Remove convenience function from API. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 2f90933772b072a5ad63e00927f0c863dbb289d6..3ac47f8a89bca18e0a4c931c55cc351b208438c1 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -962,20 +962,31 @@ class V8_EXPORT Data {
class ScriptOriginOptions {
public:
V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin = false,
- bool is_opaque = false, bool is_wasm = false)
+ bool is_opaque = false, bool is_wasm = false,
+ bool is_module = false)
: flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
- (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0)) {}
+ (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
+ (is_module ? kIsModule : 0)) {}
V8_INLINE ScriptOriginOptions(int flags)
- : flags_(flags & (kIsSharedCrossOrigin | kIsOpaque | kIsWasm)) {}
+ : flags_(flags &
+ (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
+
bool IsSharedCrossOrigin() const {
return (flags_ & kIsSharedCrossOrigin) != 0;
}
bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; }
bool IsWasm() const { return (flags_ & kIsWasm) != 0; }
+ bool IsModule() const { return (flags_ & kIsModule) != 0; }
+
int Flags() const { return flags_; }
private:
- enum { kIsSharedCrossOrigin = 1, kIsOpaque = 1 << 1, kIsWasm = 1 << 2 };
+ enum {
+ kIsSharedCrossOrigin = 1,
+ kIsOpaque = 1 << 1,
+ kIsWasm = 1 << 2,
+ kIsModule = 1 << 3
+ };
const int flags_;
};
@@ -992,7 +1003,8 @@ class ScriptOrigin {
Local<Integer> script_id = Local<Integer>(),
Local<Value> source_map_url = Local<Value>(),
Local<Boolean> resource_is_opaque = Local<Boolean>(),
- Local<Boolean> is_wasm = Local<Boolean>());
+ Local<Boolean> is_wasm = Local<Boolean>(),
+ Local<Boolean> is_module = Local<Boolean>());
V8_INLINE Local<Value> ResourceName() const;
V8_INLINE Local<Integer> ResourceLineOffset() const;
@@ -1183,6 +1195,8 @@ class V8_EXPORT ScriptCompiler {
// alive.
V8_INLINE const CachedData* GetCachedData() const;
+ V8_INLINE const ScriptOriginOptions& GetResourceOptions() const;
+
// Prevent copying.
Source(const Source&) = delete;
Source& operator=(const Source&) = delete;
@@ -1425,7 +1439,7 @@ class V8_EXPORT ScriptCompiler {
private:
static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
- Isolate* isolate, Source* source, CompileOptions options, bool is_module);
+ Isolate* isolate, Source* source, CompileOptions options);
};
@@ -8987,14 +9001,15 @@ ScriptOrigin::ScriptOrigin(Local<Value> resource_name,
Local<Integer> script_id,
Local<Value> source_map_url,
Local<Boolean> resource_is_opaque,
- Local<Boolean> is_wasm)
+ Local<Boolean> is_wasm, Local<Boolean> is_module)
: resource_name_(resource_name),
resource_line_offset_(resource_line_offset),
resource_column_offset_(resource_column_offset),
options_(!resource_is_shared_cross_origin.IsEmpty() &&
resource_is_shared_cross_origin->IsTrue(),
!resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(),
- !is_wasm.IsEmpty() && is_wasm->IsTrue()),
+ !is_wasm.IsEmpty() && is_wasm->IsTrue(),
+ !is_module.IsEmpty() && is_module->IsTrue()),
script_id_(script_id),
source_map_url_(source_map_url) {}
@@ -9043,6 +9058,9 @@ const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData()
return cached_data;
}
+const ScriptOriginOptions& ScriptCompiler::Source::GetResourceOptions() const {
+ return resource_options;
+}
Local<Boolean> Boolean::New(Isolate* isolate, bool value) {
return value ? True(isolate) : False(isolate);
« 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