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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 382333002: Introduce ChannelMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed ChanelBuilder to ChannelFactory Created 6 years, 5 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
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 "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/bind.h" 10 #include "base/bind.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 } 130 }
131 131
132 return true; 132 return true;
133 } 133 }
134 134
135 base::ProcessId ChannelWin::GetPeerPID() const { 135 base::ProcessId ChannelWin::GetPeerPID() const {
136 return peer_pid_; 136 return peer_pid_;
137 } 137 }
138 138
139 base::ProcessId ChannelWin::GetSelfPID() const {
140 return GetCurrentProcessId();
141 }
142
143 ChannelHandle ChannelWin::TakePipeHandle() {
144 ChannelHandle handle = ChannelHandle(pipe_);
145 pipe_ = INVALID_HANDLE_VALUE;
146 return handle;
147 }
148
139 // static 149 // static
140 bool ChannelWin::IsNamedServerInitialized( 150 bool ChannelWin::IsNamedServerInitialized(
141 const std::string& channel_id) { 151 const std::string& channel_id) {
142 if (WaitNamedPipe(PipeName(channel_id, NULL).c_str(), 1)) 152 if (WaitNamedPipe(PipeName(channel_id, NULL).c_str(), 1))
143 return true; 153 return true;
144 // If ERROR_SEM_TIMEOUT occurred, the pipe exists but is handling another 154 // If ERROR_SEM_TIMEOUT occurred, the pipe exists but is handling another
145 // connection. 155 // connection.
146 return GetLastError() == ERROR_SEM_TIMEOUT; 156 return GetLastError() == ERROR_SEM_TIMEOUT;
147 } 157 }
148 158
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 int secret; 551 int secret;
542 do { // Guarantee we get a non-zero value. 552 do { // Guarantee we get a non-zero value.
543 secret = base::RandInt(0, std::numeric_limits<int>::max()); 553 secret = base::RandInt(0, std::numeric_limits<int>::max());
544 } while (secret == 0); 554 } while (secret == 0);
545 555
546 id.append(GenerateUniqueRandomChannelID()); 556 id.append(GenerateUniqueRandomChannelID());
547 return id.append(base::StringPrintf("\\%d", secret)); 557 return id.append(base::StringPrintf("\\%d", secret));
548 } 558 }
549 559
550 } // namespace IPC 560 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698