Bug 46978 - [next] make TpProxy client codegen always-async
Summary: [next] make TpProxy client codegen always-async
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact: Telepathy bugs list
URL: http://cgit.freedesktop.org/~smcv/tel...
Whiteboard: review+
Keywords: patch
Depends on:
Blocks: tp-glib-1.0
  Show dependency treegraph
 
Reported: 2012-03-05 10:04 UTC by Simon McVittie
Modified: 2012-03-06 02:58 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
[master] Rewrite unsupported-interface to be suitable for the 'next' branch (10.81 KB, patch)
2012-03-05 10:05 UTC, Simon McVittie
Details | Splinter Review
[next 1/2] TpProxy codegen: always invoke the method via invoke_callback (2.11 KB, patch)
2012-03-05 10:07 UTC, Simon McVittie
Details | Splinter Review
[next 2/2] Always call TpProxy async method callbacks in an idle (5.92 KB, patch)
2012-03-05 10:07 UTC, Simon McVittie
Details | Splinter Review

Description Simon McVittie 2012-03-05 10:04:16 UTC
The tp_cli_*_call_* methods are currently async, except that if the TpProxy doesn't have the interface, the callback is called in a re-entrant way (before the function returns). This means we have to jump through hoops to use these functions with GAsyncResult (Bug #45514).

In next, we should just make these functions properly async.
Comment 1 Simon McVittie 2012-03-05 10:05:33 UTC
Created attachment 58034 [details] [review]
[master] Rewrite unsupported-interface to be suitable for the 'next'  branch

TpDBusDaemon doesn't have optionally-supported interfaces after the
removal of Telepathy Properties, so we have to use TpConnection.
I took the opportunity to modernize the test and use GTest.
Comment 2 Simon McVittie 2012-03-05 10:06:35 UTC
(In reply to comment #1)
> [master] Rewrite unsupported-interface to be suitable for the 'next' branch

Not shown here: the merge into next, which consists of ignoring the changes already made on next, taking the file from master in its entirety, and adding #include "telepathy-glib/reentrants.h".
Comment 3 Simon McVittie 2012-03-05 10:07:04 UTC
Created attachment 58035 [details] [review]
[next 1/2] TpProxy codegen: always invoke the method via  invoke_callback
Comment 4 Simon McVittie 2012-03-05 10:07:27 UTC
Created attachment 58036 [details] [review]
[next 2/2] Always call TpProxy async method callbacks in an idle

Previously, we made a re-entrant call to the callback if the TpProxy
didn't have the interface. Having a method that is "sometimes async"
is bad, though: we should follow the GAsyncResult pattern, and have
the method return be always-async. In particular, this means we can
safely complete a GAsyncResult from the callback, without doing an
additional idle.
Comment 5 Jonny Lamb 2012-03-05 14:59:19 UTC
Okay these look good.
Comment 6 Simon McVittie 2012-03-06 02:58:32 UTC
Thanks, fixed in next. (unsupported-interface test: 0.17.6.)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.