Demo/bin/Debug/front_end/host/ResourceLoader.js

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

WebInspector.ResourceLoader = {}

WebInspector.ResourceLoader._lastStreamId = 0;
/** @type {!Object.<number, !WebInspector.OutputStream>} */
WebInspector.ResourceLoader._boundStreams = {};

/**
 * @param {!WebInspector.OutputStream} stream
 * @return {number}
 */
WebInspector.ResourceLoader._bindOutputStream = function(stream)
{
    WebInspector.ResourceLoader._boundStreams[++WebInspector.ResourceLoader._lastStreamId] = stream;
    return WebInspector.ResourceLoader._lastStreamId;
}

/**
 * @param {number} id
 */
WebInspector.ResourceLoader._discardOutputStream = function(id)
{
    WebInspector.ResourceLoader._boundStreams[id].close();
    delete WebInspector.ResourceLoader._boundStreams[id];
}

/**
 * @param {number} id
 * @param {string} chunk
 */
WebInspector.ResourceLoader.streamWrite = function(id, chunk)
{
    WebInspector.ResourceLoader._boundStreams[id].write(chunk);
}

/**
 * @param {string} url
 * @param {?Object.<string, string>} headers
 * @param {function(number, !Object.<string, string>, string)} callback
 */
WebInspector.ResourceLoader.load = function(url, headers, callback)
{
    var stream = new WebInspector.StringOutputStream();
    WebInspector.ResourceLoader.loadAsStream(url, headers, stream, mycallback);

    /**
     * @param {number} statusCode
     * @param {!Object.<string, string>} headers
     */
    function mycallback(statusCode, headers)
    {
        callback(statusCode, headers, stream.data());
    }
}

/**
 * @type {string}
后面还有 72 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。