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

Side by Side Diff: src/debug-delay.js

Issue 113335: Add optional 'ids' parameter to 'scripts' request (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/debug-scripts-request.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 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 } 1581 }
1582 1582
1583 // Pull out arguments. 1583 // Pull out arguments.
1584 var handles = request.arguments.handles; 1584 var handles = request.arguments.handles;
1585 1585
1586 // Check for legal arguments. 1586 // Check for legal arguments.
1587 if (IS_UNDEFINED(handles)) { 1587 if (IS_UNDEFINED(handles)) {
1588 return response.failed('Argument "handles" missing'); 1588 return response.failed('Argument "handles" missing');
1589 } 1589 }
1590 1590
1591 // Set 'includeSource' option for script lookup.
1592 if (!IS_UNDEFINED(request.arguments.includeSource)) {
1593 includeSource = %ToBoolean(request.arguments.includeSource);
1594 response.setOption('includeSource', includeSource);
1595 }
1596
1591 // Lookup handles. 1597 // Lookup handles.
1592 var mirrors = {}; 1598 var mirrors = {};
1593 for (var i = 0; i < handles.length; i++) { 1599 for (var i = 0; i < handles.length; i++) {
1594 var handle = handles[i]; 1600 var handle = handles[i];
1595 var mirror = LookupMirror(handle); 1601 var mirror = LookupMirror(handle);
1596 if (!mirror) { 1602 if (!mirror) {
1597 return response.failed('Object #' + handle + '# not found'); 1603 return response.failed('Object #' + handle + '# not found');
1598 } 1604 }
1599 mirrors[handle] = mirror; 1605 mirrors[handle] = mirror;
1600 } 1606 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 response.body.toLine = slice.to_line; 1683 response.body.toLine = slice.to_line;
1678 response.body.fromPosition = slice.from_position; 1684 response.body.fromPosition = slice.from_position;
1679 response.body.toPosition = slice.to_position; 1685 response.body.toPosition = slice.to_position;
1680 response.body.totalLines = script.lineCount(); 1686 response.body.totalLines = script.lineCount();
1681 }; 1687 };
1682 1688
1683 1689
1684 DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) { 1690 DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) {
1685 var types = ScriptTypeFlag(Debug.ScriptType.Normal); 1691 var types = ScriptTypeFlag(Debug.ScriptType.Normal);
1686 var includeSource = false; 1692 var includeSource = false;
1693 var idsToInclude = null;
1687 if (request.arguments) { 1694 if (request.arguments) {
1688 // Pull out arguments. 1695 // Pull out arguments.
1689 if (!IS_UNDEFINED(request.arguments.types)) { 1696 if (!IS_UNDEFINED(request.arguments.types)) {
1690 types = %ToNumber(request.arguments.types); 1697 types = %ToNumber(request.arguments.types);
1691 if (isNaN(types) || types < 0) { 1698 if (isNaN(types) || types < 0) {
1692 return response.failed('Invalid types "' + request.arguments.types + '"' ); 1699 return response.failed('Invalid types "' + request.arguments.types + '"' );
1693 } 1700 }
1694 } 1701 }
1695 1702
1696 if (!IS_UNDEFINED(request.arguments.includeSource)) { 1703 if (!IS_UNDEFINED(request.arguments.includeSource)) {
1697 includeSource = %ToBoolean(request.arguments.includeSource); 1704 includeSource = %ToBoolean(request.arguments.includeSource);
1698 response.setOption('includeSource', includeSource); 1705 response.setOption('includeSource', includeSource);
1699 } 1706 }
1707
1708 if (IS_ARRAY(request.arguments.ids)) {
1709 idsToInclude = {};
1710 var ids = request.arguments.ids;
1711 for (var i = 0; i < ids.length; i++) {
1712 idsToInclude[ids[i]] = true;
1713 }
1714 }
1700 } 1715 }
1701 1716
1702 // Collect all scripts in the heap. 1717 // Collect all scripts in the heap.
1703 var scripts = %DebugGetLoadedScripts(); 1718 var scripts = %DebugGetLoadedScripts();
1704 1719
1705 response.body = []; 1720 response.body = [];
1706 1721
1707 for (var i = 0; i < scripts.length; i++) { 1722 for (var i = 0; i < scripts.length; i++) {
1723 if (idsToInclude && !idsToInclude[scripts[i].id]) {
1724 continue;
1725 }
1708 if (types & ScriptTypeFlag(scripts[i].type)) { 1726 if (types & ScriptTypeFlag(scripts[i].type)) {
1709 response.body.push(MakeMirror(scripts[i])); 1727 response.body.push(MakeMirror(scripts[i]));
1710 } 1728 }
1711 } 1729 }
1712 }; 1730 };
1713 1731
1714 1732
1715 DebugCommandProcessor.prototype.threadsRequest_ = function(request, response) { 1733 DebugCommandProcessor.prototype.threadsRequest_ = function(request, response) {
1716 // Get the number of threads. 1734 // Get the number of threads.
1717 var total_threads = this.exec_state_.threadCount(); 1735 var total_threads = this.exec_state_.threadCount();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 json += NumberToJSON_(elem); 1886 json += NumberToJSON_(elem);
1869 } else if (IS_STRING(elem)) { 1887 } else if (IS_STRING(elem)) {
1870 json += StringToJSON_(elem); 1888 json += StringToJSON_(elem);
1871 } else { 1889 } else {
1872 json += elem; 1890 json += elem;
1873 } 1891 }
1874 } 1892 }
1875 json += ']'; 1893 json += ']';
1876 return json; 1894 return json;
1877 } 1895 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/debug-scripts-request.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698