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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/DOMModel.js

Issue 2728543002: DevTools: refactor Common.Renderer for DOM nodes (Closed)
Patch Set: fixup Created 3 years, 9 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) 2009, 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 if (error) { 1840 if (error) {
1841 callback(null); 1841 callback(null);
1842 return; 1842 return;
1843 } 1843 }
1844 callback(this.nodeForId(nodeId)); 1844 callback(this.nodeForId(nodeId));
1845 } 1845 }
1846 } 1846 }
1847 1847
1848 /** 1848 /**
1849 * @param {!SDK.RemoteObject} object 1849 * @param {!SDK.RemoteObject} object
1850 * @param {function(?SDK.DOMNode)} callback 1850 * @return {!Promise<?SDK.DOMNode>}
1851 */ 1851 */
1852 pushObjectAsNodeToFrontend(object, callback) { 1852 pushObjectAsNodeToFrontend(object) {
1853 if (object.isNode()) 1853 return new Promise(fulfill => {
1854 this.pushNodeToFrontend(/** @type {string} */ (object.objectId), callback) ; 1854 if (object.isNode())
1855 else 1855 this.pushNodeToFrontend(/** @type {string} */ (object.objectId), node => fulfill(node));
dgozman 2017/03/21 23:00:49 nit: can just pass fulfill as a last parameter.
chenwilliam 2017/03/22 00:30:38 Done.
1856 callback(null); 1856 else
1857 fulfill(null);
1858 });
1857 } 1859 }
1858 1860
1859 /** 1861 /**
1860 * @override 1862 * @override
1861 * @return {!Promise} 1863 * @return {!Promise}
1862 */ 1864 */
1863 suspendModel() { 1865 suspendModel() {
1864 return new Promise(promiseBody.bind(this)); 1866 return new Promise(promiseBody.bind(this));
1865 1867
1866 /** 1868 /**
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 /** 2150 /**
2149 * @override 2151 * @override
2150 * @param {!Protocol.Page.FrameId} frameId 2152 * @param {!Protocol.Page.FrameId} frameId
2151 */ 2153 */
2152 highlightFrame(frameId) { 2154 highlightFrame(frameId) {
2153 this._agent.highlightFrame( 2155 this._agent.highlightFrame(
2154 frameId, Common.Color.PageHighlight.Content.toProtocolRGBA(), 2156 frameId, Common.Color.PageHighlight.Content.toProtocolRGBA(),
2155 Common.Color.PageHighlight.ContentOutline.toProtocolRGBA()); 2157 Common.Color.PageHighlight.ContentOutline.toProtocolRGBA());
2156 } 2158 }
2157 }; 2159 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698