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

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

Issue 2815453005: [Bindings] Use SetNativeDataProperty to install features on instances (Closed)
Patch Set: Remove different DCHECKs Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
index 288633ca3b04386091e2453ed33aebd4b18f857d..f9c1bf229ee9e031ac7c3bcc84a1f9b088f2d9ed 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
@@ -95,35 +95,36 @@ void InstallAttributeInternal(
const DOMWrapperWorld& world) {
if (!WorldConfigurationApplies(attribute, world))
return;
+
v8::Local<v8::Name> name = V8AtomicString(isolate, attribute.name);
+ v8::AccessorNameGetterCallback getter = attribute.getter;
+ v8::AccessorNameSetterCallback setter = attribute.setter;
+ v8::Local<v8::Value> data =
+ v8::External::New(isolate, const_cast<WrapperTypeInfo*>(attribute.data));
// This method is only being used for installing interfaces which are
// enabled through origin trials. Assert here that it is being called with
// an attribute configuration for a constructor.
// TODO(iclelland): Relax this constraint and allow arbitrary data-type
// properties to be added here.
- DCHECK_EQ(&V8ConstructorAttributeGetter, attribute.getter);
-
- V8PerContextData* per_context_data =
- V8PerContextData::From(isolate->GetCurrentContext());
- v8::Local<v8::Function> data =
- per_context_data->ConstructorForType(attribute.data);
+ DCHECK_EQ(&V8ConstructorAttributeGetter, getter);
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
DCHECK(attribute.property_location_configuration);
if (attribute.property_location_configuration &
- V8DOMConfiguration::kOnInstance)
+ V8DOMConfiguration::kOnInstance) {
instance
- ->DefineOwnProperty(
- isolate->GetCurrentContext(), name, data,
- static_cast<v8::PropertyAttribute>(attribute.attribute))
+ ->SetAccessor(context, name, getter, setter, data, v8::DEFAULT,
jbroman 2017/04/13 14:54:45 This is only for origin trials, so maybe you've al
haraken 2017/04/13 15:40:19 The name is really confusing but: - SetAccessor =
jbroman 2017/04/13 17:11:23 Ah. If that's the case, then ignore me (though it
+ static_cast<v8::PropertyAttribute>(attribute.attribute))
.ToChecked();
+ }
if (attribute.property_location_configuration &
- V8DOMConfiguration::kOnPrototype)
+ V8DOMConfiguration::kOnPrototype) {
prototype
- ->DefineOwnProperty(
- isolate->GetCurrentContext(), name, data,
- static_cast<v8::PropertyAttribute>(attribute.attribute))
+ ->SetAccessor(context, name, getter, setter, data, v8::DEFAULT,
+ static_cast<v8::PropertyAttribute>(attribute.attribute))
.ToChecked();
+ }
if (attribute.property_location_configuration &
V8DOMConfiguration::kOnInterface)
NOTREACHED();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698