Chromium Code Reviews| 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 "should starts with io context"); |
|
dmichael (off chromium)
2015/01/20 16:44:10
"should starts" is not proper grammar, and it's no
anujsharma
2015/01/21 03:11:51
Done.
| |
| 34 } | 34 } |
| 35 | 35 |
| 36 ChannelWin::ChannelWin(const IPC::ChannelHandle &channel_handle, | 36 ChannelWin::ChannelWin(const IPC::ChannelHandle &channel_handle, |
| 37 Mode mode, Listener* listener) | 37 Mode mode, Listener* listener) |
| 38 : ChannelReader(listener), | 38 : ChannelReader(listener), |
| 39 input_state_(this), | 39 input_state_(this), |
| 40 output_state_(this), | 40 output_state_(this), |
| 41 peer_pid_(base::kNullProcessId), | 41 peer_pid_(base::kNullProcessId), |
| 42 waiting_connect_(mode & MODE_SERVER_FLAG), | 42 waiting_connect_(mode & MODE_SERVER_FLAG), |
| 43 processing_incoming_(false), | 43 processing_incoming_(false), |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 int secret; | 499 int secret; |
| 500 do { // Guarantee we get a non-zero value. | 500 do { // Guarantee we get a non-zero value. |
| 501 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 501 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
| 502 } while (secret == 0); | 502 } while (secret == 0); |
| 503 | 503 |
| 504 id.append(GenerateUniqueRandomChannelID()); | 504 id.append(GenerateUniqueRandomChannelID()); |
| 505 return id.append(base::StringPrintf("\\%d", secret)); | 505 return id.append(base::StringPrintf("\\%d", secret)); |
| 506 } | 506 } |
| 507 | 507 |
| 508 } // namespace IPC | 508 } // namespace IPC |
| OLD | NEW |