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

Unified Diff: chrome/plugin/plugin_thread.cc

Issue 149062: mac/linux: rework plugin channel file descriptor creation (Closed)
Patch Set: address review comments Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/plugin/plugin_thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/plugin/plugin_thread.cc
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc
index 2f9c2ec3a916f9e648eb6775efb814659c5fbf28..2701f5b543bf7ceddda9d823cadd3342f9684a4a 100644
--- a/chrome/plugin/plugin_thread.cc
+++ b/chrome/plugin/plugin_thread.cc
@@ -103,24 +103,23 @@ void PluginThread::CleanUp() {
}
void PluginThread::OnCreateChannel(
-#if defined(OS_POSIX)
- base::FileDescriptor socket,
-#endif
int process_id,
bool off_the_record) {
- int fd = -1;
-#if defined(OS_POSIX)
- fd = socket.fd;
-#endif
- std::string channel_name;
scoped_refptr<PluginChannel> channel =
- PluginChannel::GetPluginChannel(process_id, owner_loop(), fd);
+ PluginChannel::GetPluginChannel(process_id, owner_loop());
+ IPC::ChannelHandle channel_handle;
if (channel.get()) {
- channel_name = channel->channel_name();
+ channel_handle.name = channel->channel_name();
+#if defined(OS_POSIX)
+ // On POSIX, pass the renderer-side FD. Also mark it as auto-close so that
+ // it gets closed after it has been sent.
+ int renderer_fd = channel->DisownRendererFd();
+ channel_handle.socket = base::FileDescriptor(renderer_fd, true);
+#endif
channel->set_off_the_record(off_the_record);
}
- Send(new PluginProcessHostMsg_ChannelCreated(channel_name));
+ Send(new PluginProcessHostMsg_ChannelCreated(channel_handle));
}
void PluginThread::OnPluginMessage(const std::vector<unsigned char> &data) {
« no previous file with comments | « chrome/plugin/plugin_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698