| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 return ProcessMessageForDelivery(message); | 101 return ProcessMessageForDelivery(message); |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool ChannelWin::ProcessMessageForDelivery(Message* message) { | 104 bool ChannelWin::ProcessMessageForDelivery(Message* message) { |
| 105 // Sending a brokerable attachment requires a call to Channel::Send(), so | 105 // Sending a brokerable attachment requires a call to Channel::Send(), so |
| 106 // both Send() and ProcessMessageForDelivery() may be re-entrant. | 106 // both Send() and ProcessMessageForDelivery() may be re-entrant. |
| 107 if (message->HasBrokerableAttachments()) { | 107 if (message->HasBrokerableAttachments()) { |
| 108 DCHECK(GetAttachmentBroker()); | 108 DCHECK(GetAttachmentBroker()); |
| 109 DCHECK(peer_pid_ != base::kNullProcessId); | 109 DCHECK(peer_pid_ != base::kNullProcessId); |
| 110 for (BrokerableAttachment* attachment : | 110 for (const scoped_refptr<IPC::BrokerableAttachment>& attachment : |
| 111 message->attachment_set()->GetBrokerableAttachments()) { | 111 message->attachment_set()->GetBrokerableAttachments()) { |
| 112 if (!GetAttachmentBroker()->SendAttachmentToProcess(attachment, | 112 if (!GetAttachmentBroker()->SendAttachmentToProcess(attachment, |
| 113 peer_pid_)) { | 113 peer_pid_)) { |
| 114 delete message; | 114 delete message; |
| 115 return false; | 115 return false; |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 #ifdef IPC_MESSAGE_LOG_ENABLED | 120 #ifdef IPC_MESSAGE_LOG_ENABLED |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 int secret; | 602 int secret; |
| 603 do { // Guarantee we get a non-zero value. | 603 do { // Guarantee we get a non-zero value. |
| 604 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 604 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
| 605 } while (secret == 0); | 605 } while (secret == 0); |
| 606 | 606 |
| 607 id.append(GenerateUniqueRandomChannelID()); | 607 id.append(GenerateUniqueRandomChannelID()); |
| 608 return id.append(base::StringPrintf("\\%d", secret)); | 608 return id.append(base::StringPrintf("\\%d", secret)); |
| 609 } | 609 } |
| 610 | 610 |
| 611 } // namespace IPC | 611 } // namespace IPC |
| OLD | NEW |