Review Console reference management#1161
Open
lionel- wants to merge 26 commits intotask/sync-plot-commfrom
Open
Review Console reference management#1161lionel- wants to merge 26 commits intotask/sync-plot-commfrom
Console reference management#1161lionel- wants to merge 26 commits intotask/sync-plot-commfrom
Conversation
6774491 to
45464f3
Compare
45464f3 to
1025ccd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branched from #1100
Progress towards #1145
New
Console::with()that passes a Console ref and catches panics, transforming them toResult.Console::get()pushed to the FFI boundary and abstracted with[ark::register]. This new macro wraps[harp::register]and callsConsole::with(). Any panics due to e.g. RefCell issues gets converted to an R error.The graphics callbacks are migrated to
[ark::register], but all Ark FFI entries should use it in the future.DeviceContextno longer reaches back intoConsole. It stores all needed state on itself.PlotCommalso owns what it needs. I was wrong to pass&Consoleto all handlers.PlotCommis the onlyCommHandlerthat used&Console, just to get thedevice_context(). It now holds anRc<DeviceContext>passed at construction time.All methods in
console_comm.rsnow take&self. Supported by a take/remove pattern. Also the comms are now stored in aDebugRefCell, a new type that maps toRefCellin debug builds and toUnsafeCell(with logging) in release builds. This allows us to transition to more Rust safety without causing panics in release builds, and without having to handle panics in awkward places.