Fix for component being disposed before the timeout function is called.

R=nicksantos
DELTA=4 (3 added, 0 deleted, 1 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=6168


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2451 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
Some cleanups before introducing Listenable handling to goog.events:

* Add goog.events.cleanUp that cleans up goog.events internal
data structure given a ListenableKey.

* Move key number generation to goog.events.ListenableKey.

* Rejigger code in goog.events to refer to
goog.events.listeners_ in as little places as possible
(subsequent logic to unify handling for DOM events and
Listenable will be cleaner, as listen_ will just return a
ListenableKey and listen/listenOnce will handle putting the
object into listeners_ array).

R=nicksantos,gboyer
DELTA=137 (104 added, 16 deleted, 17 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=6169


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2452 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
Return value of goog.events and goog.events.listenOnce is going to
change from ?number to goog.events.ListenableKey. As a first step, we
are switching the return value to a typedef goog.events.Key (currently
just typedef to ?number). This CL switches JS files to use this typedef.

Obviously, the subsequent change will be problematic if this code
make an assumption that the return value is a number and uses the return
value in context where the number is required (e.g. goog.isNumber, using
it as index to an array). While I've tried my best to fix these usages,
I may have missed some of them. Please check that the code will still
remain correct if the return value of goog.events.listen/listenOnce is
changed to an object (goog.events.ListenableKey). Furthermore, if
you know of any other location where the return value is used in a context
that require it to be numbers, please send me a quick email.

This is parts of goog.events refactoring to remove leaking listeners
problem.

R=nweiz,nicksantos
DELTA=20 (0 added, 2 deleted, 18 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=6170


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2453 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
Implemented a variant of Math.floor and Math.ceil which tolerate small rounding errors in the passed floating point number.

R=chrishenry
DELTA=63 (62 added, 0 deleted, 1 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=6171


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2454 0b95b8e8-c90f-11de-9d4f-f947ee5921c8