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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/RemoteObject.js
diff --git a/Source/devtools/front_end/sdk/RemoteObject.js b/Source/devtools/front_end/sdk/RemoteObject.js
index b465eb2d046a9c0b08290bebb3e0b603d9a68d70..199f8c58152ffea9eedc48c6a5e14214f22c61cd 100644
--- a/Source/devtools/front_end/sdk/RemoteObject.js
+++ b/Source/devtools/front_end/sdk/RemoteObject.js
@@ -117,7 +117,7 @@ WebInspector.RemoteObject.prototype = {
/**
* @param {boolean} accessorPropertiesOnly
- * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!WebInspector.RemoteObjectProperty>)} callback
+ * @param {function(?Array<!WebInspector.RemoteObjectProperty>, ?Array<!WebInspector.RemoteObjectProperty>)} callback
*/
getAllProperties: function(accessorPropertiesOnly, callback)
{
@@ -125,6 +125,37 @@ WebInspector.RemoteObject.prototype = {
},
/**
+ * @param {boolean} accessorPropertiesOnly
+ * @return {!Promise<!{properties: ?Array<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array<!WebInspector.RemoteObjectProperty>}>}
+ */
+ getAllPropertiesPromise: function(accessorPropertiesOnly)
+ {
+ return new Promise(promiseConstructor.bind(this));
+
+ /**
+ * @param {function(!{properties: ?Array<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array.<!WebInspector.RemoteObjectProperty>})} success
+ * @this {WebInspector.RemoteObject}
+ */
+ function promiseConstructor(success)
+ {
+ this.getAllProperties(accessorPropertiesOnly, getAllPropertiesCallback.bind(null, success));
+ }
+
+ /**
+ * @param {function(!{properties: ?Array<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array<!WebInspector.RemoteObjectProperty>})} callback
+ * @param {?Array<!WebInspector.RemoteObjectProperty>} properties
+ * @param {?Array<!WebInspector.RemoteObjectProperty>} internalProperties
+ */
+ function getAllPropertiesCallback(callback, properties, internalProperties)
+ {
+ callback({
+ properties: properties,
+ internalProperties: internalProperties
+ });
+ }
+ },
+
+ /**
* @return {!Promise<?Array<!WebInspector.EventListener>>}
*/
eventListeners: function()
@@ -185,7 +216,7 @@ WebInspector.RemoteObject.prototype = {
/**
* @param {function(this:Object)} functionDeclaration
- * @param {!Array.<!RuntimeAgent.CallArgument>|undefined} args
+ * @param {!Array<!RuntimeAgent.CallArgument>|undefined} args
* @param {function(*)} callback
*/
callFunctionJSON: function(functionDeclaration, args, callback)
@@ -194,6 +225,24 @@ WebInspector.RemoteObject.prototype = {
},
/**
+ * @param {function(this:Object)} functionDeclaration
+ * @param {!Array<!RuntimeAgent.CallArgument>|undefined} args
+ * @return {!Promise<*>}
+ */
+ callFunctionJSONPromise: function(functionDeclaration, args)
+ {
+ return new Promise(promiseConstructor.bind(this));
+
+ /**
+ * @this {WebInspector.RemoteObject}
+ */
+ function promiseConstructor(success)
+ {
+ this.callFunctionJSON(functionDeclaration, args, success);
+ }
+ },
+
+ /**
* @return {!WebInspector.Target}
*/
target: function()
@@ -226,6 +275,23 @@ WebInspector.RemoteObject.prototype = {
},
/**
+ * @return {!Promise<?WebInspector.DebuggerModel.FunctionDetails>}
+ */
+ functionDetailsPromise: function()
+ {
+ return new Promise(promiseConstructor.bind(this));
+
+ /**
+ * @param {function(?WebInspector.DebuggerModel.FunctionDetails)} success
+ * @this {WebInspector.RemoteObject}
+ */
+ function promiseConstructor(success)
+ {
+ this.functionDetails(success);
+ }
+ },
+
+ /**
* @param {function(?WebInspector.DebuggerModel.GeneratorObjectDetails)} callback
*/
generatorObjectDetails: function(callback)
@@ -234,7 +300,7 @@ WebInspector.RemoteObject.prototype = {
},
/**
- * @param {function(?Array.<!DebuggerAgent.CollectionEntry>)} callback
+ * @param {function(?Array<!DebuggerAgent.CollectionEntry>)} callback
*/
collectionEntries: function(callback)
{
« 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