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

Unified Diff: extensions/renderer/v8_helpers.h

Issue 1192763002: extensions: Use V8 Maybe APIs in NativeHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « extensions/renderer/v8_context_native_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/v8_helpers.h
diff --git a/extensions/renderer/v8_helpers.h b/extensions/renderer/v8_helpers.h
index 385490f4829c1cf33b5d8f9fa812a68aa5d3afe1..77e2eb8de3f0ff9721b9a84c9a5c349d9e91181a 100644
--- a/extensions/renderer/v8_helpers.h
+++ b/extensions/renderer/v8_helpers.h
@@ -22,6 +22,12 @@ inline bool ToV8String(v8::Isolate* isolate,
.ToLocal(out);
}
+inline bool ToV8String(v8::Isolate* isolate,
+ const std::string& str,
+ v8::Local<v8::String>* out) {
+ return ToV8String(isolate, str.c_str(), out);
+}
+
// Converts |str| to a V8 string.
// This crashes when strlen(str) > v8::String::kMaxLength.
inline v8::Local<v8::String> ToV8StringUnsafe(
@@ -100,6 +106,16 @@ inline v8::Local<v8::Value> GetPropertyUnsafe(
.ToLocalChecked();
}
+// Wraps v8::Function::Call(). Returns true on success.
+inline bool CallFunction(v8::Local<v8::Context> context,
+ v8::Local<v8::Function> function,
+ v8::Local<v8::Value> recv,
+ int argc,
+ v8::Local<v8::Value> argv[],
+ v8::Local<v8::Value>* out) {
+ return function->Call(context, recv, argc, argv).ToLocal(out);
+}
+
} // namespace v8_helpers
} // namespace extensions
« no previous file with comments | « extensions/renderer/v8_context_native_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698