| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 private: | 257 private: |
| 258 IPC::BrokerableAttachment::AttachmentId id_; | 258 IPC::BrokerableAttachment::AttachmentId id_; |
| 259 }; | 259 }; |
| 260 | 260 |
| 261 // A broker which always sets the current process as the destination process | 261 // A broker which always sets the current process as the destination process |
| 262 // for attachments. | 262 // for attachments. |
| 263 class MockBroker : public IPC::AttachmentBrokerUnprivilegedMac { | 263 class MockBroker : public IPC::AttachmentBrokerUnprivilegedMac { |
| 264 public: | 264 public: |
| 265 MockBroker() {} | 265 MockBroker() {} |
| 266 ~MockBroker() override {} | 266 ~MockBroker() override {} |
| 267 bool SendAttachmentToProcess(IPC::BrokerableAttachment* attachment, | 267 bool SendAttachmentToProcess( |
| 268 base::ProcessId destination_process) override { | 268 const scoped_refptr<IPC::BrokerableAttachment>& attachment, |
| 269 base::ProcessId destination_process) override { |
| 269 return IPC::AttachmentBrokerUnprivilegedMac::SendAttachmentToProcess( | 270 return IPC::AttachmentBrokerUnprivilegedMac::SendAttachmentToProcess( |
| 270 attachment, base::Process::Current().Pid()); | 271 attachment, base::Process::Current().Pid()); |
| 271 } | 272 } |
| 272 }; | 273 }; |
| 273 | 274 |
| 274 // Forwards all messages to |listener_|. Quits the message loop after a | 275 // Forwards all messages to |listener_|. Quits the message loop after a |
| 275 // message is received, or the channel has an error. | 276 // message is received, or the channel has an error. |
| 276 class ProxyListener : public IPC::Listener { | 277 class ProxyListener : public IPC::Listener { |
| 277 public: | 278 public: |
| 278 ProxyListener() : listener_(nullptr), reason_(MESSAGE_RECEIVED) {} | 279 ProxyListener() : listener_(nullptr), reason_(MESSAGE_RECEIVED) {} |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 memcmp(shared_memory2->memory(), kDataBuffer1, strlen(kDataBuffer1)) == 0; | 1020 memcmp(shared_memory2->memory(), kDataBuffer1, strlen(kDataBuffer1)) == 0; |
| 1020 SendControlMessage(sender, success); | 1021 SendControlMessage(sender, success); |
| 1021 } | 1022 } |
| 1022 | 1023 |
| 1023 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(ShareReadOnlyToProcess) { | 1024 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(ShareReadOnlyToProcess) { |
| 1024 return CommonPrivilegedProcessMain(&ShareReadOnlyToProcessCallback, | 1025 return CommonPrivilegedProcessMain(&ShareReadOnlyToProcessCallback, |
| 1025 "ShareReadOnlyToProcess"); | 1026 "ShareReadOnlyToProcess"); |
| 1026 } | 1027 } |
| 1027 | 1028 |
| 1028 } // namespace | 1029 } // namespace |
| OLD | NEW |