chrome在windows下的进程间通讯使用的是命名管道, 性能不错, 所以想研究一下.
硬盘上有以前下载的源码, 版本为: chromium.r131329
在目录\home\chrome-svn\tarball\chromium\src\ipc可以找到ipc的相关代码
ipc_channel_win.cc:
一. 创建命名管道
bool Channel::ChannelImpl::CreatePipe(const IPC::ChannelHandle &channel_handle,
Mode mode) {
DCHECK_EQ(INVALID_HANDLE_VALUE, pipe_);
string16 pipe_name;
// If we already have a valid pipe for channel just copy it.
if (channel_handle.pipe.handle) {//管道已经存在
DCHECK(channel_handle.name.empty());
pipe_name = L"Not Available"; // Just used for LOG
// Check that the given pipe confirms to the specified mode. We can
// only check for PIPE_TYPE_MESSAGE & PIPE_SERVER_END flags since the
// other flags (PIPE_TYPE_BYTE, and PIPE_CLIENT_END) are defined as 0.
DWORD flags = 0;
GetNamedPipeInfo(channel_handle.pipe.handle, &flags, NULL, NULL, NULL)