|
8 | 8 | #include "LeakChecker.h"
|
9 | 9 |
|
10 | 10 | #include <glog/logging.h>
|
| 11 | +#include <jsi/instrumentation.h> |
11 | 12 |
|
12 | 13 | namespace facebook {
|
13 | 14 | namespace react {
|
14 | 15 |
|
15 |
| -LeakChecker::LeakChecker( |
16 |
| - RuntimeExecutor const &runtimeExecutor, |
17 |
| - GarbageCollectionTrigger const &garbageCollectionTrigger) |
18 |
| - : runtimeExecutor_(runtimeExecutor), |
19 |
| - garbageCollectionTrigger_(garbageCollectionTrigger) {} |
| 16 | +LeakChecker::LeakChecker(RuntimeExecutor const &runtimeExecutor) |
| 17 | + : runtimeExecutor_(runtimeExecutor) {} |
20 | 18 |
|
21 | 19 | void LeakChecker::uiManagerDidCreateShadowNodeFamily(
|
22 | 20 | ShadowNodeFamily::Shared const &shadowNodeFamily) const {
|
23 | 21 | registry_.add(shadowNodeFamily);
|
24 | 22 | }
|
25 | 23 |
|
26 | 24 | void LeakChecker::stopSurface(SurfaceId surfaceId) {
|
27 |
| - garbageCollectionTrigger_(); |
28 |
| - |
29 | 25 | if (previouslyStoppedSurface_ > 0) {
|
30 | 26 | // Dispatch the check onto JavaScript thread to make sure all other
|
31 | 27 | // cleanup code has had chance to run.
|
32 | 28 | runtimeExecutor_([previouslySoppedSurface = previouslyStoppedSurface_,
|
33 |
| - this](jsi::Runtime &) { |
| 29 | + this](jsi::Runtime &runtime) { |
| 30 | + runtime.instrumentation().collectGarbage("LeakChecker"); |
34 | 31 | // For now check the previous surface because React uses double
|
35 | 32 | // buffering which keeps the surface that was just stopped in
|
36 | 33 | // memory. This is a documented problem in the last point of
|
|
0 commit comments