OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/nacl/renderer/manifest_service_channel.h" | 5 #include "components/nacl/renderer/manifest_service_channel.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 void ManifestServiceChannel::DidOpenResource(IPC::Message* reply, | 84 void ManifestServiceChannel::DidOpenResource(IPC::Message* reply, |
85 base::File file, | 85 base::File file, |
86 uint64_t token_lo, | 86 uint64_t token_lo, |
87 uint64_t token_hi) { | 87 uint64_t token_hi) { |
88 ppapi::proxy::SerializedHandle handle; | 88 ppapi::proxy::SerializedHandle handle; |
89 if (file.IsValid()) { | 89 if (file.IsValid()) { |
90 IPC::PlatformFileForTransit file_for_transit; | 90 IPC::PlatformFileForTransit file_for_transit; |
91 #if defined(OS_WIN) | 91 #if defined(OS_WIN) |
| 92 HANDLE raw_handle = INVALID_HANDLE_VALUE; |
92 bool ok = content::BrokerDuplicateHandle( | 93 bool ok = content::BrokerDuplicateHandle( |
93 file.TakePlatformFile(), | 94 file.TakePlatformFile(), peer_pid_, &raw_handle, |
94 peer_pid_, | |
95 &file_for_transit, | |
96 0, // desired_access is 0 since we're using DUPLICATE_SAME_ACCESS. | 95 0, // desired_access is 0 since we're using DUPLICATE_SAME_ACCESS. |
97 DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); | 96 DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); |
98 if (ok) | 97 if (ok) { |
| 98 file_for_transit = IPC::PlatformFileForTransit(raw_handle, peer_pid_); |
99 handle.set_file_handle(file_for_transit, PP_FILEOPENFLAG_READ, 0); | 99 handle.set_file_handle(file_for_transit, PP_FILEOPENFLAG_READ, 0); |
| 100 } |
100 #else | 101 #else |
101 file_for_transit = base::FileDescriptor(std::move(file)); | 102 file_for_transit = base::FileDescriptor(std::move(file)); |
102 handle.set_file_handle(file_for_transit, PP_FILEOPENFLAG_READ, 0); | 103 handle.set_file_handle(file_for_transit, PP_FILEOPENFLAG_READ, 0); |
103 #endif | 104 #endif |
104 } | 105 } |
105 PpapiHostMsg_OpenResource::WriteReplyParams(reply, | 106 PpapiHostMsg_OpenResource::WriteReplyParams(reply, |
106 handle, | 107 handle, |
107 token_lo, | 108 token_lo, |
108 token_hi); | 109 token_hi); |
109 Send(reply); | 110 Send(reply); |
110 } | 111 } |
111 | 112 |
112 } // namespace nacl | 113 } // namespace nacl |
OLD | NEW |