File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,6 +96,13 @@ var updater = {
9696 }
9797 } ) ;
9898 }
99+ else if ( message . type == 'difftrace' ) {
100+ // TODO: implement optimization based on, say,
101+ // https://code.google.com/p/google-diff-match-patch/
102+
103+ // for starters, simply create a new ExecutionVisualizer
104+ // object using the patched version of the payload
105+ }
99106 else if ( message . type == 'clear' ) {
100107 myVisualizer = null ;
101108 $ ( '#vizDiv' ) . empty ( ) ;
Original file line number Diff line number Diff line change @@ -31,8 +31,7 @@ def __init__(self):
3131 (r"/chatsocket" , ChatSocketHandler ),
3232 # respond to HTTP POST requests:
3333 (r"/wholetrace" , WholeTraceHandler ),
34- (r"/append" , AppendHandler ),
35- (r"/replace" , ReplaceHandler ),
34+ (r"/difftrace" , DiffTraceHandler ),
3635 (r"/clear" , ClearHandler ),
3736 ]
3837 tornado .web .Application .__init__ (self , handlers )
@@ -53,13 +52,10 @@ def post(self):
5352 ChatSocketHandler .send_updates (json .dumps (js_msg ))
5453
5554
56- class AppendHandler (tornado .web .RequestHandler ):
57- def post (self ):
58- pass
59-
60-
61- class ReplaceHandler (tornado .web .RequestHandler ):
55+ class DiffTraceHandler (tornado .web .RequestHandler ):
6256 def post (self ):
57+ # TODO: implement me using, say,
58+ # https://code.google.com/p/google-diff-match-patch/
6359 pass
6460
6561
Original file line number Diff line number Diff line change 6060#INDENT_LEVEL = 2 # human-readable
6161INDENT_LEVEL = None # compact
6262
63-
6463# TODO: support incremental pushes to the OPT frontend for efficiency
65- # and better "snappiness" (although the speed seems fine for now)
64+ # and better "snappiness"
65+ #
66+ # I think the easiest way to do diffs is to set INDENT_LEVEL = 2 above
67+ # and then simply send the diff of the JSON string to the server.
68+ # It's WAY TOO COMPLICATED to try implementing semantic diffs of the
69+ # OPT trace ourselves, since there are too many corner cases.
70+ #
71+ # text diffs are an elegant solution :)
72+ #
73+ # https://code.google.com/p/google-diff-match-patch/
6674
6775
6876class OptHistory (object ):
@@ -75,9 +83,6 @@ def __init__(self):
7583 def pop_last (self ):
7684 self .executed_stmts .pop ()
7785
78- def check_rep (self ):
79- pass
80-
8186 def get_code (self ):
8287 return '\n ' .join (self .executed_stmts )
8388
@@ -105,7 +110,6 @@ def run_str_and_broadcast(self, stmt_str):
105110 if epic_fail :
106111 self .pop_last ()
107112
108- self .check_rep ()
109113 urllib2 .urlopen (SERVER_ADDR + 'wholetrace' , json_output )
110114
111115
You can’t perform that action at this time.
0 commit comments