Chromium Code Reviews| 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/common/nacl_types.h" | 5 #include "components/nacl/common/nacl_types.h" |
| 6 #include "ipc/ipc_platform_file.h" | 6 #include "ipc/ipc_platform_file.h" |
| 7 | 7 |
| 8 #if defined(OS_POSIX) | |
| 9 #include "ipc/file_descriptor_set_posix.h" | |
| 10 #endif | |
| 11 | |
| 8 namespace nacl { | 12 namespace nacl { |
| 9 | 13 |
| 10 NaClStartParams::NaClStartParams() | 14 NaClStartParams::NaClStartParams() |
| 11 : nexe_file(IPC::InvalidPlatformFileForTransit()), | 15 : nexe_file(IPC::InvalidPlatformFileForTransit()), |
| 12 validation_cache_enabled(false), | 16 validation_cache_enabled(false), |
| 13 enable_debug_stub(false), | 17 enable_debug_stub(false), |
| 14 enable_ipc_proxy(false), | 18 enable_ipc_proxy(false), |
| 15 process_type(kUnknownNaClProcessType), | 19 process_type(kUnknownNaClProcessType), |
| 16 crash_info_shmem_handle(base::SharedMemory::NULLHandle()) { | 20 crash_info_shmem_handle(base::SharedMemory::NULLHandle()) { |
| 17 } | 21 } |
| 18 | 22 |
| 19 NaClStartParams::~NaClStartParams() { | 23 NaClStartParams::~NaClStartParams() { |
| 20 } | 24 } |
| 21 | 25 |
| 26 void NaClStartParams::CheckNumOfDescriptors() { | |
| 27 #if defined(OS_POSIX) | |
|
hidehiko
2015/01/28 09:05:19
Isn't this only for Non-SFI? If so, limited to Lin
Yusuke Sato
2015/02/04 02:00:28
Right, for now, OS_LINUX would suffice. Changed to
| |
| 28 // '3' is for |nexe_file|, |debug_stub_server_bound_socket|, and | |
| 29 // |crash_info_shmem_handle|. | |
| 30 size_t num_descs = handles.size() + resource_files.size() + 3; | |
| 31 // If this CHECK fails, either of the following has to be done: | |
| 32 // * Increase kMaxDescriptorsPerMessage in ipc/file_descriptor_set_posix.h. | |
| 33 // * Or, decrease kMaxPreOpenResourceFiles in | |
| 34 // components/nacl/renderer/ppb_nacl_private_impl.cc. | |
| 35 CHECK(num_descs <= FileDescriptorSet::kMaxDescriptorsPerMessage); | |
| 36 #endif | |
| 37 } | |
| 38 | |
| 39 NaClStartParams::ResourceFileInfo::ResourceFileInfo() | |
| 40 : file(IPC::InvalidPlatformFileForTransit()) { | |
| 41 } | |
| 42 | |
| 43 NaClStartParams::ResourceFileInfo::ResourceFileInfo( | |
| 44 IPC::PlatformFileForTransit file, | |
| 45 const base::FilePath& file_path, | |
| 46 const std::string& file_key) | |
| 47 : file(file), file_path(file_path), file_key(file_key) { | |
| 48 } | |
| 49 | |
| 50 NaClStartParams::ResourceFileInfo::~ResourceFileInfo() { | |
| 51 } | |
| 52 | |
| 22 NaClLaunchParams::NaClLaunchParams() | 53 NaClLaunchParams::NaClLaunchParams() |
| 23 : nexe_file(IPC::InvalidPlatformFileForTransit()), | 54 : nexe_file(IPC::InvalidPlatformFileForTransit()), |
| 24 nexe_token_lo(0), | 55 nexe_token_lo(0), |
| 25 nexe_token_hi(0), | 56 nexe_token_hi(0), |
| 26 render_view_id(0), | 57 render_view_id(0), |
| 27 permission_bits(0), | 58 permission_bits(0), |
| 28 process_type(kUnknownNaClProcessType) { | 59 process_type(kUnknownNaClProcessType) { |
| 29 } | 60 } |
| 30 | 61 |
| 31 NaClLaunchParams::NaClLaunchParams( | 62 NaClLaunchParams::NaClLaunchParams( |
| 32 const std::string& manifest_url, | 63 const std::string& manifest_url, |
| 33 const IPC::PlatformFileForTransit& nexe_file, | 64 const IPC::PlatformFileForTransit& nexe_file, |
| 34 uint64_t nexe_token_lo, | 65 uint64_t nexe_token_lo, |
| 35 uint64_t nexe_token_hi, | 66 uint64_t nexe_token_hi, |
| 67 const std::vector<ResourceFileInfo>& resource_files_info, | |
| 36 int render_view_id, | 68 int render_view_id, |
| 37 uint32 permission_bits, | 69 uint32 permission_bits, |
| 38 bool uses_nonsfi_mode, | 70 bool uses_nonsfi_mode, |
| 39 NaClAppProcessType process_type) | 71 NaClAppProcessType process_type) |
| 40 : manifest_url(manifest_url), | 72 : manifest_url(manifest_url), |
| 41 nexe_file(nexe_file), | 73 nexe_file(nexe_file), |
| 42 nexe_token_lo(nexe_token_lo), | 74 nexe_token_lo(nexe_token_lo), |
| 43 nexe_token_hi(nexe_token_hi), | 75 nexe_token_hi(nexe_token_hi), |
| 76 resource_files_info(resource_files_info), | |
| 44 render_view_id(render_view_id), | 77 render_view_id(render_view_id), |
| 45 permission_bits(permission_bits), | 78 permission_bits(permission_bits), |
| 46 uses_nonsfi_mode(uses_nonsfi_mode), | 79 uses_nonsfi_mode(uses_nonsfi_mode), |
| 47 process_type(process_type) { | 80 process_type(process_type) { |
| 48 } | 81 } |
| 49 | 82 |
| 50 NaClLaunchParams::~NaClLaunchParams() { | 83 NaClLaunchParams::~NaClLaunchParams() { |
| 51 } | 84 } |
| 52 | 85 |
| 86 NaClLaunchParams::ResourceFileInfo::ResourceFileInfo() | |
| 87 : file(IPC::InvalidPlatformFileForTransit()), | |
| 88 file_token_lo(0), | |
| 89 file_token_hi(0) { | |
| 90 } | |
| 91 | |
| 92 NaClLaunchParams::ResourceFileInfo::ResourceFileInfo( | |
| 93 IPC::PlatformFileForTransit file, | |
| 94 uint64_t file_token_lo, | |
| 95 uint64_t file_token_hi, | |
| 96 const std::string& file_key) | |
| 97 : file(file), | |
| 98 file_token_lo(file_token_lo), | |
| 99 file_token_hi(file_token_hi), | |
| 100 file_key(file_key) { | |
| 101 } | |
| 102 | |
| 103 NaClLaunchParams::ResourceFileInfo::~ResourceFileInfo() { | |
| 104 } | |
| 105 | |
| 53 NaClLaunchResult::NaClLaunchResult() | 106 NaClLaunchResult::NaClLaunchResult() |
| 54 : imc_channel_handle(IPC::InvalidPlatformFileForTransit()), | 107 : imc_channel_handle(IPC::InvalidPlatformFileForTransit()), |
| 55 ppapi_ipc_channel_handle(), | 108 ppapi_ipc_channel_handle(), |
| 56 trusted_ipc_channel_handle(), | 109 trusted_ipc_channel_handle(), |
| 57 plugin_pid(base::kNullProcessId), | 110 plugin_pid(base::kNullProcessId), |
| 58 plugin_child_id(0), | 111 plugin_child_id(0), |
| 59 crash_info_shmem_handle(base::SharedMemory::NULLHandle()) { | 112 crash_info_shmem_handle(base::SharedMemory::NULLHandle()) { |
| 60 } | 113 } |
| 61 | 114 |
| 62 NaClLaunchResult::NaClLaunchResult( | 115 NaClLaunchResult::NaClLaunchResult( |
| 63 FileDescriptor imc_channel_handle, | 116 FileDescriptor imc_channel_handle, |
| 64 const IPC::ChannelHandle& ppapi_ipc_channel_handle, | 117 const IPC::ChannelHandle& ppapi_ipc_channel_handle, |
| 65 const IPC::ChannelHandle& trusted_ipc_channel_handle, | 118 const IPC::ChannelHandle& trusted_ipc_channel_handle, |
| 66 const IPC::ChannelHandle& manifest_service_ipc_channel_handle, | 119 const IPC::ChannelHandle& manifest_service_ipc_channel_handle, |
| 67 base::ProcessId plugin_pid, | 120 base::ProcessId plugin_pid, |
| 68 int plugin_child_id, | 121 int plugin_child_id, |
| 69 base::SharedMemoryHandle crash_info_shmem_handle) | 122 base::SharedMemoryHandle crash_info_shmem_handle) |
| 70 : imc_channel_handle(imc_channel_handle), | 123 : imc_channel_handle(imc_channel_handle), |
| 71 ppapi_ipc_channel_handle(ppapi_ipc_channel_handle), | 124 ppapi_ipc_channel_handle(ppapi_ipc_channel_handle), |
| 72 trusted_ipc_channel_handle(trusted_ipc_channel_handle), | 125 trusted_ipc_channel_handle(trusted_ipc_channel_handle), |
| 73 manifest_service_ipc_channel_handle(manifest_service_ipc_channel_handle), | 126 manifest_service_ipc_channel_handle(manifest_service_ipc_channel_handle), |
| 74 plugin_pid(plugin_pid), | 127 plugin_pid(plugin_pid), |
| 75 plugin_child_id(plugin_child_id), | 128 plugin_child_id(plugin_child_id), |
| 76 crash_info_shmem_handle(crash_info_shmem_handle) { | 129 crash_info_shmem_handle(crash_info_shmem_handle) { |
| 77 } | 130 } |
| 78 | 131 |
| 79 NaClLaunchResult::~NaClLaunchResult() { | 132 NaClLaunchResult::~NaClLaunchResult() { |
| 80 } | 133 } |
| 81 | 134 |
| 135 NaClOpenExecutableResult::NaClOpenExecutableResult() { | |
| 136 } | |
| 137 | |
| 138 NaClOpenExecutableResult::NaClOpenExecutableResult( | |
| 139 const NaClOpenExecutableResult::FileInfo& file_info, | |
| 140 const std::vector<NaClOpenExecutableResult::FileInfo>& resource_files_info) | |
| 141 : file_info(file_info), | |
| 142 resource_files_info(resource_files_info) { | |
| 143 } | |
| 144 | |
| 145 NaClOpenExecutableResult::~NaClOpenExecutableResult() { | |
| 146 } | |
| 147 | |
| 148 NaClOpenExecutableResult::FileInfo::FileInfo() | |
| 149 : file(IPC::InvalidPlatformFileForTransit()), | |
| 150 file_token_lo(0), | |
| 151 file_token_hi(0) { | |
| 152 } | |
| 153 | |
| 154 NaClOpenExecutableResult::FileInfo::FileInfo(IPC::PlatformFileForTransit file, | |
| 155 uint64_t file_token_lo, | |
| 156 uint64_t file_token_hi) | |
| 157 : file(file), | |
| 158 file_token_lo(file_token_lo), | |
| 159 file_token_hi(file_token_hi) { | |
| 160 } | |
| 161 | |
| 162 NaClOpenExecutableResult::FileInfo::~FileInfo() { | |
| 163 } | |
| 164 | |
| 82 } // namespace nacl | 165 } // namespace nacl |
| OLD | NEW |