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

Side by Side Diff: remoting/host/desktop_session_agent.cc

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: include <utility> Created 5 years 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
« no previous file with comments | « remoting/host/desktop_process_unittest.cc ('k') | remoting/host/desktop_session_proxy.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/host/desktop_session_agent.h" 5 #include "remoting/host/desktop_session_agent.h"
6 6
7 #include <utility>
8
7 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
11 #include "build/build_config.h" 13 #include "build/build_config.h"
12 #include "ipc/ipc_channel_proxy.h" 14 #include "ipc/ipc_channel_proxy.h"
13 #include "ipc/ipc_message.h" 15 #include "ipc/ipc_message.h"
14 #include "ipc/ipc_message_macros.h" 16 #include "ipc/ipc_message_macros.h"
15 #include "remoting/base/auto_thread_task_runner.h" 17 #include "remoting/base/auto_thread_task_runner.h"
16 #include "remoting/base/constants.h" 18 #include "remoting/base/constants.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 #if defined(OS_MACOSX) && !defined(OS_IOS) 81 #if defined(OS_MACOSX) && !defined(OS_IOS)
80 // Remoting does not yet support Mach primitive backed SharedMemory, so 82 // Remoting does not yet support Mach primitive backed SharedMemory, so
81 // force the underlying primitive to be a POSIX fd. 83 // force the underlying primitive to be a POSIX fd.
82 // https://crbug.com/547247. 84 // https://crbug.com/547247.
83 if (!memory->CreateAndMapAnonymousPosix(size)) 85 if (!memory->CreateAndMapAnonymousPosix(size))
84 return nullptr; 86 return nullptr;
85 #else 87 #else
86 if (!memory->CreateAndMapAnonymous(size)) 88 if (!memory->CreateAndMapAnonymous(size))
87 return nullptr; 89 return nullptr;
88 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 90 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
89 return make_scoped_ptr(new SharedBuffer(agent, memory.Pass(), size, id)); 91 return make_scoped_ptr(
92 new SharedBuffer(agent, std::move(memory), size, id));
90 } 93 }
91 94
92 ~SharedBuffer() override { agent_->OnSharedBufferDeleted(id()); } 95 ~SharedBuffer() override { agent_->OnSharedBufferDeleted(id()); }
93 96
94 base::SharedMemory* shared_memory() { return shared_memory_.get(); } 97 base::SharedMemory* shared_memory() { return shared_memory_.get(); }
95 98
96 private: 99 private:
97 SharedBuffer(DesktopSessionAgent* agent, 100 SharedBuffer(DesktopSessionAgent* agent,
98 scoped_ptr<base::SharedMemory> memory, 101 scoped_ptr<base::SharedMemory> memory,
99 size_t size, 102 size_t size,
100 int id) 103 int id)
101 : SharedMemory(memory->memory(), size, 0, id), 104 : SharedMemory(memory->memory(), size, 0, id),
102 agent_(agent), 105 agent_(agent),
103 shared_memory_(memory.Pass()) {} 106 shared_memory_(std::move(memory)) {}
104 107
105 DesktopSessionAgent* agent_; 108 DesktopSessionAgent* agent_;
106 scoped_ptr<base::SharedMemory> shared_memory_; 109 scoped_ptr<base::SharedMemory> shared_memory_;
107 110
108 DISALLOW_COPY_AND_ASSIGN(SharedBuffer); 111 DISALLOW_COPY_AND_ASSIGN(SharedBuffer);
109 }; 112 };
110 113
111 DesktopSessionAgent::Delegate::~Delegate() { 114 DesktopSessionAgent::Delegate::~Delegate() {
112 } 115 }
113 116
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 292
290 #if defined(OS_WIN) 293 #if defined(OS_WIN)
291 // LocalInputMonitorWin filters out an echo of the injected input before it 294 // LocalInputMonitorWin filters out an echo of the injected input before it
292 // reaches |remote_input_filter_|. 295 // reaches |remote_input_filter_|.
293 remote_input_filter_->SetExpectLocalEcho(false); 296 remote_input_filter_->SetExpectLocalEcho(false);
294 #endif // defined(OS_WIN) 297 #endif // defined(OS_WIN)
295 298
296 // Start the input injector. 299 // Start the input injector.
297 scoped_ptr<protocol::ClipboardStub> clipboard_stub( 300 scoped_ptr<protocol::ClipboardStub> clipboard_stub(
298 new DesktopSesssionClipboardStub(this)); 301 new DesktopSesssionClipboardStub(this));
299 input_injector_->Start(clipboard_stub.Pass()); 302 input_injector_->Start(std::move(clipboard_stub));
300 303
301 // Start the audio capturer. 304 // Start the audio capturer.
302 if (delegate_->desktop_environment_factory().SupportsAudioCapture()) { 305 if (delegate_->desktop_environment_factory().SupportsAudioCapture()) {
303 audio_capturer_ = desktop_environment_->CreateAudioCapturer(); 306 audio_capturer_ = desktop_environment_->CreateAudioCapturer();
304 audio_capture_task_runner_->PostTask( 307 audio_capture_task_runner_->PostTask(
305 FROM_HERE, base::Bind(&DesktopSessionAgent::StartAudioCapturer, this)); 308 FROM_HERE, base::Bind(&DesktopSessionAgent::StartAudioCapturer, this));
306 } 309 }
307 310
308 // Start the video capturer and mouse cursor monitor. 311 // Start the video capturer and mouse cursor monitor.
309 video_capturer_ = desktop_environment_->CreateVideoCapturer(); 312 video_capturer_ = desktop_environment_->CreateVideoCapturer();
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 void DesktopSessionAgent::OnSharedBufferDeleted(int id) { 605 void DesktopSessionAgent::OnSharedBufferDeleted(int id) {
603 DCHECK(video_capture_task_runner_->BelongsToCurrentThread()); 606 DCHECK(video_capture_task_runner_->BelongsToCurrentThread());
604 DCHECK(id != 0); 607 DCHECK(id != 0);
605 608
606 shared_buffers_--; 609 shared_buffers_--;
607 DCHECK_GE(shared_buffers_, 0); 610 DCHECK_GE(shared_buffers_, 0);
608 SendToNetwork(new ChromotingDesktopNetworkMsg_ReleaseSharedBuffer(id)); 611 SendToNetwork(new ChromotingDesktopNetworkMsg_ReleaseSharedBuffer(id));
609 } 612 }
610 613
611 } // namespace remoting 614 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_process_unittest.cc ('k') | remoting/host/desktop_session_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698