Wednesday, November 13, 2013

Re: History getToken causing infinite 250ms Timer Fire events

Noticed this old thread and found that the current version of GWT still uses the timer. Is this still necessary for Chrome? Seems to be taking a lot of memory..

On Tuesday, January 5, 2010 5:26:08 PM UTC-5, Thomas Broyer wrote:

On 5 jan, 21:31, Brian <hibr...@gmail.com> wrote:
> Is History.getToken() broken?
>
> Upgraded to gwt 2.0.0 and the Speed Tracer plugin (Windows 7, 64bit,
> Chrome), and noticed my app generated an infinite number of timer
> timeouts.
>
> I got it down to a hello,world style app.  This is the whole app:
>
> public class Test implements EntryPoint {
>         public void onModuleLoad() {
>                 String token = History.getToken();
>                 RootPanel.get("block").add(new Label("hi"));
>         }
>
> }
>
> Run this app, and watch the result with the Speed Tracer plugin in
> Chrome.  I get a constant stream of:
>
> "Event Trace. Timer Fire. Duration 18ms. Time Type: setTimeout.
> Interval 250ms"
>
> Remove the History.getToken() and all the timers go away.
>
> Any ideas?

This timer is the only way to detect that the URL's #hash part has
changed (and therefore fire a ValueChangeEvent)

...at least until Chrome implements HTML5's onhashchange (as IE8 does
already, and FF soon will in 3.6). This means that currently all GWT
permutations except user.agent=ie8 use a timer.

It that really annoys you, you can still try to provide your own
HistoryImpl implementation that would not use a timer, for instance
based on this trick http://ajaxian.com/archives/emulating-onhashchange-without-setinterval
;-)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment