Changeset 60965 in webkit


Ignore:
Timestamp:
Jun 10, 2010 10:59:59 AM (14 years ago)
Author:
yurys@chromium.org
Message:

2010-06-10 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: to reduce the front end start up time don't push script
sources to frontend if debugger is always enabled, instead request
script content lazily at the moment it should be displyed. It is critical for
always enabled debugger because in that case lots of script may have
already been parsed when the front end is opening and pushing all
of them at once may slow things down(even though the script sources will never
be used if scripts panel isn't open).
https://bugs.webkit.org/show_bug.cgi?id=40364

  • inspector/InspectorBackend.cpp: (WebCore::InspectorBackend::getScriptSource):
  • inspector/InspectorBackend.h:
  • inspector/InspectorBackend.idl:
  • inspector/InspectorController.cpp: (WebCore::InspectorController::didCommitLoad): (WebCore::InspectorController::getScriptSource): (WebCore::InspectorController::didParseSource):
  • inspector/InspectorController.h:
  • inspector/InspectorFrontend.cpp: (WebCore::InspectorFrontend::didGetScriptSource):
  • inspector/InspectorFrontend.h:
  • inspector/front-end/InspectorBackendStub.js: (.WebInspector.InspectorBackendStub.prototype.editScriptSource): (.WebInspector.InspectorBackendStub.prototype.getScriptSource):
  • inspector/front-end/ScriptView.js: (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded): (WebInspector.ScriptView.prototype._didGetScriptSource): (WebInspector.ScriptView.prototype._sourceFrameSetupFinished):

2010-06-10 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: to reduce the front end start up time don't push script
sources to frontend if debugger is always enabled, instead request
script content lazily at the moment it should be displyed. It is critical for
always enabled debugger because in that case lots of script may have
already been parsed when the front end is opening and pushing all
of them at once may slow things down(even though the script sources will never
be used if scripts panel isn't open).
https://bugs.webkit.org/show_bug.cgi?id=40364

  • src/js/DevTools.js:
  • src/js/InspectorControllerImpl.js: (devtools.InspectorBackendImpl): (.devtools.InspectorBackendImpl.prototype.getScriptSource):
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r60964 r60965  
     12010-06-10  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: to reduce the front end start up time don't push script
     6        sources to frontend if debugger is always enabled, instead request
     7        script content lazily at the moment it should be displyed. It is critical for
     8        always enabled debugger because in that case lots of script may have
     9        already been parsed when the front end is opening and pushing all
     10        of them at once may slow things down(even though the script sources will never
     11        be used if scripts panel isn't open).
     12        https://bugs.webkit.org/show_bug.cgi?id=40364
     13
     14        * inspector/InspectorBackend.cpp:
     15        (WebCore::InspectorBackend::getScriptSource):
     16        * inspector/InspectorBackend.h:
     17        * inspector/InspectorBackend.idl:
     18        * inspector/InspectorController.cpp:
     19        (WebCore::InspectorController::didCommitLoad):
     20        (WebCore::InspectorController::getScriptSource):
     21        (WebCore::InspectorController::didParseSource):
     22        * inspector/InspectorController.h:
     23        * inspector/InspectorFrontend.cpp:
     24        (WebCore::InspectorFrontend::didGetScriptSource):
     25        * inspector/InspectorFrontend.h:
     26        * inspector/front-end/InspectorBackendStub.js:
     27        (.WebInspector.InspectorBackendStub.prototype.editScriptSource):
     28        (.WebInspector.InspectorBackendStub.prototype.getScriptSource):
     29        * inspector/front-end/ScriptView.js:
     30        (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded):
     31        (WebInspector.ScriptView.prototype._didGetScriptSource):
     32        (WebInspector.ScriptView.prototype._sourceFrameSetupFinished):
     33
    1342010-06-10  Adam Barth  <abarth@webkit.org>
    235
  • trunk/WebCore/inspector/InspectorBackend.cpp

    r60843 r60965  
    222222}
    223223
     224void InspectorBackend::getScriptSource(long callId, const String& sourceID)
     225{
     226    if (m_inspectorController)
     227        m_inspectorController->getScriptSource(callId, sourceID);
     228}
     229
    224230void InspectorBackend::enableProfiler(bool always)
    225231{
  • trunk/WebCore/inspector/InspectorBackend.h

    r60843 r60965  
    9292
    9393    void editScriptSource(long callId, const String& sourceID, const String& newContent);
     94    void getScriptSource(long callId, const String& sourceID);
    9495
    9596    void enableProfiler(bool always);
  • trunk/WebCore/inspector/InspectorBackend.idl

    r60843 r60965  
    6767
    6868        void editScriptSource(in long callId, in DOMString sourceID, in DOMString newContent);
     69        void getScriptSource(in long callId, in DOMString sourceID);
    6970
    7071        void enableProfiler(in boolean always);
  • trunk/WebCore/inspector/InspectorController.cpp

    r60895 r60965  
    668668#if ENABLE(JAVASCRIPT_DEBUGGER)
    669669        m_sourceIDToURL.clear();
     670        m_scriptIDToContent.clear();
    670671#endif
    671672#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
     
    16341635}
    16351636
     1637void InspectorController::getScriptSource(long callId, const String& sourceID)
     1638{
     1639    if (!m_frontend)
     1640        return;
     1641    String scriptSource = m_scriptIDToContent.get(sourceID);
     1642    m_frontend->didGetScriptSource(callId, scriptSource);
     1643}
     1644
    16361645void InspectorController::resumeDebugger()
    16371646{
     
    16841693void InspectorController::didParseSource(const String& sourceID, const String& url, const String& data, int firstLine, ScriptWorldType worldType)
    16851694{
    1686     m_frontend->parsedScriptSource(sourceID, url, data, firstLine, worldType);
     1695    // Don't send script content to the front end until it's realy needed.
     1696    m_frontend->parsedScriptSource(sourceID, url, "", firstLine, worldType);
    16871697
    16881698    if (url.isEmpty())
     
    17001710
    17011711    m_sourceIDToURL.set(sourceID, url);
     1712    m_scriptIDToContent.set(sourceID, data);
    17021713}
    17031714
  • trunk/WebCore/inspector/InspectorController.h

    r60895 r60965  
    243243
    244244    void editScriptSource(long callId, const String& sourceID, const String& newContent);
     245    void getScriptSource(long callId, const String& sourceID);
    245246
    246247    void resumeDebugger();
     
    362363    ScriptState* m_pausedScriptState;
    363364    HashMap<String, String> m_sourceIDToURL;
     365    HashMap<String, String> m_scriptIDToContent;
    364366    HashMap<String, SourceBreakpoints> m_stickyBreakpoints;
    365367
  • trunk/WebCore/inspector/InspectorFrontend.cpp

    r60895 r60965  
    371371}
    372372
     373void InspectorFrontend::didGetScriptSource(long callId, const String& result)
     374{
     375    ScriptFunctionCall function(m_webInspector, "dispatch");
     376    function.appendArgument("didGetScriptSource");
     377    function.appendArgument(callId);
     378    function.appendArgument(result);
     379    function.call();
     380}
     381
    373382void InspectorFrontend::profilerWasEnabled()
    374383{
  • trunk/WebCore/inspector/InspectorFrontend.h

    r60895 r60965  
    100100
    101101        void didEditScriptSource(long callId, bool success, const String& result, SerializedScriptValue* newCallFrames);
     102        void didGetScriptSource(long callId, const String& result);
    102103
    103104        void profilerWasEnabled();
  • trunk/WebCore/inspector/front-end/InspectorBackendStub.js

    r57505 r60965  
    186186    },
    187187
     188    editScriptSource: function()
     189    {
     190        WebInspector.didEditScriptSource(callId, false);
     191    },
     192
     193    getScriptSource: function(callId, sourceID)
     194    {
     195        WebInspector.didGetScriptSource(callId, null);
     196    },
     197
    188198    resumeDebugger: function()
    189199    {
  • trunk/WebCore/inspector/front-end/ScriptView.js

    r60567 r60965  
    5151        if (!this._frameNeedsSetup)
    5252            return;
     53        delete this._frameNeedsSetup;
    5354
    5455        this.attach();
    5556
     57        if (this.script.source)
     58            this._sourceFrameSetupFinished();
     59        else {
     60            var callbackId = WebInspector.Callback.wrap(this._didGetScriptSource.bind(this))
     61            InspectorBackend.getScriptSource(callbackId, this.script.sourceID);
     62        }
     63    },
     64
     65    _didGetScriptSource: function(source)
     66    {
     67        this.script.source = source || WebInspector.UIString("<source is not available>");
     68        this._sourceFrameSetupFinished();
     69    },
     70
     71    _sourceFrameSetupFinished: function()
     72    {
    5673        this.sourceFrame.setContent("text/javascript", this._prependWhitespace(this.script.source));
    5774        this._sourceFrameSetup = true;
    58         delete this._frameNeedsSetup;
    5975    },
    6076
     
    107123    showingLastSearchResult: WebInspector.SourceView.prototype.showingLastSearchResult,
    108124    _jumpToSearchResult: WebInspector.SourceView.prototype._jumpToSearchResult,
    109     _sourceFrameSetupFinished: WebInspector.SourceView.prototype._sourceFrameSetupFinished,
    110125    _removeBreakpoint: WebInspector.SourceView.prototype._removeBreakpoint,
    111126    _editLine: WebInspector.SourceView.prototype._editLine,
     
    114129
    115130WebInspector.ScriptView.prototype.__proto__ = WebInspector.View.prototype;
     131
     132WebInspector.didGetScriptSource = WebInspector.Callback.processCallback;
  • trunk/WebKit/chromium/ChangeLog

    r60955 r60965  
     12010-06-10  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: to reduce the front end start up time don't push script
     6        sources to frontend if debugger is always enabled, instead request
     7        script content lazily at the moment it should be displyed. It is critical for
     8        always enabled debugger because in that case lots of script may have
     9        already been parsed when the front end is opening and pushing all
     10        of them at once may slow things down(even though the script sources will never
     11        be used if scripts panel isn't open).
     12        https://bugs.webkit.org/show_bug.cgi?id=40364
     13
     14        * src/js/DevTools.js:
     15        * src/js/InspectorControllerImpl.js:
     16        (devtools.InspectorBackendImpl):
     17        (.devtools.InspectorBackendImpl.prototype.getScriptSource):
     18
    1192010-06-10  Mike Belshe  <mbelshe@google.com>
    220
  • trunk/WebKit/chromium/src/js/DevTools.js

    r60893 r60965  
    211211if (!window.v8ScriptDebugServerEnabled) {
    212212
    213 /**
    214  * This override is necessary for adding script source asynchronously.
    215  * @override
    216  */
    217 WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded = function()
    218 {
    219     if (!this._frameNeedsSetup)
    220         return;
    221 
    222     this.attach();
    223 
    224     if (this.script.source)
    225         this.didResolveScriptSource_();
    226     else {
    227         var self = this;
    228         devtools.tools.getDebuggerAgent().resolveScriptSource(
    229             this.script.sourceID,
    230             function(source) {
    231                 self.script.source = source || WebInspector.UIString("<source is not available>");
    232                 self.didResolveScriptSource_();
    233             });
    234     }
    235 };
    236 
    237 
    238 /**
    239  * Performs source frame setup when script source is aready resolved.
    240  */
    241 WebInspector.ScriptView.prototype.didResolveScriptSource_ = function()
    242 {
    243     this.sourceFrame.setContent("text/javascript", this._prependWhitespace(this.script.source));
    244     this._sourceFrameSetup = true;
    245     delete this._frameNeedsSetup;
    246 };
    247 
    248 
    249213(function()
    250214{
  • trunk/WebKit/chromium/src/js/InspectorControllerImpl.js

    r60886 r60965  
    9595    this.installInspectorControllerDelegate_("disableDebugger");
    9696    this.installInspectorControllerDelegate_("editScriptSource");
     97    this.installInspectorControllerDelegate_("getScriptSource");
    9798    this.installInspectorControllerDelegate_("enableDebugger");
    9899    this.installInspectorControllerDelegate_("setBreakpoint");
     
    151152
    152153
     154devtools.InspectorBackendImpl.prototype.getScriptSource = function(callID, sourceID)
     155{
     156    devtools.tools.getDebuggerAgent().resolveScriptSource(
     157        sourceID,
     158        function(source) {
     159             WebInspector.didGetScriptSource(callID, source);
     160        });
     161};
     162
     163
    153164devtools.InspectorBackendImpl.prototype.activateBreakpoints = function()
    154165{
Note: See TracChangeset for help on using the changeset viewer.