⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 120472 in webkit


Ignore:
Timestamp:
Jun 15, 2012, 9:57:11 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Add FileSystemRequestManager and FileSystemDispatcher
https://bugs.webkit.org/show_bug.cgi?id=89191

Patch by Taiju Tsuiki <tzik@chromium.org> on 2012-06-15
Reviewed by Vsevolod Vlasov.

  • inspector/front-end/FileSystemModel.js:

(WebInspector.FileSystemModel):
(WebInspector.FileSystemRequestManager):
(WebInspector.FileSystemRequestManager.prototoype._requestId):
(WebInspector.FileSystemRequestManager.prototoype.readDirectory):
(WebInspector.FileSystemRequestManager.prototoype._didReadDirectory):
(WebInspector.FileSystemDispatcher):
(WebInspector.FileSystemDispatcher.prototype.gotFileSystemRoot):
(WebInspector.FileSystemDispatcher.prototype.didReadDirectory):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r120471 r120472  
     12012-06-15  Taiju Tsuiki  <tzik@chromium.org>
     2
     3        Web Inspector: Add FileSystemRequestManager and FileSystemDispatcher
     4        https://bugs.webkit.org/show_bug.cgi?id=89191
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        * inspector/front-end/FileSystemModel.js:
     9        (WebInspector.FileSystemModel):
     10        (WebInspector.FileSystemRequestManager):
     11        (WebInspector.FileSystemRequestManager.prototoype._requestId):
     12        (WebInspector.FileSystemRequestManager.prototoype.readDirectory):
     13        (WebInspector.FileSystemRequestManager.prototoype._didReadDirectory):
     14        (WebInspector.FileSystemDispatcher):
     15        (WebInspector.FileSystemDispatcher.prototype.gotFileSystemRoot):
     16        (WebInspector.FileSystemDispatcher.prototype.didReadDirectory):
     17
    1182012-06-15  Pavel Feldman  <pfeldman@chromium.org>
    219
  • trunk/Source/WebCore/inspector/front-end/FileSystemModel.js

    r120223 r120472  
    4545    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
    4646
    47     FileSystemAgent.enable();
     47    this._agentWrapper = new WebInspector.FileSystemRequestManager();
    4848
    4949    if (WebInspector.resourceTreeModel.mainFrame)
     
    222222    }
    223223}
     224
     225/**
     226 * @constructor
     227 */
     228WebInspector.FileSystemRequestManager = function()
     229{
     230    this._pendingReadDirectoryRequests = {};
     231
     232    InspectorBackend.registerFileSystemDispatcher(new WebInspector.FileSystemDispatcher(this));
     233    FileSystemAgent.enable();
     234}
     235
     236WebInspector.FileSystemRequestManager.nextRequestId = 1;
     237
     238WebInspector.FileSystemRequestManager.prototype = {
     239    /**
     240     * @return {number}
     241     */
     242    _requestId: function()
     243    {
     244        return WebInspector.FileSystemRequestManager.nextRequestId++;
     245    },
     246
     247    /**
     248     * @param {string} url
     249     * @param {function(number, Array.<FileSystemAgent.Entry>=)} callback
     250     */
     251    readDirectory: function(url, callback)
     252    {
     253        var requestId = this.requestId();
     254        this._pendingReadDirectoryRequests[requestId] = callback;
     255        FileSystemAgent.readDirectory(requestId, url);
     256    },
     257
     258    /**
     259     * @param {number} requestId
     260     * @param {number} errorCode
     261     * @param {Array.<FileSystemAgent.Entry>=} backendEntries
     262     */
     263    _didReadDirectory: function(requestId, errorCode, backendEntries)
     264    {
     265        var callback = /** @type {function(number, Array.<FileSystemAgent.Entry>=)} */ this._pendingReadDirectoryRequests[requestId];
     266        if (!callback)
     267            return;
     268        delete this._pendingReadDirectoryRequests[requestId];
     269        callback(errorCode, backendEntries);
     270    }
     271}
     272
     273/**
     274 * @constructor
     275 * @implements {FileSystemAgent.Dispatcher}
     276 * @param {WebInspector.FileSystemRequestManager} agentWrapper
     277 */
     278WebInspector.FileSystemDispatcher = function(agentWrapper)
     279{
     280    this._agentWrapper = agentWrapper;
     281}
     282
     283WebInspector.FileSystemDispatcher.prototype = {
     284    /**
     285     * @param {number} requestId
     286     * @param {number} errorCode
     287     * @param {Array.<FileSystemAgent.Entry>=} backendEntries
     288     */
     289    didReadDirectory: function(requestId, errorCode, backendEntries)
     290    {
     291        this._agentWrapper._didReadDirectory(requestId, errorCode, backendEntries);
     292    }
     293}
Note: See TracChangeset for help on using the changeset viewer.