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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/ContentProviderBasedProject.js

Issue 1609973002: DevTools: promisify ContentProvider.requestContent and all its clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaseline Created 4 years, 11 months 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 WebInspector.ContentProviderBasedProject.prototype = { 48 WebInspector.ContentProviderBasedProject.prototype = {
49 /** 49 /**
50 * @override 50 * @override
51 * @param {!WebInspector.UISourceCode} uiSourceCode 51 * @param {!WebInspector.UISourceCode} uiSourceCode
52 * @param {function(?string)} callback 52 * @param {function(?string)} callback
53 */ 53 */
54 requestFileContent: function(uiSourceCode, callback) 54 requestFileContent: function(uiSourceCode, callback)
55 { 55 {
56 var contentProvider = this._contentProviders[uiSourceCode.url()]; 56 var contentProvider = this._contentProviders[uiSourceCode.url()];
57 contentProvider.requestContent(callback); 57 contentProvider.requestContent().then(callback);
58
59 /**
60 * @param {?string} content
61 * @param {boolean} encoded
62 * @param {string} mimeType
63 */
64 function innerCallback(content, encoded, mimeType)
65 {
66 callback(content);
67 }
68 }, 58 },
69 59
70 /** 60 /**
71 * @override 61 * @override
72 * @return {boolean} 62 * @return {boolean}
73 */ 63 */
74 canSetFileContent: function() 64 canSetFileContent: function()
75 { 65 {
76 return false; 66 return false;
77 }, 67 },
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 }, 312 },
323 313
324 dispose: function() 314 dispose: function()
325 { 315 {
326 this._contentProviders = {}; 316 this._contentProviders = {};
327 this.removeProject(); 317 this.removeProject();
328 }, 318 },
329 319
330 __proto__: WebInspector.ProjectStore.prototype 320 __proto__: WebInspector.ProjectStore.prototype
331 } 321 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698