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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js

Issue 1918323002: [DevTools] Simplified DebuggerScript._buildScopeObject (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/v8_inspector/debugger_script_externs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js
diff --git a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js
index 85d214e06efad6011204e3e9974bf4fca7dea040..c6d0ae0d86c40fb8ff19b5f6f718374e5dde8765 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js
+++ b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js
@@ -395,9 +395,6 @@ DebuggerScript.getBreakpointNumbers = function(eventData)
return numbers;
}
-// NOTE: This function is performance critical, as it can be run on every
-// statement that generates an async event (like addEventListener) to support
-// asynchronous call stacks. Thus, when possible, initialize the data lazily.
/**
* @param {!FrameMirror} frameMirror
* @return {!JavaScriptCallFrame}
@@ -666,36 +663,13 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
*/
DebuggerScript._buildScopeObject = function(scopeType, scopeObject)
{
- var result;
- switch (scopeType) {
- case ScopeType.Local:
- case ScopeType.Closure:
- case ScopeType.Catch:
- case ScopeType.Block:
- case ScopeType.Script:
- // For transient objects we create a "persistent" copy that contains
- // the same properties.
- // Reset scope object prototype to null so that the proto properties
- // don't appear in the local scope section.
- var properties = /** @type {!ObjectMirror} */(MakeMirror(scopeObject, true /* transient */)).properties();
- // Almost always Script scope will be empty, so just filter out that noise.
- // Also drop empty Block scopes, should we get any.
- if (!properties.length && (scopeType === ScopeType.Script || scopeType === ScopeType.Block))
- break;
- result = { __proto__: null };
- for (var j = 0; j < properties.length; j++) {
- var name = properties[j].name();
- if (name.length === 0 || name.charAt(0) === ".")
- continue; // Skip internal variables like ".arguments" and variables with empty name
- result[name] = properties[j].value_;
- }
- break;
- case ScopeType.Global:
- case ScopeType.With:
- result = scopeObject;
- break;
+ // Almost always Script scope will be empty, so just filter out that noise.
+ // Also drop empty Block scopes, should we get any.
+ if (scopeType === ScopeType.Script || scopeType === ScopeType.Block) {
+ if (Object.getOwnPropertyNames(scopeObject).length === 0)
+ return undefined;
}
- return result;
+ return scopeObject;
}
// We never resolve Mirror by its handle so to avoid memory leaks caused by Mirrors in the cache we disable it.
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/v8_inspector/debugger_script_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698