Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
/** @constructor */
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable = (function() {
  ScalaJS.c.java_lang_Object.call(this);
  this.monifu$concurrent$cancelables$RefCountCancelable$$onCancel$f = null;
  this.monifu$concurrent$cancelables$RefCountCancelable$$state$f = null;
  this.State$module$1 = null
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype = new ScalaJS.inheritable.java_lang_Object();
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.constructor = ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable;
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.monifu$concurrent$cancelables$RefCountCancelable$$State$lzycompute__p1__Lmonifu_concurrent_cancelables_RefCountCancelable$State$ = (function() {
  if ((this.State$module$1 === null)) {
    this.State$module$1 = new ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable$State$().init___Lmonifu_concurrent_cancelables_RefCountCancelable(this)
  };
  ScalaJS.modules.scala_runtime_BoxedUnit().UNIT__Lscala_runtime_BoxedUnit();
  return this.State$module$1
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.isCanceled__Z = (function() {
  return ScalaJS.as.monifu_concurrent_cancelables_RefCountCancelable$State(this.monifu$concurrent$cancelables$RefCountCancelable$$state$f.get__O()).isCanceled__Z()
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.acquireCancelable__Lmonifu_concurrent_Cancelable = (function() {
  var _$this = this;
  tailCallLoop: while (true) {
    var oldState = ScalaJS.as.monifu_concurrent_cancelables_RefCountCancelable$State(_$this.monifu$concurrent$cancelables$RefCountCancelable$$state$f.get__O());
    if (oldState.isCanceled__Z()) {
      return ScalaJS.modules.monifu_concurrent_Cancelable().alreadyCanceled__Lmonifu_concurrent_Cancelable()
    } else {
      var jsx$5 = _$this.monifu$concurrent$cancelables$RefCountCancelable$$state$f;
      var jsx$4 = oldState;
      var x$1 = (oldState.activeCounter__I() + 1);
      var x$2 = oldState.copy$default$1__Z();
      var jsx$3 = oldState.copy__Z__I__Lmonifu_concurrent_cancelables_RefCountCancelable$State(x$2, x$1);
      var jsx$2 = jsx$5.compareAndSet__O__O__Z(jsx$4, jsx$3);
      var jsx$1 = (!jsx$2);
      if (jsx$1) {
        continue tailCallLoop
      } else {
        return ScalaJS.modules.monifu_concurrent_Cancelable().apply__Lscala_Function0__Lmonifu_concurrent_Cancelable(new ScalaJS.c.scala_scalajs_runtime_AnonFunction0().init___Lscala_scalajs_js_Function0((function(arg$outer) {
          return (function() {
            var newState = ScalaJS.as.monifu_concurrent_cancelables_RefCountCancelable$State(arg$outer.monifu$concurrent$cancelables$RefCountCancelable$$state$f.transformAndGet__Lscala_Function1__O(new ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable$$anonfun$acquireCancelable$1$$anonfun$1().init___Lmonifu_concurrent_cancelables_RefCountCancelable$$anonfun$acquireCancelable$1(this)));
            if (((newState.activeCounter__I() === 0) && newState.isCanceled__Z())) {
              arg$outer.monifu$concurrent$cancelables$RefCountCancelable$$onCancel$f.apply$mcV$sp__V()
            };
            return ScalaJS.bV(undefined)
          })
        })(_$this)))
      }
    }
  }
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.cancel__V = (function() {
  var _$this = this;
  tailCallLoop: while (true) {
    var oldState = ScalaJS.as.monifu_concurrent_cancelables_RefCountCancelable$State(_$this.monifu$concurrent$cancelables$RefCountCancelable$$state$f.get__O());
    if ((!oldState.isCanceled__Z())) {
      if ((!_$this.monifu$concurrent$cancelables$RefCountCancelable$$state$f.compareAndSet__O__O__Z(oldState, oldState.copy__Z__I__Lmonifu_concurrent_cancelables_RefCountCancelable$State(true, oldState.copy$default$2__I())))) {
        continue tailCallLoop;
        ScalaJS.modules.scala_runtime_BoxedUnit().UNIT__Lscala_runtime_BoxedUnit()
      } else {
        if ((oldState.activeCounter__I() === 0)) {
          _$this.monifu$concurrent$cancelables$RefCountCancelable$$onCancel$f.apply$mcV$sp__V();
          ScalaJS.modules.scala_runtime_BoxedUnit().UNIT__Lscala_runtime_BoxedUnit()
        } else {
          ScalaJS.modules.scala_runtime_BoxedUnit().UNIT__Lscala_runtime_BoxedUnit()
        }
      }
    } else {
      ScalaJS.modules.scala_runtime_BoxedUnit().UNIT__Lscala_runtime_BoxedUnit()
    };
    return undefined
  }
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.monifu$concurrent$cancelables$RefCountCancelable$$State__Lmonifu_concurrent_cancelables_RefCountCancelable$State$ = (function() {
  if ((this.State$module$1 === null)) {
    return this.monifu$concurrent$cancelables$RefCountCancelable$$State$lzycompute__p1__Lmonifu_concurrent_cancelables_RefCountCancelable$State$()
  } else {
    return this.State$module$1
  }
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.init___Lscala_Function0 = (function(onCancel) {
  this.monifu$concurrent$cancelables$RefCountCancelable$$onCancel$f = onCancel;
  ScalaJS.c.java_lang_Object.prototype.init___.call(this);
  this.monifu$concurrent$cancelables$RefCountCancelable$$state$f = ScalaJS.as.monifu_concurrent_atomic_AtomicAny(ScalaJS.modules.monifu_concurrent_atomic_Atomic().apply__O__Lmonifu_concurrent_atomic_AtomicBuilder__Lmonifu_concurrent_atomic_Atomic(new ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable$State().init___Lmonifu_concurrent_cancelables_RefCountCancelable__Z__I(this, false, 0), ScalaJS.modules.monifu_concurrent_atomic_AtomicBuilder().AtomicRefBuilder__Lmonifu_concurrent_atomic_AtomicBuilder()));
  return this
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.monifu$concurrent$cancelables$RefCountCancelable$$State__ = (function() {
  return this.monifu$concurrent$cancelables$RefCountCancelable$$State__Lmonifu_concurrent_cancelables_RefCountCancelable$State$()
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.cancel__ = (function() {
  return ScalaJS.bV(this.cancel__V())
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.acquireCancelable__ = (function() {
  return this.acquireCancelable__Lmonifu_concurrent_Cancelable()
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.isCanceled__ = (function() {
  return ScalaJS.bZ(this.isCanceled__Z())
});
/** @constructor */
ScalaJS.inheritable.monifu_concurrent_cancelables_RefCountCancelable = (function() {
  /*<skip>*/
});
ScalaJS.inheritable.monifu_concurrent_cancelables_RefCountCancelable.prototype = ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype;
ScalaJS.is.monifu_concurrent_cancelables_RefCountCancelable = (function(obj) {
  return (!(!((obj && obj.$classData) && obj.$classData.ancestors.monifu_concurrent_cancelables_RefCountCancelable)))
});
ScalaJS.as.monifu_concurrent_cancelables_RefCountCancelable = (function(obj) {
  if ((ScalaJS.is.monifu_concurrent_cancelables_RefCountCancelable(obj) || (obj === null))) {
    return obj
  } else {
    ScalaJS.throwClassCastException(obj, "monifu.concurrent.cancelables.RefCountCancelable")
  }
});
ScalaJS.isArrayOf.monifu_concurrent_cancelables_RefCountCancelable = (function(obj, depth) {
  return (!(!(((obj && obj.$classData) && (obj.$classData.arrayDepth === depth)) && obj.$classData.arrayBase.ancestors.monifu_concurrent_cancelables_RefCountCancelable)))
});
ScalaJS.asArrayOf.monifu_concurrent_cancelables_RefCountCancelable = (function(obj, depth) {
  if ((ScalaJS.isArrayOf.monifu_concurrent_cancelables_RefCountCancelable(obj, depth) || (obj === null))) {
    return obj
  } else {
    ScalaJS.throwArrayCastException(obj, "Lmonifu.concurrent.cancelables.RefCountCancelable;", depth)
  }
});
ScalaJS.data.monifu_concurrent_cancelables_RefCountCancelable = new ScalaJS.ClassTypeData({
  monifu_concurrent_cancelables_RefCountCancelable: 0
}, false, "monifu.concurrent.cancelables.RefCountCancelable", ScalaJS.data.java_lang_Object, {
  monifu_concurrent_cancelables_RefCountCancelable: 1,
  monifu_concurrent_Cancelable: 1,
  java_lang_Object: 1
});
ScalaJS.c.monifu_concurrent_cancelables_RefCountCancelable.prototype.$classData = ScalaJS.data.monifu_concurrent_cancelables_RefCountCancelable;
//@ sourceMappingURL=RefCountCancelable.js.map
New to GrepCode? Check out our FAQ X