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

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: Created 6 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
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 } 131 }
132 132
133 return true; 133 return true;
134 } 134 }
135 135
136 base::ProcessId ChannelWin::GetPeerPID() const { 136 base::ProcessId ChannelWin::GetPeerPID() const {
137 return peer_pid_; 137 return peer_pid_;
138 } 138 }
139 139
140 base::ProcessId ChannelWin::GetSelfPID() const {
141 return GetCurrentProcessId();
142 }
143
144 ChannelHandle ChannelWin::TakePipeHandle() {
145 ChannelHandle handle = ChannelHandle(pipe_);
146 pipe_ = INVALID_HANDLE_VALUE;
147 return handle;
148 }
149
140 // static 150 // static
141 bool ChannelWin::IsNamedServerInitialized( 151 bool ChannelWin::IsNamedServerInitialized(
142 const std::string& channel_id) { 152 const std::string& channel_id) {
143 if (WaitNamedPipe(PipeName(channel_id, NULL).c_str(), 1)) 153 if (WaitNamedPipe(PipeName(channel_id, NULL).c_str(), 1))
144 return true; 154 return true;
145 // If ERROR_SEM_TIMEOUT occurred, the pipe exists but is handling another 155 // If ERROR_SEM_TIMEOUT occurred, the pipe exists but is handling another
146 // connection. 156 // connection.
147 return GetLastError() == ERROR_SEM_TIMEOUT; 157 return GetLastError() == ERROR_SEM_TIMEOUT;
148 } 158 }
149 159
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 int secret; 558 int secret;
549 do { // Guarantee we get a non-zero value. 559 do { // Guarantee we get a non-zero value.
550 secret = base::RandInt(0, std::numeric_limits<int>::max()); 560 secret = base::RandInt(0, std::numeric_limits<int>::max());
551 } while (secret == 0); 561 } while (secret == 0);
552 562
553 id.append(GenerateUniqueRandomChannelID()); 563 id.append(GenerateUniqueRandomChannelID());
554 return id.append(base::StringPrintf("\\%d", secret)); 564 return id.append(base::StringPrintf("\\%d", secret));
555 } 565 }
556 566
557 } // namespace IPC 567 } // namespace IPC
OLDNEW
« ipc/ipc_channel.h ('K') | « ipc/ipc_channel_win.h ('k') | ipc/ipc_export.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698