 Chromium Code Reviews
 Chromium Code Reviews Issue 2102453003:
  [DevTools] Move collectionEntries to internalProperties in protocol  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2102453003:
  [DevTools] Move collectionEntries to internalProperties in protocol  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 fb1862735d65a79393a6444202f86de09bb182b5..dda539c35ec17faf71cfc0fb3583650173ef89d1 100644 | 
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js | 
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js | 
| @@ -84,8 +84,9 @@ WebInspector.RemoteObject.prototype = { | 
| /** | 
| * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!WebInspector.RemoteObjectProperty>)} callback | 
| + * @param {boolean=} generatePreview | 
| */ | 
| - getOwnProperties: function(callback) | 
| + getOwnProperties: function(callback, generatePreview) | 
| { | 
| throw "Not implemented"; | 
| }, | 
| @@ -314,14 +315,6 @@ WebInspector.RemoteObject.prototype = { | 
| generatorObjectDetails: function(callback) | 
| { | 
| callback(null); | 
| - }, | 
| - | 
| - /** | 
| - * @param {function(?Array<!DebuggerAgent.CollectionEntry>)} callback | 
| - */ | 
| - collectionEntries: function(callback) | 
| - { | 
| - callback(null); | 
| } | 
| } | 
| @@ -518,10 +511,11 @@ WebInspector.RemoteObjectImpl.prototype = { | 
| /** | 
| * @override | 
| * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!WebInspector.RemoteObjectProperty>)} callback | 
| + * @param {boolean=} generatePreview | 
| 
dgozman
2016/06/28 01:20:47
Let's make it non-optional. Do we have a lot of ca
 
kozy
2016/06/28 18:41:49
Removed.
 | 
| */ | 
| - getOwnProperties: function(callback) | 
| + getOwnProperties: function(callback, generatePreview) | 
| { | 
| - this.doGetProperties(true, false, false, callback); | 
| + this.doGetProperties(true, false, generatePreview || false, callback); | 
| }, | 
| /** | 
| @@ -894,19 +888,6 @@ WebInspector.RemoteObjectImpl.prototype = { | 
| this._debuggerModel.generatorObjectDetails(this, callback); | 
| }, | 
| - /** | 
| - * @override | 
| - * @param {function(?Array.<!DebuggerAgent.CollectionEntry>)} callback | 
| - */ | 
| - collectionEntries: function(callback) | 
| - { | 
| - if (!this._objectId) { | 
| - callback(null); | 
| - return; | 
| - } | 
| - this._debuggerModel.getCollectionEntries(this._objectId, callback); | 
| - }, | 
| - | 
| __proto__: WebInspector.RemoteObject.prototype | 
| }; | 
| @@ -1088,6 +1069,55 @@ WebInspector.ScopeRef = function(number, callFrameId) | 
| this.callFrameId = callFrameId; | 
| } | 
| + | 
| +/** | 
| + * @constructor | 
| + * @extends {WebInspector.RemoteObjectImpl} | 
| + * @param {!WebInspector.Target} target | 
| + * @param {string|undefined} objectId | 
| + * @param {string} type | 
| + * @param {string|undefined} subtype | 
| + * @param {*} value | 
| + * @param {string=} description | 
| + * @param {!RuntimeAgent.ObjectPreview=} preview | 
| + */ | 
| +WebInspector.EntryRemoteObject = function(target, objectId, type, subtype, value, description, preview) | 
| +{ | 
| + WebInspector.RemoteObjectImpl.call(this, target, objectId, type, subtype, value, description, preview); | 
| +} | 
| + | 
| +WebInspector.EntryRemoteObject.prototype = { | 
| + /** | 
| + * @override | 
| + * @return {string|undefined} | 
| + */ | 
| + get description() | 
| + { | 
| + if (!this._cachedDescription) { | 
| + var properties = this.preview.properties.reduce((map, object) => map.set(object.name, this._formatValue(object)), new Map()); | 
| 
dgozman
2016/06/28 01:20:47
Turn it into for-loop please.
 
kozy
2016/06/28 18:41:49
Removed.
 | 
| + if (properties.has("key")) | 
| + this._cachedDescription = "{" + properties.get("key") + " => " + properties.get("value") + "}"; | 
| + else | 
| + this._cachedDescription = properties.get("value"); | 
| + } | 
| + return this._cachedDescription; | 
| + }, | 
| + | 
| + /** | 
| + * @param {!RuntimeAgent.PropertyPreview} propertyPreview | 
| + */ | 
| + _formatValue: function(propertyPreview) | 
| + { | 
| + var description = propertyPreview.value || ""; | 
| + if (propertyPreview.type === "string") | 
| + return "\"" + description.replace(/\n/g, "\u21B5") + "\""; | 
| + return description; | 
| + }, | 
| + | 
| + __proto__: WebInspector.RemoteObjectImpl.prototype | 
| +}; | 
| + | 
| + | 
| /** | 
| * @constructor | 
| * @param {string} name | 
| @@ -1275,8 +1305,9 @@ WebInspector.LocalJSONObject.prototype = { | 
| /** | 
| * @override | 
| * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!WebInspector.RemoteObjectProperty>)} callback | 
| + * @param {boolean=} generatePreview | 
| */ | 
| - getOwnProperties: function(callback) | 
| + getOwnProperties: function(callback, generatePreview) | 
| { | 
| callback(this._children(), null); | 
| }, | 
| @@ -1588,30 +1619,3 @@ WebInspector.RemoteFunction.prototype = { | 
| return this._object; | 
| } | 
| } | 
| - | 
| -/** | 
| - * @constructor | 
| - * @extends {WebInspector.LocalJSONObject} | 
| - * @param {*} value | 
| - */ | 
| -WebInspector.MapEntryLocalJSONObject = function(value) | 
| -{ | 
| - WebInspector.LocalJSONObject.call(this, value); | 
| -} | 
| - | 
| -WebInspector.MapEntryLocalJSONObject.prototype = { | 
| - /** | 
| - * @override | 
| - * @return {string} | 
| - */ | 
| - get description() | 
| - { | 
| - if (!this._cachedDescription) { | 
| - var children = this._children(); | 
| - this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}"; | 
| - } | 
| - return this._cachedDescription; | 
| - }, | 
| - | 
| - __proto__: WebInspector.LocalJSONObject.prototype | 
| -} |