From f5e34deb1a5226b4e7e620cb65fce0225471d4d9 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 27 Aug 2015 15:21:27 +0800 Subject: [PATCH] Add SetHidden for Dictionary --- native_mate/dictionary.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/native_mate/dictionary.h b/native_mate/dictionary.h index 0ff05c9bb88a..c15f8f902fdd 100644 --- a/native_mate/dictionary.h +++ b/native_mate/dictionary.h @@ -36,12 +36,25 @@ class Dictionary { return ConvertFromV8(isolate_, val, out); } + template + bool GetHidden(const base::StringPiece& key, T* out) const { + v8::Local val = GetHandle()->GetHiddenValue( + StringToV8(isolate_, key)); + return ConvertFromV8(isolate_, val, out); + } + template bool Set(const base::StringPiece& key, T val) { return GetHandle()->Set(StringToV8(isolate_, key), ConvertToV8(isolate_, val)); } + template + bool SetHidden(const base::StringPiece& key, T val) { + return GetHandle()->SetHiddenValue(StringToV8(isolate_, key), + ConvertToV8(isolate_, val)); + } + template bool SetMethod(const base::StringPiece& key, const T& callback) { return GetHandle()->Set(