Add WebCore::JavaScriptDebugServer and use it from WebKit/win
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Mar 2008 20:51:35 +0000 (20:51 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Mar 2008 20:51:35 +0000 (20:51 +0000)
commit5f131178b51e5c90caa533125fc5096886a41a87
treebf3ac62392fc9dacbed9d8b7db6f2c23ee56fa14
parent512c99cdfcdc4b95555bc5ac1a867c31043581b7
Add WebCore::JavaScriptDebugServer and use it from WebKit/win

WebCore:

        Add JavaScriptDebugServer

        This class is a singleton which allows one or more
        JavaScriptDebugListeners to receive callbacks during JavaScript
        execution.

        Right now all listeners receive callbacks for all Pages in the
        process. Eventually we will want to support listeners registering for
        callbacks for specific Pages (e.g., the Inspector will want to listen
        for execution in just the Page it's inspecting).

        Pages notify the JavaScriptDebugServer when they are created so that
        it can install itself as the Page's debugger.

        Reviewed by Darin.

        * GNUMakefile.am: Added new files to project.
        * WebCore.pro: Ditto.
        * WebCore.vcproj/WebCore.vcproj: Ditto.
        * WebCore.xcodeproj/project.pbxproj: Ditto.
        * WebCoreSources.bkl: Ditto.
        * page/JavaScriptDebugListener.h: Added.
        * page/JavaScriptDebugServer.cpp: Added.
        (WebCore::toFrame):
        (WebCore::JavaScriptDebugServer::shared):
        (WebCore::JavaScriptDebugServer::JavaScriptDebugServer):
        (WebCore::JavaScriptDebugServer::~JavaScriptDebugServer):
        (WebCore::JavaScriptDebugServer::addListener): Registers as the
        debugger for all Pages if we're adding our first listener.
        (WebCore::JavaScriptDebugServer::removeListener): Deregisters as the
        debugger for all Pages if we're removing our last listner.
        (WebCore::JavaScriptDebugServer::pageCreated): Registers as the
        debugger for the newly created Page if we have any listeners.
        (WebCore::dispatchDidParseSource): Helper function.
        (WebCore::dispatchFailedToParseSource): Ditto.
        (WebCore::JavaScriptDebugServer::sourceParsed): Call
        dispatchDidParseSource or dispatchFailedToParseSource depending on
        whether there was an error or not.
        (WebCore::JavaScriptDebugServer::dispatchFunctionToListeners): Calls
        the passed-in JavaScriptExecutionCallback on each listener, guarding
        against re-entry.
        (WebCore::JavaScriptDebugServer::callEvent): Dispatch didEnterCallFrame.
        (WebCore::JavaScriptDebugServer::atStatement): Dispatch willExecuteStatement.
        (WebCore::JavaScriptDebugServer::returnEvent): Dispatch willLeaveCallFrame.
        (WebCore::JavaScriptDebugServer::exception): Dispatch exceptionWasRaised.
        * page/JavaScriptDebugServer.h: Added.
        * page/Page.cpp:
        (WebCore::Page::Page): Tell the shared JavaScriptDebugServer we were
        created so it can register as our debugger if needed.

WebKit/win:

        Change WebScriptDebugServer to use WebCore::JavaScriptDebugServer

        WebScriptDebugServer is now a JavaScriptDebugListener.

        Reviewed by Darin.

        * WebScriptDebugServer.cpp:
        (WebScriptDebugServer::WebScriptDebugServer): Removed initialization
        of m_callingListeners member.
        (WebScriptDebugServer::addListener): Register as a listener with
        JavaScriptDebugServer if we've just added our first listener.
        (WebScriptDebugServer::removeListener): Deregister as a listener with
        JavaScriptDebugServer if we've just removed our last listener.
        (WebScriptDebugServer::didParseSource): Added. Code came from the old
        sourceParsed method. Removed m_callingListeners code because
        JavaScriptDebugServer guards against re-entry for us.
        (WebScriptDebugServer::failedToParseSource): Ditto.
        (WebScriptDebugServer::didEnterCallFrame): Ditto for callEvent.
        (WebScriptDebugServer::willExecuteStatement): Ditto for atStatement.
        (WebScriptDebugServer::willLeaveCallFrame): Ditto for
        willLeaveCallFrame.
        (WebScriptDebugServer::exceptionWasRaised): Ditto for exception.
        * WebScriptDebugServer.h: Changed to inherit from
        WebCore::JavaScriptDebugListener.
        * WebView.cpp:
        (WebView::initWithFrame): Removed call to
        WebScriptDebugServer::pageCreated. This is now handled by WebCore.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30874 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/WebCoreSources.bkl
WebCore/page/JavaScriptDebugListener.h [new file with mode: 0644]
WebCore/page/JavaScriptDebugServer.cpp [new file with mode: 0644]
WebCore/page/JavaScriptDebugServer.h [new file with mode: 0644]
WebCore/page/Page.cpp
WebKit/win/ChangeLog
WebKit/win/WebScriptDebugServer.cpp
WebKit/win/WebScriptDebugServer.h
WebKit/win/WebView.cpp