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

Unified Diff: Source/devtools/front_end/bindings/TempFile.js

Issue 685203003: DevTools: Get rid of synchronous XHRs in the frontend code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/bindings/TempFile.js
diff --git a/Source/devtools/front_end/bindings/TempFile.js b/Source/devtools/front_end/bindings/TempFile.js
index a9674a87f2ae9005f86aae2d7f3ea849e5940e1c..9aedcd93d7b0077e192cb78bf14e244b48e55106 100644
--- a/Source/devtools/front_end/bindings/TempFile.js
+++ b/Source/devtools/front_end/bindings/TempFile.js
@@ -32,9 +32,9 @@ window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileS
/**
* @constructor
- * @param {!string} dirPath
- * @param {!string} name
- * @param {!function(?WebInspector.TempFile)} callback
+ * @param {string} dirPath
+ * @param {string} name
+ * @param {function(?WebInspector.TempFile)} callback
*/
WebInspector.TempFile = function(dirPath, name, callback)
{
@@ -121,7 +121,7 @@ WebInspector.TempFile = function(dirPath, name, callback)
WebInspector.TempFile.prototype = {
/**
* @param {!Array.<string>} strings
- * @param {!function(boolean)} callback
+ * @param {function(boolean)} callback
*/
write: function(strings, callback)
{
@@ -221,8 +221,8 @@ WebInspector.TempFile.prototype = {
/**
* @constructor
- * @param {!string} dirPath
- * @param {!string} name
+ * @param {string} dirPath
+ * @param {string} name
*/
WebInspector.DeferredTempFile = function(dirPath, name)
{
@@ -252,7 +252,7 @@ WebInspector.DeferredTempFile.prototype = {
},
/**
- * @param {!function(?WebInspector.TempFile)} callback
+ * @param {function(?WebInspector.TempFile)} callback
*/
finishWriting: function(callback)
{
@@ -363,16 +363,24 @@ WebInspector.DeferredTempFile.prototype = {
*/
WebInspector.TempStorageCleaner = function()
{
- this._worker = Runtime.startSharedWorker("temp_storage_shared_worker", "TempStorage");
- this._worker.onerror = this._handleError.bind(this);
- this._callbacks = [];
- this._worker.port.onmessage = this._handleMessage.bind(this);
- this._worker.port.onerror = this._handleError.bind(this);
+ Runtime.startSharedWorker("temp_storage_shared_worker", "TempStorage").then(this._init.bind(this)).done();
}
WebInspector.TempStorageCleaner.prototype = {
/**
- * @param {!function()} callback
+ * @param {!SharedWorker} worker
+ */
+ _init: function(worker)
+ {
+ this._worker = worker;
+ this._worker.onerror = this._handleError.bind(this);
+ this._callbacks = [];
+ this._worker.port.onmessage = this._handleMessage.bind(this);
+ this._worker.port.onerror = this._handleError.bind(this);
+ },
+
+ /**
+ * @param {function()} callback
*/
ensureStorageCleared: function(callback)
{
@@ -407,7 +415,7 @@ WebInspector.TempStorageCleaner.prototype = {
}
/**
- * @param {!function()} callback
+ * @param {function()} callback
*/
WebInspector.TempFile._ensureTempStorageCleared = function(callback)
{

Powered by Google App Engine
This is Rietveld 408576698