| 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 #include <stddef.h> | 8 #include <stddef.h> | 
| 9 #include <stdint.h> | 9 #include <stdint.h> | 
| 10 | 10 | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 21 #include "base/threading/thread_checker.h" | 21 #include "base/threading/thread_checker.h" | 
| 22 #include "base/win/scoped_handle.h" | 22 #include "base/win/scoped_handle.h" | 
| 23 #include "ipc/attachment_broker.h" | 23 #include "ipc/attachment_broker.h" | 
| 24 #include "ipc/ipc_listener.h" | 24 #include "ipc/ipc_listener.h" | 
| 25 #include "ipc/ipc_logging.h" | 25 #include "ipc/ipc_logging.h" | 
| 26 #include "ipc/ipc_message_attachment_set.h" | 26 #include "ipc/ipc_message_attachment_set.h" | 
| 27 #include "ipc/ipc_message_utils.h" | 27 #include "ipc/ipc_message_utils.h" | 
| 28 | 28 | 
| 29 namespace IPC { | 29 namespace IPC { | 
| 30 | 30 | 
| 31 ChannelWin::State::State(ChannelWin* channel) : is_pending(false) { | 31 ChannelWin::State::State() = default; | 
| 32   memset(&context.overlapped, 0, sizeof(context.overlapped)); |  | 
| 33   context.handler = channel; |  | 
| 34 } |  | 
| 35 | 32 | 
| 36 ChannelWin::State::~State() { | 33 ChannelWin::State::~State() { | 
| 37   static_assert(offsetof(ChannelWin::State, context) == 0, | 34   static_assert(offsetof(ChannelWin::State, context) == 0, | 
| 38                 "ChannelWin::State should have context as its first data" | 35                 "ChannelWin::State should have context as its first data" | 
| 39                 "member."); | 36                 "member."); | 
| 40 } | 37 } | 
| 41 | 38 | 
| 42 ChannelWin::ChannelWin(const IPC::ChannelHandle& channel_handle, | 39 ChannelWin::ChannelWin(const IPC::ChannelHandle& channel_handle, | 
| 43                        Mode mode, | 40                        Mode mode, | 
| 44                        Listener* listener) | 41                        Listener* listener) | 
| 45     : ChannelReader(listener), | 42     : ChannelReader(listener), | 
| 46       input_state_(this), |  | 
| 47       output_state_(this), |  | 
| 48       peer_pid_(base::kNullProcessId), | 43       peer_pid_(base::kNullProcessId), | 
| 49       waiting_connect_(mode & MODE_SERVER_FLAG), | 44       waiting_connect_(mode & MODE_SERVER_FLAG), | 
| 50       processing_incoming_(false), | 45       processing_incoming_(false), | 
| 51       validate_client_(false), | 46       validate_client_(false), | 
| 52       client_secret_(0), | 47       client_secret_(0), | 
| 53       weak_factory_(this) { | 48       weak_factory_(this) { | 
| 54   CreatePipe(channel_handle, mode); | 49   CreatePipe(channel_handle, mode); | 
| 55 } | 50 } | 
| 56 | 51 | 
| 57 ChannelWin::~ChannelWin() { | 52 ChannelWin::~ChannelWin() { | 
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 606   int secret; | 601   int secret; | 
| 607   do {  // Guarantee we get a non-zero value. | 602   do {  // Guarantee we get a non-zero value. | 
| 608     secret = base::RandInt(0, std::numeric_limits<int>::max()); | 603     secret = base::RandInt(0, std::numeric_limits<int>::max()); | 
| 609   } while (secret == 0); | 604   } while (secret == 0); | 
| 610 | 605 | 
| 611   id.append(GenerateUniqueRandomChannelID()); | 606   id.append(GenerateUniqueRandomChannelID()); | 
| 612   return id.append(base::StringPrintf("\\%d", secret)); | 607   return id.append(base::StringPrintf("\\%d", secret)); | 
| 613 } | 608 } | 
| 614 | 609 | 
| 615 }  // namespace IPC | 610 }  // namespace IPC | 
| OLD | NEW | 
|---|