| goog.Disposable | |
| goog.structs.Pool | goog.Disposable |
| goog.structs.PriorityPool | goog.structs.Pool |
| goog.net.XhrIoPool | goog.structs.PriorityPool |
| goog.testing.net.XhrIoPool | goog.net.XhrIoPool |
|
opt_headers
:
Map of default headers to add to every request.
|
|
opt_minCount
:
Minimum number of objects (Default: 1).
|
|
opt_maxCount
:
Maximum number of objects (Default: 10).
|
addFreeObject(obj)
Adds an object to the collection of objects that are free. If the object can
not be added, then it is disposed.
NOTE: This method does not remove the object from the in use collection.
Arguments:
|
code » | |||
adjustForMinMax()
Adjusts the objects held in the pool to be within the min/max constraints.
NOTE: It is possible that the number of objects in the pool will still be
greater than the maximum count of objects allowed. This will be the case
if no more free objects can be disposed of to get below the minimum count
(i.e., all objects are in use).
|
code » | |||
disposeInternal()
No description.
|
code » | |||
|
Get a new object from the the pool, if there is one available, otherwise
return undefined.
Arguments:
Returns:
The new object from the pool if there is one available and a callback is not given. Otherwise, undefined.
|
code » | |||
handleQueueRequests_()
Handles the request queue. Tries to fires off as many queued requests as
possible.
|
code » | |||
setDelay(delay)
No description.
Arguments:
|
code » |
addFreeObject(obj)
Adds an object to the collection of objects that are free. If the object can
not be added, then it is disposed.
Arguments:
|
code » | ||
adjustForMinMax()
Adjusts the objects held in the pool to be within the min/max constraints.
NOTE: It is possible that the number of objects in the pool will still be
greater than the maximum count of objects allowed. This will be the case
if no more free objects can be disposed of to get below the minimum count
(i.e., all objects are in use).
|
code » | ||
|
Returns true if the given object is in the pool.
|
code » | ||
|
Should be overriden by sub-classes to return an instance of the object type
that is expected in the pool.
Returns:
The created object.
|
code » | ||
disposeInternal()
Disposes of the pool and all objects currently held in the pool.
|
code » | ||
disposeObject(obj)
Should be overriden to dispose of an object. Default implementation is to
remove all its members, which should render it useless. Calls the object's
dispose() method, if available.
Arguments:
|
code » | ||
|
Returns the number of objects currently in the pool.
Returns:
Number of objects currently in the pool.
|
code » | ||
|
Returns the number of objects currently free in the pool.
Returns:
Number of objects currently free in the pool.
|
code » | ||
|
Returns the number of objects currently in use in the pool.
Returns:
Number of objects currently in use in the pool.
|
code » | ||
|
No description.
Returns:
A new object from the pool if there is one available, otherwise undefined.
|
code » | ||
|
Determines if the pool contains no objects.
Returns:
Whether the pool contains no objects.
|
code » | ||
|
Should be overriden to determine whether an object has become unusable and
should not be returned by getObject(). Calls the object's
canBeReused() method, if available.
|
code » | ||
|
Returns an object to the pool of available objects so that it can be reused.
|
code » | ||
|
Removes a free object from the collection of objects that are free so that it
can be used.
NOTE: This method does not mark the returned object as in use.
Returns:
The object removed from the free collection, if there is one available. Otherwise, undefined.
|
code » | ||
setDelay(delay)
Sets the minimum delay between objects being returned by getObject, in
milliseconds. This defaults to zero, meaning that no minimum delay is
enforced and objects may be used as soon as they're available.
Arguments:
|
code » | ||
setMaximumCount(max)
Sets the maximum count of the pool.
If max is less than the max count of the pool, an error is thrown.
Arguments:
|
code » | ||
setMinimumCount(min)
Sets the minimum count of the pool.
If min is greater than the max count of the pool, an error is thrown.
Arguments:
|
code » |
dispose()
⇒ undefined
Disposes of the object. If the object hasn't already been disposed of, calls
#disposeInternal. Classes that extend
goog.Disposable should
override #disposeInternal in order to delete references to COM
objects, DOM nodes, and other disposable objects. Reentrant.
Returns:
undefined
Nothing.
|
code » | ||
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other
disposable objects. Classes that extend
goog.Disposable should
override this method.
Not reentrant. To avoid calling it twice, it must only be called from the
subclass' disposeInternal method. Everywhere else the public
dispose method must be used.
For example:
mypackage.MyClass = function() {
goog.base(this);
// Constructor logic specific to MyClass.
...
};
goog.inherits(mypackage.MyClass, goog.Disposable);
mypackage.MyClass.prototype.disposeInternal = function() {
goog.base(this, 'disposeInternal');
// Dispose logic specific to MyClass.
...
};
|
code » | ||
|
Use #isDisposed instead.
No description.
Returns:
Whether the object has been disposed of.
|
code » | ||
|
No description.
Returns:
Whether the object has been disposed of.
|
code » | ||
registerDisposable(disposable)
Associates a disposable object with this object so that they will be disposed
together.
Arguments:
|
code » |
|
The minimum delay between objects being made available, in milliseconds. If
this is 0, no minimum delay is enforced.
|
Code » | |
|
Set used to store objects that are currently in the pool and available
to be used.
|
Code » | |
|
Set used to store objects that are currently in the pool and in use.
|
Code » | |
|
The time of the last object being made available, in milliseconds since the
epoch (i.e., the result of Date#toTime). If this is null, no access has
occurred yet.
|
Code » | |
|
Maximum number of objects allowed
|
Code » | |
|
Minimum number of objects allowed
|
Code » |
goog.net.XhrIoPool.call()
No description.
|
code » |