Removes the static book keeping in the Timer class.

This changes removes code that keeps track of Timer statically.
Based on history the code was always there from the beginning but
my guess is, this is no longer needed: New-ish Scheduler API is not
doing the same workaround and also there are other places that are
using Impl.setTimeout directly without the workaround.

Change-Id: Idf6a9c81a5654bc2eb736a2b4ef81d5cf0517728
diff --git a/user/src/com/google/gwt/user/client/Timer.java b/user/src/com/google/gwt/user/client/Timer.java
index be226b8..f95a5a7 100644
--- a/user/src/com/google/gwt/user/client/Timer.java
+++ b/user/src/com/google/gwt/user/client/Timer.java
@@ -15,10 +15,6 @@
  */
 package com.google.gwt.user.client;
 
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-
-import java.util.ArrayList;
 
 /**
  * A simplified, browser-safe timer class. This class serves the same purpose as
@@ -43,12 +39,6 @@
  */
 public abstract class Timer {
 
-  private static ArrayList<Timer> timers = new ArrayList<Timer>();
-
-  static {
-    hookWindowClosing();
-  }
-
   private static native void clearInterval(int id) /*-{
     @com.google.gwt.core.client.impl.Impl::clearInterval(I)(id);
   }-*/;
@@ -69,18 +59,6 @@
       delay);
   }-*/;
 
-  private static void hookWindowClosing() {
-    // Catch the window closing event.
-    Window.addCloseHandler(new CloseHandler<Window>() {
-
-      public void onClose(CloseEvent<Window> event) {
-        while (timers.size() > 0) {
-          timers.get(0).cancel();
-        }
-      }
-    });
-  }
-
   private boolean isRepeating;
 
   private int timerId;
@@ -101,7 +79,6 @@
     } else {
       clearTimeout(timerId);
     }
-    timers.remove(this);
   }
 
   /**
@@ -123,7 +100,6 @@
     cancel();
     isRepeating = false;
     timerId = createTimeout(this, delayMillis, cancelCounter);
-    timers.add(this);
   }
 
   /**
@@ -139,7 +115,6 @@
     cancel();
     isRepeating = true;
     timerId = createInterval(this, periodMillis, cancelCounter);
-    timers.add(this);
   }
 
   /*
@@ -152,12 +127,6 @@
       return;
     }
 
-    // If this is a one-shot timer, remove it from the timer list. This will
-    // allow it to be garbage collected.
-    if (!isRepeating) {
-      timers.remove(this);
-    }
-
     // Run the timer's code.
     run();
   }