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

Side by Side Diff: src/inspector/debugger-script.js

Issue 2516973003: [inspector] Expose scopes for suspended generator objects (Closed)
Patch Set: Address comments Created 4 years 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
« no previous file with comments | « no previous file | src/inspector/debugger_script_externs.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 result.push({ 65 result.push({
66 type: /** @type {string} */(DebuggerScript._scopeTypeNames.get(scope Details.type())), 66 type: /** @type {string} */(DebuggerScript._scopeTypeNames.get(scope Details.type())),
67 object: scopeObject, 67 object: scopeObject,
68 name: scopeDetails.name() || "" 68 name: scopeDetails.name() || ""
69 }); 69 });
70 } 70 }
71 return result; 71 return result;
72 } 72 }
73 73
74 /** 74 /**
75 * @param {Object} gen
76 * @return {?Array<!Scope>}
77 */
78 DebuggerScript.getGeneratorScopes = function(gen)
79 {
80 var mirror = MakeMirror(gen);
81 if (!mirror.isGenerator())
82 return null;
83 var generatorMirror = /** @type {!GeneratorMirror} */(mirror);
84 var count = generatorMirror.scopeCount();
85 if (count == 0)
86 return null;
87 var result = [];
88 for (var i = 0; i < count; i++) {
89 var scopeDetails = generatorMirror.scope(i).details();
90 var scopeObject = DebuggerScript._buildScopeObject(scopeDetails.type(), scopeDetails.object());
91 if (!scopeObject)
92 continue;
93 result.push({
94 type: /** @type {string} */(DebuggerScript._scopeTypeNames.get(scope Details.type())),
95 object: scopeObject,
96 name: scopeDetails.name() || ""
97 });
98 }
99 return result;
100 }
101
102 /**
75 * @param {Object} object 103 * @param {Object} object
76 * @return {?RawLocation} 104 * @return {?RawLocation}
77 */ 105 */
78 DebuggerScript.getGeneratorObjectLocation = function(object) 106 DebuggerScript.getGeneratorObjectLocation = function(object)
79 { 107 {
80 var mirror = MakeMirror(object, true /* transient */); 108 var mirror = MakeMirror(object, true /* transient */);
81 if (!mirror.isGenerator()) 109 if (!mirror.isGenerator())
82 return null; 110 return null;
83 var generatorMirror = /** @type {!GeneratorMirror} */(mirror); 111 var generatorMirror = /** @type {!GeneratorMirror} */(mirror);
84 var funcMirror = generatorMirror.func(); 112 var funcMirror = generatorMirror.func();
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 break; 581 break;
554 } 582 }
555 return result; 583 return result;
556 } 584 }
557 585
558 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it. 586 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it.
559 ToggleMirrorCache(false); 587 ToggleMirrorCache(false);
560 588
561 return DebuggerScript; 589 return DebuggerScript;
562 })(); 590 })();
OLDNEW
« no previous file with comments | « no previous file | src/inspector/debugger_script_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698