Add SetHidden for Dictionary

This commit is contained in:
Cheng Zhao 2015-08-27 15:21:27 +08:00
parent b41635e809
commit f5e34deb1a

View file

@ -36,12 +36,25 @@ class Dictionary {
return ConvertFromV8(isolate_, val, out); return ConvertFromV8(isolate_, val, out);
} }
template<typename T>
bool GetHidden(const base::StringPiece& key, T* out) const {
v8::Local<v8::Value> val = GetHandle()->GetHiddenValue(
StringToV8(isolate_, key));
return ConvertFromV8(isolate_, val, out);
}
template<typename T> template<typename T>
bool Set(const base::StringPiece& key, T val) { bool Set(const base::StringPiece& key, T val) {
return GetHandle()->Set(StringToV8(isolate_, key), return GetHandle()->Set(StringToV8(isolate_, key),
ConvertToV8(isolate_, val)); ConvertToV8(isolate_, val));
} }
template<typename T>
bool SetHidden(const base::StringPiece& key, T val) {
return GetHandle()->SetHiddenValue(StringToV8(isolate_, key),
ConvertToV8(isolate_, val));
}
template<typename T> template<typename T>
bool SetMethod(const base::StringPiece& key, const T& callback) { bool SetMethod(const base::StringPiece& key, const T& callback) {
return GetHandle()->Set( return GetHandle()->Set(