Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 | 70 |
| 71 DebuggerScript.getFunctionScopes = function(fun) | 71 DebuggerScript.getFunctionScopes = function(fun) |
| 72 { | 72 { |
| 73 var mirror = MakeMirror(fun); | 73 var mirror = MakeMirror(fun); |
| 74 var count = mirror.scopeCount(); | 74 var count = mirror.scopeCount(); |
| 75 if (count == 0) | 75 if (count == 0) |
| 76 return null; | 76 return null; |
| 77 var result = []; | 77 var result = []; |
| 78 for (var i = 0; i < count; i++) { | 78 for (var i = 0; i < count; i++) { |
| 79 var scopeDetails = mirror.scope(i).details(); | 79 var scopeDetails = mirror.scope(i).details(); |
| 80 result[i] = { | 80 var scopeObject = DebuggerScript._buildScopeObject(scopeDetails.type(), scopeDetails.object()); |
|
yurys
2014/11/14 16:08:55
Why not support the new scope type instead? New sc
| |
| 81 if (!scopeObject) | |
| 82 continue; | |
| 83 result.push({ | |
| 81 type: scopeDetails.type(), | 84 type: scopeDetails.type(), |
| 82 object: DebuggerScript._buildScopeObject(scopeDetails.type(), scopeD etails.object()) | 85 object: scopeObject |
| 83 }; | 86 }); |
| 84 } | 87 } |
| 85 return result; | 88 return result; |
| 86 } | 89 } |
| 87 | 90 |
| 88 DebuggerScript.getCollectionEntries = function(object) | 91 DebuggerScript.getCollectionEntries = function(object) |
| 89 { | 92 { |
| 90 var mirror = MakeMirror(object, true /* transient */); | 93 var mirror = MakeMirror(object, true /* transient */); |
| 91 if (mirror.isMap()) | 94 if (mirror.isMap()) |
| 92 return mirror.entries(); | 95 return mirror.entries(); |
| 93 if (mirror.isSet() || mirror.isIterator()) { | 96 if (mirror.isSet() || mirror.isIterator()) { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 | 378 |
| 376 // Calculated lazily. | 379 // Calculated lazily. |
| 377 var scopeChain; | 380 var scopeChain; |
| 378 var funcMirror; | 381 var funcMirror; |
| 379 var location; | 382 var location; |
| 380 | 383 |
| 381 function lazyScopeChain() | 384 function lazyScopeChain() |
| 382 { | 385 { |
| 383 if (!scopeChain) { | 386 if (!scopeChain) { |
| 384 scopeChain = []; | 387 scopeChain = []; |
| 385 for (var i = 0; i < scopeObjects.length; ++i) | 388 for (var i = 0; i < scopeObjects.length; ++i) { |
| 386 scopeChain.push(DebuggerScript._buildScopeObject(scopeTypes[i], scopeObjects[i])); | 389 var scopeObject = DebuggerScript._buildScopeObject(scopeDetails. type(), scopeDetails.object()); |
| 390 if (scopeObject) | |
| 391 scopeChain.push(scopeObject); | |
| 392 } | |
| 387 scopeObjects = null; // Free for GC. | 393 scopeObjects = null; // Free for GC. |
| 388 } | 394 } |
| 389 return scopeChain; | 395 return scopeChain; |
| 390 } | 396 } |
| 391 | 397 |
| 392 function ensureFuncMirror() | 398 function ensureFuncMirror() |
| 393 { | 399 { |
| 394 if (!funcMirror) { | 400 if (!funcMirror) { |
| 395 funcMirror = MakeMirror(funcObject); | 401 funcMirror = MakeMirror(funcObject); |
| 396 if (!funcMirror.isFunction()) | 402 if (!funcMirror.isFunction()) |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 "parentPromise": eventData.parentPromise().value(), | 545 "parentPromise": eventData.parentPromise().value(), |
| 540 "status": eventData.status() | 546 "status": eventData.status() |
| 541 }; | 547 }; |
| 542 } | 548 } |
| 543 | 549 |
| 544 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it. | 550 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it. |
| 545 ToggleMirrorCache(false); | 551 ToggleMirrorCache(false); |
| 546 | 552 |
| 547 return DebuggerScript; | 553 return DebuggerScript; |
| 548 })(); | 554 })(); |
| OLD | NEW |