| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 waiting_connect_(mode & MODE_SERVER_FLAG), | 47 waiting_connect_(mode & MODE_SERVER_FLAG), |
| 48 processing_incoming_(false), | 48 processing_incoming_(false), |
| 49 validate_client_(false), | 49 validate_client_(false), |
| 50 client_secret_(0), | 50 client_secret_(0), |
| 51 broker_(broker), | 51 broker_(broker), |
| 52 weak_factory_(this) { | 52 weak_factory_(this) { |
| 53 CreatePipe(channel_handle, mode); | 53 CreatePipe(channel_handle, mode); |
| 54 } | 54 } |
| 55 | 55 |
| 56 ChannelWin::~ChannelWin() { | 56 ChannelWin::~ChannelWin() { |
| 57 CleanUp(); |
| 57 Close(); | 58 Close(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void ChannelWin::Close() { | 61 void ChannelWin::Close() { |
| 61 if (thread_check_.get()) | 62 if (thread_check_.get()) |
| 62 DCHECK(thread_check_->CalledOnValidThread()); | 63 DCHECK(thread_check_->CalledOnValidThread()); |
| 63 | 64 |
| 64 if (input_state_.is_pending || output_state_.is_pending) | 65 if (input_state_.is_pending || output_state_.is_pending) |
| 65 CancelIo(pipe_.Get()); | 66 CancelIo(pipe_.Get()); |
| 66 | 67 |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 int secret; | 577 int secret; |
| 577 do { // Guarantee we get a non-zero value. | 578 do { // Guarantee we get a non-zero value. |
| 578 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 579 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
| 579 } while (secret == 0); | 580 } while (secret == 0); |
| 580 | 581 |
| 581 id.append(GenerateUniqueRandomChannelID()); | 582 id.append(GenerateUniqueRandomChannelID()); |
| 582 return id.append(base::StringPrintf("\\%d", secret)); | 583 return id.append(base::StringPrintf("\\%d", secret)); |
| 583 } | 584 } |
| 584 | 585 |
| 585 } // namespace IPC | 586 } // namespace IPC |
| OLD | NEW |