#ifndef EXTENSIONS_RENDERER_V8_HELPERS_H_
#define EXTENSIONS_RENDERER_V8_HELPERS_H_
#include <stdint.h>
#include <string.h>
#include "base/check.h"
#include "base/strings/string_number_conversions.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-object.h"
#include "v8/include/v8-primitive.h"
namespace extensions {
namespace v8_helpers {
inline bool ToV8String(v8::Isolate* isolate,
const char* str,
v8::Local<v8::String>* out) { … }
inline bool ToV8String(v8::Isolate* isolate,
const std::string& str,
v8::Local<v8::String>* out) { … }
inline v8::Local<v8::String> ToV8StringUnsafe(
v8::Isolate* isolate,
const char* str,
v8::NewStringType string_type = v8::NewStringType::kNormal) { … }
inline v8::Local<v8::String> ToV8StringUnsafe(
v8::Isolate* isolate,
const std::string& str,
v8::NewStringType string_type = v8::NewStringType::kNormal) { … }
inline bool IsTrue(v8::Maybe<bool> maybe) { … }
inline bool SetPrivateProperty(v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
v8::Local<v8::String> key,
v8::Local<v8::Value> value) { … }
inline bool SetPrivateProperty(v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
const char* key,
v8::Local<v8::Value> value) { … }
template <typename Key>
inline bool GetProperty(v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
Key key,
v8::Local<v8::Value>* out) { … }
inline bool GetProperty(v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
const char* key,
v8::Local<v8::Value>* out) { … }
inline bool GetPrivateProperty(v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
v8::Local<v8::String> key,
v8::Local<v8::Value>* out) { … }
inline bool GetPrivateProperty(v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
const char* key,
v8::Local<v8::Value>* out) { … }
inline v8::Local<v8::Value> GetPropertyUnsafe(
v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
const char* key,
v8::NewStringType string_type = v8::NewStringType::kNormal) { … }
}
}
#endif