diff options
author | kozyatinskiy <kozyatinskiy@chromium.org> | 2016-03-23 13:42:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-23 20:44:07 +0000 |
commit | ff9743586cb05bd0b5c40c44778a87b11757500a (patch) | |
tree | 5547fd94a637a93a28b93bd170f3fa46633d6b73 /third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js | |
parent | 6c4ea00151d1ad5efcfbf27b0c7d77f66df21c81 (diff) | |
download | chromium_src-ff9743586cb05bd0b5c40c44778a87b11757500a.zip chromium_src-ff9743586cb05bd0b5c40c44778a87b11757500a.tar.gz chromium_src-ff9743586cb05bd0b5c40c44778a87b11757500a.tar.bz2 |
[DevTools] Move wrapCallFrames from InjectedScriptSource.js to native
BUG=595206
R=dgozman@chromium.org,pfeldman@chromium.org
Review URL: https://codereview.chromium.org/1826623002
Cr-Commit-Position: refs/heads/master@{#382922}
Diffstat (limited to 'third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js')
-rw-r--r-- | third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js | 127 |
1 files changed, 43 insertions, 84 deletions
diff --git a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js index 2816c37..fefb37b 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js +++ b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js @@ -418,13 +418,14 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) var location; var scopeStartLocations; var scopeEndLocations; + var details; function createLocation(script, pos) { if (!script) return null; - location = script.locationFromPosition(pos, true); + var location = script.locationFromPosition(pos, true); return { "lineNumber": location.line, "columnNumber": location.column, @@ -465,34 +466,47 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) return scopeChain; } - function lazyScopeTypes() + function lazyDetails() { - if (!scopeChain) - lazyScopeChain(); - return scopeTypes; - } - - function lazyScopeNames() - { - if (!scopeChain) - lazyScopeChain(); - return scopeNames; - } - - function lazyScopeStartLocations() - { - if (!scopeChain) - lazyScopeChain(); - - return scopeStartLocations; - } - - function lazyScopeEndLocations() - { - if (!scopeChain) - lazyScopeChain(); - - return scopeEndLocations; + if (!details) { + var scopeObjects = lazyScopeChain(); + var script = ensureFuncMirror().script(); + var scopes = []; + for (var i = 0; i < scopeObjects.length; ++i) { + var scope = { + "type": scopeTypes[i], + "object": scopeObjects[i], + }; + if (scopeNames[i]) + scope.name = scopeNames[i]; + if (scopeStartLocations[i]) + scope.startLocation = scopeStartLocations[i]; + if (scopeEndLocations[i]) + scope.endLocation = scopeEndLocations[i]; + scopes.push(scope); + } + details = { + "functionName": ensureFuncMirror().debugName(), + "location": { + "lineNumber": line(), + "columnNumber": column(), + "scriptId": String(script.id()) + }, + "this": thisObject, + "scopeChain": scopes + }; + var functionLocation = ensureFuncMirror().sourceLocation(); + if (functionLocation) { + details.functionLocation = { + "lineNumber": functionLocation.line, + "columnNumber": functionLocation.column, + "scriptId": String(script.id()) + }; + } + if (isAtReturn) + details.returnValue = returnValue; + } + return details; } function ensureFuncMirror() @@ -533,29 +547,6 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) return script && script.id(); } - function scriptName() - { - var script = ensureFuncMirror().script(); - return script && script.name(); - } - - function functionName() - { - return ensureFuncMirror().debugName(); - } - - function functionLine() - { - var location = ensureFuncMirror().sourceLocation(); - return location ? location.line : 0; - } - - function functionColumn() - { - var location = ensureFuncMirror().sourceLocation(); - return location ? location.column : 0; - } - function evaluate(expression) { return frameMirror.evaluate(expression, false).value(); @@ -571,49 +562,17 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) return DebuggerScript._setScopeVariableValue(frameMirror, scopeNumber, variableName, newValue); } - function stepInPositions() - { - var stepInPositionsV8 = frameMirror.stepInPositions(); - var stepInPositionsProtocol; - if (stepInPositionsV8) { - stepInPositionsProtocol = []; - var script = ensureFuncMirror().script(); - if (script) { - var scriptId = String(script.id()); - for (var i = 0; i < stepInPositionsV8.length; i++) { - var item = { - scriptId: scriptId, - lineNumber: stepInPositionsV8[i].position.line, - columnNumber: stepInPositionsV8[i].position.column - }; - stepInPositionsProtocol.push(item); - } - } - } - return JSON.stringify(stepInPositionsProtocol); - } - return { "sourceID": sourceID, "line": line, "column": column, - "scriptName": scriptName, - "functionName": functionName, - "functionLine": functionLine, - "functionColumn": functionColumn, "thisObject": thisObject, - "scopeChain": lazyScopeChain, - "scopeType": lazyScopeTypes, - "scopeName": lazyScopeNames, - "scopeStartLocation": lazyScopeStartLocations, - "scopeEndLocation": lazyScopeEndLocations, "evaluate": evaluate, "caller": callerFrame, "restart": restart, "setVariableValue": setVariableValue, - "stepInPositions": stepInPositions, "isAtReturn": isAtReturn, - "returnValue": returnValue + "details": lazyDetails }; } |