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

Unified Diff: Source/bindings/core/v8/V8DOMConfiguration.h

Issue 922233002: bindings: Makes runtime-enabled attributes on prototype chains compilable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8DOMConfiguration.h
diff --git a/Source/bindings/core/v8/V8DOMConfiguration.h b/Source/bindings/core/v8/V8DOMConfiguration.h
index 42d85dcbecd53d7934f031b9d48289849b73708d..0af9a401b3d99c5b7356a08730a5f0ab5356adb0 100644
--- a/Source/bindings/core/v8/V8DOMConfiguration.h
+++ b/Source/bindings/core/v8/V8DOMConfiguration.h
@@ -177,6 +177,34 @@ public:
static void installAccessors(v8::Isolate*, v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Signature>, const AccessorConfiguration*, size_t accessorCount);
+ template<class ObjectOrTemplate>
+ static inline void installAccessor(v8::Handle<ObjectOrTemplate> instanceTemplate, v8::Handle<ObjectOrTemplate> prototype, v8::Handle<v8::Signature> signature, const AccessorConfiguration& accessor, v8::Isolate* isolate)
haraken 2015/02/13 15:08:24 We might not want to duplicate the code between in
Yuki 2015/02/16 10:51:51 Refactored the code a bit. Since it seemed that ge
+ {
+ DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
+ if (accessor.exposeConfiguration == OnlyExposedToPrivateScript && !world.isPrivateScriptIsolatedWorld())
+ return;
+
+ v8::FunctionCallback getterCallback = accessor.getter;
+ v8::FunctionCallback setterCallback = accessor.setter;
+ if (world.isMainWorld()) {
+ if (accessor.getterForMainWorld)
+ getterCallback = accessor.getterForMainWorld;
+ if (accessor.setterForMainWorld)
+ setterCallback = accessor.setterForMainWorld;
+ }
+ v8::Local<v8::FunctionTemplate> getter;
+ if (getterCallback) {
+ getter = v8::FunctionTemplate::New(isolate, getterCallback, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(accessor.data)), signature, 0);
+ getter->RemovePrototype();
+ }
+ v8::Local<v8::FunctionTemplate> setter;
+ if (setterCallback) {
+ setter = v8::FunctionTemplate::New(isolate, setterCallback, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(accessor.data)), signature, 1);
+ setter->RemovePrototype();
+ }
+ prototype->SetAccessorProperty(v8AtomicString(isolate, accessor.name), getter, setter, accessor.attribute, accessor.settings);
+ }
+
static v8::Local<v8::Signature> installDOMClassTemplate(v8::Isolate*, v8::Local<v8::FunctionTemplate>, const char* interfaceName, v8::Handle<v8::FunctionTemplate> parentClass, size_t fieldCount,
const AttributeConfiguration*, size_t attributeCount,
const AccessorConfiguration*, size_t accessorCount,
« no previous file with comments | « no previous file | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698