Chromium Code Reviews| Index: chrome/nacl/nacl_listener.cc |
| diff --git a/chrome/nacl/nacl_listener.cc b/chrome/nacl/nacl_listener.cc |
| index b0b27e91a461904f9d9eef84f9cba4eb338d4e08..cd7cbad3e1bf17865795413bee5d3275b16346aa 100644 |
| --- a/chrome/nacl/nacl_listener.cc |
| +++ b/chrome/nacl/nacl_listener.cc |
| @@ -130,6 +130,34 @@ class BrowserValidationDBProxy : public NaClValidationDB { |
| } |
| } |
| + virtual bool ResolveFileNonce(uint64 nonce, int32* fd, |
| + std::string* path) OVERRIDE { |
| + *fd = -1; |
| + *path = ""; |
| + if (nonce == 0) { |
| + return false; |
| + } |
| + IPC::PlatformFileForTransit ipc_fd; |
| + base::FilePath ipc_path; |
| + if (!listener_->Send(new NaClProcessMsg_ResolveFileNonce(nonce, &ipc_fd, |
| + &ipc_path))) { |
| + return false; |
| + } |
| + if (ipc_fd == IPC::InvalidPlatformFileForTransit()) { |
| + return false; |
| + } |
| + base::PlatformFile handle = |
| + IPC::PlatformFileForTransitToPlatformFile(ipc_fd); |
| +#if defined(OS_WIN) |
| + // On Windows, valid handles are 32 bit unsigned integers so this is safe. |
| + *fd = reinterpret_cast<uintptr_t>(handle); |
| +#else |
| + *fd = handle; |
| +#endif |
| + *path = ipc_path.AsUTF8Unsafe(); |
|
Mark Seaborn
2013/05/16 23:01:47
Maybe comment why this is safe here, despite the n
Nick Bray (chromium)
2013/05/21 20:09:06
Done.
|
| + return true; |
| + } |
| + |
| private: |
| // The listener never dies, otherwise this might be a dangling reference. |
| NaClListener* listener_; |