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_message_attachment_set.h" | |
| 6 #include "ipc/ipc_platform_file.h" | 7 #include "ipc/ipc_platform_file.h" |
| 7 | 8 |
| 8 namespace nacl { | 9 namespace nacl { |
| 9 | 10 |
| 10 NaClStartParams::NaClStartParams() | 11 NaClStartParams::NaClStartParams() |
| 11 : nexe_file(IPC::InvalidPlatformFileForTransit()), | 12 : nexe_file(IPC::InvalidPlatformFileForTransit()), |
| 12 validation_cache_enabled(false), | 13 validation_cache_enabled(false), |
| 13 enable_debug_stub(false), | 14 enable_debug_stub(false), |
| 14 enable_ipc_proxy(false), | 15 enable_ipc_proxy(false), |
| 15 enable_mojo(false), | 16 enable_mojo(false), |
| 16 process_type(kUnknownNaClProcessType), | 17 process_type(kUnknownNaClProcessType), |
| 17 crash_info_shmem_handle(base::SharedMemory::NULLHandle()) { | 18 crash_info_shmem_handle(base::SharedMemory::NULLHandle()) { |
| 18 } | 19 } |
| 19 | 20 |
| 20 NaClStartParams::~NaClStartParams() { | 21 NaClStartParams::~NaClStartParams() { |
| 21 } | 22 } |
| 22 | 23 |
| 24 void NaClStartParams::CheckNumOfDescriptors() { | |
| 25 // TODO(yusukes): Change this to OS_POSIX once we support batch-opening | |
| 26 // resource files on SFI-NaCl. Note that OS_WIN does not have such an | |
| 27 // artificial limitation on the number of handles per IPC. | |
| 28 #if defined(OS_LINUX) | |
| 29 // '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.
| |
| 30 // |crash_info_shmem_handle|. | |
| 31 size_t num_descs = handles.size() + resource_files.size() + 3; | |
| 32 // If this CHECK fails, either of the following has to be done: | |
| 33 // * Increase kMaxDescriptorsPerMessage in ipc/ipc_message_attachment_set.h | |
| 34 // * Or, decrease kMaxPreOpenResourceFiles in | |
| 35 // components/nacl/renderer/ppb_nacl_private_impl.cc. | |
| 36 CHECK(num_descs <= IPC::MessageAttachmentSet::kMaxDescriptorsPerMessage); | |
| 37 #endif | |
| 38 } | |
| 39 | |
| 40 NaClStartParams::ResourceFileInfo::ResourceFileInfo() | |
| 41 : file(IPC::InvalidPlatformFileForTransit()) { | |
| 42 } | |
| 43 | |
| 44 NaClStartParams::ResourceFileInfo::ResourceFileInfo( | |
| 45 IPC::PlatformFileForTransit file, | |
| 46 const base::FilePath& file_path, | |
| 47 const std::string& file_key) | |
| 48 : file(file), file_path(file_path), file_key(file_key) { | |
| 49 } | |
| 50 | |
| 51 NaClStartParams::ResourceFileInfo::~ResourceFileInfo() { | |
| 52 } | |
| 53 | |
| 23 NaClLaunchParams::NaClLaunchParams() | 54 NaClLaunchParams::NaClLaunchParams() |
| 24 : nexe_file(IPC::InvalidPlatformFileForTransit()), | 55 : nexe_file(IPC::InvalidPlatformFileForTransit()), |
| 25 nexe_token_lo(0), | 56 nexe_token_lo(0), |
| 26 nexe_token_hi(0), | 57 nexe_token_hi(0), |
| 27 render_view_id(0), | 58 render_view_id(0), |
| 28 permission_bits(0), | 59 permission_bits(0), |
| 29 process_type(kUnknownNaClProcessType) { | 60 process_type(kUnknownNaClProcessType) { |
| 30 } | 61 } |
| 31 | 62 |
| 32 NaClLaunchParams::NaClLaunchParams( | 63 NaClLaunchParams::NaClLaunchParams( |
| 33 const std::string& manifest_url, | 64 const std::string& manifest_url, |
| 34 const IPC::PlatformFileForTransit& nexe_file, | 65 const IPC::PlatformFileForTransit& nexe_file, |
| 35 uint64_t nexe_token_lo, | 66 uint64_t nexe_token_lo, |
| 36 uint64_t nexe_token_hi, | 67 uint64_t nexe_token_hi, |
| 68 const std::vector<NaClResourceFileInfo>& resource_files_info, | |
| 37 int render_view_id, | 69 int render_view_id, |
| 38 uint32 permission_bits, | 70 uint32 permission_bits, |
| 39 bool uses_nonsfi_mode, | 71 bool uses_nonsfi_mode, |
| 40 NaClAppProcessType process_type) | 72 NaClAppProcessType process_type) |
| 41 : manifest_url(manifest_url), | 73 : manifest_url(manifest_url), |
| 42 nexe_file(nexe_file), | 74 nexe_file(nexe_file), |
| 43 nexe_token_lo(nexe_token_lo), | 75 nexe_token_lo(nexe_token_lo), |
| 44 nexe_token_hi(nexe_token_hi), | 76 nexe_token_hi(nexe_token_hi), |
| 77 resource_files_info(resource_files_info), | |
| 45 render_view_id(render_view_id), | 78 render_view_id(render_view_id), |
| 46 permission_bits(permission_bits), | 79 permission_bits(permission_bits), |
| 47 uses_nonsfi_mode(uses_nonsfi_mode), | 80 uses_nonsfi_mode(uses_nonsfi_mode), |
| 48 process_type(process_type) { | 81 process_type(process_type) { |
| 49 } | 82 } |
| 50 | 83 |
| 51 NaClLaunchParams::~NaClLaunchParams() { | 84 NaClLaunchParams::~NaClLaunchParams() { |
| 52 } | 85 } |
| 53 | 86 |
| 54 NaClLaunchResult::NaClLaunchResult() | 87 NaClLaunchResult::NaClLaunchResult() |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 73 trusted_ipc_channel_handle(trusted_ipc_channel_handle), | 106 trusted_ipc_channel_handle(trusted_ipc_channel_handle), |
| 74 manifest_service_ipc_channel_handle(manifest_service_ipc_channel_handle), | 107 manifest_service_ipc_channel_handle(manifest_service_ipc_channel_handle), |
| 75 plugin_pid(plugin_pid), | 108 plugin_pid(plugin_pid), |
| 76 plugin_child_id(plugin_child_id), | 109 plugin_child_id(plugin_child_id), |
| 77 crash_info_shmem_handle(crash_info_shmem_handle) { | 110 crash_info_shmem_handle(crash_info_shmem_handle) { |
| 78 } | 111 } |
| 79 | 112 |
| 80 NaClLaunchResult::~NaClLaunchResult() { | 113 NaClLaunchResult::~NaClLaunchResult() { |
| 81 } | 114 } |
| 82 | 115 |
| 116 NaClResourceFileInfo::NaClResourceFileInfo() | |
| 117 : file(IPC::InvalidPlatformFileForTransit()), | |
| 118 file_token_lo(0), | |
| 119 file_token_hi(0) { | |
| 120 } | |
| 121 | |
| 122 NaClResourceFileInfo::NaClResourceFileInfo(IPC::PlatformFileForTransit file, | |
| 123 uint64_t file_token_lo, | |
| 124 uint64_t file_token_hi) | |
| 125 : file(file), | |
| 126 file_token_lo(file_token_lo), | |
| 127 file_token_hi(file_token_hi) { | |
| 128 } | |
| 129 | |
| 130 NaClResourceFileInfo::NaClResourceFileInfo(IPC::PlatformFileForTransit file, | |
| 131 uint64_t file_token_lo, | |
| 132 uint64_t file_token_hi, | |
| 133 const std::string& key) | |
| 134 : file(file), | |
| 135 file_token_lo(file_token_lo), | |
| 136 file_token_hi(file_token_hi), | |
| 137 key(key) { | |
| 138 } | |
| 139 | |
| 140 NaClResourceFileInfo::~NaClResourceFileInfo() { | |
| 141 } | |
| 142 | |
| 83 } // namespace nacl | 143 } // namespace nacl |
| OLD | NEW |