| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // will be signalled even in the "synchronously completed" state. | 166 // will be signalled even in the "synchronously completed" state. |
| 167 // | 167 // |
| 168 // This allows us to potentially process some outgoing messages and | 168 // This allows us to potentially process some outgoing messages and |
| 169 // interleave other work on this thread when we're getting hammered with | 169 // interleave other work on this thread when we're getting hammered with |
| 170 // input messages. Potentially, this could be tuned to be more efficient | 170 // input messages. Potentially, this could be tuned to be more efficient |
| 171 // with some testing. | 171 // with some testing. |
| 172 input_state_.is_pending = true; | 172 input_state_.is_pending = true; |
| 173 return READ_PENDING; | 173 return READ_PENDING; |
| 174 } | 174 } |
| 175 | 175 |
| 176 bool ChannelWin::WillDispatchInputMessage(Message* msg) { | 176 bool ChannelWin::ShouldDispatchInputMessage(Message* msg) { |
| 177 // Make sure we get a hello when client validation is required. | 177 // Make sure we get a hello when client validation is required. |
| 178 if (validate_client_) | 178 if (validate_client_) |
| 179 return IsHelloMessage(*msg); | 179 return IsHelloMessage(*msg); |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 | 182 |
| 183 bool ChannelWin::GetNonBrokeredAttachments(Message* msg) { |
| 184 return true; |
| 185 } |
| 186 |
| 183 void ChannelWin::HandleInternalMessage(const Message& msg) { | 187 void ChannelWin::HandleInternalMessage(const Message& msg) { |
| 184 DCHECK_EQ(msg.type(), static_cast<unsigned>(Channel::HELLO_MESSAGE_TYPE)); | 188 DCHECK_EQ(msg.type(), static_cast<unsigned>(Channel::HELLO_MESSAGE_TYPE)); |
| 185 // The hello message contains one parameter containing the PID. | 189 // The hello message contains one parameter containing the PID. |
| 186 base::PickleIterator it(msg); | 190 base::PickleIterator it(msg); |
| 187 int32 claimed_pid; | 191 int32 claimed_pid; |
| 188 bool failed = !it.ReadInt(&claimed_pid); | 192 bool failed = !it.ReadInt(&claimed_pid); |
| 189 | 193 |
| 190 if (!failed && validate_client_) { | 194 if (!failed && validate_client_) { |
| 191 int32 secret; | 195 int32 secret; |
| 192 failed = it.ReadInt(&secret) ? (secret != client_secret_) : true; | 196 failed = it.ReadInt(&secret) ? (secret != client_secret_) : true; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 int secret; | 529 int secret; |
| 526 do { // Guarantee we get a non-zero value. | 530 do { // Guarantee we get a non-zero value. |
| 527 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 531 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
| 528 } while (secret == 0); | 532 } while (secret == 0); |
| 529 | 533 |
| 530 id.append(GenerateUniqueRandomChannelID()); | 534 id.append(GenerateUniqueRandomChannelID()); |
| 531 return id.append(base::StringPrintf("\\%d", secret)); | 535 return id.append(base::StringPrintf("\\%d", secret)); |
| 532 } | 536 } |
| 533 | 537 |
| 534 } // namespace IPC | 538 } // namespace IPC |
| OLD | NEW |