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 28 matching lines...) Expand all Loading... |
39 Listener* listener, | 39 Listener* listener, |
40 AttachmentBroker* broker) | 40 AttachmentBroker* broker) |
41 : ChannelReader(listener), | 41 : ChannelReader(listener), |
42 input_state_(this), | 42 input_state_(this), |
43 output_state_(this), | 43 output_state_(this), |
44 peer_pid_(base::kNullProcessId), | 44 peer_pid_(base::kNullProcessId), |
45 waiting_connect_(mode & MODE_SERVER_FLAG), | 45 waiting_connect_(mode & MODE_SERVER_FLAG), |
46 processing_incoming_(false), | 46 processing_incoming_(false), |
47 validate_client_(false), | 47 validate_client_(false), |
48 client_secret_(0), | 48 client_secret_(0), |
49 weak_factory_(this), | 49 broker_(broker), |
50 broker_(broker) { | 50 weak_factory_(this) { |
51 CreatePipe(channel_handle, mode); | 51 CreatePipe(channel_handle, mode); |
52 } | 52 } |
53 | 53 |
54 ChannelWin::~ChannelWin() { | 54 ChannelWin::~ChannelWin() { |
55 Close(); | 55 Close(); |
56 } | 56 } |
57 | 57 |
58 void ChannelWin::Close() { | 58 void ChannelWin::Close() { |
59 if (thread_check_.get()) | 59 if (thread_check_.get()) |
60 DCHECK(thread_check_->CalledOnValidThread()); | 60 DCHECK(thread_check_->CalledOnValidThread()); |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 int secret; | 510 int secret; |
511 do { // Guarantee we get a non-zero value. | 511 do { // Guarantee we get a non-zero value. |
512 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 512 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
513 } while (secret == 0); | 513 } while (secret == 0); |
514 | 514 |
515 id.append(GenerateUniqueRandomChannelID()); | 515 id.append(GenerateUniqueRandomChannelID()); |
516 return id.append(base::StringPrintf("\\%d", secret)); | 516 return id.append(base::StringPrintf("\\%d", secret)); |
517 } | 517 } |
518 | 518 |
519 } // namespace IPC | 519 } // namespace IPC |
OLD | NEW |