summaryrefslogtreecommitdiff
path: root/js/src/Ice/AsyncResult.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/Ice/AsyncResult.js')
-rw-r--r--js/src/Ice/AsyncResult.js216
1 files changed, 108 insertions, 108 deletions
diff --git a/js/src/Ice/AsyncResult.js b/js/src/Ice/AsyncResult.js
index 43d0d2f0fc7..9feb2f0473e 100644
--- a/js/src/Ice/AsyncResult.js
+++ b/js/src/Ice/AsyncResult.js
@@ -7,124 +7,124 @@
//
// **********************************************************************
-(function(global){
- require("Ice/Class");
- require("Ice/AsyncResultBase");
- require("Ice/Debug");
- require("Ice/Promise");
- require("Ice/Protocol");
- require("Ice/Exception");
- require("Ice/BasicStream");
+var Ice = require("../Ice/ModuleRegistry").Ice;
+Ice.__M.require(module, "Ice",
+ [
+ "../Ice/Class",
+ "../Ice/AsyncResultBase",
+ "../Ice/Debug",
+ "../Ice/Promise",
+ "../Ice/Protocol",
+ "../Ice/Exception",
+ "../Ice/BasicStream"
+ ]);
- var Ice = global.Ice || {};
+var AsyncResultBase = Ice.AsyncResultBase;
+var Debug = Ice.Debug;
+var Promise = Ice.Promise;
+var Protocol = Ice.Protocol;
+var UserException = Ice.UserException;
+var BasicStream = Ice.BasicStream;
- var AsyncResultBase = Ice.AsyncResultBase;
- var Debug = Ice.Debug;
- var Promise = Ice.Promise;
- var Protocol = Ice.Protocol;
- var UserException = Ice.UserException;
- var BasicStream = Ice.BasicStream;
-
- var AsyncResult = Ice.Class(AsyncResultBase, {
- __init__: function(communicator, op, connection, proxy, adapter, completedFn, sentFn)
+var AsyncResult = Ice.Class(AsyncResultBase, {
+ __init__: function(communicator, op, connection, proxy, adapter, completedFn, sentFn)
+ {
+ //
+ // AsyncResult can be constructed by a sub-type's prototype, in which case the
+ // arguments are undefined.
+ //
+ AsyncResultBase.call(this, communicator, op, connection, proxy, adapter);
+ if(communicator !== undefined)
+ {
+ this._completed = completedFn;
+ this._sent = sentFn;
+ this._is = null;
+ this._os = communicator !== null ?
+ new BasicStream(this._instance, Protocol.currentProtocolEncoding, false) : null;
+ this._state = 0;
+ this._exception = null;
+ this._timeoutRequestHandler = null;
+ this._timeoutToken = null;
+ }
+ },
+ __os: function()
+ {
+ return this._os;
+ },
+ __is: function()
+ {
+ return this._is;
+ },
+ __startReadParams: function()
+ {
+ this._is.startReadEncaps();
+ return this._is;
+ },
+ __endReadParams: function()
+ {
+ this._is.endReadEncaps();
+ },
+ __readEmptyParams: function()
+ {
+ this._is.skipEmptyEncaps(null);
+ },
+ __readParamEncaps: function()
+ {
+ return this._is.readEncaps(null);
+ },
+ __throwUserException: function()
+ {
+ Debug.assert((this._state & AsyncResult.Done) !== 0);
+ if((this._state & AsyncResult.OK) === 0)
{
- //
- // AsyncResult can be constructed by a sub-type's prototype, in which case the
- // arguments are undefined.
- //
- AsyncResultBase.call(this, communicator, op, connection, proxy, adapter);
- if(communicator !== undefined)
+ try
{
- this._completed = completedFn;
- this._sent = sentFn;
- this._is = null;
- this._os = communicator !== null ?
- new BasicStream(this._instance, Protocol.currentProtocolEncoding, false) : null;
- this._state = 0;
- this._exception = null;
- this._timeoutRequestHandler = null;
- this._timeoutToken = null;
+ this._is.startReadEncaps();
+ this._is.throwException();
}
- },
- __os: function()
- {
- return this._os;
- },
- __is: function()
- {
- return this._is;
- },
- __startReadParams: function()
- {
- this._is.startReadEncaps();
- return this._is;
- },
- __endReadParams: function()
- {
- this._is.endReadEncaps();
- },
- __readEmptyParams: function()
- {
- this._is.skipEmptyEncaps(null);
- },
- __readParamEncaps: function()
- {
- return this._is.readEncaps(null);
- },
- __throwUserException: function()
- {
- Debug.assert((this._state & AsyncResult.Done) !== 0);
- if((this._state & AsyncResult.OK) === 0)
+ catch(ex)
{
- try
- {
- this._is.startReadEncaps();
- this._is.throwException();
- }
- catch(ex)
+ if(ex instanceof UserException)
{
- if(ex instanceof UserException)
- {
- this._is.endReadEncaps();
- }
- throw ex;
+ this._is.endReadEncaps();
}
+ throw ex;
}
- },
- __invokeException: function(ex)
- {
- this._state |= AsyncResult.Done;
- this._exception = ex;
- this._os.resize(0);
- this.fail(ex, this);
- },
- __invokeCompleted: function()
- {
- //
- // Note: no need to change the state here, specializations are responsible for
- // changing the state.
- //
+ }
+ },
+ __invokeException: function(ex)
+ {
+ this._state |= AsyncResult.Done;
+ this._exception = ex;
+ this._os.resize(0);
+ this.fail(ex, this);
+ },
+ __invokeCompleted: function()
+ {
+ //
+ // Note: no need to change the state here, specializations are responsible for
+ // changing the state.
+ //
- if(this.proxy !== null && this.proxy.ice_isTwoway())
- {
- Debug.assert(this._completed !== null);
- this._completed(this);
- }
- },
- __runTimerTask: function()
+ if(this.proxy !== null && this.proxy.ice_isTwoway())
{
- if(this._timeoutRequestHandler)
- {
- this._timeoutRequestHandler.asyncRequestTimedOut(this);
- this._timeoutRequestHnalder = null;
- }
+ Debug.assert(this._completed !== null);
+ this._completed(this);
}
- });
-
- AsyncResult.OK = 0x1;
- AsyncResult.Done = 0x2;
- AsyncResult.Sent = 0x4;
+ },
+ __runTimerTask: function()
+ {
+ if(this._timeoutRequestHandler)
+ {
+ this._timeoutRequestHandler.asyncRequestTimedOut(this);
+ this._timeoutRequestHnalder = null;
+ }
+ }
+});
+
+AsyncResult.OK = 0x1;
+AsyncResult.Done = 0x2;
+AsyncResult.Sent = 0x4;
- Ice.AsyncResult = AsyncResult;
- global.Ice = Ice;
-}(typeof (global) === "undefined" ? window : global));
+Ice.AsyncResult = AsyncResult;
+module.exports.Ice = Ice;