Title: [98427] trunk/Source/WebCore
Revision
98427
Author
[email protected]
Date
2011-10-25 20:06:58 -0700 (Tue, 25 Oct 2011)

Log Message

JSEventTarget.cpp has a bunch of unnessary includes
https://bugs.webkit.org/show_bug.cgi?id=70865

Reviewed by Eric Seidel.

In the process of removing these includes, I noticed we had a bunch of
non-autogenerated code in this file, which I've now autogenerated.

* bindings/js/JSEventTarget.cpp:
(WebCore::toEventTarget):
    - One subtly here is the outter static_cast, which is caused by an
      inheritance infelicity in _javascript_AudioNode, which I've noted
      with a FIXME.  In any case, the extra static_cast shouldn't cause
      any trouble.
* webaudio/_javascript_AudioNode.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98426 => 98427)


--- trunk/Source/WebCore/ChangeLog	2011-10-26 02:14:53 UTC (rev 98426)
+++ trunk/Source/WebCore/ChangeLog	2011-10-26 03:06:58 UTC (rev 98427)
@@ -1,5 +1,23 @@
 2011-10-25  Adam Barth  <[email protected]>
 
+        JSEventTarget.cpp has a bunch of unnessary includes
+        https://bugs.webkit.org/show_bug.cgi?id=70865
+
+        Reviewed by Eric Seidel.
+
+        In the process of removing these includes, I noticed we had a bunch of
+        non-autogenerated code in this file, which I've now autogenerated.
+
+        * bindings/js/JSEventTarget.cpp:
+        (WebCore::toEventTarget):
+            - One subtly here is the outter static_cast, which is caused by an
+              inheritance infelicity in _javascript_AudioNode, which I've noted
+              with a FIXME.  In any case, the extra static_cast shouldn't cause
+              any trouble.
+        * webaudio/_javascript_AudioNode.h:
+
+2011-10-25  Adam Barth  <[email protected]>
+
         V8DOMWrapper.cpp has unneeded header includes
         https://bugs.webkit.org/show_bug.cgi?id=70863
 

Modified: trunk/Source/WebCore/bindings/js/JSEventTarget.cpp (98426 => 98427)


--- trunk/Source/WebCore/bindings/js/JSEventTarget.cpp	2011-10-26 02:14:53 UTC (rev 98426)
+++ trunk/Source/WebCore/bindings/js/JSEventTarget.cpp	2011-10-26 03:06:58 UTC (rev 98427)
@@ -26,83 +26,11 @@
 #include "config.h"
 #include "JSEventTarget.h"
 
-#include "DOMWindow.h"
-#include "Document.h"
 #include "EventTargetHeaders.h"
 #include "EventTargetInterfaces.h"
-#include "JSDOMWindow.h"
 #include "JSDOMWindowShell.h"
 #include "JSEventListener.h"
-#include "JSMessagePort.h"
-#include "JSNode.h"
-#if ENABLE(SHARED_WORKERS)
 
-#include "JSSharedWorker.h"
-#include "JSSharedWorkerContext.h"
-#endif
-
-#include "JSXMLHttpRequest.h"
-#include "JSXMLHttpRequestUpload.h"
-#include "MessagePort.h"
-
-#if ENABLE(SHARED_WORKERS)
-#include "SharedWorker.h"
-#include "SharedWorkerContext.h"
-#endif
-
-#include "XMLHttpRequest.h"
-#include "XMLHttpRequestUpload.h"
-
-#include "EventSource.h"
-#include "JSEventSource.h"
-
-#include "DOMApplicationCache.h"
-#include "JSDOMApplicationCache.h"
-
-#if ENABLE(SVG)
-#include "SVGElementInstance.h"
-#include "JSSVGElementInstance.h"
-#endif
-
-#if ENABLE(WORKERS)
-#include "DedicatedWorkerContext.h"
-#include "JSDedicatedWorkerContext.h"
-#include "JSWorker.h"
-#include "Worker.h"
-#endif
-
-#if ENABLE(NOTIFICATIONS)
-#include "JSNotification.h"
-#include "Notification.h"
-#endif
-
-#if ENABLE(INDEXED_DATABASE)
-#include "IDBRequest.h"
-#include "JSIDBRequest.h"
-#endif
-
-#if ENABLE(WEB_AUDIO)
-#include "AudioContext.h"
-#include "JSAudioContext.h"
-#include "JSJavaScriptAudioNode.h"
-#include "_javascript_AudioNode.h"
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-#include "JSWebSocket.h"
-#include "WebSocket.h"
-#endif
-
-#if ENABLE(BLOB)
-#include "JSFileReader.h"
-#include "FileReader.h"
-#endif
-
-#if ENABLE(MEDIA_STREAM)
-#include "LocalMediaStream.h"
-#include "MediaStream.h"
-#endif
-
 using namespace JSC;
 
 namespace WebCore {
@@ -136,46 +64,19 @@
 
 #undef TRY_TO_WRAP_WITH_INTERFACE
 
+#define TRY_TO_UNWRAP_WITH_INTERFACE(interfaceName) \
+    if (value.inherits(&JS##interfaceName::s_info)) \
+        return static_cast<interfaceName*>(static_cast<JS##interfaceName*>(asObject(value))->impl());
+
 EventTarget* toEventTarget(JSC::JSValue value)
 {
-    #define CONVERT_TO_EVENT_TARGET(type) \
-        if (value.inherits(&JS##type::s_info)) \
-            return static_cast<JS##type*>(asObject(value))->impl();
-
-    CONVERT_TO_EVENT_TARGET(Node)
-    CONVERT_TO_EVENT_TARGET(XMLHttpRequest)
-    CONVERT_TO_EVENT_TARGET(XMLHttpRequestUpload)
-    CONVERT_TO_EVENT_TARGET(MessagePort)
-
     if (value.inherits(&JSDOMWindowShell::s_info))
         return static_cast<JSDOMWindowShell*>(asObject(value))->impl();
 
-    CONVERT_TO_EVENT_TARGET(EventSource)
-    CONVERT_TO_EVENT_TARGET(DOMApplicationCache)
-
-#if ENABLE(SVG)
-    CONVERT_TO_EVENT_TARGET(SVGElementInstance)
-#endif
-
-#if ENABLE(WORKERS)
-    CONVERT_TO_EVENT_TARGET(Worker)
-    CONVERT_TO_EVENT_TARGET(DedicatedWorkerContext)
-#endif
-
-#if ENABLE(SHARED_WORKERS)
-    CONVERT_TO_EVENT_TARGET(SharedWorker)
-    CONVERT_TO_EVENT_TARGET(SharedWorkerContext)
-#endif
-
-#if ENABLE(NOTIFICATIONS)
-    CONVERT_TO_EVENT_TARGET(Notification)
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-    CONVERT_TO_EVENT_TARGET(WebSocket)
-#endif
-
+    DOM_EVENT_TARGET_INTERFACES_FOR_EACH(TRY_TO_UNWRAP_WITH_INTERFACE)
     return 0;
 }
 
+#undef TRY_TO_UNWRAP_WITH_INTERFACE
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/webaudio/_javascript_AudioNode.h (98426 => 98427)


--- trunk/Source/WebCore/webaudio/_javascript_AudioNode.h	2011-10-26 02:14:53 UTC (rev 98426)
+++ trunk/Source/WebCore/webaudio/_javascript_AudioNode.h	2011-10-26 03:06:58 UTC (rev 98427)
@@ -46,6 +46,7 @@
 // The "onaudioprocess" attribute is an event listener which will get called periodically with an AudioProcessingEvent which has
 // AudioBuffers for each input and output.
 
+// FIXME: EventTarget should be introduced at the base of the inheritance hierarchy (i.e., as a base class for AudioNode).
 class _javascript_AudioNode : public AudioNode, public EventTarget {
 public:
     // bufferSize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to