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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 7486007: Fix NamedProxyLauncher on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 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_win.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ipc_channel_win.h" 5 #include "ipc/ipc_channel_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (!waiting_connect_) { 86 if (!waiting_connect_) {
87 if (!output_state_.is_pending) { 87 if (!output_state_.is_pending) {
88 if (!ProcessOutgoingMessages(NULL, 0)) 88 if (!ProcessOutgoingMessages(NULL, 0))
89 return false; 89 return false;
90 } 90 }
91 } 91 }
92 92
93 return true; 93 return true;
94 } 94 }
95 95
96 // static
97 bool Channel::ChannelImpl::IsNamedServerInitialized(
98 const std::string& channel_id) {
99 if (WaitNamedPipe(PipeName(channel_id).c_str(), 1))
100 return true;
101 // If ERROR_SEM_TIMEOUT occurred, the pipe exists but is handling another
102 // connection.
103 return GetLastError() == ERROR_SEM_TIMEOUT;
104 }
105
106 // static
96 const std::wstring Channel::ChannelImpl::PipeName( 107 const std::wstring Channel::ChannelImpl::PipeName(
97 const std::string& channel_id) const { 108 const std::string& channel_id) {
98 std::string name("\\\\.\\pipe\\chrome."); 109 std::string name("\\\\.\\pipe\\chrome.");
99 return ASCIIToWide(name.append(channel_id)); 110 return ASCIIToWide(name.append(channel_id));
100 } 111 }
101 112
102 bool Channel::ChannelImpl::CreatePipe(const IPC::ChannelHandle &channel_handle, 113 bool Channel::ChannelImpl::CreatePipe(const IPC::ChannelHandle &channel_handle,
103 Mode mode) { 114 Mode mode) {
104 DCHECK_EQ(INVALID_HANDLE_VALUE, pipe_); 115 DCHECK_EQ(INVALID_HANDLE_VALUE, pipe_);
105 const std::wstring pipe_name = PipeName(channel_handle.name); 116 const std::wstring pipe_name = PipeName(channel_handle.name);
106 if (mode & MODE_SERVER_FLAG) { 117 if (mode & MODE_SERVER_FLAG) {
107 pipe_ = CreateNamedPipeW(pipe_name.c_str(), 118 pipe_ = CreateNamedPipeW(pipe_name.c_str(),
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 415 }
405 416
406 void Channel::set_listener(Listener* listener) { 417 void Channel::set_listener(Listener* listener) {
407 channel_impl_->set_listener(listener); 418 channel_impl_->set_listener(listener);
408 } 419 }
409 420
410 bool Channel::Send(Message* message) { 421 bool Channel::Send(Message* message) {
411 return channel_impl_->Send(message); 422 return channel_impl_->Send(message);
412 } 423 }
413 424
425 // static
426 bool Channel::IsNamedServerInitialized(const std::string& channel_id) {
427 return ChannelImpl::IsNamedServerInitialized(channel_id);
428 }
429
414 } // namespace IPC 430 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698