CompositeDisposable.smali 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. .class public final Lio/reactivex/disposables/CompositeDisposable;
  2. .super Ljava/lang/Object;
  3. .source "CompositeDisposable.java"
  4. # interfaces
  5. .implements Lio/reactivex/disposables/Disposable;
  6. .implements Lio/reactivex/internal/disposables/DisposableContainer;
  7. # instance fields
  8. .field volatile disposed:Z
  9. .field resources:Lio/reactivex/internal/util/OpenHashSet;
  10. .annotation system Ldalvik/annotation/Signature;
  11. value = {
  12. "Lio/reactivex/internal/util/OpenHashSet<",
  13. "Lio/reactivex/disposables/Disposable;",
  14. ">;"
  15. }
  16. .end annotation
  17. .end field
  18. # direct methods
  19. .method public constructor <init>()V
  20. .locals 0
  21. .line 35
  22. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  23. return-void
  24. .end method
  25. .method public constructor <init>(Ljava/lang/Iterable;)V
  26. .locals 2
  27. .annotation system Ldalvik/annotation/Signature;
  28. value = {
  29. "(",
  30. "Ljava/lang/Iterable<",
  31. "+",
  32. "Lio/reactivex/disposables/Disposable;",
  33. ">;)V"
  34. }
  35. .end annotation
  36. .line 55
  37. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  38. const-string v0, "resources is null"
  39. .line 56
  40. invoke-static {p1, v0}, Lio/reactivex/internal/functions/ObjectHelper;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
  41. .line 57
  42. new-instance v0, Lio/reactivex/internal/util/OpenHashSet;
  43. invoke-direct {v0}, Lio/reactivex/internal/util/OpenHashSet;-><init>()V
  44. iput-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  45. .line 58
  46. invoke-interface {p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
  47. move-result-object p1
  48. :goto_0
  49. invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
  50. move-result v0
  51. if-eqz v0, :cond_0
  52. invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
  53. move-result-object v0
  54. check-cast v0, Lio/reactivex/disposables/Disposable;
  55. const-string v1, "Disposable item is null"
  56. .line 59
  57. invoke-static {v0, v1}, Lio/reactivex/internal/functions/ObjectHelper;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
  58. .line 60
  59. iget-object v1, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  60. invoke-virtual {v1, v0}, Lio/reactivex/internal/util/OpenHashSet;->add(Ljava/lang/Object;)Z
  61. goto :goto_0
  62. :cond_0
  63. return-void
  64. .end method
  65. .method public varargs constructor <init>([Lio/reactivex/disposables/Disposable;)V
  66. .locals 4
  67. .line 42
  68. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  69. const-string v0, "resources is null"
  70. .line 43
  71. invoke-static {p1, v0}, Lio/reactivex/internal/functions/ObjectHelper;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
  72. .line 44
  73. new-instance v0, Lio/reactivex/internal/util/OpenHashSet;
  74. array-length v1, p1
  75. add-int/lit8 v1, v1, 0x1
  76. invoke-direct {v0, v1}, Lio/reactivex/internal/util/OpenHashSet;-><init>(I)V
  77. iput-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  78. .line 45
  79. array-length v0, p1
  80. const/4 v1, 0x0
  81. :goto_0
  82. if-ge v1, v0, :cond_0
  83. aget-object v2, p1, v1
  84. const-string v3, "Disposable item is null"
  85. .line 46
  86. invoke-static {v2, v3}, Lio/reactivex/internal/functions/ObjectHelper;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
  87. .line 47
  88. iget-object v3, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  89. invoke-virtual {v3, v2}, Lio/reactivex/internal/util/OpenHashSet;->add(Ljava/lang/Object;)Z
  90. add-int/lit8 v1, v1, 0x1
  91. goto :goto_0
  92. :cond_0
  93. return-void
  94. .end method
  95. # virtual methods
  96. .method public add(Lio/reactivex/disposables/Disposable;)Z
  97. .locals 1
  98. const-string v0, "d is null"
  99. .line 89
  100. invoke-static {p1, v0}, Lio/reactivex/internal/functions/ObjectHelper;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
  101. .line 90
  102. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  103. if-nez v0, :cond_2
  104. .line 91
  105. monitor-enter p0
  106. .line 92
  107. :try_start_0
  108. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  109. if-nez v0, :cond_1
  110. .line 93
  111. iget-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  112. if-nez v0, :cond_0
  113. .line 95
  114. new-instance v0, Lio/reactivex/internal/util/OpenHashSet;
  115. invoke-direct {v0}, Lio/reactivex/internal/util/OpenHashSet;-><init>()V
  116. .line 96
  117. iput-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  118. .line 98
  119. :cond_0
  120. invoke-virtual {v0, p1}, Lio/reactivex/internal/util/OpenHashSet;->add(Ljava/lang/Object;)Z
  121. const/4 p1, 0x1
  122. .line 99
  123. monitor-exit p0
  124. return p1
  125. .line 101
  126. :cond_1
  127. monitor-exit p0
  128. goto :goto_0
  129. :catchall_0
  130. move-exception p1
  131. monitor-exit p0
  132. :try_end_0
  133. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  134. throw p1
  135. .line 103
  136. :cond_2
  137. :goto_0
  138. invoke-interface {p1}, Lio/reactivex/disposables/Disposable;->dispose()V
  139. const/4 p1, 0x0
  140. return p1
  141. .end method
  142. .method public varargs addAll([Lio/reactivex/disposables/Disposable;)Z
  143. .locals 6
  144. const-string v0, "ds is null"
  145. .line 114
  146. invoke-static {p1, v0}, Lio/reactivex/internal/functions/ObjectHelper;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
  147. .line 115
  148. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  149. const/4 v1, 0x0
  150. if-nez v0, :cond_3
  151. .line 116
  152. monitor-enter p0
  153. .line 117
  154. :try_start_0
  155. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  156. if-nez v0, :cond_2
  157. .line 118
  158. iget-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  159. const/4 v2, 0x1
  160. if-nez v0, :cond_0
  161. .line 120
  162. new-instance v0, Lio/reactivex/internal/util/OpenHashSet;
  163. array-length v3, p1
  164. add-int/2addr v3, v2
  165. invoke-direct {v0, v3}, Lio/reactivex/internal/util/OpenHashSet;-><init>(I)V
  166. .line 121
  167. iput-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  168. .line 123
  169. :cond_0
  170. array-length v3, p1
  171. :goto_0
  172. if-ge v1, v3, :cond_1
  173. aget-object v4, p1, v1
  174. const-string v5, "d is null"
  175. .line 124
  176. invoke-static {v4, v5}, Lio/reactivex/internal/functions/ObjectHelper;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
  177. .line 125
  178. invoke-virtual {v0, v4}, Lio/reactivex/internal/util/OpenHashSet;->add(Ljava/lang/Object;)Z
  179. add-int/lit8 v1, v1, 0x1
  180. goto :goto_0
  181. .line 127
  182. :cond_1
  183. monitor-exit p0
  184. return v2
  185. .line 129
  186. :cond_2
  187. monitor-exit p0
  188. goto :goto_1
  189. :catchall_0
  190. move-exception p1
  191. monitor-exit p0
  192. :try_end_0
  193. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  194. throw p1
  195. .line 131
  196. :cond_3
  197. :goto_1
  198. array-length v0, p1
  199. const/4 v2, 0x0
  200. :goto_2
  201. if-ge v2, v0, :cond_4
  202. aget-object v3, p1, v2
  203. .line 132
  204. invoke-interface {v3}, Lio/reactivex/disposables/Disposable;->dispose()V
  205. add-int/lit8 v2, v2, 0x1
  206. goto :goto_2
  207. :cond_4
  208. return v1
  209. .end method
  210. .method public clear()V
  211. .locals 2
  212. .line 169
  213. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  214. if-eqz v0, :cond_0
  215. return-void
  216. .line 173
  217. :cond_0
  218. monitor-enter p0
  219. .line 174
  220. :try_start_0
  221. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  222. if-eqz v0, :cond_1
  223. .line 175
  224. monitor-exit p0
  225. return-void
  226. .line 178
  227. :cond_1
  228. iget-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  229. const/4 v1, 0x0
  230. .line 179
  231. iput-object v1, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  232. .line 180
  233. monitor-exit p0
  234. :try_end_0
  235. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  236. .line 182
  237. invoke-virtual {p0, v0}, Lio/reactivex/disposables/CompositeDisposable;->dispose(Lio/reactivex/internal/util/OpenHashSet;)V
  238. return-void
  239. :catchall_0
  240. move-exception v0
  241. .line 180
  242. :try_start_1
  243. monitor-exit p0
  244. :try_end_1
  245. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  246. throw v0
  247. .end method
  248. .method public delete(Lio/reactivex/disposables/Disposable;)Z
  249. .locals 2
  250. const-string v0, "Disposable item is null"
  251. .line 148
  252. invoke-static {p1, v0}, Lio/reactivex/internal/functions/ObjectHelper;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
  253. .line 149
  254. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  255. const/4 v1, 0x0
  256. if-eqz v0, :cond_0
  257. return v1
  258. .line 152
  259. :cond_0
  260. monitor-enter p0
  261. .line 153
  262. :try_start_0
  263. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  264. if-eqz v0, :cond_1
  265. .line 154
  266. monitor-exit p0
  267. return v1
  268. .line 157
  269. :cond_1
  270. iget-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  271. if-eqz v0, :cond_3
  272. .line 158
  273. invoke-virtual {v0, p1}, Lio/reactivex/internal/util/OpenHashSet;->remove(Ljava/lang/Object;)Z
  274. move-result p1
  275. if-nez p1, :cond_2
  276. goto :goto_0
  277. .line 161
  278. :cond_2
  279. monitor-exit p0
  280. const/4 p1, 0x1
  281. return p1
  282. .line 159
  283. :cond_3
  284. :goto_0
  285. monitor-exit p0
  286. return v1
  287. :catchall_0
  288. move-exception p1
  289. .line 161
  290. monitor-exit p0
  291. :try_end_0
  292. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  293. throw p1
  294. .end method
  295. .method public dispose()V
  296. .locals 2
  297. .line 66
  298. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  299. if-eqz v0, :cond_0
  300. return-void
  301. .line 70
  302. :cond_0
  303. monitor-enter p0
  304. .line 71
  305. :try_start_0
  306. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  307. if-eqz v0, :cond_1
  308. .line 72
  309. monitor-exit p0
  310. return-void
  311. :cond_1
  312. const/4 v0, 0x1
  313. .line 74
  314. iput-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  315. .line 75
  316. iget-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  317. const/4 v1, 0x0
  318. .line 76
  319. iput-object v1, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  320. .line 77
  321. monitor-exit p0
  322. :try_end_0
  323. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  324. .line 79
  325. invoke-virtual {p0, v0}, Lio/reactivex/disposables/CompositeDisposable;->dispose(Lio/reactivex/internal/util/OpenHashSet;)V
  326. return-void
  327. :catchall_0
  328. move-exception v0
  329. .line 77
  330. :try_start_1
  331. monitor-exit p0
  332. :try_end_1
  333. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  334. throw v0
  335. .end method
  336. .method dispose(Lio/reactivex/internal/util/OpenHashSet;)V
  337. .locals 6
  338. .annotation system Ldalvik/annotation/Signature;
  339. value = {
  340. "(",
  341. "Lio/reactivex/internal/util/OpenHashSet<",
  342. "Lio/reactivex/disposables/Disposable;",
  343. ">;)V"
  344. }
  345. .end annotation
  346. if-nez p1, :cond_0
  347. return-void
  348. :cond_0
  349. const/4 v0, 0x0
  350. .line 212
  351. invoke-virtual {p1}, Lio/reactivex/internal/util/OpenHashSet;->keys()[Ljava/lang/Object;
  352. move-result-object p1
  353. .line 213
  354. array-length v1, p1
  355. const/4 v2, 0x0
  356. move-object v3, v0
  357. const/4 v0, 0x0
  358. :goto_0
  359. if-ge v0, v1, :cond_3
  360. aget-object v4, p1, v0
  361. .line 214
  362. instance-of v5, v4, Lio/reactivex/disposables/Disposable;
  363. if-eqz v5, :cond_2
  364. .line 216
  365. :try_start_0
  366. check-cast v4, Lio/reactivex/disposables/Disposable;
  367. invoke-interface {v4}, Lio/reactivex/disposables/Disposable;->dispose()V
  368. :try_end_0
  369. .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
  370. goto :goto_1
  371. :catch_0
  372. move-exception v4
  373. .line 218
  374. invoke-static {v4}, Lio/reactivex/exceptions/Exceptions;->throwIfFatal(Ljava/lang/Throwable;)V
  375. if-nez v3, :cond_1
  376. .line 220
  377. new-instance v3, Ljava/util/ArrayList;
  378. invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V
  379. .line 222
  380. :cond_1
  381. invoke-interface {v3, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  382. :cond_2
  383. :goto_1
  384. add-int/lit8 v0, v0, 0x1
  385. goto :goto_0
  386. :cond_3
  387. if-eqz v3, :cond_5
  388. .line 227
  389. invoke-interface {v3}, Ljava/util/List;->size()I
  390. move-result p1
  391. const/4 v0, 0x1
  392. if-ne p1, v0, :cond_4
  393. .line 228
  394. invoke-interface {v3, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
  395. move-result-object p1
  396. check-cast p1, Ljava/lang/Throwable;
  397. invoke-static {p1}, Lio/reactivex/internal/util/ExceptionHelper;->wrapOrThrow(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;
  398. move-result-object p1
  399. throw p1
  400. .line 230
  401. :cond_4
  402. new-instance p1, Lio/reactivex/exceptions/CompositeException;
  403. invoke-direct {p1, v3}, Lio/reactivex/exceptions/CompositeException;-><init>(Ljava/lang/Iterable;)V
  404. throw p1
  405. :cond_5
  406. return-void
  407. .end method
  408. .method public isDisposed()Z
  409. .locals 1
  410. .line 84
  411. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  412. return v0
  413. .end method
  414. .method public remove(Lio/reactivex/disposables/Disposable;)Z
  415. .locals 1
  416. .line 139
  417. invoke-virtual {p0, p1}, Lio/reactivex/disposables/CompositeDisposable;->delete(Lio/reactivex/disposables/Disposable;)Z
  418. move-result v0
  419. if-eqz v0, :cond_0
  420. .line 140
  421. invoke-interface {p1}, Lio/reactivex/disposables/Disposable;->dispose()V
  422. const/4 p1, 0x1
  423. return p1
  424. :cond_0
  425. const/4 p1, 0x0
  426. return p1
  427. .end method
  428. .method public size()I
  429. .locals 2
  430. .line 190
  431. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  432. const/4 v1, 0x0
  433. if-eqz v0, :cond_0
  434. return v1
  435. .line 193
  436. :cond_0
  437. monitor-enter p0
  438. .line 194
  439. :try_start_0
  440. iget-boolean v0, p0, Lio/reactivex/disposables/CompositeDisposable;->disposed:Z
  441. if-eqz v0, :cond_1
  442. .line 195
  443. monitor-exit p0
  444. return v1
  445. .line 197
  446. :cond_1
  447. iget-object v0, p0, Lio/reactivex/disposables/CompositeDisposable;->resources:Lio/reactivex/internal/util/OpenHashSet;
  448. if-eqz v0, :cond_2
  449. .line 198
  450. invoke-virtual {v0}, Lio/reactivex/internal/util/OpenHashSet;->size()I
  451. move-result v1
  452. :cond_2
  453. monitor-exit p0
  454. return v1
  455. :catchall_0
  456. move-exception v0
  457. .line 199
  458. monitor-exit p0
  459. :try_end_0
  460. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  461. throw v0
  462. .end method