| 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..8847907746f468ed009ff5c2bd80780a224d6bf7 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
|
| + // |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<ResourceFileInfo>& 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),
|
| @@ -51,6 +84,18 @@ NaClLaunchParams::NaClLaunchParams(
|
| NaClLaunchParams::~NaClLaunchParams() {
|
| }
|
|
|
| +NaClLaunchParams::ResourceFileInfo::ResourceFileInfo() {
|
| +}
|
| +
|
| +NaClLaunchParams::ResourceFileInfo::ResourceFileInfo(
|
| + NaClFileInfo file_info, const std::string& file_key)
|
| + : file_info(file_info),
|
| + file_key(file_key) {
|
| +}
|
| +
|
| +NaClLaunchParams::ResourceFileInfo::~ResourceFileInfo() {
|
| +}
|
| +
|
| NaClLaunchResult::NaClLaunchResult()
|
| : imc_channel_handle(IPC::InvalidPlatformFileForTransit()),
|
| ppapi_ipc_channel_handle(),
|
| @@ -80,4 +125,21 @@ NaClLaunchResult::NaClLaunchResult(
|
| NaClLaunchResult::~NaClLaunchResult() {
|
| }
|
|
|
| +NaClFileInfo::NaClFileInfo()
|
| + : file(IPC::InvalidPlatformFileForTransit()),
|
| + file_token_lo(0),
|
| + file_token_hi(0) {
|
| +}
|
| +
|
| +NaClFileInfo::NaClFileInfo(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) {
|
| +}
|
| +
|
| +NaClFileInfo::~NaClFileInfo() {
|
| +}
|
| +
|
| } // namespace nacl
|
|
|