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

Side by Side Diff: Source/devtools/front_end/elements/PropertiesWidget.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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Google Inc. All rights reserved. 3 * Copyright (C) 2014 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 * @param {!WebInspector.Event} event 57 * @param {!WebInspector.Event} event
58 */ 58 */
59 _setNode: function(event) 59 _setNode: function(event)
60 { 60 {
61 this._node = /** @type {?WebInspector.DOMNode} */(event.data); 61 this._node = /** @type {?WebInspector.DOMNode} */(event.data);
62 this.update(); 62 this.update();
63 }, 63 },
64 64
65 /** 65 /**
66 * @override 66 * @override
67 * @param {!WebInspector.Throttler.FinishCallback} finishCallback
68 * @protected 67 * @protected
68 * @return {!Promise.<?>}
69 */ 69 */
70 doUpdate: function(finishCallback) 70 doUpdate: function()
71 { 71 {
72 if (this._lastRequestedNode) { 72 if (this._lastRequestedNode) {
73 this._lastRequestedNode.target().runtimeAgent().releaseObjectGroup(W ebInspector.PropertiesWidget._objectGroupName); 73 this._lastRequestedNode.target().runtimeAgent().releaseObjectGroup(W ebInspector.PropertiesWidget._objectGroupName);
74 delete this._lastRequestedNode; 74 delete this._lastRequestedNode;
75 } 75 }
76 76
77 if (!this._node) { 77 if (!this._node) {
78 this.element.removeChildren(); 78 this.element.removeChildren();
79 this.sections = []; 79 this.sections = [];
80 finishCallback(); 80 return Promise.resolve();
81 return;
82 } 81 }
83 82
84 this._lastRequestedNode = this._node; 83 this._lastRequestedNode = this._node;
85 this._node.resolveToObjectPromise(WebInspector.PropertiesWidget._objectG roupName) 84 return this._node.resolveToObjectPromise(WebInspector.PropertiesWidget._ objectGroupName)
86 .then(nodeResolved.bind(this)) 85 .then(nodeResolved.bind(this))
87 .then(finishCallback)
88 .catch(/** @type {function()} */(finishCallback));
89 86
90 /** 87 /**
91 * @param {?WebInspector.RemoteObject} object 88 * @param {?WebInspector.RemoteObject} object
92 * @this {WebInspector.PropertiesWidget} 89 * @this {WebInspector.PropertiesWidget}
93 */ 90 */
94 function nodeResolved(object) 91 function nodeResolved(object)
95 { 92 {
96 if (!object) 93 if (!object)
97 return; 94 return;
98 95
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return; 171 return;
175 var data = event.data; 172 var data = event.data;
176 var node = /** @type {!WebInspector.DOMNode} */ (data instanceof WebInsp ector.DOMNode ? data : data.node); 173 var node = /** @type {!WebInspector.DOMNode} */ (data instanceof WebInsp ector.DOMNode ? data : data.node);
177 if (this._node !== node) 174 if (this._node !== node)
178 return; 175 return;
179 this.update(); 176 this.update();
180 }, 177 },
181 178
182 __proto__: WebInspector.ThrottledWidget.prototype 179 __proto__: WebInspector.ThrottledWidget.prototype
183 } 180 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/PlatformFontsWidget.js ('k') | Source/devtools/front_end/elements/StylesSidebarPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698