Chromium Code Reviews

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

Issue 1942073002: [DevTools] Move getCompletions to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 241 matching lines...)
252 /** 252 /**
253 * @this {WebInspector.RemoteObject} 253 * @this {WebInspector.RemoteObject}
254 */ 254 */
255 function promiseConstructor(success) 255 function promiseConstructor(success)
256 { 256 {
257 this.callFunctionJSON(functionDeclaration, args, success); 257 this.callFunctionJSON(functionDeclaration, args, success);
258 } 258 }
259 }, 259 },
260 260
261 /** 261 /**
262 * @return {!Promise<!Array<string>>}
263 */
264 getCompletionsPromise: function()
pfeldman 2016/05/03 18:07:25 completionsPromise
265 {
266 throw "Not implemented";
267 },
268
269 /**
262 * @return {!WebInspector.Target} 270 * @return {!WebInspector.Target}
263 */ 271 */
264 target: function() 272 target: function()
265 { 273 {
266 throw new Error("Target-less object"); 274 throw new Error("Target-less object");
267 }, 275 },
268 276
269 /** 277 /**
270 * @return {?WebInspector.DebuggerModel} 278 * @return {?WebInspector.DebuggerModel}
271 */ 279 */
(...skipping 604 matching lines...)
876 * @param {boolean=} wasThrown 884 * @param {boolean=} wasThrown
877 */ 885 */
878 function mycallback(error, result, wasThrown) 886 function mycallback(error, result, wasThrown)
879 { 887 {
880 callback((error || wasThrown) ? null : result.value); 888 callback((error || wasThrown) ? null : result.value);
881 } 889 }
882 890
883 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to String(), args, true, true, false, undefined, mycallback); 891 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to String(), args, true, true, false, undefined, mycallback);
884 }, 892 },
885 893
894 /**
895 * @override
896 * @return {!Promise<!Array<string>>}
897 */
898 getCompletionsPromise: function()
899 {
900 var callback;
901 var promise = new Promise(fulfill => callback = fulfill);
902 this._runtimeAgent.getCompletions(this._objectId, this.type, didGetCompl etions);
903 return promise;
904
905 /**
906 * @param {?Protocol.Error} error
907 * @param {!Array<string>} completions
908 */
909 function didGetCompletions(error, completions)
910 {
911 callback(error ? [] : completions);
912 }
913 },
914
886 release: function() 915 release: function()
887 { 916 {
888 if (!this._objectId) 917 if (!this._objectId)
889 return; 918 return;
890 this._runtimeAgent.releaseObject(this._objectId); 919 this._runtimeAgent.releaseObject(this._objectId);
891 }, 920 },
892 921
893 /** 922 /**
894 * @override 923 * @override
895 * @return {number} 924 * @return {number}
(...skipping 750 matching lines...)
1646 { 1675 {
1647 if (!this._cachedDescription) { 1676 if (!this._cachedDescription) {
1648 var children = this._children(); 1677 var children = this._children();
1649 this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}"; 1678 this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}";
1650 } 1679 }
1651 return this._cachedDescription; 1680 return this._cachedDescription;
1652 }, 1681 },
1653 1682
1654 __proto__: WebInspector.LocalJSONObject.prototype 1683 __proto__: WebInspector.LocalJSONObject.prototype
1655 } 1684 }
OLDNEW

Powered by Google App Engine