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

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

Issue 652027: Basic implementation of liveedit feature (Closed)
Patch Set: add proper source headers Created 10 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
« no previous file with comments | « src/debug.cc ('k') | src/flag-definitions.h » ('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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 this.sourceRequest_(request, response); 1244 this.sourceRequest_(request, response);
1245 } else if (request.command == 'scripts') { 1245 } else if (request.command == 'scripts') {
1246 this.scriptsRequest_(request, response); 1246 this.scriptsRequest_(request, response);
1247 } else if (request.command == 'threads') { 1247 } else if (request.command == 'threads') {
1248 this.threadsRequest_(request, response); 1248 this.threadsRequest_(request, response);
1249 } else if (request.command == 'suspend') { 1249 } else if (request.command == 'suspend') {
1250 this.suspendRequest_(request, response); 1250 this.suspendRequest_(request, response);
1251 } else if (request.command == 'version') { 1251 } else if (request.command == 'version') {
1252 this.versionRequest_(request, response); 1252 this.versionRequest_(request, response);
1253 } else if (request.command == 'profile') { 1253 } else if (request.command == 'profile') {
1254 this.profileRequest_(request, response); 1254 this.profileRequest_(request, response);
1255 } else if (request.command == 'changelive') {
1256 this.changeLiveRequest_(request, response);
1255 } else { 1257 } else {
1256 throw new Error('Unknown command "' + request.command + '" in request'); 1258 throw new Error('Unknown command "' + request.command + '" in request');
1257 } 1259 }
1258 } catch (e) { 1260 } catch (e) {
1259 // If there is no response object created one (without command). 1261 // If there is no response object created one (without command).
1260 if (!response) { 1262 if (!response) {
1261 response = this.createResponse(); 1263 response = this.createResponse();
1262 } 1264 }
1263 response.success = false; 1265 response.success = false;
1264 response.message = %ToString(e); 1266 response.message = %ToString(e);
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 %ProfilerResume(modules, tag); 1949 %ProfilerResume(modules, tag);
1948 } else if (request.arguments.command == 'pause') { 1950 } else if (request.arguments.command == 'pause') {
1949 %ProfilerPause(modules, tag); 1951 %ProfilerPause(modules, tag);
1950 } else { 1952 } else {
1951 return response.failed('Unknown command'); 1953 return response.failed('Unknown command');
1952 } 1954 }
1953 response.body = {}; 1955 response.body = {};
1954 }; 1956 };
1955 1957
1956 1958
1959 DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response) {
1960 if (!Debug.LiveEditChangeScript) {
1961 return response.failed('LiveEdit feature is not supported');
1962 }
1963 if (!request.arguments) {
1964 return response.failed('Missing arguments');
1965 }
1966 var script_id = request.arguments.script_id;
1967 var change_pos = parseInt(request.arguments.change_pos);
1968 var change_len = parseInt(request.arguments.change_len);
1969 var new_string = request.arguments.new_string;
1970 if (!IS_STRING(new_string)) {
1971 response.failed('Argument "new_string" is not a string value');
1972 return;
1973 }
1974
1975 var scripts = %DebugGetLoadedScripts();
1976
1977 var the_script = null;
1978 for (var i = 0; i < scripts.length; i++) {
1979 if (scripts[i].id == script_id) {
1980 the_script = scripts[i];
1981 }
1982 }
1983 if (!the_script) {
1984 response.failed('Script not found');
1985 return;
1986 }
1987
1988 var change_log = new Array();
1989 Debug.LiveEditChangeScript(the_script, change_pos, change_len, new_string,
1990 change_log);
1991
1992 response.body = {change_log: change_log};
1993 };
1994
1995
1957 // Check whether the previously processed command caused the VM to become 1996 // Check whether the previously processed command caused the VM to become
1958 // running. 1997 // running.
1959 DebugCommandProcessor.prototype.isRunning = function() { 1998 DebugCommandProcessor.prototype.isRunning = function() {
1960 return this.running_; 1999 return this.running_;
1961 } 2000 }
1962 2001
1963 2002
1964 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) { 2003 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) {
1965 return %SystemBreak(); 2004 return %SystemBreak();
1966 }; 2005 };
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 case 'string': 2112 case 'string':
2074 case 'number': 2113 case 'number':
2075 json = value; 2114 json = value;
2076 break 2115 break
2077 2116
2078 default: 2117 default:
2079 json = null; 2118 json = null;
2080 } 2119 }
2081 return json; 2120 return json;
2082 } 2121 }
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698