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

Unified Diff: include/v8.h

Issue 980613002: convert compile functions to use maybe (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: try fix clang Created 5 years, 10 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 36f3d4b47db8deacc573164762439bb3a4899235..3069c598f629bfbaf7930e22efdfdec29f9c2bcd 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -439,7 +439,7 @@ class MaybeLocal {
template <class S>
V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local<S>* out) const {
out->val_ = IsEmpty() ? nullptr : this->val_;
- return IsEmpty();
+ return !IsEmpty();
}
V8_INLINE Local<T> ToLocalChecked() {
@@ -1066,10 +1066,14 @@ class V8_EXPORT Script {
/**
* A shorthand for ScriptCompiler::Compile().
*/
+ // TODO(dcarney): deprecate.
static Local<Script> Compile(Handle<String> source,
- ScriptOrigin* origin = NULL);
+ ScriptOrigin* origin = nullptr);
+ static MaybeLocal<Script> Compile(Local<Context> context,
+ Handle<String> source,
+ ScriptOrigin* origin = nullptr);
- // To be decprecated, use the Compile above.
+ // TODO(dcarney): deprecate.
static Local<Script> Compile(Handle<String> source,
Handle<String> file_name);
@@ -1265,9 +1269,13 @@ class V8_EXPORT ScriptCompiler {
* \return Compiled script object (context independent; for running it must be
* bound to a context).
*/
+ // TODO(dcarney): deprecate
static Local<UnboundScript> CompileUnbound(
Isolate* isolate, Source* source,
CompileOptions options = kNoCompileOptions);
+ static MaybeLocal<UnboundScript> CompileUnboundScript(
+ Isolate* isolate, Source* source,
+ CompileOptions options = kNoCompileOptions);
/**
* Compiles the specified script (bound to current context).
@@ -1280,9 +1288,12 @@ class V8_EXPORT ScriptCompiler {
* when this function was called. When run it will always use this
* context.
*/
+ // TODO(dcarney): deprecate
static Local<Script> Compile(
Isolate* isolate, Source* source,
CompileOptions options = kNoCompileOptions);
+ static MaybeLocal<Script> Compile(Local<Context> context, Source* source,
+ CompileOptions options = kNoCompileOptions);
/**
* Returns a task which streams script data into V8, or NULL if the script
@@ -1306,9 +1317,14 @@ class V8_EXPORT ScriptCompiler {
* (ScriptStreamingTask has been run). V8 doesn't construct the source string
* during streaming, so the embedder needs to pass the full source here.
*/
+ // TODO(dcarney): deprecate
static Local<Script> Compile(Isolate* isolate, StreamedSource* source,
Handle<String> full_source_string,
const ScriptOrigin& origin);
+ static MaybeLocal<Script> Compile(Local<Context> context,
+ StreamedSource* source,
+ Handle<String> full_source_string,
+ const ScriptOrigin& origin);
/**
* Return a version tag for CachedData for the current V8 version & flags.
@@ -1338,9 +1354,13 @@ class V8_EXPORT ScriptCompiler {
* TODO(adamk): Script is likely the wrong return value for this;
* should return some new Module type.
*/
+ // TODO(dcarney): deprecate.
static Local<Script> CompileModule(
Isolate* isolate, Source* source,
CompileOptions options = kNoCompileOptions);
+ static MaybeLocal<Script> CompileModule(
+ Local<Context> context, Source* source,
+ CompileOptions options = kNoCompileOptions);
/**
* Compile a function for a given context. This is equivalent to running
@@ -1352,16 +1372,19 @@ class V8_EXPORT ScriptCompiler {
* It is possible to specify multiple context extensions (obj in the above
* example).
*/
+ // TODO(dcarney): deprecate.
static Local<Function> CompileFunctionInContext(
Isolate* isolate, Source* source, Local<Context> context,
size_t arguments_count, Local<String> arguments[],
size_t context_extension_count, Local<Object> context_extensions[]);
+ static MaybeLocal<Function> CompileFunctionInContext(
+ Local<Context> context, Source* source, size_t arguments_count,
+ Local<String> arguments[], size_t context_extension_count,
+ Local<Object> context_extensions[]);
private:
- static Local<UnboundScript> CompileUnboundInternal(Isolate* isolate,
- Source* source,
- CompileOptions options,
- bool is_module);
+ static MaybeLocal<UnboundScript> CompileUnboundInternal(
+ Isolate* isolate, Source* source, CompileOptions options, bool is_module);
};
« 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