Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp |
| index 48ea91a1ca31bddd10bf47ef995d41a5e0ec3990..5254d1a0d8320e3bff9d88b031e14b9250804e3b 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp |
| @@ -35,17 +35,17 @@ |
| #include "bindings/core/v8/V8ArrayBuffer.h" |
| #include "bindings/core/v8/V8Binding.h" |
| #include "bindings/core/v8/V8Blob.h" |
| -#include "bindings/core/v8/V8HiddenValue.h" |
| #include "bindings/core/v8/V8MessagePort.h" |
| +#include "bindings/core/v8/V8PrivateProperty.h" |
| #include "bindings/core/v8/V8Window.h" |
| -#include "core/events/MessageEvent.h" |
| namespace blink { |
| void V8MessageEvent::dataAttributeGetterCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| - v8::Local<v8::Value> cachedData = V8HiddenValue::getHiddenValue(scriptState, info.Holder(), V8HiddenValue::data(info.GetIsolate())); |
| + auto privateCachedData = V8PrivateProperty::getMessageEventCachedData(info.GetIsolate()); |
| + v8::Local<v8::Value> cachedData = privateCachedData.get(scriptState->context(), info.Holder()); |
| if (!cachedData.IsEmpty()) { |
| v8SetReturnValue(info, cachedData); |
| return; |
| @@ -70,29 +70,22 @@ void V8MessageEvent::dataAttributeGetterCustom(const v8::FunctionCallbackInfo<v8 |
| } |
| break; |
| - case MessageEvent::DataTypeString: { |
| - result = V8HiddenValue::getHiddenValue(scriptState, info.Holder(), V8HiddenValue::stringData(info.GetIsolate())); |
|
haraken
2016/05/26 16:41:53
Why can you remove this code?
Yuki
2016/05/27 11:49:02
MessageEvent used three different hidden values be
|
| - if (result.IsEmpty()) { |
| - String stringValue = event->dataAsString(); |
| - result = v8String(info.GetIsolate(), stringValue); |
| - } |
| + case MessageEvent::DataTypeString: |
| + result = v8String(info.GetIsolate(), event->dataAsString()); |
| break; |
| - } |
| case MessageEvent::DataTypeBlob: |
| result = toV8(event->dataAsBlob(), info.Holder(), info.GetIsolate()); |
| break; |
| case MessageEvent::DataTypeArrayBuffer: |
| - result = V8HiddenValue::getHiddenValue(scriptState, info.Holder(), V8HiddenValue::arrayBufferData(info.GetIsolate())); |
|
haraken
2016/05/26 16:41:52
Ditto.
|
| - if (result.IsEmpty()) |
| - result = toV8(event->dataAsArrayBuffer(), info.Holder(), info.GetIsolate()); |
| + result = toV8(event->dataAsArrayBuffer(), info.Holder(), info.GetIsolate()); |
| break; |
| } |
| - // Store the result as a hidden value so this callback returns the cached |
| + // Store the result as a private value so this callback returns the cached |
| // result in future invocations. |
| - V8HiddenValue::setHiddenValue(scriptState, info.Holder(), V8HiddenValue::data(info.GetIsolate()), result); |
| + privateCachedData.set(scriptState->context(), info.Holder(), result); |
| v8SetReturnValue(info, result); |
| } |