• timothy@apple.com's avatar
    Make the JavaScript profiler opt-in, so it does not slow down JavaScript all the time. · 7dec1b92
    timothy@apple.com authored
    Make the Profiles panel in the Web Inspector have an enable screen.
    Profiling now needs to be enabled before console.profile() works.
    
    WebCore:
    
    2008-10-27  Timothy Hatcher  <timothy@apple.com>
    
            Make the Profiles panel in the Web Inspector have an enable screen.
            Profiling now needs to be enabled before console.profile() works.
    
            <rdar://problem/6211578> Make the JavaScript profiler opt-in, so it does
            not slow down JavaScript all the time
    
            Reviewed by Darin Adler and Kevin McCullough.
    
            * English.lproj/localizedStrings.js: New strings.
            * WebCore.base.exp: New and changed exports.
            * WebCore.vcproj/WebCore.vcproj: Add the PanelEnablerView.js file.
            * bindings/js/JSDOMWindowBase.cpp:
            (WebCore::JSDOMWindowBase::supportsProfiling): Call InspectorController:profilerEnabled.
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::InspectorController): Initialize the m_startProfiling
            Timer to call InspectorController::startUserInitiatedProfiling.
            (WebCore::InspectorController::startUserInitiatedProfilingSoon): Start a one-shot timer
            that calls InspectorController::startUserInitiatedProfiling.
            (WebCore::InspectorController::startUserInitiatedProfiling): Recompile all JavaScript
            and enable the profiler if the profiler was not enabled.
            (WebCore::InspectorController::stopUserInitiatedProfiling): Rearrange code for readability.
            (WebCore::InspectorController::enableProfiler): Recompile all the JavaScript functions
            if the skipRecompile argument is false. Call the profilerWasEnabled script function.
            (WebCore::InspectorController::disableProfiler): Recompile all the JavaScript functions.
            Call the profilerWasEnabled script function.
            (WebCore::InspectorController::disableDebugger): Set m_attachDebuggerWhenShown to false,
            so it won't be started later.
            * inspector/InspectorController.h:
            (WebCore::InspectorController::profilerEnabled): Return enabled() && m_profilerEnabled.
            * inspector/front-end/Images/debuggingButtons.png: Remove.
            * inspector/front-end/Images/enableButtons.png: Added.
            * inspector/front-end/Images/profilesSilhouette.png: Added.
            * inspector/front-end/Images/scriptsSilhouette.png: Added.
            * inspector/front-end/PanelEnablerView.js: Added.
            (WebInspector.PanelEnablerView):
            (WebInspector.PanelEnablerView.prototype._enableButtonCicked): Fire the "enable clicked"
            event so listeners can do their thing.
            (WebInspector.PanelEnablerView.prototype._windowResized): Test if the icon should be hidden.
            * inspector/front-end/ProfilesPanel.js:
            (WebInspector.ProfilesPanel): Create the PanelEnablerView and the strings needed for it.
            (WebInspector.ProfilesPanel.prototype.get statusBarItems): Include the enableToggleButton.
            (WebInspector.ProfilesPanel.prototype.profilerWasEnabled): Call reset and populateInterface.
            (WebInspector.ProfilesPanel.prototype.profilerWasDisabled): Call reset.
            (WebInspector.ProfilesPanel.prototype.reset): Call _updateInterface.
            (WebInspector.ProfilesPanel.prototype.setRecordingProfile): Moved in the code, no changes.
            (WebInspector.ProfilesPanel.prototype._updateInterface): Update the toggle button and
            show/hide other buttons. Also show/hide the PanelEnablerView.
            (WebInspector.ProfilesPanel.prototype._enableProfiling): Call _toggleProfiling if not enabled.
            (WebInspector.ProfilesPanel.prototype._toggleProfiling): Call InspectorController's
            disableProfiler or enableProfiler.
            * inspector/front-end/ScriptsPanel.js:
            (WebInspector.ScriptsPanel): Replace the overlay element with a PanelEnablerView. Replace the
            debuggingButton with the enableToggleButton.
            (WebInspector.ScriptsPanel.prototype.get statusBarItems): Replace the debuggingButton with
            the enableToggleButton.
            (WebInspector.ScriptsPanel.prototype._updateDebuggerButtons): Hide/show the pauseOnExceptionButton
            when needed. Replace the overlay element with a PanelEnablerView. Replace the debuggingButton
            with the enableToggleButton.
            (WebInspector.ScriptsPanel.prototype._enableDebugging): Call _toggleDebugging when not enabled.
            (WebInspector.ScriptsPanel.prototype._toggleDebugging): Remove the call to _clearInterface,
            since reset is called from debuggerWasEnabled and debuggerWasDisabled.
            * inspector/front-end/View.js: Inherit from WebInspector.Object.
            * inspector/front-end/WebKit.qrc: Add the PanelEnablerView.js file.
            * inspector/front-end/inspector.css: New styles for the PanelEnablerView.
            * inspector/front-end/inspector.html: Add the PanelEnablerView.js file.
            * inspector/front-end/inspector.js:
            (WebInspector.profilerWasEnabled): Added. Calls the ProfilesPanel.
            (WebInspector.profilerWasDisabled): Ditto.
            * page/Console.cpp:
            (WebCore::Console::error): Remove null check for m_frame, since m_frame isn't used.
            (WebCore::Console::info): Ditto.
            (WebCore::Console::log): Ditto.
            (WebCore::Console::assertCondition): Ditto.
            (WebCore::Console::dirxml): Remove null check for m_frame and use this->page().
            (WebCore::Console::count): Ditto.
            (WebCore::Console::profile): Return early if InspectorController::profilerEnabled is false.
            (WebCore::Console::profileEnd): Ditto.
            (WebCore::Console::warn): Remove null check for m_frame, since m_frame isn't used.
            * page/Settings.cpp:
            (WebCore::Settings::Settings): Remove initialization of m_didInitializeDeveloperExtrasEnabled.
            (WebCore::Settings::setDeveloperExtrasEnabled): Remove code that recompiled functions.
            Now just sets the member boolean.
            * page/Settings.h: Remove m_didInitializeDeveloperExtrasEnabled.
    
    WebKit/mac:
    
    2008-10-28  Timothy Hatcher  <timothy@apple.com>
    
            Add WebInspector methods to enable the profiler.
    
            https://bugs.webkit.org/show_bug.cgi?id=21927
    
            <rdar://problem/6211578> Make the JavaScript profiler opt-in, so it does
            not slow down JavaScript all the time
    
            Reviewed by Darin Adler and Kevin McCullough.
    
            * WebInspector/WebInspector.h:
            * WebInspector/WebInspector.mm:
            (-[WebInspector isJavaScriptProfilingEnabled]): Added. Calls InspectorController::profilerEnabled.
            (-[WebInspector setJavaScriptProfilingEnabled:]): Added. Call InspectorController's disableProfiler
            or enableProfiler methods.
    
    WebKit/win:
    
    2008-10-28  Timothy Hatcher  <timothy@apple.com>
    
            Add IWebInspector methods to enable the profiler.
    
            https://bugs.webkit.org/show_bug.cgi?id=21927
    
            <rdar://problem/6211578> Make the JavaScript profiler opt-in, so it does
            not slow down JavaScript all the time
    
            Reviewed by Darin Adler and Kevin McCullough.
    
            * WebInspector.cpp:
            (WebInspector::isJavaScriptProfilingEnabled): Added. Calls InspectorController::profilerEnabled.
            (WebInspector::setJavaScriptProfilingEnabled): Added. Call InspectorController's disableProfiler
            or enableProfiler methods.
            * WebInspector.h:
    
    WebKitTools:
    
    2008-10-28  Timothy Hatcher  <timothy@apple.com>
    
            Add support for enabling the profiler, so the profiling tests can continue
            work now that the profiler is not always enabled.
    
            https://bugs.webkit.org/show_bug.cgi?id=21927
    
            <rdar://problem/6211578> Make the JavaScript profiler opt-in, so it does
            not slow down JavaScript all the time
    
            Reviewed by Darin Adler and Kevin McCullough.
    
            * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Make the editor use spaces.
            * DumpRenderTree/LayoutTestController.cpp:
            (setJavaScriptProfilingEnabledCallback): Added. Calls LayoutTestController::setJavaScriptProfilingEnabled.
            (LayoutTestController::staticFunctions): Added setJavaScriptProfilingEnabled to the script class.
            * DumpRenderTree/LayoutTestController.h:
            * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
            (LayoutTestController::setJavaScriptProfilingEnabled): Stubbed out with a FIXME.
            * DumpRenderTree/mac/DumpRenderTree.mm:
            (resetWebViewToConsistentStateBeforeTesting): Disables the developer extras and disables the profiler.
            * DumpRenderTree/mac/LayoutTestControllerMac.mm:
            (LayoutTestController::setJavaScriptProfilingEnabled): Toggles the developer extras and profiler.
            * DumpRenderTree/win/DumpRenderTree.cpp:
            (resetWebViewToConsistentStateBeforeTesting): Disables the developer extras and disables the profiler.
            * DumpRenderTree/win/LayoutTestControllerWin.cpp:
            (LayoutTestController::setJavaScriptProfilingEnabled): Toggles the developer extras and profiler.
    
    LayoutTests:
    
    2008-10-28  Timothy Hatcher  <timothy@apple.com>
    
            Update profiler tests to opt-in to profiling and clean up the output.
    
            https://bugs.webkit.org/show_bug.cgi?id=21927
    
            <rdar://problem/6211578> Make the JavaScript profiler opt-in, so it
            does not slow down JavaScript all the time
    
            Reviewed by Darin Adler and Kevin McCullough.
    
            * fast/profiler/anonymous-event-handler-expected.txt:
            * fast/profiler/anonymous-event-handler.html:
            * fast/profiler/anonymous-function-called-from-different-contexts-expected.txt:
            * fast/profiler/anonymous-function-called-from-different-contexts.html:
            * fast/profiler/anonymous-function-calls-built-in-functions-expected.txt:
            * fast/profiler/anonymous-function-calls-built-in-functions.html:
            * fast/profiler/anonymous-function-calls-eval-expected.txt:
            * fast/profiler/anonymous-function-calls-eval.html:
            * fast/profiler/apply-expected.txt:
            * fast/profiler/apply.html:
            * fast/profiler/built-in-function-calls-anonymous-expected.txt:
            * fast/profiler/built-in-function-calls-anonymous.html:
            * fast/profiler/built-in-function-calls-user-defined-function-expected.txt:
            * fast/profiler/built-in-function-calls-user-defined-function.html:
            * fast/profiler/call-expected.txt:
            * fast/profiler/call-nodelist-as-function-expected.txt:
            * fast/profiler/call-nodelist-as-function.html:
            * fast/profiler/call.html:
            * fast/profiler/calling-the-function-that-started-the-profiler-from-another-scope-expected.txt:
            * fast/profiler/calling-the-function-that-started-the-profiler-from-another-scope.html:
            * fast/profiler/compare-multiple-profiles-expected.txt:
            * fast/profiler/compare-multiple-profiles.html:
            * fast/profiler/constructor-expected.txt:
            * fast/profiler/constructor.html:
            * fast/profiler/dead-time-expected.txt:
            * fast/profiler/dead-time.html:
            * fast/profiler/document-dot-write-expected.txt:
            * fast/profiler/document-dot-write.html:
            * fast/profiler/event-handler-expected.txt:
            * fast/profiler/event-handler.html:
            * fast/profiler/execution-context-and-eval-on-same-line-expected.txt:
            * fast/profiler/execution-context-and-eval-on-same-line.html:
            * fast/profiler/heavy-view-expected.txt:
            * fast/profiler/heavy-view.html:
            * fast/profiler/inline-event-handler-expected.txt:
            * fast/profiler/inline-event-handler.html:
            * fast/profiler/many-calls-in-the-same-scope-expected.txt:
            * fast/profiler/many-calls-in-the-same-scope.html:
            * fast/profiler/multiple-and-different-scoped-anonymous-function-calls-expected.txt:
            * fast/profiler/multiple-and-different-scoped-anonymous-function-calls.html:
            * fast/profiler/multiple-and-different-scoped-function-calls-expected.txt:
            * fast/profiler/multiple-and-different-scoped-function-calls.html:
            * fast/profiler/multiple-frames-expected.txt:
            * fast/profiler/multiple-frames.html:
            * fast/profiler/nested-anonymous-functon-expected.txt:
            * fast/profiler/nested-anonymous-functon.html:
            * fast/profiler/nested-start-and-stop-profiler-expected.txt:
            * fast/profiler/nested-start-and-stop-profiler.html:
            * fast/profiler/no-execution-context-expected.txt:
            * fast/profiler/no-execution-context.html:
            * fast/profiler/one-execution-context-expected.txt:
            * fast/profiler/one-execution-context.html:
            * fast/profiler/profile-calls-in-included-file-expected.txt:
            * fast/profiler/profile-calls-in-included-file.html:
            * fast/profiler/profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting-expected.txt:
            * fast/profiler/profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting.html:
            * fast/profiler/profiling-from-a-nested-location-expected.txt:
            * fast/profiler/profiling-from-a-nested-location.html:
            * fast/profiler/resources/profiler-test-JS-resources.js:
            (endTest): Remove some whitespace.
            (insertGivenText): Hide the output of this method, sicne it is not important to the test.
            (insertNewText): Ditto.
            (printHeavyProfilesDataWithoutTime): Output plain text an not console.log.
            (printProfilesDataWithoutTime): Ditto.
            (printProfileNodeWithoutTime): Ditto.
            * fast/profiler/simple-event-call-expected.txt:
            * fast/profiler/simple-event-call.html:
            * fast/profiler/simple-no-level-change-expected.txt:
            * fast/profiler/simple-no-level-change.html:
            * fast/profiler/start-and-stop-profiler-multiple-times-expected.txt:
            * fast/profiler/start-and-stop-profiler-multiple-times.html:
            * fast/profiler/start-and-stop-profiling-in-the-same-function-expected.txt:
            * fast/profiler/start-and-stop-profiling-in-the-same-function.html:
            * fast/profiler/start-but-dont-stop-profiling-expected.txt:
            * fast/profiler/start-but-dont-stop-profiling.html:
            * fast/profiler/stop-profiling-after-setTimeout-expected.txt:
            * fast/profiler/stop-profiling-after-setTimeout.html:
            * fast/profiler/stop-then-function-call-expected.txt:
            * fast/profiler/stop-then-function-call.html:
            * fast/profiler/throw-exception-from-eval-expected.txt:
            * fast/profiler/throw-exception-from-eval.html:
            * fast/profiler/two-execution-contexts-expected.txt:
            * fast/profiler/two-execution-contexts.html:
            * fast/profiler/user-defined-function-calls-built-in-functions-expected.txt:
            * fast/profiler/user-defined-function-calls-built-in-functions.html:
            * fast/profiler/window-dot-eval-expected.txt:
            * fast/profiler/window-dot-eval.html:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37933 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    7dec1b92
ChangeLog 371 KB