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

Issue 149062: mac/linux: rework plugin channel file descriptor creation (Closed)

Created:
11 years, 6 months ago by Antoine Labour
Modified:
9 years, 7 months ago
Reviewers:
jam, Evan Martin
CC:
chromium-reviews_googlegroups.com, Amanda Walker
Visibility:
Public.

Description

mac/linux: rework plugin channel file descriptor creation This CL fixes a bug where the same renderer could open several channels to the same plugin process, which end up having the same name. This CL makes it that there is only one channel for each (plugin, renderer) pair, just like on Windows. The socketpair is created in the plugin process (which can ensure that only one channel per renderer gets created), and sends the renderer side through the browser process. Note: this should essentially be a noop on Windows.

Patch Set 1 #

Total comments: 26

Patch Set 2 : address review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+69 lines, -72 lines) Patch
M chrome/browser/plugin_process_host.h View 1 2 chunks +3 lines, -6 lines 0 comments Download
M chrome/browser/plugin_process_host.cc View 1 2 chunks +5 lines, -27 lines 0 comments Download
M chrome/common/ipc_message.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/plugin_messages_internal.h View 2 chunks +1 line, -11 lines 0 comments Download
M chrome/plugin/plugin_channel.h View 1 4 chunks +22 lines, -2 lines 0 comments Download
M chrome/plugin/plugin_channel.cc View 1 4 chunks +27 lines, -10 lines 0 comments Download
M chrome/plugin/plugin_thread.h View 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/plugin/plugin_thread.cc View 1 chunk +10 lines, -11 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Antoine Labour
11 years, 6 months ago (2009-06-26 07:43:55 UTC) #1
Evan Martin
http://codereview.chromium.org/149062/diff/1/2 File chrome/browser/plugin_process_host.cc (right): http://codereview.chromium.org/149062/diff/1/2#newcode549 Line 549: const IPC::ChannelHandle &channel_handle) { & on left http://codereview.chromium.org/149062/diff/1/2#newcode552 ...
11 years, 6 months ago (2009-06-26 19:18:31 UTC) #2
jam
lgtm. yeah it's very important that there's only one channel between a plugin and renderer, ...
11 years, 6 months ago (2009-06-26 19:38:40 UTC) #3
Antoine Labour
John: today, if multiple channels are created for the same renderer, the plugin process will ...
11 years, 6 months ago (2009-06-26 20:23:46 UTC) #4
Evan Martin
On 2009/06/26 20:23:46, Antoine Labour wrote: > On 2009/06/26 19:18:31, Evan Martin wrote: > > ...
11 years, 6 months ago (2009-06-26 20:33:48 UTC) #5
Evan Martin
LGTM if you've checked that we can still create and close tabs
11 years, 6 months ago (2009-06-26 20:36:12 UTC) #6
jam
On 2009/06/26 20:23:46, Antoine Labour wrote: > John: today, if multiple channels are created for ...
11 years, 6 months ago (2009-06-26 20:48:58 UTC) #7
Antoine Labour
11 years, 6 months ago (2009-06-26 21:55:55 UTC) #8
On 2009/06/26 20:48:58, John Abd-El-Malek wrote:
> On 2009/06/26 20:23:46, Antoine Labour wrote:
> > John: today, if multiple channels are created for the same renderer, the
> plugin
> > process will assert on mac and linux (in the code that maps channel names to
> > FDs).
> > Unit tests would be better indeed. I'll see what I can do there, but I'm not
> > sure that channel name -> FD map works in the single process case, and even
> the
> > channel name is generated using process IDs.
> 
> In Windows, single-process mode means everything runs in one process
(renderers
> & plugins).  I vaguely remember Evan saying this isn't possible because there
> can only be one UI thread in a process, so you guys still have to run plugins
in
> a different process?  I'm not sure why it wouldn't work in that case, each
> RenderProcessHost will have a fake renderer id so I assume there'll be a
> different channel for it.
> 
> > Is there an easy setup to do unit tests with multiple processes ?
> 
> UI tests run chrome in multi-process mode, and there's also
> in-browser-unit-tests, which are similar but more powerful since a binary is
> loaded into the browser process so it has access to globals etc (ui tests just
> control the browser using the automation API).
> 
> > 
> > http://codereview.chromium.org/149062/diff/1/2
> > File chrome/browser/plugin_process_host.cc (right):
> > 
> > http://codereview.chromium.org/149062/diff/1/2#newcode549
> > Line 549: const IPC::ChannelHandle &channel_handle) {
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > & on left
> > 
> > Done.
> > 
> > http://codereview.chromium.org/149062/diff/1/2#newcode552
> > Line 552: #ifdef OS_POSIX
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > if defined(...)
> > 
> > Done.
> > 
> > http://codereview.chromium.org/149062/diff/1/2#newcode555
> > Line 555: // dup()'ed FD gets closed.
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > I don't quite understand this.  ipc_message_utils says fds coming in from
> IPC
> > > have auto_close=true.
> > 
> > Oh. I don't read docs, only code :) Message::ReadFileDescriptor implemented
> > otherwise. I fixed it to match the docs, I like it better that way.
> > 
> > http://codereview.chromium.org/149062/diff/1/2#newcode560
> > Line 560: channel_handle,
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > Should this be using reply_handle?
> > 
> > Yes it should have. But with the modifications, it's channel_handle again.
> > 
> > http://codereview.chromium.org/149062/diff/1/3
> > File chrome/browser/plugin_process_host.h (right):
> > 
> > http://codereview.chromium.org/149062/diff/1/3#newcode100
> > Line 100: void OnChannelCreated(const IPC::ChannelHandle &channel_handle);
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > & on left
> > 
> > Done.
> > 
> > http://codereview.chromium.org/149062/diff/1/5
> > File chrome/plugin/plugin_channel.cc (right):
> > 
> > http://codereview.chromium.org/149062/diff/1/5#newcode36
> > Line 36: #ifdef OS_POSIX
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > if defined
> > 
> > Done.
> > 
> > http://codereview.chromium.org/149062/diff/1/5#newcode50
> > Line 50: #ifdef OS_POSIX
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > if defined
> > 
> > Done.
> > 
> > http://codereview.chromium.org/149062/diff/1/5#newcode52
> > Line 52: if (renderer_fd_) {
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > You use -1 for "unset", so I think you should test for that here.  (0 is
> also
> > a
> > > valid fd...)
> > 
> > Doh! done.
> > 
> > http://codereview.chromium.org/149062/diff/1/5#newcode153
> > Line 153: #ifdef OS_POSIX
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > if defined
> > 
> > Done.
> > 
> > http://codereview.chromium.org/149062/diff/1/5#newcode156
> > Line 156: // name. Keep the renderer side FD in the channel to be able to
> > transmit it
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > "in the channel" is a bit confusing, you mean as a member variable, yeah?
> > 
> > Yeah. Fixed the docs.
> > 
> > http://codereview.chromium.org/149062/diff/1/6
> > File chrome/plugin/plugin_channel.h (right):
> > 
> > http://codereview.chromium.org/149062/diff/1/6#newcode32
> > Line 32: #ifdef OS_POSIX
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > if defined
> > 
> > Done.
> > 
> > http://codereview.chromium.org/149062/diff/1/6#newcode76
> > Line 76: #ifdef OS_POSIX
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > if defined
> > 
> > Done.
> > 
> > http://codereview.chromium.org/149062/diff/1/6#newcode77
> > Line 77: // FD for the renderer side.
> > On 2009/06/26 19:18:31, Evan Martin wrote:
> > > Could you elaborate on this one?  That is the local end of the pipe, or
the
> fd
> > > that will be passed over IPC to the other end?  Is it only for before the
> IPC
> > > goes through, then cleared?  etc.
> > 
> > Added some extra docs.

BTW the try servers came back green in all platforms. For some reason, they
never come up on the CL when I use git :/

Powered by Google App Engine
This is Rietveld 408576698