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

Side by Side Diff: Source/devtools/front_end/sdk/RemoteObject.js

Issue 1307383002: [DevTools] Promisify RemoteObject methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 { 110 {
111 callback({ 111 callback({
112 properties: properties, 112 properties: properties,
113 internalProperties: internalProperties 113 internalProperties: internalProperties
114 }); 114 });
115 } 115 }
116 }, 116 },
117 117
118 /** 118 /**
119 * @param {boolean} accessorPropertiesOnly 119 * @param {boolean} accessorPropertiesOnly
120 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback 120 * @param {function(?Array<!WebInspector.RemoteObjectProperty>, ?Array<!WebI nspector.RemoteObjectProperty>)} callback
121 */ 121 */
122 getAllProperties: function(accessorPropertiesOnly, callback) 122 getAllProperties: function(accessorPropertiesOnly, callback)
123 { 123 {
124 throw "Not implemented"; 124 throw "Not implemented";
125 }, 125 },
126 126
127 /** 127 /**
128 * @param {boolean} accessorPropertiesOnly
129 * @return {!Promise<!{properties: ?Array<!WebInspector.RemoteObjectProperty >, internalProperties: ?Array<!WebInspector.RemoteObjectProperty>}>}
130 */
131 getAllPropertiesPromise: function(accessorPropertiesOnly)
132 {
133 return new Promise(promiseConstructor.bind(this));
134
135 /**
136 * @param {function(!{properties: ?Array<!WebInspector.RemoteObjectPrope rty>, internalProperties: ?Array.<!WebInspector.RemoteObjectProperty>})} success
137 * @this {WebInspector.RemoteObject}
138 */
139 function promiseConstructor(success)
140 {
141 this.getAllProperties(accessorPropertiesOnly, getAllPropertiesCallba ck.bind(null, success));
142 }
143
144 /**
145 * @param {function(!{properties: ?Array<!WebInspector.RemoteObjectPrope rty>, internalProperties: ?Array<!WebInspector.RemoteObjectProperty>})} callback
146 * @param {?Array<!WebInspector.RemoteObjectProperty>} properties
147 * @param {?Array<!WebInspector.RemoteObjectProperty>} internalPropertie s
148 */
149 function getAllPropertiesCallback(callback, properties, internalProperti es)
150 {
151 callback({
152 properties: properties,
153 internalProperties: internalProperties
154 });
155 }
156 },
157
158 /**
128 * @return {!Promise<?Array<!WebInspector.EventListener>>} 159 * @return {!Promise<?Array<!WebInspector.EventListener>>}
129 */ 160 */
130 eventListeners: function() 161 eventListeners: function()
131 { 162 {
132 throw "Not implemented"; 163 throw "Not implemented";
133 }, 164 },
134 165
135 /** 166 /**
136 * @param {!RuntimeAgent.CallArgument} name 167 * @param {!RuntimeAgent.CallArgument} name
137 * @param {function(string=)} callback 168 * @param {function(string=)} callback
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 { 209 {
179 callback({ 210 callback({
180 object: object, 211 object: object,
181 wasThrown: wasThrown 212 wasThrown: wasThrown
182 }); 213 });
183 } 214 }
184 }, 215 },
185 216
186 /** 217 /**
187 * @param {function(this:Object)} functionDeclaration 218 * @param {function(this:Object)} functionDeclaration
188 * @param {!Array.<!RuntimeAgent.CallArgument>|undefined} args 219 * @param {!Array<!RuntimeAgent.CallArgument>|undefined} args
189 * @param {function(*)} callback 220 * @param {function(*)} callback
190 */ 221 */
191 callFunctionJSON: function(functionDeclaration, args, callback) 222 callFunctionJSON: function(functionDeclaration, args, callback)
192 { 223 {
193 throw "Not implemented"; 224 throw "Not implemented";
194 }, 225 },
195 226
196 /** 227 /**
228 * @param {function(this:Object)} functionDeclaration
229 * @param {!Array<!RuntimeAgent.CallArgument>|undefined} args
230 * @return {!Promise<*>}
231 */
232 callFunctionJSONPromise: function(functionDeclaration, args)
233 {
234 return new Promise(promiseConstructor.bind(this));
235
236 /**
237 * @this {WebInspector.RemoteObject}
238 */
239 function promiseConstructor(success)
240 {
241 this.callFunctionJSON(functionDeclaration, args, success);
242 }
243 },
244
245 /**
197 * @return {!WebInspector.Target} 246 * @return {!WebInspector.Target}
198 */ 247 */
199 target: function() 248 target: function()
200 { 249 {
201 throw new Error("Target-less object"); 250 throw new Error("Target-less object");
202 }, 251 },
203 252
204 /** 253 /**
205 * @return {?WebInspector.DebuggerModel} 254 * @return {?WebInspector.DebuggerModel}
206 */ 255 */
(...skipping 12 matching lines...) Expand all
219 268
220 /** 269 /**
221 * @param {function(?WebInspector.DebuggerModel.FunctionDetails)} callback 270 * @param {function(?WebInspector.DebuggerModel.FunctionDetails)} callback
222 */ 271 */
223 functionDetails: function(callback) 272 functionDetails: function(callback)
224 { 273 {
225 callback(null); 274 callback(null);
226 }, 275 },
227 276
228 /** 277 /**
278 * @return {!Promise<?WebInspector.DebuggerModel.FunctionDetails>}
279 */
280 functionDetailsPromise: function()
281 {
282 return new Promise(promiseConstructor.bind(this));
283
284 /**
285 * @param {function(?WebInspector.DebuggerModel.FunctionDetails)} succes s
286 * @this {WebInspector.RemoteObject}
287 */
288 function promiseConstructor(success)
289 {
290 this.functionDetails(success);
291 }
292 },
293
294 /**
229 * @param {function(?WebInspector.DebuggerModel.GeneratorObjectDetails)} cal lback 295 * @param {function(?WebInspector.DebuggerModel.GeneratorObjectDetails)} cal lback
230 */ 296 */
231 generatorObjectDetails: function(callback) 297 generatorObjectDetails: function(callback)
232 { 298 {
233 callback(null); 299 callback(null);
234 }, 300 },
235 301
236 /** 302 /**
237 * @param {function(?Array.<!DebuggerAgent.CollectionEntry>)} callback 303 * @param {function(?Array<!DebuggerAgent.CollectionEntry>)} callback
238 */ 304 */
239 collectionEntries: function(callback) 305 collectionEntries: function(callback)
240 { 306 {
241 callback(null); 307 callback(null);
242 } 308 }
243 } 309 }
244 310
245 /** 311 /**
246 * @param {*} value 312 * @param {*} value
247 * @return {!WebInspector.RemoteObject} 313 * @return {!WebInspector.RemoteObject}
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 { 1351 {
1286 if (!this._cachedDescription) { 1352 if (!this._cachedDescription) {
1287 var children = this._children(); 1353 var children = this._children();
1288 this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}"; 1354 this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}";
1289 } 1355 }
1290 return this._cachedDescription; 1356 return this._cachedDescription;
1291 }, 1357 },
1292 1358
1293 __proto__: WebInspector.LocalJSONObject.prototype 1359 __proto__: WebInspector.LocalJSONObject.prototype
1294 } 1360 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698