-
Notifications
You must be signed in to change notification settings - Fork 17
Remove the app_control reply channel #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the app_control reply channel #183
Conversation
bda18b0 to
7c84c8a
Compare
- Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager
49ba110 to
1f22bd7
Compare
- Add NativeAttachAppControl - Move definitions to the header
1f22bd7 to
f3011db
Compare
| } | ||
| auto id = app_control->id(); | ||
| Dart_NewFinalizableHandle_DL( | ||
| handle, app_control.get(), 64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it 64? (Just curious.. 😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value is a hint for the garbage collector as far as the documentation says. Increasing the size may increase the chance of finalizable objects to be collected.
As a side note, the general finalizer support will be added to the Dart language in the near future so this (finalization through FFI) is a temporary solution until then.
| } | ||
| AppControlResult ret = app_control_reply_to_launch_request( | ||
| reply->Handle(), this->handle_, result_e); | ||
| reply->handle(), this->handle_, result_e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no need the null checking for AppControl*? other functions have same issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An exception will be thrown in the Dart side constructors in case of instantiation failure so it cannot be nullptr as far as I can see (although it can be "invalid" if the destructor already has been called. The platform will return error if the app_control handle is invalid.)
Also I'll closely review the overall implementation in a follow-up PR. I tried not to make many changes to the existing code in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I understand.
|
|
||
| void AppControlChannel::Reply( | ||
| std::shared_ptr<AppControl> app_control, | ||
| AppControl* app_control, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
bwikbs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see this and I've been looking at how it works for a long time. 😄
Results of the refactoring are expected !!(Very intuitive~!)
It's good try to use a finalizer for the part that is connected to dart in this way. 👍
WonyoungChoi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! clean code 👍
This comment has been minimized.
This comment has been minimized.
pkosko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
* Remove the app_control reply channel - Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager * Convert shared_ptr to unique_ptr * Fix memory leaks - Add NativeAttachAppControl - Move definitions to the header
* Remove the app_control reply channel - Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager * Convert shared_ptr to unique_ptr * Fix memory leaks - Add NativeAttachAppControl - Move definitions to the header
* Remove the app_control reply channel - Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager * Convert shared_ptr to unique_ptr * Fix memory leaks - Add NativeAttachAppControl - Move definitions to the header
* Remove the app_control reply channel - Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager * Convert shared_ptr to unique_ptr * Fix memory leaks - Add NativeAttachAppControl - Move definitions to the header
* Remove the app_control reply channel - Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager * Convert shared_ptr to unique_ptr * Fix memory leaks - Add NativeAttachAppControl - Move definitions to the header
* Remove the app_control reply channel - Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager * Convert shared_ptr to unique_ptr * Fix memory leaks - Add NativeAttachAppControl - Move definitions to the header
* Remove the app_control reply channel - Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager * Convert shared_ptr to unique_ptr * Fix memory leaks - Add NativeAttachAppControl - Move definitions to the header
* Remove the app_control reply channel - Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager * Convert shared_ptr to unique_ptr * Fix memory leaks - Add NativeAttachAppControl - Move definitions to the header
* Remove the app_control reply channel - Let the method channel directly return responses to the caller - Add NativeInitializeDartApi, NativeCreateAppControl - Create AppControlManager * Convert shared_ptr to unique_ptr * Fix memory leaks - Add NativeAttachAppControl - Move definitions to the header
Part of flutter-tizen/flutter-tizen#210.
Changes:
sendLaunchRequestmethod now returns the response as aMap<String, dynamic>ifwaitForReplyis true.callerIdtocallerAppIdand newly implementshouldReply.AppControlManagerfor managing AppControl instances. They were previously managed byAppControlChannel.inttoint32_t, and useunique_ptrinstead ofshared_ptr.Newly exported APIs:
NativeInitializeDartApiNativeCreateAppControlNativeAttachAppControlcreateanddisposemethods are still supported just for backward compatibility.)NativeInitializeDartApimay be moved outsideapp_control.ccif more FFI functions are added in the future.Notes: