diff options
author | morrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-02 19:41:12 +0000 |
---|---|---|
committer | morrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-02 19:41:12 +0000 |
commit | cf178fb755d0fda06fd770c1a94eb8696063c001 (patch) | |
tree | 6e78f195f4731ec0231c538fc8377a3a41e8482b /remoting | |
parent | 7d1c92a65a91100f4cae59626107b7b74aba536b (diff) | |
download | chromium_src-cf178fb755d0fda06fd770c1a94eb8696063c001.zip chromium_src-cf178fb755d0fda06fd770c1a94eb8696063c001.tar.gz chromium_src-cf178fb755d0fda06fd770c1a94eb8696063c001.tar.bz2 |
Introduce IPC::ChannelProxy::Create*() and IPC::SynChannel::Create*()
This change hides constructors of these classes so that we can turn
them polymorphic classes.
Note that having almost identical ChannelProxy::Init*() isn't great
and they will be replaced by a factory-like abstraction in coming
changes.
TEST=none
R=darin,cpu
BUG=377980
Review URL: https://codereview.chromium.org/301973003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274310 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/desktop_process.cc | 8 | ||||
-rw-r--r-- | remoting/host/desktop_process_unittest.cc | 16 | ||||
-rw-r--r-- | remoting/host/desktop_session_proxy.cc | 8 | ||||
-rw-r--r-- | remoting/host/ipc_desktop_environment_unittest.cc | 9 | ||||
-rw-r--r-- | remoting/host/ipc_util_posix.cc | 8 | ||||
-rw-r--r-- | remoting/host/ipc_util_win.cc | 5 | ||||
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 14 | ||||
-rw-r--r-- | remoting/host/win/worker_process_launcher_unittest.cc | 10 |
8 files changed, 36 insertions, 42 deletions
diff --git a/remoting/host/desktop_process.cc b/remoting/host/desktop_process.cc index 4592bfd..53bb336 100644 --- a/remoting/host/desktop_process.cc +++ b/remoting/host/desktop_process.cc @@ -139,10 +139,10 @@ bool DesktopProcess::Start( } // Connect to the daemon. - daemon_channel_.reset(new IPC::ChannelProxy(daemon_channel_name_, - IPC::Channel::MODE_CLIENT, - this, - io_task_runner.get())); + daemon_channel_ = IPC::ChannelProxy::CreateClient( + daemon_channel_name_, + this, + io_task_runner.get()); // Pass |desktop_pipe| to the daemon. daemon_channel_->Send( diff --git a/remoting/host/desktop_process_unittest.cc b/remoting/host/desktop_process_unittest.cc index d83d803..6b08c9f 100644 --- a/remoting/host/desktop_process_unittest.cc +++ b/remoting/host/desktop_process_unittest.cc @@ -175,10 +175,10 @@ void DesktopProcessTest::ConnectNetworkChannel( IPC::ChannelHandle channel_handle(desktop_process); #endif // defined(OS_WIN) - network_channel_.reset(new IPC::ChannelProxy(channel_handle, - IPC::Channel::MODE_CLIENT, - &network_listener_, - io_task_runner_.get())); + network_channel_ = IPC::ChannelProxy::CreateClient( + channel_handle, + &network_listener_, + io_task_runner_.get()); } void DesktopProcessTest::OnDesktopAttached( @@ -246,10 +246,10 @@ void DesktopProcessTest::RunDesktopProcess() { "IPC thread", ui_task_runner, base::MessageLoop::TYPE_IO); std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); - daemon_channel_.reset(new IPC::ChannelProxy(IPC::ChannelHandle(channel_name), - IPC::Channel::MODE_SERVER, - &daemon_listener_, - io_task_runner_.get())); + daemon_channel_ = IPC::ChannelProxy::CreateServer( + IPC::ChannelHandle(channel_name), + &daemon_listener_, + io_task_runner_.get()); scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory( new MockDesktopEnvironmentFactory()); diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc index 73497f9..f34dd04 100644 --- a/remoting/host/desktop_session_proxy.cc +++ b/remoting/host/desktop_session_proxy.cc @@ -254,10 +254,10 @@ bool DesktopSessionProxy::AttachToDesktop( #endif // Connect to the desktop process. - desktop_channel_.reset(new IPC::ChannelProxy(desktop_channel_handle, - IPC::Channel::MODE_CLIENT, - this, - io_task_runner_.get())); + desktop_channel_ = IPC::ChannelProxy::CreateClient( + desktop_channel_handle, + this, + io_task_runner_.get()); // Pass ID of the client (which is authenticated at this point) to the desktop // session agent and start the agent. diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc index 7e31688..32ce885 100644 --- a/remoting/host/ipc_desktop_environment_unittest.cc +++ b/remoting/host/ipc_desktop_environment_unittest.cc @@ -367,11 +367,10 @@ void IpcDesktopEnvironmentTest::CreateDesktopProcess() { // Create the daemon end of the daemon-to-desktop channel. desktop_channel_name_ = IPC::Channel::GenerateUniqueRandomChannelID(); - desktop_channel_.reset( - new IPC::ChannelProxy(IPC::ChannelHandle(desktop_channel_name_), - IPC::Channel::MODE_SERVER, - &desktop_listener_, - io_task_runner_.get())); + desktop_channel_ = IPC::ChannelProxy::CreateServer( + IPC::ChannelHandle(desktop_channel_name_), + &desktop_listener_, + io_task_runner_.get()); // Create and start the desktop process. desktop_process_.reset(new DesktopProcess(task_runner_, diff --git a/remoting/host/ipc_util_posix.cc b/remoting/host/ipc_util_posix.cc index d7c6a5d..0b423cd 100644 --- a/remoting/host/ipc_util_posix.cc +++ b/remoting/host/ipc_util_posix.cc @@ -45,10 +45,10 @@ bool CreateConnectedIpcChannel( // Wrap the pipe into an IPC channel. base::FileDescriptor fd(pipe_fds[0], false); IPC::ChannelHandle handle(socket_name, fd); - server_out->reset(new IPC::ChannelProxy(IPC::ChannelHandle(socket_name, fd), - IPC::Channel::MODE_SERVER, - listener, - io_task_runner.get())); + *server_out = IPC::ChannelProxy::CreateServer( + IPC::ChannelHandle(socket_name, fd), + listener, + io_task_runner.get()); *client_out = base::FileDescriptor(pipe_fds[1], false); return true; diff --git a/remoting/host/ipc_util_win.cc b/remoting/host/ipc_util_win.cc index 37c3383..452c7bd 100644 --- a/remoting/host/ipc_util_win.cc +++ b/remoting/host/ipc_util_win.cc @@ -51,11 +51,10 @@ bool CreateConnectedIpcChannel( } // Wrap the pipe into an IPC channel. - scoped_ptr<IPC::ChannelProxy> server(new IPC::ChannelProxy( + scoped_ptr<IPC::ChannelProxy> server = IPC::ChannelProxy::CreateServer( IPC::ChannelHandle(pipe), - IPC::Channel::MODE_SERVER, listener, - io_task_runner)); + io_task_runner); // Convert the channel name to the pipe name. std::string pipe_name(kChromePipeNamePrefix); diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 22f5da0..5eefaad 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -384,21 +384,19 @@ bool HostProcess::InitWithCommandLine(const base::CommandLine* cmd_line) { #endif // defined(OS_POSIX) // Connect to the daemon process. - daemon_channel_.reset(new IPC::ChannelProxy( + daemon_channel_ = IPC::ChannelProxy::CreateClient( channel_handle, - IPC::Channel::MODE_CLIENT, this, - context_->network_task_runner())); + context_->network_task_runner()); #else // !defined(REMOTING_MULTI_PROCESS) // Connect to the daemon process. std::string channel_name = cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); if (!channel_name.empty()) { - daemon_channel_.reset( - new IPC::ChannelProxy(channel_name, - IPC::Channel::MODE_CLIENT, - this, - context_->network_task_runner().get())); + daemon_channel_= IPC::ChannelProxy::CreateClient( + channel_name, + this, + context_->network_task_runner().get()); } if (cmd_line->HasSwitch(kHostConfigSwitchName)) { diff --git a/remoting/host/win/worker_process_launcher_unittest.cc b/remoting/host/win/worker_process_launcher_unittest.cc index 5503ab9..fc3ef60 100644 --- a/remoting/host/win/worker_process_launcher_unittest.cc +++ b/remoting/host/win/worker_process_launcher_unittest.cc @@ -273,11 +273,10 @@ void WorkerProcessLauncherTest::TerminateWorker(DWORD exit_code) { } void WorkerProcessLauncherTest::ConnectClient() { - channel_client_.reset(new IPC::ChannelProxy( + channel_client_ = IPC::ChannelProxy::CreateClient( IPC::ChannelHandle(channel_name_), - IPC::Channel::MODE_CLIENT, &client_listener_, - task_runner_)); + task_runner_); // Pretend that |kLaunchSuccessTimeoutSeconds| passed since launching // the worker process. This will make the backoff algorithm think that this @@ -361,11 +360,10 @@ void WorkerProcessLauncherTest::DoLaunchProcess() { ASSERT_TRUE(CreateIpcChannel(channel_name_, kIpcSecurityDescriptor, &pipe)); // Wrap the pipe into an IPC channel. - channel_server_.reset(new IPC::ChannelProxy( + channel_server_ = IPC::ChannelProxy::CreateServer( IPC::ChannelHandle(pipe), - IPC::Channel::MODE_SERVER, this, - task_runner_)); + task_runner_); HANDLE temp_handle; ASSERT_TRUE(DuplicateHandle(GetCurrentProcess(), |