Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| index efc30fd9f8e8525818f3029c82a653ca3199ec89..fd37790ae95694fe8c57bc77895ad9514daf5cc2 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| @@ -79,6 +79,19 @@ SDK.RemoteObject = class { |
| } |
| /** |
| + * @param {!Protocol.Runtime.ObjectPreview} preview |
| + * @return {number} |
| + */ |
| + static mapOrSetEntriesCount(preview) { |
| + if (preview.subtype !== 'map' && preview.subtype !== 'set') |
| + return 0; |
| + var matches = preview.description.match(/\(([0-9]+)\)/); |
| + if (!matches) |
| + return 0; |
| + return parseInt(matches[1], 10); |
| + } |
| + |
| + /** |
| * @param {!Protocol.Runtime.RemoteObject|!SDK.RemoteObject|number|string|boolean|undefined|null} object |
| * @return {!Protocol.Runtime.CallArgument} |
| */ |
| @@ -119,9 +132,10 @@ SDK.RemoteObject = class { |
| /** |
| * @param {!SDK.RemoteObject} object |
| + * @param {boolean} generatePreview |
| * @param {function(?Array.<!SDK.RemoteObjectProperty>, ?Array.<!SDK.RemoteObjectProperty>)} callback |
| */ |
| - static loadFromObjectPerProto(object, callback) { |
| + static loadFromObjectPerProto(object, generatePreview, callback) { |
| // Combines 2 asynch calls. Doesn't rely on call-back orders (some calls may be loop-back). |
| var savedOwnProperties; |
| var savedAccessorProperties; |
| @@ -177,8 +191,8 @@ SDK.RemoteObject = class { |
| processCallback(); |
| } |
| - object.getAllProperties(true, allAccessorPropertiesCallback); |
| - object.getOwnProperties(ownPropertiesCallback); |
| + object.getAllProperties(true, generatePreview, allAccessorPropertiesCallback); |
| + object.getOwnProperties(generatePreview, ownPropertiesCallback); |
| } |
| /** |
| @@ -216,16 +230,18 @@ SDK.RemoteObject = class { |
| } |
| /** |
| + * @param {boolean} generatePreview |
| * @param {function(?Array.<!SDK.RemoteObjectProperty>, ?Array.<!SDK.RemoteObjectProperty>)} callback |
| */ |
| - getOwnProperties(callback) { |
| + getOwnProperties(generatePreview, callback) { |
| throw 'Not implemented'; |
| } |
| /** |
| + * @param {boolean=} generatePreview |
|
dgozman
2017/01/13 02:55:42
Don't make it optional.
luoe
2017/01/13 23:20:13
Done.
|
| * @return {!Promise<!{properties: ?Array.<!SDK.RemoteObjectProperty>, internalProperties: ?Array.<!SDK.RemoteObjectProperty>}>} |
| */ |
| - getOwnPropertiesPromise() { |
| + getOwnPropertiesPromise(generatePreview) { |
| return new Promise(promiseConstructor.bind(this)); |
| /** |
| @@ -233,7 +249,7 @@ SDK.RemoteObject = class { |
| * @this {SDK.RemoteObject} |
| */ |
| function promiseConstructor(success) { |
| - this.getOwnProperties(getOwnPropertiesCallback.bind(null, success)); |
| + this.getOwnProperties(!!generatePreview, getOwnPropertiesCallback.bind(null, success)); |
| } |
| /** |
| @@ -248,17 +264,19 @@ SDK.RemoteObject = class { |
| /** |
| * @param {boolean} accessorPropertiesOnly |
| + * @param {boolean} generatePreview |
| * @param {function(?Array<!SDK.RemoteObjectProperty>, ?Array<!SDK.RemoteObjectProperty>)} callback |
| */ |
| - getAllProperties(accessorPropertiesOnly, callback) { |
| + getAllProperties(accessorPropertiesOnly, generatePreview, callback) { |
| throw 'Not implemented'; |
| } |
| /** |
| * @param {boolean} accessorPropertiesOnly |
| + * @param {boolean} generatePreview |
| * @return {!Promise<!{properties: ?Array<!SDK.RemoteObjectProperty>, internalProperties: ?Array<!SDK.RemoteObjectProperty>}>} |
| */ |
| - getAllPropertiesPromise(accessorPropertiesOnly) { |
| + getAllPropertiesPromise(accessorPropertiesOnly, generatePreview) { |
| return new Promise(promiseConstructor.bind(this)); |
| /** |
| @@ -266,7 +284,7 @@ SDK.RemoteObject = class { |
| * @this {SDK.RemoteObject} |
| */ |
| function promiseConstructor(success) { |
| - this.getAllProperties(accessorPropertiesOnly, getAllPropertiesCallback.bind(null, success)); |
| + this.getAllProperties(accessorPropertiesOnly, generatePreview, getAllPropertiesCallback.bind(null, success)); |
| } |
| /** |
| @@ -494,19 +512,21 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject { |
| /** |
| * @override |
| + * @param {boolean} generatePreview |
| * @param {function(?Array.<!SDK.RemoteObjectProperty>, ?Array.<!SDK.RemoteObjectProperty>)} callback |
| */ |
| - getOwnProperties(callback) { |
| - this.doGetProperties(true, false, false, callback); |
| + getOwnProperties(generatePreview, callback) { |
| + this.doGetProperties(true, false, generatePreview, callback); |
| } |
| /** |
| * @override |
| * @param {boolean} accessorPropertiesOnly |
| + * @param {boolean} generatePreview |
| * @param {function(?Array.<!SDK.RemoteObjectProperty>, ?Array.<!SDK.RemoteObjectProperty>)} callback |
| */ |
| - getAllProperties(accessorPropertiesOnly, callback) { |
| - this.doGetProperties(false, accessorPropertiesOnly, false, callback); |
| + getAllProperties(accessorPropertiesOnly, generatePreview, callback) { |
| + this.doGetProperties(false, accessorPropertiesOnly, generatePreview, callback); |
| } |
| /** |
| @@ -1125,18 +1145,20 @@ SDK.LocalJSONObject = class extends SDK.RemoteObject { |
| /** |
| * @override |
| + * @param {boolean} generatePreview |
| * @param {function(?Array.<!SDK.RemoteObjectProperty>, ?Array.<!SDK.RemoteObjectProperty>)} callback |
| */ |
| - getOwnProperties(callback) { |
| + getOwnProperties(generatePreview, callback) { |
| callback(this._children(), null); |
| } |
| /** |
| * @override |
| * @param {boolean} accessorPropertiesOnly |
| + * @param {boolean} generatePreview |
| * @param {function(?Array.<!SDK.RemoteObjectProperty>, ?Array.<!SDK.RemoteObjectProperty>)} callback |
| */ |
| - getAllProperties(accessorPropertiesOnly, callback) { |
| + getAllProperties(accessorPropertiesOnly, generatePreview, callback) { |
| if (accessorPropertiesOnly) |
| callback([], null); |
| else |