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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 57783006: Revert https://src.chromium.org/viewvc/chrome?view=rev&revision=231330 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile (cc perftest). Created 7 years, 1 month 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_unittest.cc ('k') | ipc/ipc_fuzzing_tests.cc » ('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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 if (pipe_ == INVALID_HANDLE_VALUE) { 262 if (pipe_ == INVALID_HANDLE_VALUE) {
263 // If this process is being closed, the pipe may be gone already. 263 // If this process is being closed, the pipe may be gone already.
264 LOG(WARNING) << "Unable to create pipe \"" << pipe_name << 264 LOG(WARNING) << "Unable to create pipe \"" << pipe_name <<
265 "\" in " << (mode & MODE_SERVER_FLAG ? "server" : "client") 265 "\" in " << (mode & MODE_SERVER_FLAG ? "server" : "client")
266 << " mode. Error :" << GetLastError(); 266 << " mode. Error :" << GetLastError();
267 return false; 267 return false;
268 } 268 }
269 269
270 // Create the Hello message to be sent when Connect is called 270 // Create the Hello message to be sent when Connect is called
271 scoped_ptr<Message> m(new Message(MSG_ROUTING_NONE, 271 scoped_ptr<Message> m(new Message(MSG_ROUTING_NONE,
272 HELLO_MESSAGE_TYPE)); 272 HELLO_MESSAGE_TYPE,
273 IPC::Message::PRIORITY_NORMAL));
273 274
274 // Don't send the secret to the untrusted process, and don't send a secret 275 // Don't send the secret to the untrusted process, and don't send a secret
275 // if the value is zero (for IPC backwards compatability). 276 // if the value is zero (for IPC backwards compatability).
276 int32 secret = validate_client_ ? 0 : client_secret_; 277 int32 secret = validate_client_ ? 0 : client_secret_;
277 if (!m->WriteInt(GetCurrentProcessId()) || 278 if (!m->WriteInt(GetCurrentProcessId()) ||
278 (secret && !m->WriteUInt32(secret))) { 279 (secret && !m->WriteUInt32(secret))) {
279 CloseHandle(pipe_); 280 CloseHandle(pipe_);
280 pipe_ = INVALID_HANDLE_VALUE; 281 pipe_ = INVALID_HANDLE_VALUE;
281 return false; 282 return false;
282 } 283 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 int secret; 509 int secret;
509 do { // Guarantee we get a non-zero value. 510 do { // Guarantee we get a non-zero value.
510 secret = base::RandInt(0, std::numeric_limits<int>::max()); 511 secret = base::RandInt(0, std::numeric_limits<int>::max());
511 } while (secret == 0); 512 } while (secret == 0);
512 513
513 id.append(GenerateUniqueRandomChannelID()); 514 id.append(GenerateUniqueRandomChannelID());
514 return id.append(base::StringPrintf("\\%d", secret)); 515 return id.append(base::StringPrintf("\\%d", secret));
515 } 516 }
516 517
517 } // namespace IPC 518 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_unittest.cc ('k') | ipc/ipc_fuzzing_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698