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

Side by Side Diff: Source/devtools/front_end/bindings/StylesSourceMapping.js

Issue 1285183006: DevTools: WI.Throttler goes promisified. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cc
Patch Set: remove dependent patchset Created 5 years, 4 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 * @param {!WebInspector.Event} event 366 * @param {!WebInspector.Event} event
367 */ 367 */
368 _workingCopyChanged: function(event) 368 _workingCopyChanged: function(event)
369 { 369 {
370 if (this._isAddingRevision) 370 if (this._isAddingRevision)
371 return; 371 return;
372 372
373 this._commitThrottler.schedule(this._commitIncrementalEdit.bind(this), f alse); 373 this._commitThrottler.schedule(this._commitIncrementalEdit.bind(this), f alse);
374 }, 374 },
375 375
376 /** 376 _commitIncrementalEdit: function()
377 * @param {!WebInspector.Throttler.FinishCallback} finishCallback
378 */
379 _commitIncrementalEdit: function(finishCallback)
380 { 377 {
381 this._mapping._setStyleContent(this._uiSourceCode, this._uiSourceCode.wo rkingCopy(), this._isMajorChangePending) 378 var promise = this._mapping._setStyleContent(this._uiSourceCode, this._u iSourceCode.workingCopy(), this._isMajorChangePending)
382 .then(this._styleContentSet.bind(this)) 379 .then(this._styleContentSet.bind(this))
383 .then(finishCallback)
384 .catch(/** @type {function()} */(finishCallback));
385 this._isMajorChangePending = false; 380 this._isMajorChangePending = false;
381 return promise;
386 }, 382 },
387 383
388 /** 384 /**
389 * @param {?string} error 385 * @param {?string} error
390 */ 386 */
391 _styleContentSet: function(error) 387 _styleContentSet: function(error)
392 { 388 {
393 if (error) 389 if (error)
394 WebInspector.console.error(error); 390 WebInspector.console.error(error);
395 }, 391 },
396 392
397 /** 393 /**
398 * @param {string} content 394 * @param {string} content
399 */ 395 */
400 addRevision: function(content) 396 addRevision: function(content)
401 { 397 {
402 this._isAddingRevision = true; 398 this._isAddingRevision = true;
403 this._uiSourceCode.addRevision(content); 399 this._uiSourceCode.addRevision(content);
404 delete this._isAddingRevision; 400 delete this._isAddingRevision;
405 }, 401 },
406 402
407 dispose: function() 403 dispose: function()
408 { 404 {
409 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); 405 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this);
410 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); 406 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this);
411 } 407 }
412 } 408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698