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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 601563002: Remove IPC::Channel::TakePipeHandle() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Nacl build error Created 6 years, 2 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
« no previous file with comments | « ipc/ipc_channel_win.h ('k') | ipc/ipc_test_sink.h » ('j') | 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) 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 base::ProcessId ChannelWin::GetPeerPID() const { 139 base::ProcessId ChannelWin::GetPeerPID() const {
140 return peer_pid_; 140 return peer_pid_;
141 } 141 }
142 142
143 base::ProcessId ChannelWin::GetSelfPID() const { 143 base::ProcessId ChannelWin::GetSelfPID() const {
144 return GetCurrentProcessId(); 144 return GetCurrentProcessId();
145 } 145 }
146 146
147 ChannelHandle ChannelWin::TakePipeHandle() {
148 ChannelHandle handle = ChannelHandle(pipe_);
149 pipe_ = INVALID_HANDLE_VALUE;
150 return handle;
151 }
152
153 // static 147 // static
154 bool ChannelWin::IsNamedServerInitialized( 148 bool ChannelWin::IsNamedServerInitialized(
155 const std::string& channel_id) { 149 const std::string& channel_id) {
156 if (WaitNamedPipe(PipeName(channel_id, NULL).c_str(), 1)) 150 if (WaitNamedPipe(PipeName(channel_id, NULL).c_str(), 1))
157 return true; 151 return true;
158 // 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
159 // connection. 153 // connection.
160 return GetLastError() == ERROR_SEM_TIMEOUT; 154 return GetLastError() == ERROR_SEM_TIMEOUT;
161 } 155 }
162 156
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 int secret; 558 int secret;
565 do { // Guarantee we get a non-zero value. 559 do { // Guarantee we get a non-zero value.
566 secret = base::RandInt(0, std::numeric_limits<int>::max()); 560 secret = base::RandInt(0, std::numeric_limits<int>::max());
567 } while (secret == 0); 561 } while (secret == 0);
568 562
569 id.append(GenerateUniqueRandomChannelID()); 563 id.append(GenerateUniqueRandomChannelID());
570 return id.append(base::StringPrintf("\\%d", secret)); 564 return id.append(base::StringPrintf("\\%d", secret));
571 } 565 }
572 566
573 } // namespace IPC 567 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_win.h ('k') | ipc/ipc_test_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698