Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Issue 2522333002: Provide a Mojo equivalent of ThreadSafeSender. (Closed)

Created:
4 years ago by Jay Civelli
Modified:
3 years, 11 months ago
CC:
Aaron Boodman, abarth-chromium, chromium-reviews, darin (slow to review), darin-cc_chromium.org, jam, mlamouri+watch-content_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, leonhsl(Using Gerrit)
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Provide a Mojo equivalent of ThreadSafeSender. Introduces the ThreadSafeAssociatedInterfacePtrProvider class that provides functionalities similar to the content::ThreadSafeSender. You create it with a ChannelProxy and you can then retrieve ThreadSafeInterfacePtr's from it that you can call methods on from any thread and even before the actual channel is connected. BUG=668317 Committed: https://crrev.com/315d17fc22a94a23657b7c52df283f5f93795e89 Cr-Commit-Position: refs/heads/master@{#435005}

Patch Set 1 #

Patch Set 2 : Clean-up #

Total comments: 5

Patch Set 3 : Addressed comments and synced #

Total comments: 2

Patch Set 4 : Addresses @tsepez comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+257 lines, -20 lines) Patch
M content/renderer/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
A content/renderer/mojo/thread_safe_associated_interface_ptr_provider.h View 1 2 3 1 chunk +56 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.h View 1 6 chunks +10 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.cc View 1 2 4 chunks +19 lines, -0 lines 0 comments Download
M ipc/ipc_channel_proxy.h View 1 2 3 3 chunks +21 lines, -1 line 0 comments Download
M mojo/public/cpp/bindings/tests/associated_interface_unittest.cc View 1 2 1 chunk +63 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc View 1 2 1 chunk +52 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/thread_safe_interface_ptr.h View 1 2 6 chunks +35 lines, -19 lines 0 comments Download

Messages

Total messages: 34 (17 generated)
Jay Civelli
4 years ago (2016-11-24 00:27:31 UTC) #1
Jay Civelli
4 years ago (2016-11-24 00:28:15 UTC) #4
yzshen1
LGTM with one nit. Thanks! https://codereview.chromium.org/2522333002/diff/20001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/2522333002/diff/20001/content/renderer/render_thread_impl.cc#newcode704 content/renderer/render_thread_impl.cc:704: base::MakeUnique<ThreadSafeAssociatedInterfacePtrProvider>(channel()); I thought channel()'s ...
4 years ago (2016-11-28 18:05:45 UTC) #9
Jay Civelli
Adding @jochen for content/ OWNER review and @tsepez for IPC OWNER review. Thanks.
4 years ago (2016-11-28 18:33:51 UTC) #11
Jay Civelli
https://codereview.chromium.org/2522333002/diff/20001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/2522333002/diff/20001/content/renderer/render_thread_impl.cc#newcode704 content/renderer/render_thread_impl.cc:704: base::MakeUnique<ThreadSafeAssociatedInterfacePtrProvider>(channel()); On 2016/11/28 18:05:45, yzshen1 wrote: > I thought ...
4 years ago (2016-11-28 18:46:10 UTC) #12
Tom Sepez
It seems like this is opening a pretty wide hole where we can stuff anything ...
4 years ago (2016-11-28 18:49:11 UTC) #13
yzshen1
https://codereview.chromium.org/2522333002/diff/20001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/2522333002/diff/20001/content/renderer/render_thread_impl.cc#newcode704 content/renderer/render_thread_impl.cc:704: base::MakeUnique<ThreadSafeAssociatedInterfacePtrProvider>(channel()); On 2016/11/28 18:46:10, Jay Civelli wrote: > On ...
4 years ago (2016-11-28 18:50:21 UTC) #14
Jay Civelli
On 2016/11/28 18:49:11, Tom Sepez wrote: > It seems like this is opening a pretty ...
4 years ago (2016-11-28 19:18:23 UTC) #15
Tom Sepez
On 2016/11/28 19:18:23, Jay Civelli wrote: > On 2016/11/28 18:49:11, Tom Sepez wrote: > > ...
4 years ago (2016-11-28 20:18:32 UTC) #16
Jay Civelli
https://codereview.chromium.org/2522333002/diff/40001/ipc/ipc_channel_proxy.h File ipc/ipc_channel_proxy.h (right): https://codereview.chromium.org/2522333002/diff/40001/ipc/ipc_channel_proxy.h#newcode233 ipc/ipc_channel_proxy.h:233: using RunOnIOThreadCallback = base::Callback<void(Channel*)>; On 2016/11/28 18:49:11, Tom Sepez ...
4 years ago (2016-11-28 22:49:02 UTC) #17
Tom Sepez
lgtm
4 years ago (2016-11-28 23:11:31 UTC) #18
jochen (gone - plz use gerrit)
lgtm
4 years ago (2016-11-29 15:44:20 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2522333002/60001
4 years ago (2016-11-29 16:11:01 UTC) #26
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years ago (2016-11-29 16:15:38 UTC) #29
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/315d17fc22a94a23657b7c52df283f5f93795e89 Cr-Commit-Position: refs/heads/master@{#435005}
4 years ago (2016-11-29 16:17:49 UTC) #31
blundell
leonhsl@intel.com made the comment that the interface added here seems problematic: ThreadSafeAssociatedInterfacePtrProvider::CreateInterfacePtr() returns an unbound ...
3 years, 11 months ago (2016-12-29 10:10:17 UTC) #33
Jay Civelli
3 years, 11 months ago (2016-12-29 20:51:13 UTC) #34
Message was sent while issue was closed.
Thanks for pointing that out. You are right, that code is not correct.
I have a fix where the ThreadSafeAssociatedInterfacePtr when created with
CreateUnound() takes in the task runner on which the bind will happen.
This allows you to create the ThreadSafeAssociatedInterfacePtr, post a task
to bind and then call on the ThreadSafeAssociatedInterfacePtr immediately
(which are posted to the thread where the bind will happen) .
See https://codereview.chromium.org/2608783003

Jay

On Thu, Dec 29, 2016 at 2:10 AM, <blundell@chromium.org> wrote:

> leonhsl@intel.com made the comment that the interface added here seems
> problematic: ThreadSafeAssociatedInterfacePtrProvider::CreateInterfacePtr
> ()
> returns an unbound mojo::ThreadSafeAssociatedInterfacePtr. Per the
> documentation
> on the latter class no interface methods should be called on an unbound
> instance. However the documentation of the interface added here encourages
> using
> the returned object immediately. Is there something that we're missing that
> makes this seeming discrepancy actually OK?
>
> If this *is* problematic, one way to resolve it would be by making the
> CreateInterfacePtr() method added here asynchronous (i.e., it calls a
> client-provided callback from BindInterfacePtr()). I'm not sure if that
> change
> would cripple the intended use case.
>
> https://codereview.chromium.org/2522333002/
>

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

Powered by Google App Engine
This is Rietveld 408576698