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

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: runtime error Created 4 years, 8 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
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 OnConnect();
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 int secret; 605 int secret;
604 do { // Guarantee we get a non-zero value. 606 do { // Guarantee we get a non-zero value.
605 secret = base::RandInt(0, std::numeric_limits<int>::max()); 607 secret = base::RandInt(0, std::numeric_limits<int>::max());
606 } while (secret == 0); 608 } while (secret == 0);
607 609
608 id.append(GenerateUniqueRandomChannelID()); 610 id.append(GenerateUniqueRandomChannelID());
609 return id.append(base::StringPrintf("\\%d", secret)); 611 return id.append(base::StringPrintf("\\%d", secret));
610 } 612 }
611 613
612 } // namespace IPC 614 } // namespace IPC
OLDNEW
« ipc/ipc_channel.h ('K') | « 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