Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/host/ResourceLoader.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 WebInspector.ResourceLoader = {} 5 WebInspector.ResourceLoader = {};
6 6
7 WebInspector.ResourceLoader._lastStreamId = 0; 7 WebInspector.ResourceLoader._lastStreamId = 0;
8 /** @type {!Object.<number, !WebInspector.OutputStream>} */ 8 /** @type {!Object.<number, !WebInspector.OutputStream>} */
9 WebInspector.ResourceLoader._boundStreams = {}; 9 WebInspector.ResourceLoader._boundStreams = {};
10 10
11 /** 11 /**
12 * @param {!WebInspector.OutputStream} stream 12 * @param {!WebInspector.OutputStream} stream
13 * @return {number} 13 * @return {number}
14 */ 14 */
15 WebInspector.ResourceLoader._bindOutputStream = function(stream) 15 WebInspector.ResourceLoader._bindOutputStream = function(stream)
16 { 16 {
17 WebInspector.ResourceLoader._boundStreams[++WebInspector.ResourceLoader._las tStreamId] = stream; 17 WebInspector.ResourceLoader._boundStreams[++WebInspector.ResourceLoader._las tStreamId] = stream;
18 return WebInspector.ResourceLoader._lastStreamId; 18 return WebInspector.ResourceLoader._lastStreamId;
19 } 19 };
20 20
21 /** 21 /**
22 * @param {number} id 22 * @param {number} id
23 */ 23 */
24 WebInspector.ResourceLoader._discardOutputStream = function(id) 24 WebInspector.ResourceLoader._discardOutputStream = function(id)
25 { 25 {
26 WebInspector.ResourceLoader._boundStreams[id].close(); 26 WebInspector.ResourceLoader._boundStreams[id].close();
27 delete WebInspector.ResourceLoader._boundStreams[id]; 27 delete WebInspector.ResourceLoader._boundStreams[id];
28 } 28 };
29 29
30 /** 30 /**
31 * @param {number} id 31 * @param {number} id
32 * @param {string} chunk 32 * @param {string} chunk
33 */ 33 */
34 WebInspector.ResourceLoader.streamWrite = function(id, chunk) 34 WebInspector.ResourceLoader.streamWrite = function(id, chunk)
35 { 35 {
36 WebInspector.ResourceLoader._boundStreams[id].write(chunk); 36 WebInspector.ResourceLoader._boundStreams[id].write(chunk);
37 } 37 };
38 38
39 /** 39 /**
40 * @param {string} url 40 * @param {string} url
41 * @param {?Object.<string, string>} headers 41 * @param {?Object.<string, string>} headers
42 * @param {function(number, !Object.<string, string>, string)} callback 42 * @param {function(number, !Object.<string, string>, string)} callback
43 */ 43 */
44 WebInspector.ResourceLoader.load = function(url, headers, callback) 44 WebInspector.ResourceLoader.load = function(url, headers, callback)
45 { 45 {
46 var stream = new WebInspector.StringOutputStream(); 46 var stream = new WebInspector.StringOutputStream();
47 WebInspector.ResourceLoader.loadAsStream(url, headers, stream, mycallback); 47 WebInspector.ResourceLoader.loadAsStream(url, headers, stream, mycallback);
48 48
49 /** 49 /**
50 * @param {number} statusCode 50 * @param {number} statusCode
51 * @param {!Object.<string, string>} headers 51 * @param {!Object.<string, string>} headers
52 */ 52 */
53 function mycallback(statusCode, headers) 53 function mycallback(statusCode, headers)
54 { 54 {
55 callback(statusCode, headers, stream.data()); 55 callback(statusCode, headers, stream.data());
56 } 56 }
57 } 57 };
58 58
59 /** 59 /**
60 * @param {string} url 60 * @param {string} url
61 * @param {?Object.<string, string>} headers 61 * @param {?Object.<string, string>} headers
62 * @param {!WebInspector.OutputStream} stream 62 * @param {!WebInspector.OutputStream} stream
63 * @param {function(number, !Object.<string, string>)=} callback 63 * @param {function(number, !Object.<string, string>)=} callback
64 */ 64 */
65 WebInspector.ResourceLoader.loadAsStream = function(url, headers, stream, callba ck) 65 WebInspector.ResourceLoader.loadAsStream = function(url, headers, stream, callba ck)
66 { 66 {
67 var streamId = WebInspector.ResourceLoader._bindOutputStream(stream); 67 var streamId = WebInspector.ResourceLoader._bindOutputStream(stream);
(...skipping 28 matching lines...) Expand all
96 function dataURLDecodeSuccessful(text) 96 function dataURLDecodeSuccessful(text)
97 { 97 {
98 WebInspector.ResourceLoader.streamWrite(streamId, text); 98 WebInspector.ResourceLoader.streamWrite(streamId, text);
99 finishedCallback(/** @type {!InspectorFrontendHostAPI.LoadNetworkResourc eResult} */ ({statusCode : 200})); 99 finishedCallback(/** @type {!InspectorFrontendHostAPI.LoadNetworkResourc eResult} */ ({statusCode : 200}));
100 } 100 }
101 101
102 function dataURLDecodeFailed() 102 function dataURLDecodeFailed()
103 { 103 {
104 finishedCallback(/** @type {!InspectorFrontendHostAPI.LoadNetworkResourc eResult} */ ({statusCode : 404})); 104 finishedCallback(/** @type {!InspectorFrontendHostAPI.LoadNetworkResourc eResult} */ ({statusCode : 404}));
105 } 105 }
106 } 106 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698