Guest User

stateAttributeGetter()

a guest
Mar 17th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. static void stateAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
  2. {
  3.     v8::Local<v8::Object> holder = info.Holder();
  4.     v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "state");
  5.     History* impl = V8History::toImpl(holder);
  6.     if (!impl->stateChanged()) {
  7.         v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(info.GetIsolate(), holder, propertyName);
  8.         if (!v8Value.IsEmpty()) {
  9.             v8SetReturnValue(info, v8Value);
  10.             return;
  11.         }
  12.     }
  13.     RefPtr<SerializedScriptValue> cppValue(impl->state());
  14.     v8::Local<v8::Value> v8Value(cppValue ? cppValue->deserialize() : v8::Local<v8::Value>(v8::Null(info.GetIsolate())));
  15.     V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, v8Value);
  16.     v8SetReturnValue(info, v8Value);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment