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

Side by Side Diff: ipc/ipc_send_fds_test.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 (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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #if defined(OS_MACOSX) 8 #if defined(OS_MACOSX)
9 extern "C" { 9 extern "C" {
10 #include <sandbox.h> 10 #include <sandbox.h>
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 int fds_to_send) : 227 int fds_to_send) :
228 in_thread_(in_thread), 228 in_thread_(in_thread),
229 out_thread_(out_thread), 229 out_thread_(out_thread),
230 cb_listener_(cb, fds_to_send), 230 cb_listener_(cb, fds_to_send),
231 null_listener_(base::Bind(&null_cb), 0) { 231 null_listener_(base::Bind(&null_cb), 0) {
232 } 232 }
233 233
234 void Init() { 234 void Init() {
235 IPC::ChannelHandle in_handle("IN"); 235 IPC::ChannelHandle in_handle("IN");
236 in = IPC::Channel::CreateServer(in_handle, &null_listener_); 236 in = IPC::Channel::CreateServer(in_handle, &null_listener_);
237 base::FileDescriptor out_fd( 237 IPC::ChannelHandle out_handle(
238 in->TakeClientFileDescriptor(), false); 238 "OUT", base::FileDescriptor(in->TakeClientFileDescriptor()));
239 IPC::ChannelHandle out_handle("OUT", out_fd);
240 out = IPC::Channel::CreateClient(out_handle, &cb_listener_); 239 out = IPC::Channel::CreateClient(out_handle, &cb_listener_);
241 // PostTask the connect calls to make sure the callbacks happens 240 // PostTask the connect calls to make sure the callbacks happens
242 // on the right threads. 241 // on the right threads.
243 in_thread_->message_loop()->PostTask( 242 in_thread_->message_loop()->PostTask(
244 FROM_HERE, 243 FROM_HERE,
245 base::Bind(&PipeChannelHelper::Connect, in.get())); 244 base::Bind(&PipeChannelHelper::Connect, in.get()));
246 out_thread_->message_loop()->PostTask( 245 out_thread_->message_loop()->PostTask(
247 FROM_HERE, 246 FROM_HERE,
248 base::Bind(&PipeChannelHelper::Connect, out.get())); 247 base::Bind(&PipeChannelHelper::Connect, out.get()));
249 } 248 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 base::WaitableEvent received_; 367 base::WaitableEvent received_;
369 }; 368 };
370 369
371 TEST_F(IPCMultiSendingFdsTest, StressTest) { 370 TEST_F(IPCMultiSendingFdsTest, StressTest) {
372 Run(); 371 Run();
373 } 372 }
374 373
375 } // namespace 374 } // namespace
376 375
377 #endif // defined(OS_POSIX) 376 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_test_sink.h » ('j') | ppapi/proxy/proxy_channel.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698