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

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

Issue 2785943002: [Bindings] Simplify V8PrivateProperty::Symbol methods (Closed)
Patch Set: work for comments Created 3 years, 9 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 0e838f1372e0fa00477916e5d7252e04fa577960..b3a11ca2c2bbed886de0c0bb03e316208ffdf392 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp
@@ -44,11 +44,10 @@ namespace blink {
void V8MessageEvent::dataAttributeGetterCustom(
const v8::FunctionCallbackInfo<v8::Value>& info) {
- ScriptState* scriptState = ScriptState::current(info.GetIsolate());
+ v8::Isolate* isolate = info.GetIsolate();
auto privateCachedData =
- V8PrivateProperty::getMessageEventCachedData(info.GetIsolate());
- v8::Local<v8::Value> cachedData =
- privateCachedData.get(scriptState->context(), info.Holder());
+ V8PrivateProperty::getMessageEventCachedData(isolate);
+ v8::Local<v8::Value> cachedData = privateCachedData.getOrEmpty(info.Holder());
if (!cachedData.IsEmpty()) {
v8SetReturnValue(info, cachedData);
return;
@@ -59,9 +58,10 @@ void V8MessageEvent::dataAttributeGetterCustom(
v8::Local<v8::Value> result;
switch (event->getDataType()) {
case MessageEvent::DataTypeScriptValue:
- result = event->dataAsScriptValue().v8ValueFor(scriptState);
+ result =
+ event->dataAsScriptValue().v8ValueFor(ScriptState::current(isolate));
if (result.IsEmpty())
- result = v8::Null(info.GetIsolate());
+ result = v8::Null(isolate);
break;
case MessageEvent::DataTypeSerializedScriptValue:
@@ -70,29 +70,28 @@ void V8MessageEvent::dataAttributeGetterCustom(
MessagePortArray ports = event->ports();
SerializedScriptValue::DeserializeOptions options;
options.messagePorts = &ports;
- result = serializedValue->deserialize(info.GetIsolate(), options);
+ result = serializedValue->deserialize(isolate, options);
} else {
- result = v8::Null(info.GetIsolate());
+ result = v8::Null(isolate);
}
break;
case MessageEvent::DataTypeString:
- result = v8String(info.GetIsolate(), event->dataAsString());
+ result = v8String(isolate, event->dataAsString());
break;
case MessageEvent::DataTypeBlob:
- result = ToV8(event->dataAsBlob(), info.Holder(), info.GetIsolate());
+ result = ToV8(event->dataAsBlob(), info.Holder(), isolate);
break;
case MessageEvent::DataTypeArrayBuffer:
- result =
- ToV8(event->dataAsArrayBuffer(), info.Holder(), info.GetIsolate());
+ result = ToV8(event->dataAsArrayBuffer(), info.Holder(), isolate);
break;
}
// Store the result as a private value so this callback returns the cached
// result in future invocations.
- privateCachedData.set(scriptState->context(), info.Holder(), result);
+ privateCachedData.set(info.Holder(), result);
v8SetReturnValue(info, result);
}

Powered by Google App Engine
This is Rietveld 408576698