Move generate prototype and constructor classes into the generated implementation files
https://bugs.webkit.org/show_bug.cgi?id=134054

Reviewed by Oliver Hunt.

In an effort to reduce the size of the generated bindings headers, which is important
as the generated headers get included in a lot of places, this patch moves the prototype
and constructor declarations from the header to implementation file. This works because,
for the most part, no code cares about the prototype or constructors except the instance.

There are a few exceptions which had to be accounted for:
- The global objects (JSDOMWindow and JSWorkerGlobalScope) need to have their prototypes
  available during initialization, so they remain in the header.
- JSLocation requires customizing some aspects of the prototype behavior, so its prototype,
  and any future class that uses JSCustomNamedGetterOnPrototype or JSCustomDefineOwnPropertyOnPrototype,
  remains in the header.
- A few classes had custom constructor functions. Instead of keeping the entire constructor
  in the header, I opted for pulling just the static constructor function into the header, and
  modifying the custom constructors to use the DOMConstructorObject type as the callee, since the
  more specific type was unnecessary.

As a result of making these changes, I was also able to remove the #include of JSDOMBinding.h from
all the headers, which brought in quite a bit.

* bindings/js/JSAudioContextCustom.cpp:
(WebCore::constructJSAudioContext):
(WebCore::JSAudioContextConstructor::constructJSAudioContext): Deleted.
* bindings/js/JSBlobCustom.cpp:
(WebCore::constructJSBlob):
(WebCore::JSBlobConstructor::constructJSBlob): Deleted.
* bindings/js/JSCryptoCustom.cpp:
* bindings/js/JSDOMFormDataCustom.cpp:
(WebCore::constructJSDOMFormData):
(WebCore::JSDOMFormDataConstructor::constructJSDOMFormData): Deleted.
* bindings/js/JSDOMMimeTypeArrayCustom.cpp:
* bindings/js/JSDOMPluginArrayCustom.cpp:
* bindings/js/JSDOMPluginCustom.cpp:
* bindings/js/JSDataCueCustom.cpp:
(WebCore::constructJSDataCue):
(WebCore::JSDataCueConstructor::constructJSDataCue): Deleted.
* bindings/js/JSDataTransferCustom.cpp:
* bindings/js/JSEventCustom.cpp:
* bindings/js/JSFileReaderCustom.cpp:
* bindings/js/JSHistoryCustom.cpp:
* bindings/js/JSIDBAnyCustom.cpp:
* bindings/js/JSIDBDatabaseCustom.cpp:
* bindings/js/JSIDBObjectStoreCustom.cpp:
* bindings/js/JSImageConstructor.cpp:
(WebCore::JSImageConstructor::finishCreation):
* bindings/js/JSImageDataCustom.cpp:
* bindings/js/JSInspectorFrontendHostCustom.cpp:
* bindings/js/JSLocationCustom.cpp:
* bindings/js/JSMessagePortCustom.cpp:
* bindings/js/JSMutationObserverCustom.cpp:
(WebCore::constructJSMutationObserver):
(WebCore::JSMutationObserverConstructor::constructJSMutationObserver): Deleted.
* bindings/js/JSSQLResultSetRowListCustom.cpp:
* bindings/js/JSSQLTransactionSyncCustom.cpp:
* bindings/js/JSSVGLengthCustom.cpp:
* bindings/js/JSSharedWorkerCustom.cpp:
(WebCore::constructJSSharedWorker):
(WebCore::JSSharedWorkerConstructor::constructJSSharedWorker): Deleted.
* bindings/js/JSStorageCustom.cpp:
* bindings/js/JSUserMessageHandlersNamespaceCustom.cpp:
* bindings/js/JSWebKitPointCustom.cpp:
(WebCore::constructJSWebKitPoint):
(WebCore::JSWebKitPointConstructor::constructJSWebKitPoint): Deleted.
* bindings/js/JSWorkerCustom.cpp:
(WebCore::constructJSWorker):
(WebCore::JSWorkerConstructor::constructJSWorker): Deleted.
* bindings/js/SerializedScriptValue.cpp:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
(GeneratePrototypeDeclaration):
(GenerateConstructorDeclaration):
(GenerateConstructorHelperMethods):
(HeaderNeedsPrototypeDeclaration):
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestActiveDOMObject.h:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestEventConstructor.h:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.h:
* bindings/scripts/test/JS/JSTestException.cpp:
* bindings/scripts/test/JS/JSTestException.h:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.h:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestNode.h:
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
* bindings/scripts/test/JS/JSTestNondeterministic.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.h:
* bindings/scripts/test/JS/JSattribute.cpp:
* bindings/scripts/test/JS/JSattribute.h:
* bindings/scripts/test/JS/JSreadonly.cpp:
* bindings/scripts/test/JS/JSreadonly.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
index 0f7110a..b9f4f74 100644
--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
@@ -21,11 +21,8 @@
 #ifndef JSTestObj_h
 #define JSTestObj_h
 
-#include "JSDOMBinding.h"
+#include "JSDOMWrapper.h"
 #include "TestObj.h"
-#include <runtime/JSGlobalObject.h>
-#include <runtime/JSObject.h>
-#include <runtime/ObjectPrototype.h>
 
 namespace WebCore {
 
@@ -40,6 +37,7 @@
     }
 
     static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
+    static JSC::JSObject* getPrototype(JSC::VM&, JSC::JSGlobalObject*);
     static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
     static void destroy(JSC::JSCell*);
     ~JSTestObj();
@@ -109,52 +107,6 @@
 JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestObj*);
 TestObj* toTestObj(JSC::JSValue);
 
-class JSTestObjPrototype : public JSC::JSNonFinalObject {
-public:
-    typedef JSC::JSNonFinalObject Base;
-    static JSC::JSObject* self(JSC::VM&, JSC::JSGlobalObject*);
-    static JSTestObjPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
-    {
-        JSTestObjPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestObjPrototype>(vm.heap)) JSTestObjPrototype(vm, globalObject, structure);
-        ptr->finishCreation(vm);
-        return ptr;
-    }
-
-    DECLARE_INFO;
-    void finishCreation(JSC::VM&);
-    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
-    {
-        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
-    }
-
-private:
-    JSTestObjPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(vm, structure) { }
-};
-
-class JSTestObjConstructor : public DOMConstructorObject {
-private:
-    JSTestObjConstructor(JSC::Structure*, JSDOMGlobalObject*);
-    void finishCreation(JSC::VM&, JSDOMGlobalObject*);
-
-public:
-    typedef DOMConstructorObject Base;
-    static JSTestObjConstructor* create(JSC::VM& vm, JSC::Structure* structure, JSDOMGlobalObject* globalObject)
-    {
-        JSTestObjConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestObjConstructor>(vm.heap)) JSTestObjConstructor(structure, globalObject);
-        ptr->finishCreation(vm, globalObject);
-        return ptr;
-    }
-
-    DECLARE_INFO;
-    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
-    {
-        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
-    }
-protected:
-    static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestObj(JSC::ExecState*);
-    static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);
-};
-
 
 } // namespace WebCore