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

Unified Diff: components/nacl/loader/nacl_listener.cc

Issue 137623018: NaCl: Update to use new embedding interface provided by chrome_main.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nacl_listener.cc
diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc
index 0866f26000faafbcfdcefe3b3e72aedf9eb6f2b6..3afbff97e0ff6ff4385b93d679dcf67b7944628c 100644
--- a/components/nacl/loader/nacl_listener.cc
+++ b/components/nacl/loader/nacl_listener.cc
@@ -24,7 +24,8 @@
#include "ipc/ipc_switches.h"
#include "ipc/ipc_sync_channel.h"
#include "ipc/ipc_sync_message_filter.h"
-#include "native_client/src/trusted/service_runtime/sel_main_chrome.h"
+#include "native_client/src/public/chrome_main.h"
+#include "native_client/src/public/nacl_app.h"
#include "native_client/src/trusted/validator/nacl_file_info.h"
#if defined(OS_POSIX)
@@ -233,11 +234,26 @@ bool NaClListener::OnMessageReceived(const IPC::Message& msg) {
}
void NaClListener::OnStart(const nacl::NaClStartParams& params) {
+#if defined(OS_LINUX) || defined(OS_MACOSX)
+ int urandom_fd = dup(base::GetUrandomFD());
+ if (urandom_fd < 0) {
+ LOG(ERROR) << "Failed to dup() the urandom FD";
+ return;
+ }
+ NaClChromeMainSetUrandomFd(urandom_fd);
+#endif
+
+ NaClChromeMainInit();
struct NaClChromeMainArgs *args = NaClChromeMainArgsCreate();
if (args == NULL) {
LOG(ERROR) << "NaClChromeMainArgsCreate() failed";
return;
}
+ struct NaClApp *nap = NaClAppCreate();
+ if (nap == NULL) {
+ LOG(ERROR) << "NaClAppCreate() failed";
+ return;
+ }
if (params.enable_ipc_proxy) {
// Create the initial PPAPI IPC channel between the NaCl IRT and the
@@ -251,7 +267,7 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
// Pass a NaClDesc to the untrusted side. This will hold a ref to the
// NaClIPCAdapter.
- args->initial_ipc_desc = ipc_adapter->MakeNaClDesc();
+ NaClAppSetDesc(nap, NACL_CHROME_DESC_BASE, ipc_adapter->MakeNaClDesc());
#if defined(OS_POSIX)
handle.socket = base::FileDescriptor(
ipc_adapter->TakeClientFileDescriptor(), true);
@@ -263,11 +279,6 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
std::vector<nacl::FileDescriptor> handles = params.handles;
#if defined(OS_LINUX) || defined(OS_MACOSX)
- args->urandom_fd = dup(base::GetUrandomFD());
- if (args->urandom_fd < 0) {
- LOG(ERROR) << "Failed to dup() the urandom FD";
- return;
- }
args->number_of_cores = number_of_cores_;
args->create_memory_object_func = CreateMemoryObject;
# if defined(OS_MACOSX)
@@ -340,6 +351,6 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
return;
}
#endif
- NaClChromeMainStart(args);
+ NaClChromeMainStartApp(nap, args);
NOTREACHED();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698