Bläddra i källkod

Misc cleanup: debug logging, record filename, etc.

- include/canvas.js: When 'debug' logging, show browser detection
  values.
- test/canvas.html: Only restore the canvas to it's starting state if
  the logging level is not 'debug'.
- wsproxy.py: Append the session number to the record filename so that
  multiple sessions don't stomp on each other.
Joel Martin 15 år sedan
förälder
incheckning
005d9ee999
3 ändrade filer med 13 tillägg och 5 borttagningar
  1. 6 1
      include/canvas.js
  2. 4 2
      tests/canvas.html
  3. 3 2
      utils/wsproxy.py

+ 6 - 1
include/canvas.js

@@ -89,7 +89,7 @@ function constructor() {
     Util.Debug(">> Canvas.init");
 
     var c, ctx, imgTest, tval, i, curDat, curSave,
-        has_imageData = false;
+        has_imageData = false, UE = Util.Engine;
 
     if (! conf.target) { throw("target must be set"); }
 
@@ -104,6 +104,11 @@ function constructor() {
     if (! conf.ctx) { conf.ctx = c.getContext('2d'); }
     ctx = conf.ctx;
 
+    if (UE.gecko) { Util.Debug("Browser: gecko " + UE.gecko); }
+    if (UE.webkit) { Util.Debug("Browser: webkit " + UE.webkit); }
+    if (UE.trident) { Util.Debug("Browser: webkit " + UE.trident); }
+    if (UE.presto) { Util.Debug("Browser: webkit " + UE.presto); }
+
     that.clear();
 
     /*

+ 4 - 2
tests/canvas.html

@@ -104,8 +104,10 @@
             message("prefer Canvas ops: " + time2 + "ms total, " +
                     (time2 / iterations) + "ms per frame");
 
-            canvas.resize(start_width, start_height, true);
-            test_functions();
+            if (Util.get_logging() !== 'debug') {
+                canvas.resize(start_width, start_height, true);
+                test_functions();
+            }
             $('startButton').disabled = false;
             $('startButton').value = "Do Performance Test";
         }

+ 3 - 2
utils/wsproxy.py

@@ -105,7 +105,8 @@ def proxy_handler(client):
 
     if settings['record']:
         handler_msg("opening record file: %s" % settings['record'])
-        rec = open(settings['record'], 'w+')
+        rec = open("%s.%s" % (settings['record'],
+                              settings['handler_id']), 'w+')
         rec.write("var VNC_frame_data = [\n")
 
     handler_msg("connecting to: %s:%s" % (target_host, target_port))
@@ -131,7 +132,7 @@ if __name__ == '__main__':
     parser.add_option("--verbose", "-v", action="store_true",
             help="verbose messages and per frame traffic")
     parser.add_option("--record",
-            help="record session to a file", metavar="FILE")
+            help="record sessions to FILE.[session_number]", metavar="FILE")
     parser.add_option("--foreground", "-f",
             dest="daemon", default=True, action="store_false",
             help="stay in foreground, do not daemonize")