Goktug Gokdogan has uploaded a new change for review.
https://gwt-review.googlesource.com/2851
Change subject: Removes the static book keeping in the Timer class.
......................................................................
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
---
M user/src/com/google/gwt/user/client/Timer.java
1 file changed, 0 insertions(+), 31 deletions(-)
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);
}-*/;
@@ -68,18 +58,6 @@
$entry(function() {
timer.@com.google.gwt.user.client.Timer::fire(I)(cancelCounter); }),
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;
@@ -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);
}
/*
@@ -150,12 +125,6 @@
final void fire(int scheduleCancelCounter) {
if (scheduleCancelCounter != cancelCounter) {
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.
--
To view, visit
https://gwt-review.googlesource.com/2851
To unsubscribe, visit
https://gwt-review.googlesource.com/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf6a9c81a5654bc2eb736a2b4ef81d5cf0517728
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Goktug Gokdogan <
gok...@google.com>