Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2753)

Unified Diff: components/nacl/common/nacl_types.cc

Issue 649603004: Non-SFI NaCl: Batch-open resource files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove ipc/ and mojo/ changes following Mark's suggestion Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/nacl/common/nacl_types.cc
diff --git a/components/nacl/common/nacl_types.cc b/components/nacl/common/nacl_types.cc
index 572b72c44cda14d3f7e6ca0a3cd4d668ffa29762..52ea72afd9a1ebdfe6ffd26e501dd62190ed705b 100644
--- a/components/nacl/common/nacl_types.cc
+++ b/components/nacl/common/nacl_types.cc
@@ -5,6 +5,10 @@
#include "components/nacl/common/nacl_types.h"
#include "ipc/ipc_platform_file.h"
+#if defined(OS_POSIX)
+#include "ipc/file_descriptor_set_posix.h"
+#endif
+
namespace nacl {
NaClStartParams::NaClStartParams()
@@ -19,6 +23,33 @@ NaClStartParams::NaClStartParams()
NaClStartParams::~NaClStartParams() {
}
+void NaClStartParams::CheckNumOfDescriptors() {
+#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
+ // '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/file_descriptor_set_posix.h.
+ // * Or, decrease kMaxPreOpenResourceFiles in
+ // components/nacl/renderer/ppb_nacl_private_impl.cc.
+ CHECK(num_descs <= FileDescriptorSet::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),
@@ -33,6 +64,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,
@@ -41,6 +73,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),
@@ -50,6 +83,26 @@ NaClLaunchParams::NaClLaunchParams(
NaClLaunchParams::~NaClLaunchParams() {
}
+NaClLaunchParams::ResourceFileInfo::ResourceFileInfo()
+ : file(IPC::InvalidPlatformFileForTransit()),
+ file_token_lo(0),
+ file_token_hi(0) {
+}
+
+NaClLaunchParams::ResourceFileInfo::ResourceFileInfo(
+ IPC::PlatformFileForTransit file,
+ uint64_t file_token_lo,
+ uint64_t file_token_hi,
+ const std::string& file_key)
+ : file(file),
+ file_token_lo(file_token_lo),
+ file_token_hi(file_token_hi),
+ file_key(file_key) {
+}
+
+NaClLaunchParams::ResourceFileInfo::~ResourceFileInfo() {
+}
+
NaClLaunchResult::NaClLaunchResult()
: imc_channel_handle(IPC::InvalidPlatformFileForTransit()),
ppapi_ipc_channel_handle(),
@@ -79,4 +132,34 @@ NaClLaunchResult::NaClLaunchResult(
NaClLaunchResult::~NaClLaunchResult() {
}
+NaClOpenExecutableResult::NaClOpenExecutableResult() {
+}
+
+NaClOpenExecutableResult::NaClOpenExecutableResult(
+ const NaClOpenExecutableResult::FileInfo& file_info,
+ const std::vector<NaClOpenExecutableResult::FileInfo>& resource_files_info)
+ : file_info(file_info),
+ resource_files_info(resource_files_info) {
+}
+
+NaClOpenExecutableResult::~NaClOpenExecutableResult() {
+}
+
+NaClOpenExecutableResult::FileInfo::FileInfo()
+ : file(IPC::InvalidPlatformFileForTransit()),
+ file_token_lo(0),
+ file_token_hi(0) {
+}
+
+NaClOpenExecutableResult::FileInfo::FileInfo(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) {
+}
+
+NaClOpenExecutableResult::FileInfo::~FileInfo() {
+}
+
} // namespace nacl

Powered by Google App Engine
This is Rietveld 408576698