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

Unified Diff: remoting/host/desktop_session_agent.cc

Issue 307463004: Remove PlatformFile from remoting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation Created 6 years, 7 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 | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/desktop_session_agent.cc
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index 4f023a6017238ddfc5de3d0fc9e861062890c107..634ca64019c0f926e4eb6f85d9902399c062f831 100644
--- a/remoting/host/desktop_session_agent.cc
+++ b/remoting/host/desktop_session_agent.cc
@@ -120,7 +120,6 @@ DesktopSessionAgent::DesktopSessionAgent(
io_task_runner_(io_task_runner),
video_capture_task_runner_(video_capture_task_runner),
control_factory_(this),
- desktop_pipe_(IPC::InvalidPlatformFileForTransit()),
next_shared_buffer_id_(1),
shared_buffers_(0),
started_(false) {
@@ -164,7 +163,7 @@ void DesktopSessionAgent::OnChannelConnected(int32 peer_pid) {
VLOG(1) << "IPC: desktop <- network (" << peer_pid << ")";
- CloseDesktopPipeHandle();
+ desktop_pipe_.Close();
}
void DesktopSessionAgent::OnChannelError() {
@@ -172,7 +171,7 @@ void DesktopSessionAgent::OnChannelError() {
// Make sure the channel is closed.
network_channel_.reset();
- CloseDesktopPipeHandle();
+ desktop_pipe_.Close();
// Notify the caller that the channel has been disconnected.
if (delegate_.get())
@@ -216,8 +215,6 @@ DesktopSessionAgent::~DesktopSessionAgent() {
DCHECK(!network_channel_);
DCHECK(!screen_controls_);
DCHECK(!video_capturer_);
-
- CloseDesktopPipeHandle();
}
const std::string& DesktopSessionAgent::client_jid() const {
@@ -371,7 +368,14 @@ bool DesktopSessionAgent::Start(const base::WeakPtr<Delegate>& delegate,
this,
&desktop_pipe_,
&network_channel_);
- *desktop_pipe_out = desktop_pipe_;
+ base::PlatformFile raw_desktop_pipe = desktop_pipe_.GetPlatformFile();
+#if defined(OS_WIN)
+ *desktop_pipe_out = IPC::PlatformFileForTransit(raw_desktop_pipe);
+#elif defined(OS_POSIX)
+ *desktop_pipe_out = IPC::PlatformFileForTransit(raw_desktop_pipe, false);
+#else
+#error Unsupported platform.
+#endif
return result;
}
@@ -562,18 +566,4 @@ void DesktopSessionAgent::OnSharedBufferDeleted(int id) {
SendToNetwork(new ChromotingDesktopNetworkMsg_ReleaseSharedBuffer(id));
}
-void DesktopSessionAgent::CloseDesktopPipeHandle() {
- if (!(desktop_pipe_ == IPC::InvalidPlatformFileForTransit())) {
-#if defined(OS_WIN)
- base::ClosePlatformFile(desktop_pipe_);
-#elif defined(OS_POSIX)
- base::ClosePlatformFile(desktop_pipe_.fd);
-#else // !defined(OS_POSIX)
-#error Unsupported platform.
-#endif // !defined(OS_POSIX)
-
- desktop_pipe_ = IPC::InvalidPlatformFileForTransit();
- }
-}
-
} // namespace remoting
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698