Converting a synchronous IPC message to Mojo

135 views
Skip to first unread message

Peter Beverloo

unread,
Jan 28, 2016, 12:47:47 PM1/28/16
to chromi...@chromium.org
Hi chromium-mojo,

I have a synchronous IPC message from the renderer to the browser that is needed to support a Web exposed feature with too much usage to deprecate.

Is there an established upgrade path to Mojo for this situation?

If there isn't, it would be good to establish one as there are a few features that are likely to run in to this (appcache, clipboard, File API, notifications).

Thanks,
Peter

Fady Samuel

unread,
Jan 28, 2016, 12:49:13 PM1/28/16
to Peter Beverloo, chromium-mojo
This is the common pattern I've seen so far, but I'm not sure if it's the ideal pattern:

// in the mojom

interface FoobarClient {

 DoSomethingDone();

};


interface Foobar {

 DoSomething(FoobarClient client);

};


// In the FoobarImpl

void FoobarImpl::DoSomething(FoobarClientPtr client) {

 client->DoSomethingDone();

}


// In a Foobar consumer

foobar->DoSomething(binding_.CreateInterfacePtrAndBind());

// Wait for DoSomethingDone.

binding_.WaitForIncomingMethodCall();


Fady

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.
To post to this group, send email to chromi...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-mojo/CAE8Xsdi7JqGcUN_s20Z%3DD_Xxja6XC%3D6ibD_%2BBUOt25nqj-WtBA%40mail.gmail.com.

John Abd-El-Malek

unread,
Jan 28, 2016, 12:51:50 PM1/28/16
to Fady Samuel, Peter Beverloo, chromium-mojo
btw Yuzhu is working on better support for sync IPCs in Mojo: https://code.google.com/p/chromium/issues/detail?id=577699

On Thu, Jan 28, 2016 at 9:49 AM, Fady Samuel <fsa...@chromium.org> wrote:
This is the common pattern I've seen so far, but I'm not sure if it's the ideal pattern:

// in the mojom

interface FoobarClient {

 DoSomethingDone();

};


interface Foobar {

 DoSomething(FoobarClient client);

};


// In the FoobarImpl

void FoobarImpl::DoSomething(FoobarClientPtr client) {

 client->DoSomethingDone();

}


// In a Foobar consumer

foobar->DoSomething(binding_.CreateInterfacePtrAndBind());

// Wait for DoSomethingDone.

binding_.WaitForIncomingMethodCall();


Fady
On Thu, Jan 28, 2016 at 12:47 PM, Peter Beverloo <pe...@chromium.org> wrote:
Hi chromium-mojo,

I have a synchronous IPC message from the renderer to the browser that is needed to support a Web exposed feature with too much usage to deprecate.

Is there an established upgrade path to Mojo for this situation?

If there isn't, it would be good to establish one as there are a few features that are likely to run in to this (appcache, clipboard, File API, notifications).

Thanks,
Peter

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

Fady Samuel

unread,
Jan 28, 2016, 12:51:54 PM1/28/16
to Peter Beverloo, Yuzhu Shen, chromium-mojo
+yzshen@

I should have noted that this pattern does not allow reentrancy. I believe yzshen@ is looking into that.

Fady

Peter Beverloo

unread,
Jan 28, 2016, 12:54:34 PM1/28/16
to Fady Samuel, Yuzhu Shen, chromium-mojo
Got it. Thank you for the prompt answers!

While reentrancy is not required for my use-case, moving to Mojo is not blocking anything either so I'll wait for 577699 to resolve.

Thanks,
Peter

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

Yuzhu Shen

unread,
Jan 28, 2016, 1:08:47 PM1/28/16
to Peter Beverloo, Fady Samuel, chromium-mojo
(resent from correct account)

Thanks Fady and John!
Agreed with all what they have said.

And I am currently working on providing mojo sync call support similar to what we can do with sync IPC messages (probably not as powerful, intentionally :)).
There will be a design doc shortly.
Reply all
Reply to author
Forward
0 new messages