| 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/browser/nacl_process_host.h" | 5 #include "components/nacl/browser/nacl_process_host.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 // validation caching in that case, so it's unnecessary work, and would | 812 // validation caching in that case, so it's unnecessary work, and would |
| 813 // expose the file path to the plugin. | 813 // expose the file path to the plugin. |
| 814 } else { | 814 } else { |
| 815 if (NaClBrowser::GetInstance()->GetFilePath(nexe_token_.lo, | 815 if (NaClBrowser::GetInstance()->GetFilePath(nexe_token_.lo, |
| 816 nexe_token_.hi, | 816 nexe_token_.hi, |
| 817 &file_path)) { | 817 &file_path)) { |
| 818 // We have to reopen the file in the browser process; we don't want a | 818 // We have to reopen the file in the browser process; we don't want a |
| 819 // compromised renderer to pass an arbitrary fd that could get loaded | 819 // compromised renderer to pass an arbitrary fd that could get loaded |
| 820 // into the plugin process. | 820 // into the plugin process. |
| 821 base::PostTaskWithTraitsAndReplyWithResult( | 821 base::PostTaskWithTraitsAndReplyWithResult( |
| 822 FROM_HERE, | 822 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 823 base::TaskTraits().MayBlock().WithPriority( | |
| 824 base::TaskPriority::BACKGROUND), | |
| 825 base::Bind(OpenNaClReadExecImpl, file_path, true /* is_executable */), | 823 base::Bind(OpenNaClReadExecImpl, file_path, true /* is_executable */), |
| 826 base::Bind(&NaClProcessHost::StartNaClFileResolved, | 824 base::Bind(&NaClProcessHost::StartNaClFileResolved, |
| 827 weak_factory_.GetWeakPtr(), params, file_path)); | 825 weak_factory_.GetWeakPtr(), params, file_path)); |
| 828 return true; | 826 return true; |
| 829 } | 827 } |
| 830 } | 828 } |
| 831 | 829 |
| 832 StartNaClFileResolved(params, base::FilePath(), base::File()); | 830 StartNaClFileResolved(params, base::FilePath(), base::File()); |
| 833 return true; | 831 return true; |
| 834 } | 832 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 Send(new NaClProcessMsg_ResolveFileTokenReply( | 1028 Send(new NaClProcessMsg_ResolveFileTokenReply( |
| 1031 file_token_lo, | 1029 file_token_lo, |
| 1032 file_token_hi, | 1030 file_token_hi, |
| 1033 IPC::PlatformFileForTransit(), | 1031 IPC::PlatformFileForTransit(), |
| 1034 base::FilePath())); | 1032 base::FilePath())); |
| 1035 return; | 1033 return; |
| 1036 } | 1034 } |
| 1037 | 1035 |
| 1038 // Open the file. | 1036 // Open the file. |
| 1039 base::PostTaskWithTraitsAndReplyWithResult( | 1037 base::PostTaskWithTraitsAndReplyWithResult( |
| 1040 FROM_HERE, | 1038 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 1041 base::TaskTraits().MayBlock().WithPriority( | |
| 1042 base::TaskPriority::BACKGROUND), | |
| 1043 base::Bind(OpenNaClReadExecImpl, file_path, true /* is_executable */), | 1039 base::Bind(OpenNaClReadExecImpl, file_path, true /* is_executable */), |
| 1044 base::Bind(&NaClProcessHost::FileResolved, weak_factory_.GetWeakPtr(), | 1040 base::Bind(&NaClProcessHost::FileResolved, weak_factory_.GetWeakPtr(), |
| 1045 file_token_lo, file_token_hi, file_path)); | 1041 file_token_lo, file_token_hi, file_path)); |
| 1046 } | 1042 } |
| 1047 | 1043 |
| 1048 void NaClProcessHost::FileResolved( | 1044 void NaClProcessHost::FileResolved( |
| 1049 uint64_t file_token_lo, | 1045 uint64_t file_token_lo, |
| 1050 uint64_t file_token_hi, | 1046 uint64_t file_token_hi, |
| 1051 const base::FilePath& file_path, | 1047 const base::FilePath& file_path, |
| 1052 base::File file) { | 1048 base::File file) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 NaClStartDebugExceptionHandlerThread( | 1125 NaClStartDebugExceptionHandlerThread( |
| 1130 std::move(process), info, base::ThreadTaskRunnerHandle::Get(), | 1126 std::move(process), info, base::ThreadTaskRunnerHandle::Get(), |
| 1131 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1127 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 1132 weak_factory_.GetWeakPtr())); | 1128 weak_factory_.GetWeakPtr())); |
| 1133 return true; | 1129 return true; |
| 1134 } | 1130 } |
| 1135 } | 1131 } |
| 1136 #endif | 1132 #endif |
| 1137 | 1133 |
| 1138 } // namespace nacl | 1134 } // namespace nacl |
| OLD | NEW |