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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js

Issue 1815753002: [DevTools] Move getFunctionDetails to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-get-internal-properties
Patch Set: Created 4 years, 9 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 unified diff | Download patch
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 30 matching lines...) Expand all
41 41
42 DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.D ontPauseOnExceptions; 42 DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.D ontPauseOnExceptions;
43 Debug.clearBreakOnException(); 43 Debug.clearBreakOnException();
44 Debug.clearBreakOnUncaughtException(); 44 Debug.clearBreakOnUncaughtException();
45 45
46 DebuggerScript.getAfterCompileScript = function(eventData) 46 DebuggerScript.getAfterCompileScript = function(eventData)
47 { 47 {
48 return DebuggerScript._formatScript(eventData.script_.script_); 48 return DebuggerScript._formatScript(eventData.script_.script_);
49 } 49 }
50 50
51 DebuggerScript._scopeTypeNames = {
52 0: "global",
dgozman 2016/03/18 23:27:55 0 -> ScopeType.Global, etc.
kozy 2016/03/19 00:40:23 Done.
53 1: "local",
54 2: "with",
55 3: "closure",
56 4: "catch",
57 5: "block",
58 6: "script",
59 __proto__: null
60 };
61
51 DebuggerScript.getFunctionScopes = function(fun) 62 DebuggerScript.getFunctionScopes = function(fun)
52 { 63 {
53 var mirror = MakeMirror(fun); 64 var mirror = MakeMirror(fun);
54 if (!mirror.isFunction()) 65 if (!mirror.isFunction())
55 return null; 66 return null;
56 var count = mirror.scopeCount(); 67 var count = mirror.scopeCount();
57 if (count == 0) 68 if (count == 0)
58 return null; 69 return null;
59 var result = []; 70 var result = [];
60 for (var i = 0; i < count; i++) { 71 for (var i = 0; i < count; i++) {
61 var scopeDetails = mirror.scope(i).details(); 72 var scopeDetails = mirror.scope(i).details();
62 var scopeObject = DebuggerScript._buildScopeObject(scopeDetails.type(), scopeDetails.object()); 73 var scopeObject = DebuggerScript._buildScopeObject(scopeDetails.type(), scopeDetails.object());
63 if (!scopeObject) 74 if (!scopeObject)
64 continue; 75 continue;
65 result.push({ 76 result.push({
66 type: scopeDetails.type(), 77 type: DebuggerScript._scopeTypeNames[scopeDetails.type()],
67 object: scopeObject, 78 object: scopeObject,
68 name: scopeDetails.name() 79 name: scopeDetails.name() || ""
69 }); 80 });
70 } 81 }
71 return result; 82 return result;
72 } 83 }
73 84
74 DebuggerScript.getGeneratorObjectDetails = function(object) 85 DebuggerScript.getGeneratorObjectDetails = function(object)
75 { 86 {
76 var mirror = MakeMirror(object, true /* transient */); 87 var mirror = MakeMirror(object, true /* transient */);
77 if (!mirror.isGenerator()) 88 if (!mirror.isGenerator())
78 return null; 89 return null;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 436
426 function lazyScopeChain() 437 function lazyScopeChain()
427 { 438 {
428 if (!scopeChain) { 439 if (!scopeChain) {
429 scopeChain = []; 440 scopeChain = [];
430 scopeStartLocations = []; 441 scopeStartLocations = [];
431 scopeEndLocations = []; 442 scopeEndLocations = [];
432 for (var i = 0, j = 0; i < scopeObjects.length; ++i) { 443 for (var i = 0, j = 0; i < scopeObjects.length; ++i) {
433 var scopeObject = DebuggerScript._buildScopeObject(scopeTypes[i] , scopeObjects[i]); 444 var scopeObject = DebuggerScript._buildScopeObject(scopeTypes[i] , scopeObjects[i]);
434 if (scopeObject) { 445 if (scopeObject) {
435 scopeTypes[j] = scopeTypes[i]; 446 scopeTypes[j] = scopeTypes[i];
dgozman 2016/03/18 23:27:55 Wrap here to string.
kozy 2016/03/19 00:40:23 Done.
436 scopeNames[j] = scopeNames[i]; 447 scopeNames[j] = scopeNames[i];
437 scopeChain[j] = scopeObject; 448 scopeChain[j] = scopeObject;
438 449
439 var funcMirror = scopeFunctions ? MakeMirror(scopeFunctions[ i]) : null; 450 var funcMirror = scopeFunctions ? MakeMirror(scopeFunctions[ i]) : null;
440 if (!funcMirror || !funcMirror.isFunction()) 451 if (!funcMirror || !funcMirror.isFunction())
441 funcMirror = new UnresolvedFunctionMirror(funcObject); 452 funcMirror = new UnresolvedFunctionMirror(funcObject);
442 453
443 var script = funcMirror.script(); 454 var script = funcMirror.script();
444 scopeStartLocations[j] = createLocation(script, scopeStartPo sitions[i]); 455 scopeStartLocations[j] = createLocation(script, scopeStartPo sitions[i]);
445 scopeEndLocations[j] = createLocation(script, scopeEndPositi ons[i]); 456 scopeEndLocations[j] = createLocation(script, scopeEndPositi ons[i]);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 "parentPromise": eventData.parentPromise().value(), 660 "parentPromise": eventData.parentPromise().value(),
650 "status": eventData.status() 661 "status": eventData.status()
651 }; 662 };
652 } 663 }
653 664
654 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it. 665 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it.
655 ToggleMirrorCache(false); 666 ToggleMirrorCache(false);
656 667
657 return DebuggerScript; 668 return DebuggerScript;
658 })(); 669 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698