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 <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (!success) { | 95 if (!success) { |
96 LOG(INFO) << "Failed to deserialize message."; | 96 LOG(INFO) << "Failed to deserialize message."; |
97 return nullptr; | 97 return nullptr; |
98 } | 98 } |
99 | 99 |
100 base::SharedMemoryHandle handle = base::get<0>(p); | 100 base::SharedMemoryHandle handle = base::get<0>(p); |
101 scoped_ptr<base::SharedMemory> shared_memory( | 101 scoped_ptr<base::SharedMemory> shared_memory( |
102 new base::SharedMemory(handle, false)); | 102 new base::SharedMemory(handle, false)); |
103 | 103 |
104 shared_memory->Map(size); | 104 shared_memory->Map(size); |
105 return std::move(shared_memory); | 105 return shared_memory; |
106 } | 106 } |
107 | 107 |
108 // |message| must be deserializable as a TestTwoHandleWinMsg. Returns the | 108 // |message| must be deserializable as a TestTwoHandleWinMsg. Returns the |
109 // HANDLE, or nullptr if deserialization failed. | 109 // HANDLE, or nullptr if deserialization failed. |
110 bool GetHandleFromTestTwoHandleWinMsg(const IPC::Message& message, | 110 bool GetHandleFromTestTwoHandleWinMsg(const IPC::Message& message, |
111 HANDLE* h1, | 111 HANDLE* h1, |
112 HANDLE* h2) { | 112 HANDLE* h2) { |
113 // Expect a message with a brokered attachment. | 113 // Expect a message with a brokered attachment. |
114 if (!message.HasBrokerableAttachments()) { | 114 if (!message.HasBrokerableAttachments()) { |
115 LOG(INFO) << "Message missing brokerable attachment."; | 115 LOG(INFO) << "Message missing brokerable attachment."; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 memcmp(shared_memory->memory(), kDataBuffer, strlen(kDataBuffer)) == 0; | 643 memcmp(shared_memory->memory(), kDataBuffer, strlen(kDataBuffer)) == 0; |
644 SendControlMessage(sender, success); | 644 SendControlMessage(sender, success); |
645 } | 645 } |
646 | 646 |
647 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendSharedMemoryHandle) { | 647 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendSharedMemoryHandle) { |
648 return CommonPrivilegedProcessMain(&SendSharedMemoryHandleCallback, | 648 return CommonPrivilegedProcessMain(&SendSharedMemoryHandleCallback, |
649 "SendSharedMemoryHandle"); | 649 "SendSharedMemoryHandle"); |
650 } | 650 } |
651 | 651 |
652 } // namespace | 652 } // namespace |
OLD | NEW |