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

Side by Side Diff: src/mirror-delay.js

Issue 140061: Send variable values in 'scopes' response (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/debug-delay.js ('k') | 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 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 1888
1889 return content; 1889 return content;
1890 } 1890 }
1891 1891
1892 1892
1893 JSONProtocolSerializer.prototype.includeSource_ = function() { 1893 JSONProtocolSerializer.prototype.includeSource_ = function() {
1894 return this.options_ && this.options_.includeSource; 1894 return this.options_ && this.options_.includeSource;
1895 } 1895 }
1896 1896
1897 1897
1898 JSONProtocolSerializer.prototype.compactFormat_ = function() { 1898 JSONProtocolSerializer.prototype.inlineRefs_ = function() {
1899 return this.options_ && this.options_.compactFormat; 1899 return this.options_ && this.options_.inlineRefs;
1900 } 1900 }
1901 1901
1902 1902
1903 JSONProtocolSerializer.prototype.add_ = function(mirror) { 1903 JSONProtocolSerializer.prototype.add_ = function(mirror) {
1904 // If this mirror is already in the list just return. 1904 // If this mirror is already in the list just return.
1905 for (var i = 0; i < this.mirrors_.length; i++) { 1905 for (var i = 0; i < this.mirrors_.length; i++) {
1906 if (this.mirrors_[i] === mirror) { 1906 if (this.mirrors_[i] === mirror) {
1907 return; 1907 return;
1908 } 1908 }
1909 } 1909 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 return o; 1953 return o;
1954 }; 1954 };
1955 1955
1956 1956
1957 JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference, 1957 JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
1958 details) { 1958 details) {
1959 // If serializing a reference to a mirror just return the reference and add 1959 // If serializing a reference to a mirror just return the reference and add
1960 // the mirror to the referenced mirrors. 1960 // the mirror to the referenced mirrors.
1961 if (reference && 1961 if (reference &&
1962 (mirror.isValue() || mirror.isScript() || mirror.isContext())) { 1962 (mirror.isValue() || mirror.isScript() || mirror.isContext())) {
1963 if (this.compactFormat_() && mirror.isValue()) { 1963 if (this.inlineRefs_() && mirror.isValue()) {
1964 return this.serializeReferenceWithDisplayData_(mirror); 1964 return this.serializeReferenceWithDisplayData_(mirror);
1965 } else { 1965 } else {
1966 this.add_(mirror); 1966 this.add_(mirror);
1967 return {'ref' : mirror.handle()}; 1967 return {'ref' : mirror.handle()};
1968 } 1968 }
1969 } 1969 }
1970 1970
1971 // Collect the JSON property/value pairs. 1971 // Collect the JSON property/value pairs.
1972 var content = {}; 1972 var content = {};
1973 1973
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 * {"name":"length","attributes":7,"propertyType":3,"ref":2} 2168 * {"name":"length","attributes":7,"propertyType":3,"ref":2}
2169 * 2169 *
2170 * @param {PropertyMirror} propertyMirror The property to serialize. 2170 * @param {PropertyMirror} propertyMirror The property to serialize.
2171 * @returns {Object} Protocol object representing the property. 2171 * @returns {Object} Protocol object representing the property.
2172 */ 2172 */
2173 JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) { 2173 JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) {
2174 var result = {}; 2174 var result = {};
2175 2175
2176 result.name = propertyMirror.name(); 2176 result.name = propertyMirror.name();
2177 var propertyValue = propertyMirror.value(); 2177 var propertyValue = propertyMirror.value();
2178 if (this.compactFormat_() && propertyValue.isValue()) { 2178 if (this.inlineRefs_() && propertyValue.isValue()) {
2179 result.value = this.serializeReferenceWithDisplayData_(propertyValue); 2179 result.value = this.serializeReferenceWithDisplayData_(propertyValue);
2180 } else { 2180 } else {
2181 if (propertyMirror.attributes() != PropertyAttribute.None) { 2181 if (propertyMirror.attributes() != PropertyAttribute.None) {
2182 result.attributes = propertyMirror.attributes(); 2182 result.attributes = propertyMirror.attributes();
2183 } 2183 }
2184 if (propertyMirror.propertyType() != PropertyType.Normal) { 2184 if (propertyMirror.propertyType() != PropertyType.Normal) {
2185 result.propertyType = propertyMirror.propertyType(); 2185 result.propertyType = propertyMirror.propertyType();
2186 } 2186 }
2187 result.ref = propertyValue.handle(); 2187 result.ref = propertyValue.handle();
2188 } 2188 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 index: i 2241 index: i
2242 }); 2242 });
2243 } 2243 }
2244 } 2244 }
2245 2245
2246 2246
2247 JSONProtocolSerializer.prototype.serializeScope_ = function(mirror, content) { 2247 JSONProtocolSerializer.prototype.serializeScope_ = function(mirror, content) {
2248 content.index = mirror.scopeIndex(); 2248 content.index = mirror.scopeIndex();
2249 content.frameIndex = mirror.frameIndex(); 2249 content.frameIndex = mirror.frameIndex();
2250 content.type = mirror.scopeType(); 2250 content.type = mirror.scopeType();
2251 content.object = this.serializeReference(mirror.scopeObject()); 2251 content.object = this.inlineRefs_() ?
2252 this.serializeValue(mirror.scopeObject()) :
2253 this.serializeReference(mirror.scopeObject());
2252 } 2254 }
2253 2255
2254 2256
2255 /** 2257 /**
2256 * Convert a number to a protocol value. For all finite numbers the number 2258 * Convert a number to a protocol value. For all finite numbers the number
2257 * itself is returned. For non finite numbers NaN, Infinite and 2259 * itself is returned. For non finite numbers NaN, Infinite and
2258 * -Infinite the string representation "NaN", "Infinite" or "-Infinite" 2260 * -Infinite the string representation "NaN", "Infinite" or "-Infinite"
2259 * (not including the quotes) is returned. 2261 * (not including the quotes) is returned.
2260 * 2262 *
2261 * @param {number} value The number value to convert to a protocol value. 2263 * @param {number} value The number value to convert to a protocol value.
2262 * @returns {number|string} Protocol value. 2264 * @returns {number|string} Protocol value.
2263 */ 2265 */
2264 function NumberToJSON_(value) { 2266 function NumberToJSON_(value) {
2265 if (isNaN(value)) { 2267 if (isNaN(value)) {
2266 return 'NaN'; 2268 return 'NaN';
2267 } 2269 }
2268 if (!isFinite(value)) { 2270 if (!isFinite(value)) {
2269 if (value > 0) { 2271 if (value > 0) {
2270 return 'Infinity'; 2272 return 'Infinity';
2271 } else { 2273 } else {
2272 return '-Infinity'; 2274 return '-Infinity';
2273 } 2275 }
2274 } 2276 }
2275 return value; 2277 return value;
2276 } 2278 }
OLDNEW
« no previous file with comments | « src/debug-delay.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698