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 "components/nacl/renderer/plugin/pnacl_translate_thread.h" | 5 #include "components/nacl/renderer/plugin/pnacl_translate_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <iterator> | 9 #include <iterator> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 done_ = true; | 161 done_ = true; |
162 buffer_cond_.Signal(); | 162 buffer_cond_.Signal(); |
163 } | 163 } |
164 | 164 |
165 ppapi::proxy::SerializedHandle PnaclTranslateThread::GetHandleForSubprocess( | 165 ppapi::proxy::SerializedHandle PnaclTranslateThread::GetHandleForSubprocess( |
166 base::File* file, int32_t open_flags, base::ProcessId peer_pid) { | 166 base::File* file, int32_t open_flags, base::ProcessId peer_pid) { |
167 IPC::PlatformFileForTransit file_for_transit; | 167 IPC::PlatformFileForTransit file_for_transit; |
168 | 168 |
169 DCHECK(file->IsValid()); | 169 DCHECK(file->IsValid()); |
170 #if defined(OS_WIN) | 170 #if defined(OS_WIN) |
| 171 HANDLE raw_handle = INVALID_HANDLE_VALUE; |
171 if (!content::BrokerDuplicateHandle( | 172 if (!content::BrokerDuplicateHandle( |
172 file->GetPlatformFile(), | 173 file->GetPlatformFile(), peer_pid, &raw_handle, |
173 peer_pid, | |
174 &file_for_transit, | |
175 0, // desired_access is 0 since we're using DUPLICATE_SAME_ACCESS. | 174 0, // desired_access is 0 since we're using DUPLICATE_SAME_ACCESS. |
176 DUPLICATE_SAME_ACCESS)) { | 175 DUPLICATE_SAME_ACCESS)) { |
177 return ppapi::proxy::SerializedHandle(); | 176 return ppapi::proxy::SerializedHandle(); |
178 } | 177 } |
| 178 file_for_transit = IPC::PlatformFileForTransit(raw_handle, peer_pid); |
179 #else | 179 #else |
180 file_for_transit = base::FileDescriptor(dup(file->GetPlatformFile()), true); | 180 file_for_transit = base::FileDescriptor(dup(file->GetPlatformFile()), true); |
181 #endif | 181 #endif |
182 | 182 |
183 // Using 0 disables any use of quota enforcement for this file handle. | 183 // Using 0 disables any use of quota enforcement for this file handle. |
184 PP_Resource file_io = 0; | 184 PP_Resource file_io = 0; |
185 | 185 |
186 ppapi::proxy::SerializedHandle handle; | 186 ppapi::proxy::SerializedHandle handle; |
187 handle.set_file_handle(file_for_transit, open_flags, file_io); | 187 handle.set_file_handle(file_for_transit, open_flags, file_io); |
188 return handle; | 188 return handle; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 buffer_cond_.Signal(); | 408 buffer_cond_.Signal(); |
409 } | 409 } |
410 | 410 |
411 PnaclTranslateThread::~PnaclTranslateThread() { | 411 PnaclTranslateThread::~PnaclTranslateThread() { |
412 AbortSubprocesses(); | 412 AbortSubprocesses(); |
413 if (translate_thread_) | 413 if (translate_thread_) |
414 translate_thread_->Join(); | 414 translate_thread_->Join(); |
415 } | 415 } |
416 | 416 |
417 } // namespace plugin | 417 } // namespace plugin |
OLD | NEW |