| Index: remoting/host/desktop_session_agent.cc
|
| diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
|
| index bb5024d9be9d1bb8172307e9f338d7288ea36279..53dacedbeb4ec7c06d594c11b1dfe5c1a1592004 100644
|
| --- a/remoting/host/desktop_session_agent.cc
|
| +++ b/remoting/host/desktop_session_agent.cc
|
| @@ -60,6 +60,9 @@ void DesktopSesssionClipboardStub::InjectClipboardEvent(
|
|
|
| } // namespace
|
|
|
| +DesktopSessionAgent::Delegate::~Delegate() {
|
| +}
|
| +
|
| DesktopSessionAgent::~DesktopSessionAgent() {
|
| DCHECK(!network_channel_);
|
| DCHECK(!video_capturer_);
|
| @@ -100,7 +103,8 @@ void DesktopSessionAgent::OnChannelError() {
|
| network_channel_.reset();
|
|
|
| // Notify the caller that the channel has been disconnected.
|
| - disconnected_task_.Run();
|
| + if (delegate_.get())
|
| + delegate_->OnNetworkProcessDisconnected();
|
| }
|
|
|
| scoped_refptr<SharedBuffer> DesktopSessionAgent::CreateSharedBuffer(
|
| @@ -188,19 +192,19 @@ void DesktopSessionAgent::InjectClipboardEvent(
|
| new ChromotingDesktopNetworkMsg_InjectClipboardEvent(serialized_event));
|
| }
|
|
|
| -bool DesktopSessionAgent::Start(const base::Closure& disconnected_task,
|
| +bool DesktopSessionAgent::Start(const base::WeakPtr<Delegate>& delegate,
|
| IPC::PlatformFileForTransit* desktop_pipe_out) {
|
| DCHECK(caller_task_runner()->BelongsToCurrentThread());
|
| + DCHECK(delegate_.get() == NULL);
|
|
|
| - disconnected_task_ = disconnected_task;
|
| + delegate_ = delegate;
|
|
|
| // Create an IPC channel to communicate with the network process.
|
| if (!CreateChannelForNetworkProcess(desktop_pipe_out, &network_channel_))
|
| return false;
|
|
|
| // Create and start the event executor.
|
| - event_executor_ = EventExecutor::Create(input_task_runner(),
|
| - caller_task_runner());
|
| + event_executor_ = CreateEventExecutor();
|
| scoped_ptr<protocol::ClipboardStub> clipboard_stub(
|
| new DesktopSesssionClipboardStub(this));
|
| event_executor_->Start(clipboard_stub.Pass());
|
| @@ -214,6 +218,8 @@ bool DesktopSessionAgent::Start(const base::Closure& disconnected_task,
|
| void DesktopSessionAgent::Stop() {
|
| DCHECK(caller_task_runner()->BelongsToCurrentThread());
|
|
|
| + delegate_.reset();
|
| +
|
| // Make sure the channel is closed.
|
| network_channel_.reset();
|
|
|
|
|