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

Unified Diff: src/inspector/debugger-script.js

Issue 2449213002: [inspector] migrate scriptParsed and getCompiledScripts to native (Closed)
Patch Set: addressed comments Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: src/inspector/debugger-script.js
diff --git a/src/inspector/debugger-script.js b/src/inspector/debugger-script.js
index 9f1a6caafa97b45a5cb05e48720d2307ac782ed3..1614566ffa8565aa6244e0ee2afcfedb6bc10783 100644
--- a/src/inspector/debugger-script.js
+++ b/src/inspector/debugger-script.js
@@ -40,7 +40,7 @@ DebuggerScript.getAfterCompileScript = function(eventData)
{
var script = eventData.script().value();
if (!script.is_debugger_script)
- return DebuggerScript._formatScript(eventData.script().value());
+ return script;
return null;
}
@@ -140,82 +140,6 @@ DebuggerScript._executionContextId = function(contextData)
}
/**
- * @param {string|undefined} contextData
- * @return {string}
- */
-DebuggerScript._executionContextAuxData = function(contextData)
-{
- if (!contextData)
- return "";
- var match = contextData.match(/^[^,]*,[^,]*,(.*)$/);
- return match ? match[1] : "";
-}
-
-/**
- * @param {string} contextGroupId
- * @return {!Array<!FormattedScript>}
- */
-DebuggerScript.getScripts = function(contextGroupId)
-{
- var result = [];
- var scripts = Debug.scripts();
- var contextDataPrefix = null;
- if (contextGroupId)
- contextDataPrefix = contextGroupId + ",";
- for (var i = 0; i < scripts.length; ++i) {
- var script = scripts[i];
- if (contextDataPrefix) {
- if (!script.context_data)
- continue;
- // Context data is a string in the following format:
- // <contextGroupId>,<contextId>,<auxData>
- if (script.context_data.indexOf(contextDataPrefix) !== 0)
- continue;
- }
- if (script.is_debugger_script)
- continue;
- result.push(DebuggerScript._formatScript(script));
- }
- return result;
-}
-
-/**
- * @param {!Script} script
- * @return {!FormattedScript}
- */
-DebuggerScript._formatScript = function(script)
-{
- var lineEnds = script.line_ends;
- var lineCount = lineEnds.length;
- var endLine = script.line_offset + lineCount - 1;
- var endColumn;
- // V8 will not count last line if script source ends with \n.
- if (script.source[script.source.length - 1] === '\n') {
- endLine += 1;
- endColumn = 0;
- } else {
- if (lineCount === 1)
- endColumn = script.source.length + script.column_offset;
- else
- endColumn = script.source.length - (lineEnds[lineCount - 2] + 1);
- }
- return {
- id: script.id,
- name: script.nameOrSourceURL(),
- sourceURL: script.source_url,
- sourceMappingURL: script.source_mapping_url,
- source: script.source,
- startLine: script.line_offset,
- startColumn: script.column_offset,
- endLine: endLine,
- endColumn: endColumn,
- executionContextId: DebuggerScript._executionContextId(script.context_data),
- // Note that we cannot derive aux data from context id because of compilation cache.
- executionContextAuxData: DebuggerScript._executionContextAuxData(script.context_data)
- };
-}
-
-/**
* @param {!ExecutionState} execState
* @param {!BreakpointInfo} info
* @return {string|undefined}

Powered by Google App Engine
This is Rietveld 408576698