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

Side by Side Diff: chrome/plugin/plugin_channel.cc

Issue 195079: Gears File Drag Drop (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/plugin/plugin_channel.h ('k') | chrome/plugin/plugin_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/plugin/plugin_channel.h" 5 #include "chrome/plugin/plugin_channel.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/process_util.h" 8 #include "base/process_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 15 matching lines...) Expand all
26 26
27 // How long we wait before releasing the plugin process. 27 // How long we wait before releasing the plugin process.
28 static const int kPluginReleaseTimeMS = 10000; 28 static const int kPluginReleaseTimeMS = 10000;
29 29
30 PluginChannel* PluginChannel::GetPluginChannel(int renderer_id, 30 PluginChannel* PluginChannel::GetPluginChannel(int renderer_id,
31 MessageLoop* ipc_message_loop) { 31 MessageLoop* ipc_message_loop) {
32 // Map renderer ID to a (single) channel to that process. 32 // Map renderer ID to a (single) channel to that process.
33 std::string channel_name = StringPrintf( 33 std::string channel_name = StringPrintf(
34 "%d.r%d", base::GetCurrentProcId(), renderer_id); 34 "%d.r%d", base::GetCurrentProcId(), renderer_id);
35 35
36 return static_cast<PluginChannel*>(PluginChannelBase::GetChannel( 36 PluginChannel* channel =
37 channel_name, 37 static_cast<PluginChannel*>(PluginChannelBase::GetChannel(
38 IPC::Channel::MODE_SERVER, 38 channel_name,
39 ClassFactory, 39 IPC::Channel::MODE_SERVER,
40 ipc_message_loop, 40 ClassFactory,
41 false)); 41 ipc_message_loop,
42 false));
43
44 if (channel)
45 channel->renderer_id_ = renderer_id;
46
47 return channel;
42 } 48 }
43 49
44 PluginChannel::PluginChannel() 50 PluginChannel::PluginChannel()
45 : renderer_handle_(0), 51 : renderer_handle_(0),
52 renderer_id_(-1),
46 #if defined(OS_POSIX) 53 #if defined(OS_POSIX)
47 renderer_fd_(-1), 54 renderer_fd_(-1),
48 #endif 55 #endif
49 in_send_(0), 56 in_send_(0),
50 off_the_record_(false) { 57 off_the_record_(false) {
51 SendUnblockingOnlyDuringDispatch(); 58 SendUnblockingOnlyDuringDispatch();
52 ChildProcess::current()->AddRefProcess(); 59 ChildProcess::current()->AddRefProcess();
53 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 60 const CommandLine* command_line = CommandLine::ForCurrentProcess();
54 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); 61 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);
55 } 62 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // This gets called when the PluginChannel is initially created. At this 172 // This gets called when the PluginChannel is initially created. At this
166 // point, create the socketpair and assign the plugin side FD to the channel 173 // point, create the socketpair and assign the plugin side FD to the channel
167 // name. Keep the renderer side FD as a member variable in the PluginChannel 174 // name. Keep the renderer side FD as a member variable in the PluginChannel
168 // to be able to transmit it through IPC. 175 // to be able to transmit it through IPC.
169 int plugin_fd; 176 int plugin_fd;
170 IPC::SocketPair(&plugin_fd, &renderer_fd_); 177 IPC::SocketPair(&plugin_fd, &renderer_fd_);
171 IPC::AddChannelSocket(channel_name(), plugin_fd); 178 IPC::AddChannelSocket(channel_name(), plugin_fd);
172 #endif 179 #endif
173 return PluginChannelBase::Init(ipc_message_loop, create_pipe_now); 180 return PluginChannelBase::Init(ipc_message_loop, create_pipe_now);
174 } 181 }
OLDNEW
« no previous file with comments | « chrome/plugin/plugin_channel.h ('k') | chrome/plugin/plugin_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698