Index: ipc/ipc_channel_win.cc |
diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc |
index e56235da3d16fba598bfdc56375b8373e2f66955..3a85a1651fb40b7750dbfa3e7a010c0c21938f8d 100644 |
--- a/ipc/ipc_channel_win.cc |
+++ b/ipc/ipc_channel_win.cc |
@@ -93,8 +93,19 @@ bool Channel::ChannelImpl::Send(Message* message) { |
return true; |
} |
+// static |
+bool Channel::ChannelImpl::IsNamedServerInitialized( |
+ const std::string& channel_id) { |
+ if (WaitNamedPipe(PipeName(channel_id).c_str(), 1)) |
+ return true; |
+ // If ERROR_SEM_TIMEOUT occurred, the pipe exists but is handling another |
+ // connection. |
+ return GetLastError() == ERROR_SEM_TIMEOUT; |
+} |
+ |
+// static |
const std::wstring Channel::ChannelImpl::PipeName( |
- const std::string& channel_id) const { |
+ const std::string& channel_id) { |
std::string name("\\\\.\\pipe\\chrome."); |
return ASCIIToWide(name.append(channel_id)); |
} |
@@ -411,4 +422,9 @@ bool Channel::Send(Message* message) { |
return channel_impl_->Send(message); |
} |
+// static |
+bool Channel::IsNamedServerInitialized(const std::string& channel_id) { |
+ return ChannelImpl::IsNamedServerInitialized(channel_id); |
+} |
+ |
} // namespace IPC |