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

Side by Side Diff: ipc/mojo/ipc_channel_mojo.cc

Issue 621613002: Refactoring: Make IPC::Channel::TakeClientFileDescriptor() a ScopedFD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing Mac build Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ipc/mojo/ipc_channel_mojo.h" 5 #include "ipc/mojo/ipc_channel_mojo.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "ipc/ipc_listener.h" 10 #include "ipc/ipc_listener.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 listener_->OnMessageReceived(message); 206 listener_->OnMessageReceived(message);
207 if (message.dispatch_error()) 207 if (message.dispatch_error())
208 listener_->OnBadMessageReceived(message); 208 listener_->OnBadMessageReceived(message);
209 } 209 }
210 210
211 #if defined(OS_POSIX) && !defined(OS_NACL) 211 #if defined(OS_POSIX) && !defined(OS_NACL)
212 int ChannelMojo::GetClientFileDescriptor() const { 212 int ChannelMojo::GetClientFileDescriptor() const {
213 return bootstrap_->GetClientFileDescriptor(); 213 return bootstrap_->GetClientFileDescriptor();
214 } 214 }
215 215
216 int ChannelMojo::TakeClientFileDescriptor() { 216 base::ScopedFD ChannelMojo::TakeClientFileDescriptor() {
217 return bootstrap_->TakeClientFileDescriptor(); 217 return bootstrap_->TakeClientFileDescriptor();
218 } 218 }
219 219
220 // static 220 // static
221 MojoResult ChannelMojo::WriteToFileDescriptorSet( 221 MojoResult ChannelMojo::WriteToFileDescriptorSet(
222 const std::vector<MojoHandle>& handle_buffer, 222 const std::vector<MojoHandle>& handle_buffer,
223 Message* message) { 223 Message* message) {
224 for (size_t i = 0; i < handle_buffer.size(); ++i) { 224 for (size_t i = 0; i < handle_buffer.size(); ++i) {
225 mojo::embedder::ScopedPlatformHandle platform_handle; 225 mojo::embedder::ScopedPlatformHandle platform_handle;
226 MojoResult unwrap_result = mojo::embedder::PassWrappedPlatformHandle( 226 MojoResult unwrap_result = mojo::embedder::PassWrappedPlatformHandle(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 fdset->CommitAll(); 276 fdset->CommitAll();
277 } 277 }
278 278
279 return MOJO_RESULT_OK; 279 return MOJO_RESULT_OK;
280 } 280 }
281 281
282 #endif // defined(OS_POSIX) && !defined(OS_NACL) 282 #endif // defined(OS_POSIX) && !defined(OS_NACL)
283 283
284 } // namespace IPC 284 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698