| 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 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 if (input_state_.is_pending || output_state_.is_pending) | 62 if (input_state_.is_pending || output_state_.is_pending) |
| 63 CancelIo(pipe_.Get()); | 63 CancelIo(pipe_.Get()); |
| 64 | 64 |
| 65 // Closing the handle at this point prevents us from issuing more requests | 65 // Closing the handle at this point prevents us from issuing more requests |
| 66 // form OnIOCompleted(). | 66 // form OnIOCompleted(). |
| 67 if (pipe_.IsValid()) | 67 if (pipe_.IsValid()) |
| 68 pipe_.Close(); | 68 pipe_.Close(); |
| 69 | 69 |
| 70 // Make sure all IO has completed. | 70 // Make sure all IO has completed. |
| 71 base::Time start = base::Time::Now(); | |
| 72 while (input_state_.is_pending || output_state_.is_pending) { | 71 while (input_state_.is_pending || output_state_.is_pending) { |
| 73 base::MessageLoopForIO::current()->WaitForIOCompletion(INFINITE, this); | 72 base::MessageLoopForIO::current()->WaitForIOCompletion(INFINITE, this); |
| 74 } | 73 } |
| 75 | 74 |
| 76 while (!output_queue_.empty()) { | 75 while (!output_queue_.empty()) { |
| 77 Message* m = output_queue_.front(); | 76 Message* m = output_queue_.front(); |
| 78 output_queue_.pop(); | 77 output_queue_.pop(); |
| 79 delete m; | 78 delete m; |
| 80 } | 79 } |
| 81 } | 80 } |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 int secret; | 509 int secret; |
| 511 do { // Guarantee we get a non-zero value. | 510 do { // Guarantee we get a non-zero value. |
| 512 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 511 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
| 513 } while (secret == 0); | 512 } while (secret == 0); |
| 514 | 513 |
| 515 id.append(GenerateUniqueRandomChannelID()); | 514 id.append(GenerateUniqueRandomChannelID()); |
| 516 return id.append(base::StringPrintf("\\%d", secret)); | 515 return id.append(base::StringPrintf("\\%d", secret)); |
| 517 } | 516 } |
| 518 | 517 |
| 519 } // namespace IPC | 518 } // namespace IPC |
| OLD | NEW |