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

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: Addressed comments 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::GetPipeHandle() const {
144 return ChannelHandle(pipe_);
145 }
146
139 // static 147 // static
140 bool ChannelWin::IsNamedServerInitialized( 148 bool ChannelWin::IsNamedServerInitialized(
141 const std::string& channel_id) { 149 const std::string& channel_id) {
142 if (WaitNamedPipe(PipeName(channel_id, NULL).c_str(), 1)) 150 if (WaitNamedPipe(PipeName(channel_id, NULL).c_str(), 1))
143 return true; 151 return true;
144 // If ERROR_SEM_TIMEOUT occurred, the pipe exists but is handling another 152 // If ERROR_SEM_TIMEOUT occurred, the pipe exists but is handling another
145 // connection. 153 // connection.
146 return GetLastError() == ERROR_SEM_TIMEOUT; 154 return GetLastError() == ERROR_SEM_TIMEOUT;
147 } 155 }
148 156
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 int secret; 549 int secret;
542 do { // Guarantee we get a non-zero value. 550 do { // Guarantee we get a non-zero value.
543 secret = base::RandInt(0, std::numeric_limits<int>::max()); 551 secret = base::RandInt(0, std::numeric_limits<int>::max());
544 } while (secret == 0); 552 } while (secret == 0);
545 553
546 id.append(GenerateUniqueRandomChannelID()); 554 id.append(GenerateUniqueRandomChannelID());
547 return id.append(base::StringPrintf("\\%d", secret)); 555 return id.append(base::StringPrintf("\\%d", secret));
548 } 556 }
549 557
550 } // namespace IPC 558 } // namespace IPC
OLDNEW
« ipc/ipc_channel_proxy.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