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

Unified Diff: src/api.cc

Issue 1140673002: [V8] Added Script::is_opaque flag for embedders (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Introduces ScriptOriginOptions 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | src/compilation-cache.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 8269f27ed93c331f2e314e9abeb6c5ee8e2e03a0..f4e3c95852531fc3583384aec58964528b80017a 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -195,7 +195,8 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate,
v8::Boolean::New(v8_isolate, script->is_shared_cross_origin()),
v8::Integer::New(v8_isolate, script->id()->value()),
v8::Boolean::New(v8_isolate, script->is_embedder_debug_script()),
- Utils::ToLocal(source_map_url));
+ Utils::ToLocal(source_map_url),
+ v8::Boolean::New(v8_isolate, script->is_opaque()));
return origin;
}
@@ -1715,8 +1716,6 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
i::Handle<i::Object> source_map_url;
int line_offset = 0;
int column_offset = 0;
- bool is_embedder_debug_script = false;
- bool is_shared_cross_origin = false;
if (!source->resource_name.IsEmpty()) {
name_obj = Utils::OpenHandle(*(source->resource_name));
}
@@ -1727,21 +1726,13 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
column_offset =
static_cast<int>(source->resource_column_offset->Value());
}
- if (!source->resource_is_shared_cross_origin.IsEmpty()) {
- is_shared_cross_origin =
- source->resource_is_shared_cross_origin->IsTrue();
- }
- if (!source->resource_is_embedder_debug_script.IsEmpty()) {
- is_embedder_debug_script =
- source->resource_is_embedder_debug_script->IsTrue();
- }
if (!source->source_map_url.IsEmpty()) {
source_map_url = Utils::OpenHandle(*(source->source_map_url));
}
result = i::Compiler::CompileScript(
- str, name_obj, line_offset, column_offset, is_embedder_debug_script,
- is_shared_cross_origin, source_map_url, isolate->native_context(), NULL,
- &script_data, options, i::NOT_NATIVES_CODE, is_module);
+ str, name_obj, line_offset, column_offset, source->resource_options,
+ source_map_url, isolate->native_context(), NULL, &script_data, options,
+ i::NOT_NATIVES_CODE, is_module);
has_pending_exception = result.is_null();
if (has_pending_exception && script_data != NULL) {
// This case won't happen during normal operation; we have compiled
@@ -1975,14 +1966,10 @@ MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
script->set_column_offset(i::Smi::FromInt(
static_cast<int>(origin.ResourceColumnOffset()->Value())));
}
- if (!origin.ResourceIsSharedCrossOrigin().IsEmpty()) {
- script->set_is_shared_cross_origin(
- origin.ResourceIsSharedCrossOrigin()->IsTrue());
- }
- if (!origin.ResourceIsEmbedderDebugScript().IsEmpty()) {
- script->set_is_embedder_debug_script(
- origin.ResourceIsEmbedderDebugScript()->IsTrue());
- }
+ script->set_is_shared_cross_origin(origin.Options().IsSharedCrossOrigin());
+ script->set_is_opaque(origin.Options().IsOpaque());
+ script->set_is_embedder_debug_script(
+ origin.Options().IsEmbedderDebugScript());
Yang 2015/05/18 07:23:33 V8 doesn't use those flags internally, so there is
horo 2015/05/18 10:19:23 Done.
if (!origin.SourceMapUrl().IsEmpty()) {
script->set_source_mapping_url(
*Utils::OpenHandle(*(origin.SourceMapUrl())));
@@ -2364,6 +2351,15 @@ bool Message::IsSharedCrossOrigin() const {
return i::Script::cast(script->value())->is_shared_cross_origin();
}
+bool Message::IsOpaque() const {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ENTER_V8(isolate);
+ auto self = Utils::OpenHandle(this);
+ auto script = i::Handle<i::JSValue>::cast(
+ i::Handle<i::Object>(self->script(), isolate));
+ return i::Script::cast(script->value())->is_opaque();
+}
+
MaybeLocal<String> Message::GetSourceLine(Local<Context> context) const {
PREPARE_FOR_EXECUTION(context, "v8::Message::GetSourceLine()", String);
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | src/compilation-cache.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698