diff options
author | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-27 12:41:22 +0000 |
---|---|---|
committer | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-27 12:41:22 +0000 |
commit | 4b6af4f75e9ad65588f01d9e980a0cc427695d91 (patch) | |
tree | 1a1314085360c475c3c439c94b8877c7a07c8ad5 /webkit/port/bindings/v8/v8_proxy.h | |
parent | 3050f7d57b2dee4784df2cb0812c3b5845956ee1 (diff) | |
download | chromium_src-4b6af4f75e9ad65588f01d9e980a0cc427695d91.zip chromium_src-4b6af4f75e9ad65588f01d9e980a0cc427695d91.tar.gz chromium_src-4b6af4f75e9ad65588f01d9e980a0cc427695d91.tar.bz2 |
Move a bunch of code-driven binding template configuration to a data-driven approach. This reduces the code size, and the overall binary size.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/bindings/v8/v8_proxy.h')
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/webkit/port/bindings/v8/v8_proxy.h b/webkit/port/bindings/v8/v8_proxy.h index 40909c0..23d1f95 100644 --- a/webkit/port/bindings/v8/v8_proxy.h +++ b/webkit/port/bindings/v8/v8_proxy.h @@ -103,6 +103,41 @@ class GlobalHandleInfo { #endif // NDEBUG +// The following Batch structs and methods are used for setting multiple +// properties on an ObjectTemplate, used from the generated bindings +// initialization (ConfigureXXXTemplate). This greatly reduces the binary +// size by moving from code driven setup to data table driven setup. + +// BatchedAttribute translates into calls to SetAccessor() on either the +// instance or the prototype ObjectTemplate, based on |on_proto|. +struct BatchedAttribute { + const char* const name; + v8::AccessorGetter getter; + v8::AccessorSetter setter; + V8ClassIndex::V8WrapperType data; + v8::AccessControl settings; + v8::PropertyAttribute attribute; + bool on_proto; +}; + +void BatchConfigureAttributes(v8::Handle<v8::ObjectTemplate> inst, + v8::Handle<v8::ObjectTemplate> proto, + const BatchedAttribute* attrs, + size_t num_attrs); + +// BhatchedConstant translates into calls to Set() for setting up an object's +// constants. It sets the constant on both the FunctionTemplate |desc| and the +// ObjectTemplate |proto|. PropertyAttributes is always ReadOnly. +struct BatchedConstant { + const char* const name; + int value; +}; + +void BatchConfigureConstants(v8::Handle<v8::FunctionTemplate> desc, + v8::Handle<v8::ObjectTemplate> proto, + const BatchedConstant* consts, + size_t num_consts); + class V8Proxy { public: // The types of javascript errors that can be thrown. |