Chromium Code Reviews| Index: components/nacl/common/nacl_types.cc |
| diff --git a/components/nacl/common/nacl_types.cc b/components/nacl/common/nacl_types.cc |
| index fec4a02983d431a520a98afa5e9800c25b80955e..7c57cbedc6ca01b3d91a3191ff2e7d3a2217d33c 100644 |
| --- a/components/nacl/common/nacl_types.cc |
| +++ b/components/nacl/common/nacl_types.cc |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "components/nacl/common/nacl_types.h" |
| +#include "ipc/ipc_message_attachment_set.h" |
| #include "ipc/ipc_platform_file.h" |
| namespace nacl { |
| @@ -20,6 +21,36 @@ NaClStartParams::NaClStartParams() |
| NaClStartParams::~NaClStartParams() { |
| } |
| +void NaClStartParams::CheckNumOfDescriptors() { |
| + // TODO(yusukes): Change this to OS_POSIX once we support batch-opening |
| + // resource files on SFI-NaCl. Note that OS_WIN does not have such an |
| + // artificial limitation on the number of handles per IPC. |
| +#if defined(OS_LINUX) |
| + // '3' is for |nexe_file|, |debug_stub_server_bound_socket|, and |
|
Mark Seaborn
2015/02/12 03:57:33
Similar to my comment in ppb_nacl_private_impl.cc,
Yusuke Sato
2015/02/13 23:01:16
ok, dropped.
|
| + // |crash_info_shmem_handle|. |
| + size_t num_descs = handles.size() + resource_files.size() + 3; |
| + // If this CHECK fails, either of the following has to be done: |
| + // * Increase kMaxDescriptorsPerMessage in ipc/ipc_message_attachment_set.h |
| + // * Or, decrease kMaxPreOpenResourceFiles in |
| + // components/nacl/renderer/ppb_nacl_private_impl.cc. |
| + CHECK(num_descs <= IPC::MessageAttachmentSet::kMaxDescriptorsPerMessage); |
| +#endif |
| +} |
| + |
| +NaClStartParams::ResourceFileInfo::ResourceFileInfo() |
| + : file(IPC::InvalidPlatformFileForTransit()) { |
| +} |
| + |
| +NaClStartParams::ResourceFileInfo::ResourceFileInfo( |
| + IPC::PlatformFileForTransit file, |
| + const base::FilePath& file_path, |
| + const std::string& file_key) |
| + : file(file), file_path(file_path), file_key(file_key) { |
| +} |
| + |
| +NaClStartParams::ResourceFileInfo::~ResourceFileInfo() { |
| +} |
| + |
| NaClLaunchParams::NaClLaunchParams() |
| : nexe_file(IPC::InvalidPlatformFileForTransit()), |
| nexe_token_lo(0), |
| @@ -34,6 +65,7 @@ NaClLaunchParams::NaClLaunchParams( |
| const IPC::PlatformFileForTransit& nexe_file, |
| uint64_t nexe_token_lo, |
| uint64_t nexe_token_hi, |
| + const std::vector<NaClResourceFileInfo>& resource_files_info, |
| int render_view_id, |
| uint32 permission_bits, |
| bool uses_nonsfi_mode, |
| @@ -42,6 +74,7 @@ NaClLaunchParams::NaClLaunchParams( |
| nexe_file(nexe_file), |
| nexe_token_lo(nexe_token_lo), |
| nexe_token_hi(nexe_token_hi), |
| + resource_files_info(resource_files_info), |
| render_view_id(render_view_id), |
| permission_bits(permission_bits), |
| uses_nonsfi_mode(uses_nonsfi_mode), |
| @@ -80,4 +113,31 @@ NaClLaunchResult::NaClLaunchResult( |
| NaClLaunchResult::~NaClLaunchResult() { |
| } |
| +NaClResourceFileInfo::NaClResourceFileInfo() |
| + : file(IPC::InvalidPlatformFileForTransit()), |
| + file_token_lo(0), |
| + file_token_hi(0) { |
| +} |
| + |
| +NaClResourceFileInfo::NaClResourceFileInfo(IPC::PlatformFileForTransit file, |
| + uint64_t file_token_lo, |
| + uint64_t file_token_hi) |
| + : file(file), |
| + file_token_lo(file_token_lo), |
| + file_token_hi(file_token_hi) { |
| +} |
| + |
| +NaClResourceFileInfo::NaClResourceFileInfo(IPC::PlatformFileForTransit file, |
| + uint64_t file_token_lo, |
| + uint64_t file_token_hi, |
| + const std::string& key) |
| + : file(file), |
| + file_token_lo(file_token_lo), |
| + file_token_hi(file_token_hi), |
| + key(key) { |
| +} |
| + |
| +NaClResourceFileInfo::~NaClResourceFileInfo() { |
| +} |
| + |
| } // namespace nacl |