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

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

Issue 2558913004: [inspector] Store interger in context embedder data instead of a string. (Closed)
Patch Set: review 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 | « src/debug/debug-interface.h ('k') | 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (mirror.isSet() || mirror.isIterator()) { 137 if (mirror.isSet() || mirror.isIterator()) {
138 var result = []; 138 var result = [];
139 var values = mirror.isSet() ? /** @type {!SetMirror} */(mirror).values() : /** @type {!IteratorMirror} */(mirror).preview(); 139 var values = mirror.isSet() ? /** @type {!SetMirror} */(mirror).values() : /** @type {!IteratorMirror} */(mirror).preview();
140 for (var i = 0; i < values.length; ++i) 140 for (var i = 0; i < values.length; ++i)
141 result.push({ value: values[i] }); 141 result.push({ value: values[i] });
142 return result; 142 return result;
143 } 143 }
144 } 144 }
145 145
146 /** 146 /**
147 * @param {string|undefined} contextData
148 * @return {number}
149 */
150 DebuggerScript._executionContextId = function(contextData)
151 {
152 if (!contextData)
153 return 0;
154 var match = contextData.match(/^[^,]*,([^,]*),.*$/);
155 if (!match)
156 return 0;
157 return parseInt(match[1], 10) || 0;
158 }
159
160 /**
161 * @param {!ExecutionState} execState 147 * @param {!ExecutionState} execState
162 * @param {!BreakpointInfo} info 148 * @param {!BreakpointInfo} info
163 * @return {string|undefined} 149 * @return {string|undefined}
164 */ 150 */
165 DebuggerScript.setBreakpoint = function(execState, info) 151 DebuggerScript.setBreakpoint = function(execState, info)
166 { 152 {
167 var breakId = Debug.setScriptBreakPointById(info.sourceID, info.lineNumber, info.columnNumber, info.condition, undefined, Debug.BreakPositionAlignment.State ment); 153 var breakId = Debug.setScriptBreakPointById(info.sourceID, info.lineNumber, info.columnNumber, info.condition, undefined, Debug.BreakPositionAlignment.State ment);
168 var locations = Debug.findBreakPointActualLocations(breakId); 154 var locations = Debug.findBreakPointActualLocations(breakId);
169 if (!locations.length) 155 if (!locations.length)
170 return undefined; 156 return undefined;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 { 464 {
479 return ensureLocation().column; 465 return ensureLocation().column;
480 } 466 }
481 467
482 /** 468 /**
483 * @return {number} 469 * @return {number}
484 */ 470 */
485 function contextId() 471 function contextId()
486 { 472 {
487 var mirror = ensureFuncMirror(); 473 var mirror = ensureFuncMirror();
488 // Old V8 do not have context() function on these objects
489 if (!mirror.context)
490 return DebuggerScript._executionContextId(mirror.script().value().co ntext_data);
491 var context = mirror.context(); 474 var context = mirror.context();
492 if (context) 475 if (context && context.data())
493 return DebuggerScript._executionContextId(context.data()); 476 return Number(context.data());
494 return 0; 477 return 0;
495 } 478 }
496 479
497 /** 480 /**
498 * @return {number} 481 * @return {number}
499 */ 482 */
500 function sourceID() 483 function sourceID()
501 { 484 {
502 var script = ensureScriptMirror(); 485 var script = ensureScriptMirror();
503 return script.id(); 486 return script.id();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 break; 569 break;
587 } 570 }
588 return result; 571 return result;
589 } 572 }
590 573
591 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it. 574 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it.
592 ToggleMirrorCache(false); 575 ToggleMirrorCache(false);
593 576
594 return DebuggerScript; 577 return DebuggerScript;
595 })(); 578 })();
OLDNEW
« no previous file with comments | « src/debug/debug-interface.h ('k') | src/inspector/debugger_script_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698