chore: support converting OnceCallback to V8 (#17941)

This commit is contained in:
Cheng Zhao
2019-04-25 09:40:27 +09:00
committed by GitHub
parent 93d9dafacc
commit 3142d5ca00
5 changed files with 103 additions and 18 deletions

View File

@@ -8,6 +8,7 @@
#include <map>
#include <set>
#include <string>
#include <type_traits>
#include <vector>
#include "base/strings/string_piece.h"
@@ -304,6 +305,12 @@ v8::Local<v8::Value> ConvertToV8(v8::Isolate* isolate, const T& input) {
return Converter<T>::ToV8(isolate, input);
}
template <typename T>
v8::Local<v8::Value> ConvertToV8(v8::Isolate* isolate, T&& input) {
return Converter<typename std::remove_reference<T>::type>::ToV8(
isolate, std::move(input));
}
inline v8::Local<v8::Value> ConvertToV8(v8::Isolate* isolate,
const char* input) {
return Converter<const char*>::ToV8(isolate, input);