ReplayProcessor$UnboundedReplayBuffer.smali 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. .class final Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;
  2. .super Ljava/util/concurrent/atomic/AtomicReference;
  3. .source "ReplayProcessor.java"
  4. # interfaces
  5. .implements Lio/reactivex/processors/ReplayProcessor$ReplayBuffer;
  6. # annotations
  7. .annotation system Ldalvik/annotation/EnclosingClass;
  8. value = Lio/reactivex/processors/ReplayProcessor;
  9. .end annotation
  10. .annotation system Ldalvik/annotation/InnerClass;
  11. accessFlags = 0x18
  12. name = "UnboundedReplayBuffer"
  13. .end annotation
  14. .annotation system Ldalvik/annotation/Signature;
  15. value = {
  16. "<T:",
  17. "Ljava/lang/Object;",
  18. ">",
  19. "Ljava/util/concurrent/atomic/AtomicReference<",
  20. "Ljava/lang/Object;",
  21. ">;",
  22. "Lio/reactivex/processors/ReplayProcessor$ReplayBuffer<",
  23. "TT;>;"
  24. }
  25. .end annotation
  26. # static fields
  27. .field private static final serialVersionUID:J = -0x3ddb289978ca6d74L
  28. # instance fields
  29. .field final buffer:Ljava/util/List;
  30. .annotation system Ldalvik/annotation/Signature;
  31. value = {
  32. "Ljava/util/List<",
  33. "Ljava/lang/Object;",
  34. ">;"
  35. }
  36. .end annotation
  37. .end field
  38. .field volatile done:Z
  39. .field volatile size:I
  40. # direct methods
  41. .method constructor <init>(I)V
  42. .locals 2
  43. .line 531
  44. invoke-direct {p0}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V
  45. .line 532
  46. new-instance v0, Ljava/util/ArrayList;
  47. const-string v1, "capacityHint"
  48. invoke-static {p1, v1}, Lio/reactivex/internal/functions/ObjectHelper;->verifyPositive(ILjava/lang/String;)I
  49. move-result p1
  50. invoke-direct {v0, p1}, Ljava/util/ArrayList;-><init>(I)V
  51. iput-object v0, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  52. return-void
  53. .end method
  54. # virtual methods
  55. .method public add(Ljava/lang/Object;)V
  56. .locals 1
  57. .annotation system Ldalvik/annotation/Signature;
  58. value = {
  59. "(TT;)V"
  60. }
  61. .end annotation
  62. .line 537
  63. iget-object v0, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  64. invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  65. .line 538
  66. iget p1, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  67. add-int/lit8 p1, p1, 0x1
  68. iput p1, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  69. return-void
  70. .end method
  71. .method public addFinal(Ljava/lang/Object;)V
  72. .locals 1
  73. .line 543
  74. invoke-virtual {p0, p1}, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->lazySet(Ljava/lang/Object;)V
  75. .line 544
  76. iget-object v0, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  77. invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  78. .line 545
  79. iget p1, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  80. const/4 v0, 0x1
  81. add-int/2addr p1, v0
  82. iput p1, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  83. .line 546
  84. iput-boolean v0, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->done:Z
  85. return-void
  86. .end method
  87. .method public getValue()Ljava/lang/Object;
  88. .locals 5
  89. .annotation system Ldalvik/annotation/Signature;
  90. value = {
  91. "()TT;"
  92. }
  93. .end annotation
  94. .line 552
  95. iget v0, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  96. const/4 v1, 0x0
  97. if-eqz v0, :cond_3
  98. .line 554
  99. iget-object v2, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  100. add-int/lit8 v3, v0, -0x1
  101. .line 555
  102. invoke-interface {v2, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;
  103. move-result-object v3
  104. .line 556
  105. invoke-static {v3}, Lio/reactivex/internal/util/NotificationLite;->isComplete(Ljava/lang/Object;)Z
  106. move-result v4
  107. if-nez v4, :cond_1
  108. invoke-static {v3}, Lio/reactivex/internal/util/NotificationLite;->isError(Ljava/lang/Object;)Z
  109. move-result v4
  110. if-eqz v4, :cond_0
  111. goto :goto_0
  112. :cond_0
  113. return-object v3
  114. :cond_1
  115. :goto_0
  116. const/4 v3, 0x1
  117. if-ne v0, v3, :cond_2
  118. return-object v1
  119. :cond_2
  120. add-int/lit8 v0, v0, -0x2
  121. .line 560
  122. invoke-interface {v2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
  123. move-result-object v0
  124. return-object v0
  125. :cond_3
  126. return-object v1
  127. .end method
  128. .method public getValues([Ljava/lang/Object;)[Ljava/lang/Object;
  129. .locals 6
  130. .annotation system Ldalvik/annotation/Signature;
  131. value = {
  132. "([TT;)[TT;"
  133. }
  134. .end annotation
  135. .line 570
  136. iget v0, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  137. const/4 v1, 0x0
  138. const/4 v2, 0x0
  139. if-nez v0, :cond_1
  140. .line 572
  141. array-length v0, p1
  142. if-eqz v0, :cond_0
  143. .line 573
  144. aput-object v1, p1, v2
  145. :cond_0
  146. return-object p1
  147. .line 577
  148. :cond_1
  149. iget-object v3, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  150. add-int/lit8 v4, v0, -0x1
  151. .line 578
  152. invoke-interface {v3, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;
  153. move-result-object v4
  154. .line 580
  155. invoke-static {v4}, Lio/reactivex/internal/util/NotificationLite;->isComplete(Ljava/lang/Object;)Z
  156. move-result v5
  157. if-nez v5, :cond_2
  158. invoke-static {v4}, Lio/reactivex/internal/util/NotificationLite;->isError(Ljava/lang/Object;)Z
  159. move-result v4
  160. if-eqz v4, :cond_4
  161. :cond_2
  162. add-int/lit8 v0, v0, -0x1
  163. if-nez v0, :cond_4
  164. .line 583
  165. array-length v0, p1
  166. if-eqz v0, :cond_3
  167. .line 584
  168. aput-object v1, p1, v2
  169. :cond_3
  170. return-object p1
  171. .line 591
  172. :cond_4
  173. array-length v4, p1
  174. if-ge v4, v0, :cond_5
  175. .line 592
  176. invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
  177. move-result-object p1
  178. invoke-virtual {p1}, Ljava/lang/Class;->getComponentType()Ljava/lang/Class;
  179. move-result-object p1
  180. invoke-static {p1, v0}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;I)Ljava/lang/Object;
  181. move-result-object p1
  182. check-cast p1, [Ljava/lang/Object;
  183. check-cast p1, [Ljava/lang/Object;
  184. :cond_5
  185. :goto_0
  186. if-ge v2, v0, :cond_6
  187. .line 595
  188. invoke-interface {v3, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
  189. move-result-object v4
  190. aput-object v4, p1, v2
  191. add-int/lit8 v2, v2, 0x1
  192. goto :goto_0
  193. .line 597
  194. :cond_6
  195. array-length v2, p1
  196. if-le v2, v0, :cond_7
  197. .line 598
  198. aput-object v1, p1, v0
  199. :cond_7
  200. return-object p1
  201. .end method
  202. .method public replay(Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;)V
  203. .locals 18
  204. .annotation system Ldalvik/annotation/Signature;
  205. value = {
  206. "(",
  207. "Lio/reactivex/processors/ReplayProcessor$ReplaySubscription<",
  208. "TT;>;)V"
  209. }
  210. .end annotation
  211. move-object/from16 v0, p0
  212. move-object/from16 v1, p1
  213. .line 607
  214. invoke-virtual/range {p1 .. p1}, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->getAndIncrement()I
  215. move-result v2
  216. if-eqz v2, :cond_0
  217. return-void
  218. .line 612
  219. :cond_0
  220. iget-object v2, v0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  221. .line 613
  222. iget-object v3, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->actual:Lorg/reactivestreams/Subscriber;
  223. .line 615
  224. iget-object v4, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->index:Ljava/lang/Object;
  225. check-cast v4, Ljava/lang/Integer;
  226. const/4 v5, 0x0
  227. const/4 v6, 0x1
  228. if-eqz v4, :cond_1
  229. .line 618
  230. invoke-virtual {v4}, Ljava/lang/Integer;->intValue()I
  231. move-result v5
  232. goto :goto_0
  233. .line 621
  234. :cond_1
  235. invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  236. move-result-object v4
  237. iput-object v4, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->index:Ljava/lang/Object;
  238. :goto_0
  239. const/4 v4, 0x1
  240. .line 626
  241. :cond_2
  242. :goto_1
  243. iget-boolean v7, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->cancelled:Z
  244. const/4 v8, 0x0
  245. if-eqz v7, :cond_3
  246. .line 627
  247. iput-object v8, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->index:Ljava/lang/Object;
  248. return-void
  249. .line 631
  250. :cond_3
  251. iget v7, v0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  252. .line 632
  253. iget-object v9, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->requested:Ljava/util/concurrent/atomic/AtomicLong;
  254. invoke-virtual {v9}, Ljava/util/concurrent/atomic/AtomicLong;->get()J
  255. move-result-wide v9
  256. const-wide/16 v13, 0x0
  257. :goto_2
  258. if-eq v7, v5, :cond_8
  259. .line 637
  260. iget-boolean v15, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->cancelled:Z
  261. if-eqz v15, :cond_4
  262. .line 638
  263. iput-object v8, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->index:Ljava/lang/Object;
  264. return-void
  265. .line 642
  266. :cond_4
  267. invoke-interface {v2, v5}, Ljava/util/List;->get(I)Ljava/lang/Object;
  268. move-result-object v15
  269. .line 644
  270. iget-boolean v11, v0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->done:Z
  271. if-eqz v11, :cond_6
  272. add-int/lit8 v11, v5, 0x1
  273. if-ne v11, v7, :cond_6
  274. .line 646
  275. iget v7, v0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  276. if-ne v11, v7, :cond_6
  277. .line 648
  278. invoke-static {v15}, Lio/reactivex/internal/util/NotificationLite;->isComplete(Ljava/lang/Object;)Z
  279. move-result v2
  280. if-eqz v2, :cond_5
  281. .line 649
  282. invoke-interface {v3}, Lorg/reactivestreams/Subscriber;->onComplete()V
  283. goto :goto_3
  284. .line 651
  285. :cond_5
  286. invoke-static {v15}, Lio/reactivex/internal/util/NotificationLite;->getError(Ljava/lang/Object;)Ljava/lang/Throwable;
  287. move-result-object v2
  288. invoke-interface {v3, v2}, Lorg/reactivestreams/Subscriber;->onError(Ljava/lang/Throwable;)V
  289. .line 653
  290. :goto_3
  291. iput-object v8, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->index:Ljava/lang/Object;
  292. .line 654
  293. iput-boolean v6, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->cancelled:Z
  294. return-void
  295. :cond_6
  296. const-wide/16 v11, 0x0
  297. cmp-long v16, v9, v11
  298. if-nez v16, :cond_7
  299. .line 661
  300. iget-object v9, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->requested:Ljava/util/concurrent/atomic/AtomicLong;
  301. invoke-virtual {v9}, Ljava/util/concurrent/atomic/AtomicLong;->get()J
  302. move-result-wide v9
  303. add-long/2addr v9, v13
  304. cmp-long v17, v9, v11
  305. if-nez v17, :cond_7
  306. goto :goto_4
  307. .line 667
  308. :cond_7
  309. invoke-interface {v3, v15}, Lorg/reactivestreams/Subscriber;->onNext(Ljava/lang/Object;)V
  310. const-wide/16 v11, 0x1
  311. sub-long/2addr v9, v11
  312. sub-long/2addr v13, v11
  313. add-int/lit8 v5, v5, 0x1
  314. goto :goto_2
  315. :cond_8
  316. :goto_4
  317. const-wide/16 v7, 0x0
  318. cmp-long v11, v13, v7
  319. if-eqz v11, :cond_9
  320. .line 674
  321. iget-object v7, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->requested:Ljava/util/concurrent/atomic/AtomicLong;
  322. invoke-virtual {v7}, Ljava/util/concurrent/atomic/AtomicLong;->get()J
  323. move-result-wide v7
  324. const-wide v11, 0x7fffffffffffffffL
  325. cmp-long v15, v7, v11
  326. if-eqz v15, :cond_9
  327. .line 675
  328. iget-object v7, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->requested:Ljava/util/concurrent/atomic/AtomicLong;
  329. invoke-virtual {v7, v13, v14}, Ljava/util/concurrent/atomic/AtomicLong;->addAndGet(J)J
  330. move-result-wide v9
  331. .line 678
  332. :cond_9
  333. iget v7, v0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  334. if-eq v5, v7, :cond_a
  335. const-wide/16 v7, 0x0
  336. cmp-long v11, v9, v7
  337. if-eqz v11, :cond_a
  338. goto/16 :goto_1
  339. .line 682
  340. :cond_a
  341. invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  342. move-result-object v7
  343. iput-object v7, v1, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->index:Ljava/lang/Object;
  344. neg-int v4, v4
  345. .line 684
  346. invoke-virtual {v1, v4}, Lio/reactivex/processors/ReplayProcessor$ReplaySubscription;->addAndGet(I)I
  347. move-result v4
  348. if-nez v4, :cond_2
  349. return-void
  350. .end method
  351. .method public size()I
  352. .locals 4
  353. .line 693
  354. iget v0, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->size:I
  355. if-eqz v0, :cond_2
  356. .line 695
  357. iget-object v1, p0, Lio/reactivex/processors/ReplayProcessor$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  358. add-int/lit8 v2, v0, -0x1
  359. invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
  360. move-result-object v1
  361. .line 696
  362. invoke-static {v1}, Lio/reactivex/internal/util/NotificationLite;->isComplete(Ljava/lang/Object;)Z
  363. move-result v3
  364. if-nez v3, :cond_1
  365. invoke-static {v1}, Lio/reactivex/internal/util/NotificationLite;->isError(Ljava/lang/Object;)Z
  366. move-result v1
  367. if-eqz v1, :cond_0
  368. goto :goto_0
  369. :cond_0
  370. return v0
  371. :cond_1
  372. :goto_0
  373. return v2
  374. :cond_2
  375. const/4 v0, 0x0
  376. return v0
  377. .end method