Skip to content
  • aroben@apple.com's avatar
    Add WebCore::JavaScriptDebugServer and use it from WebKit/win · 908319c6
    aroben@apple.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@30874 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    908319c6