diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-10 20:12:37 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-10 20:12:37 +0000 |
commit | a3a459d2cd09640092e23d4ba05aa69676ee376d (patch) | |
tree | 49cfecc080464742705169d3fe4b3a855e7bde25 /ppapi | |
parent | 93d4026613e067afac17c81b12ec6c39a5836ce2 (diff) | |
download | chromium_src-a3a459d2cd09640092e23d4ba05aa69676ee376d.zip chromium_src-a3a459d2cd09640092e23d4ba05aa69676ee376d.tar.gz chromium_src-a3a459d2cd09640092e23d4ba05aa69676ee376d.tar.bz2 |
Fix 82176 by transferring ownership of render (client) file descriptor instead of duplicating it.
The Issue:
After broker creates the render-broker channel, the original code will dup() the client file descriptor (fd) and send the duplicate to the render. As a result, there are two copies of the same client fd. One is in the broker process; the other one is sent over the IPC channel and will be owned by the browser and finally by the render. Normally, when connection establishes correctly, the render will send a HelloMessage to the broker, so that the broker is notified and has a chance to call IPC::Channel::ChannelImpl::ProcessIncomingMessages(), which will call CloseClientFileDescriptor() and close its copy of the client fd in the broker. After this, there will be only one copy of the client fd in the render. Whenever the render closes this fd, the broker will get notified with an event.
However, if before the connection establishes, something goes wrong (e.g. the render crashed), closing the cliend fd in the browser or render will not work. The broker will keep its server fd and never get notified. The reason is as follows. Since the connection is not established, the HelloMessage never comes. So the broker will never call CloseClientFileDescriptor() to close its copy of the client fd. When there are two copies of the client fd open, closing one of them (e.g. the one owned by the render or browser) won't generate an event in the broker. The broker will keep waiting and never get notified.
The Fix:
Do not duplicate the client fd. Thus whenever/whereever the client fd is closed, the broker will get notified with an event.
BUG=82176
TEST=Tested with ui broker test and normal usage. Also crashed render before connection established and verified that the broker released the render-broker IPC channel.
Review URL: http://codereview.chromium.org/8497026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/proxy_channel.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/proxy_channel.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/ppapi/proxy/proxy_channel.cc b/ppapi/proxy/proxy_channel.cc index 3bf6c20..fd5937f 100644 --- a/ppapi/proxy/proxy_channel.cc +++ b/ppapi/proxy/proxy_channel.cc @@ -42,9 +42,9 @@ void ProxyChannel::OnChannelError() { } #if defined(OS_POSIX) -int ProxyChannel::GetRendererFD() { +int ProxyChannel::TakeRendererFD() { DCHECK(channel()); - return channel()->GetClientFileDescriptor(); + return channel()->TakeClientFileDescriptor(); } #endif diff --git a/ppapi/proxy/proxy_channel.h b/ppapi/proxy/proxy_channel.h index 89d81ae..75b9ad3 100644 --- a/ppapi/proxy/proxy_channel.h +++ b/ppapi/proxy/proxy_channel.h @@ -73,7 +73,7 @@ class PPAPI_PROXY_EXPORT ProxyChannel } #if defined(OS_POSIX) - int GetRendererFD(); + int TakeRendererFD(); #endif protected: |