Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp

Issue 2007463003: binding: Reimplements V8HiddenValue as V8PrivateProperty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()));
- 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()));
- 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);
}
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.cpp ('k') | third_party/WebKit/Source/bindings/core/v8/v8.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698