Repository navigation
Commit d4b69f1
committed
docs(android): Note the cost of reading INavScope.app
The member read as a cheap accessor, which invites call sites that run more
often than once per navigation. It isn't: App's copy constructor isn't public,
so an App can't be copied on its own, and NavScope goes through Contexts
instead. That deep-copies every context on the scope -- on Android including a
fully populated Device -- and discards all of it but the App.
Document the caller-facing warning on INavScope.app and the mechanism behind it
on NavScope.app, so the constraint sits where it is true and whoever replaces
the copy later doesn't have to re-derive it.
Also records why a copy is needed at all, which was undocumented: callers mutate
the result before binding it to a transaction, so handing out the scope's live
App would corrupt shared scope state.1 parent 2733897 commit d4b69f1
2 files changed
Lines changed: 21 additions & 3 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
39 | 48 | | |
40 | 49 | | |
41 | 50 | | |
| |||
106 | 115 | | |
107 | 116 | | |
108 | 117 | | |
109 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
110 | 127 | | |
111 | 128 | | |
112 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
0 commit comments