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

Side by Side Diff: ipc/ipc_channel_proxy.cc

Issue 6334061: Clean up channel modes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed up agl's comments Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_channel_win.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/ref_counted.h" 6 #include "base/ref_counted.h"
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "ipc/ipc_channel_proxy.h" 9 #include "ipc/ipc_channel_proxy.h"
10 #include "ipc/ipc_logging.h" 10 #include "ipc/ipc_logging.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 301
302 void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle, 302 void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle,
303 Channel::Mode mode, MessageLoop* ipc_thread_loop, 303 Channel::Mode mode, MessageLoop* ipc_thread_loop,
304 bool create_pipe_now) { 304 bool create_pipe_now) {
305 #if defined(OS_POSIX) 305 #if defined(OS_POSIX)
306 // When we are creating a server on POSIX, we need its file descriptor 306 // When we are creating a server on POSIX, we need its file descriptor
307 // to be created immediately so that it can be accessed and passed 307 // to be created immediately so that it can be accessed and passed
308 // to other processes. Forcing it to be created immediately avoids 308 // to other processes. Forcing it to be created immediately avoids
309 // race conditions that may otherwise arise. 309 // race conditions that may otherwise arise.
310 if (mode == Channel::MODE_SERVER || mode == Channel::MODE_NAMED_SERVER) { 310 if (mode & Channel::MODE_SERVER_FLAG) {
311 create_pipe_now = true; 311 create_pipe_now = true;
312 } 312 }
313 #endif // defined(OS_POSIX) 313 #endif // defined(OS_POSIX)
314 314
315 if (create_pipe_now) { 315 if (create_pipe_now) {
316 // Create the channel immediately. This effectively sets up the 316 // Create the channel immediately. This effectively sets up the
317 // low-level pipe so that the client can connect. Without creating 317 // low-level pipe so that the client can connect. Without creating
318 // the pipe immediately, it is possible for a listener to attempt 318 // the pipe immediately, it is possible for a listener to attempt
319 // to connect and get an error since the pipe doesn't exist yet. 319 // to connect and get an error since the pipe doesn't exist yet.
320 context_->CreateChannel(channel_handle, mode); 320 context_->CreateChannel(channel_handle, mode);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 Channel *channel = context_.get()->channel_.get(); 374 Channel *channel = context_.get()->channel_.get();
375 // Channel must have been created first. 375 // Channel must have been created first.
376 DCHECK(channel) << context_.get()->channel_id_; 376 DCHECK(channel) << context_.get()->channel_id_;
377 return channel->GetClientFileDescriptor(); 377 return channel->GetClientFileDescriptor();
378 } 378 }
379 #endif 379 #endif
380 380
381 //----------------------------------------------------------------------------- 381 //-----------------------------------------------------------------------------
382 382
383 } // namespace IPC 383 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_channel_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698