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 11 matching lines...) Expand all Loading... | |
22 #include "ipc/ipc_message_utils.h" | 22 #include "ipc/ipc_message_utils.h" |
23 | 23 |
24 namespace IPC { | 24 namespace IPC { |
25 | 25 |
26 ChannelWin::State::State(ChannelWin* channel) : is_pending(false) { | 26 ChannelWin::State::State(ChannelWin* channel) : is_pending(false) { |
27 memset(&context.overlapped, 0, sizeof(context.overlapped)); | 27 memset(&context.overlapped, 0, sizeof(context.overlapped)); |
28 context.handler = channel; | 28 context.handler = channel; |
29 } | 29 } |
30 | 30 |
31 ChannelWin::State::~State() { | 31 ChannelWin::State::~State() { |
32 COMPILE_ASSERT(!offsetof(ChannelWin::State, context), | 32 static_assert(offsetof(ChannelWin::State, context) == 0, |
33 starts_with_io_context); | 33 "ChannelWin::State should have context as its first data" |
34 "member"); | |
dmichael (off chromium)
2015/01/21 16:21:23
Please add a period to end the sentence.
"member.
| |
34 } | 35 } |
35 | 36 |
36 ChannelWin::ChannelWin(const IPC::ChannelHandle &channel_handle, | 37 ChannelWin::ChannelWin(const IPC::ChannelHandle &channel_handle, |
37 Mode mode, Listener* listener) | 38 Mode mode, Listener* listener) |
38 : ChannelReader(listener), | 39 : ChannelReader(listener), |
39 input_state_(this), | 40 input_state_(this), |
40 output_state_(this), | 41 output_state_(this), |
41 peer_pid_(base::kNullProcessId), | 42 peer_pid_(base::kNullProcessId), |
42 waiting_connect_(mode & MODE_SERVER_FLAG), | 43 waiting_connect_(mode & MODE_SERVER_FLAG), |
43 processing_incoming_(false), | 44 processing_incoming_(false), |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 int secret; | 500 int secret; |
500 do { // Guarantee we get a non-zero value. | 501 do { // Guarantee we get a non-zero value. |
501 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 502 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
502 } while (secret == 0); | 503 } while (secret == 0); |
503 | 504 |
504 id.append(GenerateUniqueRandomChannelID()); | 505 id.append(GenerateUniqueRandomChannelID()); |
505 return id.append(base::StringPrintf("\\%d", secret)); | 506 return id.append(base::StringPrintf("\\%d", secret)); |
506 } | 507 } |
507 | 508 |
508 } // namespace IPC | 509 } // namespace IPC |
OLD | NEW |