CompletableSubject.smali
14.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
.class public final Lio/reactivex/subjects/CompletableSubject;
.super Lio/reactivex/Completable;
.source "CompletableSubject.java"
# interfaces
.implements Lio/reactivex/CompletableObserver;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
}
.end annotation
# static fields
.field static final EMPTY:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
.field static final TERMINATED:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
# instance fields
.field error:Ljava/lang/Throwable;
.field final observers:Ljava/util/concurrent/atomic/AtomicReference;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/atomic/AtomicReference<",
"[",
"Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;",
">;"
}
.end annotation
.end field
.field final once:Ljava/util/concurrent/atomic/AtomicBoolean;
# direct methods
.method static constructor <clinit>()V
.locals 2
const/4 v0, 0x0
.line 93
new-array v1, v0, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
sput-object v1, Lio/reactivex/subjects/CompletableSubject;->EMPTY:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
.line 95
new-array v0, v0, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
sput-object v0, Lio/reactivex/subjects/CompletableSubject;->TERMINATED:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
return-void
.end method
.method constructor <init>()V
.locals 2
.line 110
invoke-direct {p0}, Lio/reactivex/Completable;-><init>()V
.line 111
new-instance v0, Ljava/util/concurrent/atomic/AtomicBoolean;
invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>()V
iput-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->once:Ljava/util/concurrent/atomic/AtomicBoolean;
.line 112
new-instance v0, Ljava/util/concurrent/atomic/AtomicReference;
sget-object v1, Lio/reactivex/subjects/CompletableSubject;->EMPTY:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
invoke-direct {v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;-><init>(Ljava/lang/Object;)V
iput-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
return-void
.end method
.method public static create()Lio/reactivex/subjects/CompletableSubject;
.locals 1
.annotation runtime Lio/reactivex/annotations/CheckReturnValue;
.end annotation
.annotation build Lio/reactivex/annotations/NonNull;
.end annotation
.line 107
new-instance v0, Lio/reactivex/subjects/CompletableSubject;
invoke-direct {v0}, Lio/reactivex/subjects/CompletableSubject;-><init>()V
return-object v0
.end method
# virtual methods
.method add(Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;)Z
.locals 4
.line 164
:cond_0
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
.line 165
sget-object v1, Lio/reactivex/subjects/CompletableSubject;->TERMINATED:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
const/4 v2, 0x0
if-ne v0, v1, :cond_1
return v2
.line 169
:cond_1
array-length v1, v0
add-int/lit8 v3, v1, 0x1
.line 171
new-array v3, v3, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
.line 172
invoke-static {v0, v2, v3, v2, v1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
.line 173
aput-object p1, v3, v1
.line 174
iget-object v1, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v1, v0, v3}, Ljava/util/concurrent/atomic/AtomicReference;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
const/4 p1, 0x1
return p1
.end method
.method public getThrowable()Ljava/lang/Throwable;
.locals 2
.annotation build Lio/reactivex/annotations/Nullable;
.end annotation
.line 221
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
sget-object v1, Lio/reactivex/subjects/CompletableSubject;->TERMINATED:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
if-ne v0, v1, :cond_0
.line 222
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->error:Ljava/lang/Throwable;
return-object v0
:cond_0
const/4 v0, 0x0
return-object v0
.end method
.method public hasComplete()Z
.locals 2
.line 240
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
sget-object v1, Lio/reactivex/subjects/CompletableSubject;->TERMINATED:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
if-ne v0, v1, :cond_0
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->error:Ljava/lang/Throwable;
if-nez v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
return v0
.end method
.method public hasObservers()Z
.locals 1
.line 248
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
array-length v0, v0
if-eqz v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
return v0
.end method
.method public hasThrowable()Z
.locals 2
.line 232
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
sget-object v1, Lio/reactivex/subjects/CompletableSubject;->TERMINATED:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
if-ne v0, v1, :cond_0
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->error:Ljava/lang/Throwable;
if-eqz v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
return v0
.end method
.method observerCount()I
.locals 1
.line 256
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
array-length v0, v0
return v0
.end method
.method public onComplete()V
.locals 4
.line 137
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->once:Ljava/util/concurrent/atomic/AtomicBoolean;
const/4 v1, 0x1
const/4 v2, 0x0
invoke-virtual {v0, v2, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;->compareAndSet(ZZ)Z
move-result v0
if-eqz v0, :cond_0
.line 138
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
sget-object v1, Lio/reactivex/subjects/CompletableSubject;->TERMINATED:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;->getAndSet(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
array-length v1, v0
:goto_0
if-ge v2, v1, :cond_0
aget-object v3, v0, v2
.line 139
iget-object v3, v3, Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;->actual:Lio/reactivex/CompletableObserver;
invoke-interface {v3}, Lio/reactivex/CompletableObserver;->onComplete()V
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_0
return-void
.end method
.method public onError(Ljava/lang/Throwable;)V
.locals 4
const-string v0, "onError called with null. Null values are generally not allowed in 2.x operators and sources."
.line 124
invoke-static {p1, v0}, Lio/reactivex/internal/functions/ObjectHelper;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
.line 125
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->once:Ljava/util/concurrent/atomic/AtomicBoolean;
const/4 v1, 0x1
const/4 v2, 0x0
invoke-virtual {v0, v2, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;->compareAndSet(ZZ)Z
move-result v0
if-eqz v0, :cond_0
.line 126
iput-object p1, p0, Lio/reactivex/subjects/CompletableSubject;->error:Ljava/lang/Throwable;
.line 127
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
sget-object v1, Lio/reactivex/subjects/CompletableSubject;->TERMINATED:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;->getAndSet(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
array-length v1, v0
:goto_0
if-ge v2, v1, :cond_1
aget-object v3, v0, v2
.line 128
iget-object v3, v3, Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;->actual:Lio/reactivex/CompletableObserver;
invoke-interface {v3, p1}, Lio/reactivex/CompletableObserver;->onError(Ljava/lang/Throwable;)V
add-int/lit8 v2, v2, 0x1
goto :goto_0
.line 131
:cond_0
invoke-static {p1}, Lio/reactivex/plugins/RxJavaPlugins;->onError(Ljava/lang/Throwable;)V
:cond_1
return-void
.end method
.method public onSubscribe(Lio/reactivex/disposables/Disposable;)V
.locals 2
.line 117
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
sget-object v1, Lio/reactivex/subjects/CompletableSubject;->TERMINATED:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
if-ne v0, v1, :cond_0
.line 118
invoke-interface {p1}, Lio/reactivex/disposables/Disposable;->dispose()V
:cond_0
return-void
.end method
.method remove(Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;)V
.locals 6
.line 182
:cond_0
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
.line 183
array-length v1, v0
if-nez v1, :cond_1
return-void
:cond_1
const/4 v2, -0x1
const/4 v3, 0x0
move v4, v3
:goto_0
if-ge v4, v1, :cond_3
.line 191
aget-object v5, v0, v4
if-ne v5, p1, :cond_2
move v2, v4
goto :goto_1
:cond_2
add-int/lit8 v4, v4, 0x1
goto :goto_0
:cond_3
:goto_1
if-gez v2, :cond_4
return-void
:cond_4
const/4 v4, 0x1
if-ne v1, v4, :cond_5
.line 202
sget-object v1, Lio/reactivex/subjects/CompletableSubject;->EMPTY:[Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
goto :goto_2
:cond_5
add-int/lit8 v5, v1, -0x1
.line 204
new-array v5, v5, [Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
.line 205
invoke-static {v0, v3, v5, v3, v2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
add-int/lit8 v3, v2, 0x1
sub-int/2addr v1, v2
sub-int/2addr v1, v4
.line 206
invoke-static {v0, v3, v5, v2, v1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
move-object v1, v5
.line 209
:goto_2
iget-object v2, p0, Lio/reactivex/subjects/CompletableSubject;->observers:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v2, v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
return-void
.end method
.method protected subscribeActual(Lio/reactivex/CompletableObserver;)V
.locals 2
.line 146
new-instance v0, Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;
invoke-direct {v0, p1, p0}, Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;-><init>(Lio/reactivex/CompletableObserver;Lio/reactivex/subjects/CompletableSubject;)V
.line 147
invoke-interface {p1, v0}, Lio/reactivex/CompletableObserver;->onSubscribe(Lio/reactivex/disposables/Disposable;)V
.line 148
invoke-virtual {p0, v0}, Lio/reactivex/subjects/CompletableSubject;->add(Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;)Z
move-result v1
if-eqz v1, :cond_0
.line 149
invoke-virtual {v0}, Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;->isDisposed()Z
move-result p1
if-eqz p1, :cond_2
.line 150
invoke-virtual {p0, v0}, Lio/reactivex/subjects/CompletableSubject;->remove(Lio/reactivex/subjects/CompletableSubject$CompletableDisposable;)V
goto :goto_0
.line 153
:cond_0
iget-object v0, p0, Lio/reactivex/subjects/CompletableSubject;->error:Ljava/lang/Throwable;
if-eqz v0, :cond_1
.line 155
invoke-interface {p1, v0}, Lio/reactivex/CompletableObserver;->onError(Ljava/lang/Throwable;)V
goto :goto_0
.line 157
:cond_1
invoke-interface {p1}, Lio/reactivex/CompletableObserver;->onComplete()V
:cond_2
:goto_0
return-void
.end method