Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp |
| index 141a8426f20404c2afa61835d9fdbd345b6510c0..94716c8a5765ecc8c8fd5c981d558a68bf751e5f 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp |
| @@ -32,8 +32,8 @@ |
| #include "bindings/core/v8/SerializedScriptValue.h" |
| #include "bindings/core/v8/SerializedScriptValueFactory.h" |
| -#include "bindings/core/v8/V8HiddenValue.h" |
| #include "bindings/core/v8/V8History.h" |
| +#include "bindings/core/v8/V8PrivateProperty.h" |
| #include "core/events/PopStateEvent.h" |
| #include "core/frame/History.h" |
| @@ -44,9 +44,8 @@ namespace blink { |
| static v8::Local<v8::Value> cacheState(ScriptState* scriptState, |
| v8::Local<v8::Object> popStateEvent, |
| v8::Local<v8::Value> state) { |
| - V8HiddenValue::setHiddenValue(scriptState, popStateEvent, |
| - V8HiddenValue::state(scriptState->isolate()), |
| - state); |
| + V8PrivateProperty::getPopStateEventState(scriptState->isolate()) |
| + .set(scriptState->context(), popStateEvent, state); |
| return state; |
| } |
| @@ -54,8 +53,10 @@ void V8PopStateEvent::stateAttributeGetterCustom( |
| const v8::FunctionCallbackInfo<v8::Value>& info) { |
| v8::Isolate* isolate = info.GetIsolate(); |
| ScriptState* scriptState = ScriptState::current(isolate); |
| - v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue( |
| - scriptState, info.Holder(), V8HiddenValue::state(isolate)); |
| + v8::Local<v8::Context> context = scriptState->context(); |
| + V8PrivateProperty::Symbol stateSymbol = |
| + V8PrivateProperty::getPopStateEventState(isolate); |
| + v8::Local<v8::Value> result = stateSymbol.get(context, info.Holder()); |
| if (!result.IsEmpty()) { |
| v8SetReturnValue(info, result); |
| @@ -93,17 +94,13 @@ void V8PopStateEvent::stateAttributeGetterCustom( |
| if (v8HistoryValue.IsEmpty()) |
| return; |
| v8::Local<v8::Object> v8History = v8HistoryValue.As<v8::Object>(); |
| - if (!history->stateChanged()) { |
| - result = V8HiddenValue::getHiddenValue(scriptState, v8History, |
| - V8HiddenValue::state(isolate)); |
| - if (!result.IsEmpty()) { |
| - v8SetReturnValue(info, cacheState(scriptState, info.Holder(), result)); |
| - return; |
| - } |
| + if (!history->stateChanged() && stateSymbol.hasValue(context, v8History)) { |
| + v8SetReturnValue(info, cacheState(scriptState, info.Holder(), |
| + stateSymbol.get(context, v8History))); |
|
Yuki
2017/03/29 06:22:53
s/get/getOrUndefined/
because you've already check
peria
2017/03/29 07:00:01
Done.
|
| + return; |
| } |
| result = event->serializedState()->deserialize(isolate); |
| - V8HiddenValue::setHiddenValue(scriptState, v8History, |
| - V8HiddenValue::state(isolate), result); |
| + stateSymbol.set(context, v8History, result); |
| } else { |
| result = event->serializedState()->deserialize(isolate); |
| } |