BehaviorSubject$BehaviorDisposable.smali 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. .class final Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;
  2. .super Ljava/lang/Object;
  3. .source "BehaviorSubject.java"
  4. # interfaces
  5. .implements Lio/reactivex/disposables/Disposable;
  6. .implements Lio/reactivex/internal/util/AppendOnlyLinkedArrayList$NonThrowingPredicate;
  7. # annotations
  8. .annotation system Ldalvik/annotation/EnclosingClass;
  9. value = Lio/reactivex/subjects/BehaviorSubject;
  10. .end annotation
  11. .annotation system Ldalvik/annotation/InnerClass;
  12. accessFlags = 0x18
  13. name = "BehaviorDisposable"
  14. .end annotation
  15. .annotation system Ldalvik/annotation/Signature;
  16. value = {
  17. "<T:",
  18. "Ljava/lang/Object;",
  19. ">",
  20. "Ljava/lang/Object;",
  21. "Lio/reactivex/disposables/Disposable;",
  22. "Lio/reactivex/internal/util/AppendOnlyLinkedArrayList$NonThrowingPredicate<",
  23. "Ljava/lang/Object;",
  24. ">;"
  25. }
  26. .end annotation
  27. # instance fields
  28. .field final actual:Lio/reactivex/Observer;
  29. .annotation system Ldalvik/annotation/Signature;
  30. value = {
  31. "Lio/reactivex/Observer<",
  32. "-TT;>;"
  33. }
  34. .end annotation
  35. .end field
  36. .field volatile cancelled:Z
  37. .field emitting:Z
  38. .field fastPath:Z
  39. .field index:J
  40. .field next:Z
  41. .field queue:Lio/reactivex/internal/util/AppendOnlyLinkedArrayList;
  42. .annotation system Ldalvik/annotation/Signature;
  43. value = {
  44. "Lio/reactivex/internal/util/AppendOnlyLinkedArrayList<",
  45. "Ljava/lang/Object;",
  46. ">;"
  47. }
  48. .end annotation
  49. .end field
  50. .field final state:Lio/reactivex/subjects/BehaviorSubject;
  51. .annotation system Ldalvik/annotation/Signature;
  52. value = {
  53. "Lio/reactivex/subjects/BehaviorSubject<",
  54. "TT;>;"
  55. }
  56. .end annotation
  57. .end field
  58. # direct methods
  59. .method constructor <init>(Lio/reactivex/Observer;Lio/reactivex/subjects/BehaviorSubject;)V
  60. .locals 0
  61. .annotation system Ldalvik/annotation/Signature;
  62. value = {
  63. "(",
  64. "Lio/reactivex/Observer<",
  65. "-TT;>;",
  66. "Lio/reactivex/subjects/BehaviorSubject<",
  67. "TT;>;)V"
  68. }
  69. .end annotation
  70. .line 406
  71. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  72. .line 407
  73. iput-object p1, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->actual:Lio/reactivex/Observer;
  74. .line 408
  75. iput-object p2, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->state:Lio/reactivex/subjects/BehaviorSubject;
  76. return-void
  77. .end method
  78. # virtual methods
  79. .method public dispose()V
  80. .locals 1
  81. .line 413
  82. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->cancelled:Z
  83. if-nez v0, :cond_0
  84. const/4 v0, 0x1
  85. .line 414
  86. iput-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->cancelled:Z
  87. .line 416
  88. iget-object v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->state:Lio/reactivex/subjects/BehaviorSubject;
  89. invoke-virtual {v0, p0}, Lio/reactivex/subjects/BehaviorSubject;->remove(Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;)V
  90. :cond_0
  91. return-void
  92. .end method
  93. .method emitFirst()V
  94. .locals 4
  95. .line 426
  96. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->cancelled:Z
  97. if-eqz v0, :cond_0
  98. return-void
  99. .line 430
  100. :cond_0
  101. monitor-enter p0
  102. .line 431
  103. :try_start_0
  104. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->cancelled:Z
  105. if-eqz v0, :cond_1
  106. .line 432
  107. monitor-exit p0
  108. return-void
  109. .line 434
  110. :cond_1
  111. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->next:Z
  112. if-eqz v0, :cond_2
  113. .line 435
  114. monitor-exit p0
  115. return-void
  116. .line 438
  117. :cond_2
  118. iget-object v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->state:Lio/reactivex/subjects/BehaviorSubject;
  119. .line 439
  120. iget-object v1, v0, Lio/reactivex/subjects/BehaviorSubject;->readLock:Ljava/util/concurrent/locks/Lock;
  121. .line 441
  122. invoke-interface {v1}, Ljava/util/concurrent/locks/Lock;->lock()V
  123. .line 442
  124. iget-wide v2, v0, Lio/reactivex/subjects/BehaviorSubject;->index:J
  125. iput-wide v2, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->index:J
  126. .line 443
  127. iget-object v0, v0, Lio/reactivex/subjects/BehaviorSubject;->value:Ljava/util/concurrent/atomic/AtomicReference;
  128. invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
  129. move-result-object v0
  130. .line 444
  131. invoke-interface {v1}, Ljava/util/concurrent/locks/Lock;->unlock()V
  132. const/4 v1, 0x1
  133. if-eqz v0, :cond_3
  134. const/4 v2, 0x1
  135. goto :goto_0
  136. :cond_3
  137. const/4 v2, 0x0
  138. .line 446
  139. :goto_0
  140. iput-boolean v2, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->emitting:Z
  141. .line 447
  142. iput-boolean v1, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->next:Z
  143. .line 448
  144. monitor-exit p0
  145. :try_end_0
  146. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  147. if-eqz v0, :cond_5
  148. .line 451
  149. invoke-virtual {p0, v0}, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->test(Ljava/lang/Object;)Z
  150. move-result v0
  151. if-eqz v0, :cond_4
  152. return-void
  153. .line 455
  154. :cond_4
  155. invoke-virtual {p0}, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->emitLoop()V
  156. :cond_5
  157. return-void
  158. :catchall_0
  159. move-exception v0
  160. .line 448
  161. :try_start_1
  162. monitor-exit p0
  163. :try_end_1
  164. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  165. throw v0
  166. .end method
  167. .method emitLoop()V
  168. .locals 2
  169. .line 495
  170. :goto_0
  171. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->cancelled:Z
  172. if-eqz v0, :cond_0
  173. return-void
  174. .line 499
  175. :cond_0
  176. monitor-enter p0
  177. .line 500
  178. :try_start_0
  179. iget-object v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->queue:Lio/reactivex/internal/util/AppendOnlyLinkedArrayList;
  180. if-nez v0, :cond_1
  181. const/4 v0, 0x0
  182. .line 502
  183. iput-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->emitting:Z
  184. .line 503
  185. monitor-exit p0
  186. return-void
  187. :cond_1
  188. const/4 v1, 0x0
  189. .line 505
  190. iput-object v1, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->queue:Lio/reactivex/internal/util/AppendOnlyLinkedArrayList;
  191. .line 506
  192. monitor-exit p0
  193. :try_end_0
  194. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  195. .line 508
  196. invoke-virtual {v0, p0}, Lio/reactivex/internal/util/AppendOnlyLinkedArrayList;->forEachWhile(Lio/reactivex/internal/util/AppendOnlyLinkedArrayList$NonThrowingPredicate;)V
  197. goto :goto_0
  198. :catchall_0
  199. move-exception v0
  200. .line 506
  201. :try_start_1
  202. monitor-exit p0
  203. :try_end_1
  204. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  205. goto :goto_2
  206. :goto_1
  207. throw v0
  208. :goto_2
  209. goto :goto_1
  210. .end method
  211. .method emitNext(Ljava/lang/Object;J)V
  212. .locals 3
  213. .line 460
  214. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->cancelled:Z
  215. if-eqz v0, :cond_0
  216. return-void
  217. .line 463
  218. :cond_0
  219. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->fastPath:Z
  220. if-nez v0, :cond_5
  221. .line 464
  222. monitor-enter p0
  223. .line 465
  224. :try_start_0
  225. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->cancelled:Z
  226. if-eqz v0, :cond_1
  227. .line 466
  228. monitor-exit p0
  229. return-void
  230. .line 468
  231. :cond_1
  232. iget-wide v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->index:J
  233. cmp-long v2, v0, p2
  234. if-nez v2, :cond_2
  235. .line 469
  236. monitor-exit p0
  237. return-void
  238. .line 471
  239. :cond_2
  240. iget-boolean p2, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->emitting:Z
  241. if-eqz p2, :cond_4
  242. .line 472
  243. iget-object p2, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->queue:Lio/reactivex/internal/util/AppendOnlyLinkedArrayList;
  244. if-nez p2, :cond_3
  245. .line 474
  246. new-instance p2, Lio/reactivex/internal/util/AppendOnlyLinkedArrayList;
  247. const/4 p3, 0x4
  248. invoke-direct {p2, p3}, Lio/reactivex/internal/util/AppendOnlyLinkedArrayList;-><init>(I)V
  249. .line 475
  250. iput-object p2, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->queue:Lio/reactivex/internal/util/AppendOnlyLinkedArrayList;
  251. .line 477
  252. :cond_3
  253. invoke-virtual {p2, p1}, Lio/reactivex/internal/util/AppendOnlyLinkedArrayList;->add(Ljava/lang/Object;)V
  254. .line 478
  255. monitor-exit p0
  256. return-void
  257. :cond_4
  258. const/4 p2, 0x1
  259. .line 480
  260. iput-boolean p2, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->next:Z
  261. .line 481
  262. monitor-exit p0
  263. :try_end_0
  264. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  265. .line 482
  266. iput-boolean p2, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->fastPath:Z
  267. goto :goto_0
  268. :catchall_0
  269. move-exception p1
  270. .line 481
  271. :try_start_1
  272. monitor-exit p0
  273. :try_end_1
  274. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  275. throw p1
  276. .line 485
  277. :cond_5
  278. :goto_0
  279. invoke-virtual {p0, p1}, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->test(Ljava/lang/Object;)Z
  280. return-void
  281. .end method
  282. .method public isDisposed()Z
  283. .locals 1
  284. .line 422
  285. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->cancelled:Z
  286. return v0
  287. .end method
  288. .method public test(Ljava/lang/Object;)Z
  289. .locals 1
  290. .line 490
  291. iget-boolean v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->cancelled:Z
  292. if-nez v0, :cond_1
  293. iget-object v0, p0, Lio/reactivex/subjects/BehaviorSubject$BehaviorDisposable;->actual:Lio/reactivex/Observer;
  294. invoke-static {p1, v0}, Lio/reactivex/internal/util/NotificationLite;->accept(Ljava/lang/Object;Lio/reactivex/Observer;)Z
  295. move-result p1
  296. if-eqz p1, :cond_0
  297. goto :goto_0
  298. :cond_0
  299. const/4 p1, 0x0
  300. goto :goto_1
  301. :cond_1
  302. :goto_0
  303. const/4 p1, 0x1
  304. :goto_1
  305. return p1
  306. .end method