Document and design the case of object creation
This commit is contained in:
parent
c733a41d10
commit
4f40510248
@ -23,3 +23,8 @@ A related use case is where we want to "recycle" wrappers and ensure that for a
|
||||
|
||||
Another goal of this use case is to ensure that the unexpected destruction of the underlying QObject is handled in a more graceful and helpful way than just segfaulting the whole application. This requires the tracking of the QObject via its "destroy" signal and using that to communicate back to JS what has happened.
|
||||
|
||||
The object creation sequence runs quite differently than in the "Wrapper Keep Alive" case because the application initiates the creation of the object and NodeGui then creates the different wrappers on the JS and C++ sides.
|
||||
|
||||

|
||||
|
||||
The destruction sequence in the case of the C++ object being destroyed is basically the same as the "Wrapper Keep Alive" case.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 96 KiB |
@ -34,6 +34,9 @@ qwindowts --> qwindowwrap: screen()
|
||||
qwindowwrap --> qwindow: screen()
|
||||
qwindow --> qwindowwrap: QScreen instance
|
||||
qwindowwrap --> wrappercachecpp: get<QScreen, QScreenWrap>()
|
||||
note over wrappercachecpp
|
||||
Checks wrapper cache
|
||||
end note
|
||||
wrappercachecpp --> qscreenwrap: new()
|
||||
activate qscreenwrap
|
||||
qscreenwrap --> wrappercachecpp: QScreenWrap instance
|
||||
|
||||
BIN
website/docs/development/wrapper_recycle_seq.png
Normal file
BIN
website/docs/development/wrapper_recycle_seq.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
46
website/docs/development/wrapper_recycle_seq.puml
Normal file
46
website/docs/development/wrapper_recycle_seq.puml
Normal file
@ -0,0 +1,46 @@
|
||||
@startuml
|
||||
|
||||
skinparam object {
|
||||
backgroundColor White
|
||||
borderColor Black
|
||||
arrowColor Black
|
||||
}
|
||||
|
||||
skinparam note {
|
||||
backgroundColor LightYellow
|
||||
borderColor Black
|
||||
}
|
||||
|
||||
hide footbox
|
||||
|
||||
title Wrapper Recycle
|
||||
|
||||
participant App as app << ts >> #E3C800
|
||||
participant "QObject.ts" as qobjectts << ts>> #E3C800
|
||||
|
||||
participant "WrapperCache" as wrappercachets << ts>> #E3C800
|
||||
participant "QObjectWrap" as qobjectwrap << cpp >>
|
||||
participant "WrapperCache" as wrappercachecpp << cpp >>
|
||||
participant "QObject" as qobject << cpp >> #D5E8D4
|
||||
|
||||
== Wrapper construction ==
|
||||
|
||||
app --> qobjectts: new()
|
||||
activate qobjectts
|
||||
qobjectts --> qobjectwrap: new()
|
||||
activate qobjectwrap
|
||||
qobjectwrap --> qobject: new()
|
||||
activate qobject
|
||||
qobject --> qobjectwrap: QObject instance
|
||||
|
||||
qobjectwrap --> wrappercachecpp: store(QObject, QObjectWrap)
|
||||
wrappercachecpp --> qobject: connect to destroy signal
|
||||
|
||||
qobjectwrap --> qobjectts: QOjectWrap instance
|
||||
qobjectts --> wrappercachets: store(QObject.ts)
|
||||
qobjectts --> app: QObject instance
|
||||
|
||||
|
||||
note across: The app can use the QObject and run.
|
||||
|
||||
@enduml
|
||||
Loading…
Reference in New Issue
Block a user