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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 1903663004: IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (scoped_ptr->std::unique_ptr) Created 4 years, 7 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_proxy.cc ('k') | ipc/ipc_endpoint.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 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 pipe_.Close(); 385 pipe_.Close();
386 return false; 386 return false;
387 } 387 }
388 388
389 OutputElement* element = new OutputElement(m.release()); 389 OutputElement* element = new OutputElement(m.release());
390 output_queue_.push(element); 390 output_queue_.push(element);
391 return true; 391 return true;
392 } 392 }
393 393
394 bool ChannelWin::Connect() { 394 bool ChannelWin::Connect() {
395 WillConnect();
396
395 DLOG_IF(WARNING, thread_check_.get()) << "Connect called more than once"; 397 DLOG_IF(WARNING, thread_check_.get()) << "Connect called more than once";
396 398
397 if (!thread_check_.get()) 399 if (!thread_check_.get())
398 thread_check_.reset(new base::ThreadChecker()); 400 thread_check_.reset(new base::ThreadChecker());
399 401
400 if (!pipe_.IsValid()) 402 if (!pipe_.IsValid())
401 return false; 403 return false;
402 404
403 base::MessageLoopForIO::current()->RegisterIOHandler(pipe_.Get(), this); 405 base::MessageLoopForIO::current()->RegisterIOHandler(pipe_.Get(), this);
404 406
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 int secret; 606 int secret;
605 do { // Guarantee we get a non-zero value. 607 do { // Guarantee we get a non-zero value.
606 secret = base::RandInt(0, std::numeric_limits<int>::max()); 608 secret = base::RandInt(0, std::numeric_limits<int>::max());
607 } while (secret == 0); 609 } while (secret == 0);
608 610
609 id.append(GenerateUniqueRandomChannelID()); 611 id.append(GenerateUniqueRandomChannelID());
610 return id.append(base::StringPrintf("\\%d", secret)); 612 return id.append(base::StringPrintf("\\%d", secret));
611 } 613 }
612 614
613 } // namespace IPC 615 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698