OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |