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

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

Issue 2005433002: [Origin Trials] Install origin trial bindings on V8 context conditionally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-ef-install
Patch Set: Clean up, use Yuki's method to define interface objects 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/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 0396898eebd7e46c7576985d3328c75425483b16..e36f340f95519d74247d4d2a8131327d2f1d08dc 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
@@ -29,6 +29,7 @@
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
+#include "bindings/core/v8/V8PerContextData.h"
#include "platform/TraceEvent.h"
namespace blink {
@@ -68,13 +69,22 @@ void installAttributeInternal(v8::Isolate* isolate, v8::Local<v8::Object> instan
return;
v8::Local<v8::Name> name = v8AtomicString(isolate, attribute.name);
- 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 conguration for a constructor.
haraken 2016/05/31 00:16:32 configuration
iclelland 2016/05/31 03:17:31 Done.
+ // TODO(iclelland): Relax this constraint and allow arbitrary data-type
+ // properties to be added here.
+ DCHECK_EQ(&v8ConstructorAttributeGetter, attribute.getter);
+
+ V8PerContextData* perContextData = V8PerContextData::from(isolate->GetCurrentContext());
+ v8::Local<v8::Function> data = perContextData->constructorForType(attribute.data);
DCHECK(attribute.propertyLocationConfiguration);
if (attribute.propertyLocationConfiguration & V8DOMConfiguration::OnInstance)
- v8CallOrCrash(instance->DefineOwnProperty(isolate->GetCurrentContext(), name, data, static_cast<v8::PropertyAttribute>(attribute.attribute)));
+ v8CallOrCrash(instance->DefineOwnProperty(isolate->GetCurrentContext(), name, data));
if (attribute.propertyLocationConfiguration & V8DOMConfiguration::OnPrototype)
- v8CallOrCrash(prototype->DefineOwnProperty(isolate->GetCurrentContext(), name, data, static_cast<v8::PropertyAttribute>(attribute.attribute)));
+ v8CallOrCrash(prototype->DefineOwnProperty(isolate->GetCurrentContext(), name, data));
if (attribute.propertyLocationConfiguration & V8DOMConfiguration::OnInterface)
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698