From 0feda5a2e1130040ab9dfedbb5a5c60fd584f4e1 Mon Sep 17 00:00:00 2001 From: "yurys@chromium.org" Date: Tue, 23 Jun 2009 09:53:18 +0000 Subject: [PATCH] Introduce an argument that allows to include some data neccessary for displaying collapsed scope variables values in graphical debugger. When request has 'inlineRefs' option simple type values will be written in the response directly. Variables of other types in addition to 'ref' property containing the value handle will contain some type information. Review URL: http://codereview.chromium.org/140061 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2253 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/debug-delay.js | 14 +++++++------- src/mirror-delay.js | 12 +++++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/debug-delay.js b/src/debug-delay.js index fc26660..423a118 100644 --- a/src/debug-delay.js +++ b/src/debug-delay.js @@ -1194,6 +1194,13 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request) throw new Error('Command not specified'); } + // TODO(yurys): remove request.arguments.compactFormat check once + // ChromeDevTools are switched to 'inlineRefs' + if (request.arguments && (request.arguments.inlineRefs || + request.arguments.compactFormat)) { + response.setOption('inlineRefs', true); + } + if (request.command == 'continue') { this.continueRequest_(request, response); } else if (request.command == 'break') { @@ -1504,9 +1511,6 @@ DebugCommandProcessor.prototype.backtraceRequest_ = function(request, response) if (from_index < 0 || to_index < 0) { return response.failed('Invalid frame number'); } - if (request.arguments.compactFormat) { - response.setOption('compactFormat', true); - } } // Adjust the index. @@ -1696,10 +1700,6 @@ DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { response.setOption('includeSource', includeSource); } - if (request.arguments.compactFormat) { - response.setOption('compactFormat', true); - } - // Lookup handles. var mirrors = {}; for (var i = 0; i < handles.length; i++) { diff --git a/src/mirror-delay.js b/src/mirror-delay.js index 4f72f71..d0e8aa4 100644 --- a/src/mirror-delay.js +++ b/src/mirror-delay.js @@ -1895,8 +1895,8 @@ JSONProtocolSerializer.prototype.includeSource_ = function() { } -JSONProtocolSerializer.prototype.compactFormat_ = function() { - return this.options_ && this.options_.compactFormat; +JSONProtocolSerializer.prototype.inlineRefs_ = function() { + return this.options_ && this.options_.inlineRefs; } @@ -1960,7 +1960,7 @@ JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference, // the mirror to the referenced mirrors. if (reference && (mirror.isValue() || mirror.isScript() || mirror.isContext())) { - if (this.compactFormat_() && mirror.isValue()) { + if (this.inlineRefs_() && mirror.isValue()) { return this.serializeReferenceWithDisplayData_(mirror); } else { this.add_(mirror); @@ -2175,7 +2175,7 @@ JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) { result.name = propertyMirror.name(); var propertyValue = propertyMirror.value(); - if (this.compactFormat_() && propertyValue.isValue()) { + if (this.inlineRefs_() && propertyValue.isValue()) { result.value = this.serializeReferenceWithDisplayData_(propertyValue); } else { if (propertyMirror.attributes() != PropertyAttribute.None) { @@ -2248,7 +2248,9 @@ JSONProtocolSerializer.prototype.serializeScope_ = function(mirror, content) { content.index = mirror.scopeIndex(); content.frameIndex = mirror.frameIndex(); content.type = mirror.scopeType(); - content.object = this.serializeReference(mirror.scopeObject()); + content.object = this.inlineRefs_() ? + this.serializeValue(mirror.scopeObject()) : + this.serializeReference(mirror.scopeObject()); } -- 2.7.4