OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/loader/nacl_listener.h" | 5 #include "components/nacl/loader/nacl_listener.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 &ipc_path))) { | 201 &ipc_path))) { |
202 return false; | 202 return false; |
203 } | 203 } |
204 if (ipc_fd == IPC::InvalidPlatformFileForTransit()) { | 204 if (ipc_fd == IPC::InvalidPlatformFileForTransit()) { |
205 return false; | 205 return false; |
206 } | 206 } |
207 base::PlatformFile handle = | 207 base::PlatformFile handle = |
208 IPC::PlatformFileForTransitToPlatformFile(ipc_fd); | 208 IPC::PlatformFileForTransitToPlatformFile(ipc_fd); |
209 #if defined(OS_WIN) | 209 #if defined(OS_WIN) |
210 // On Windows, valid handles are 32 bit unsigned integers so this is safe. | 210 // On Windows, valid handles are 32 bit unsigned integers so this is safe. |
211 *fd = reinterpret_cast<uintptr_t>(handle); | 211 *fd = reinterpret_cast<int32>(handle); |
212 #else | 212 #else |
213 *fd = handle; | 213 *fd = handle; |
214 #endif | 214 #endif |
215 // It doesn't matter if the path is invalid UTF8 as long as it's consistent | 215 // It doesn't matter if the path is invalid UTF8 as long as it's consistent |
216 // and unforgeable. | 216 // and unforgeable. |
217 *path = ipc_path.AsUTF8Unsafe(); | 217 *path = ipc_path.AsUTF8Unsafe(); |
218 return true; | 218 return true; |
219 } | 219 } |
220 | 220 |
221 private: | 221 private: |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 491 } |
492 | 492 |
493 void NaClListener::OnFileTokenResolved( | 493 void NaClListener::OnFileTokenResolved( |
494 uint64_t token_lo, | 494 uint64_t token_lo, |
495 uint64_t token_hi, | 495 uint64_t token_hi, |
496 IPC::PlatformFileForTransit ipc_fd, | 496 IPC::PlatformFileForTransit ipc_fd, |
497 base::FilePath file_path) { | 497 base::FilePath file_path) { |
498 resolved_cb_.Run(ipc_fd, file_path); | 498 resolved_cb_.Run(ipc_fd, file_path); |
499 resolved_cb_.Reset(); | 499 resolved_cb_.Reset(); |
500 } | 500 } |
OLD | NEW |