Commit c8e1ea3e authored by mseaborn@chromium.org's avatar mseaborn@chromium.org

NaCl: Remove use of the C++ IMC interface; use the C version instead

We want to remove the C++ version of IMC from the NaCl side.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3303
TEST=build

Review URL: https://codereview.chromium.org/12225154

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182091 0039d316-1c4b-4281-b951-d872f2087c98
parent e4b1429f
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "extensions/common/url_pattern.h" #include "extensions/common/url_pattern.h"
#include "ipc/ipc_channel.h" #include "ipc/ipc_channel.h"
#include "ipc/ipc_switches.h" #include "ipc/ipc_switches.h"
#include "native_client/src/shared/imc/nacl_imc.h" #include "native_client/src/shared/imc/nacl_imc_c.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
#include "net/base/tcp_listen_socket.h" #include "net/base/tcp_listen_socket.h"
#include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppapi_messages.h"
...@@ -77,7 +77,7 @@ bool RunningOnWOW64() { ...@@ -77,7 +77,7 @@ bool RunningOnWOW64() {
} }
#endif #endif
void SetCloseOnExec(nacl::Handle fd) { void SetCloseOnExec(NaClHandle fd) {
#if defined(OS_POSIX) #if defined(OS_POSIX)
int flags = fcntl(fd, F_GETFD); int flags = fcntl(fd, F_GETFD);
CHECK_NE(flags, -1); CHECK_NE(flags, -1);
...@@ -88,7 +88,7 @@ void SetCloseOnExec(nacl::Handle fd) { ...@@ -88,7 +88,7 @@ void SetCloseOnExec(nacl::Handle fd) {
bool ShareHandleToSelLdr( bool ShareHandleToSelLdr(
base::ProcessHandle processh, base::ProcessHandle processh,
nacl::Handle sourceh, NaClHandle sourceh,
bool close_source, bool close_source,
std::vector<nacl::FileDescriptor> *handles_for_sel_ldr) { std::vector<nacl::FileDescriptor> *handles_for_sel_ldr) {
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -128,12 +128,12 @@ ppapi::PpapiPermissions GetNaClPermissions(uint32 permission_bits) { ...@@ -128,12 +128,12 @@ ppapi::PpapiPermissions GetNaClPermissions(uint32 permission_bits) {
} // namespace } // namespace
struct NaClProcessHost::NaClInternal { struct NaClProcessHost::NaClInternal {
nacl::Handle socket_for_renderer; NaClHandle socket_for_renderer;
nacl::Handle socket_for_sel_ldr; NaClHandle socket_for_sel_ldr;
NaClInternal() NaClInternal()
: socket_for_renderer(nacl::kInvalidHandle), : socket_for_renderer(NACL_INVALID_HANDLE),
socket_for_sel_ldr(nacl::kInvalidHandle) { } socket_for_sel_ldr(NACL_INVALID_HANDLE) { }
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -203,15 +203,15 @@ NaClProcessHost::~NaClProcessHost() { ...@@ -203,15 +203,15 @@ NaClProcessHost::~NaClProcessHost() {
LOG(ERROR) << message; LOG(ERROR) << message;
} }
if (internal_->socket_for_renderer != nacl::kInvalidHandle) { if (internal_->socket_for_renderer != NACL_INVALID_HANDLE) {
if (nacl::Close(internal_->socket_for_renderer) != 0) { if (NaClClose(internal_->socket_for_renderer) != 0) {
NOTREACHED() << "nacl::Close() failed"; NOTREACHED() << "NaClClose() failed";
} }
} }
if (internal_->socket_for_sel_ldr != nacl::kInvalidHandle) { if (internal_->socket_for_sel_ldr != NACL_INVALID_HANDLE) {
if (nacl::Close(internal_->socket_for_sel_ldr) != 0) { if (NaClClose(internal_->socket_for_sel_ldr) != 0) {
NOTREACHED() << "nacl::Close() failed"; NOTREACHED() << "NaClClose() failed";
} }
} }
...@@ -278,9 +278,9 @@ void NaClProcessHost::Launch( ...@@ -278,9 +278,9 @@ void NaClProcessHost::Launch(
// This means the sandboxed renderer cannot send handles to the // This means the sandboxed renderer cannot send handles to the
// browser process. // browser process.
nacl::Handle pair[2]; NaClHandle pair[2];
// Create a connected socket // Create a connected socket
if (nacl::SocketPair(pair) == -1) { if (NaClSocketPair(pair) == -1) {
LOG(ERROR) << "NaCl process launch failed: could not create a socket pair"; LOG(ERROR) << "NaCl process launch failed: could not create a socket pair";
delete this; delete this;
return; return;
...@@ -667,7 +667,7 @@ bool NaClProcessHost::ReplyToRenderer( ...@@ -667,7 +667,7 @@ bool NaClProcessHost::ReplyToRenderer(
chrome_render_message_filter_->Send(reply_msg_); chrome_render_message_filter_->Send(reply_msg_);
chrome_render_message_filter_ = NULL; chrome_render_message_filter_ = NULL;
reply_msg_ = NULL; reply_msg_ = NULL;
internal_->socket_for_renderer = nacl::kInvalidHandle; internal_->socket_for_renderer = NACL_INVALID_HANDLE;
return true; return true;
} }
...@@ -768,7 +768,7 @@ bool NaClProcessHost::StartNaClExecution() { ...@@ -768,7 +768,7 @@ bool NaClProcessHost::StartNaClExecution() {
process_->Send(new NaClProcessMsg_Start(params)); process_->Send(new NaClProcessMsg_Start(params));
internal_->socket_for_sel_ldr = nacl::kInvalidHandle; internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE;
return true; return true;
} }
......
...@@ -78,7 +78,7 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate { ...@@ -78,7 +78,7 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate {
private: private:
friend class PluginListener; friend class PluginListener;
// Internal class that holds the nacl::Handle objecs so that // Internal class that holds the NaClHandle objecs so that
// nacl_process_host.h doesn't include NaCl headers. Needed since it's // nacl_process_host.h doesn't include NaCl headers. Needed since it's
// included by src\content, which can't depend on the NaCl gyp file because it // included by src\content, which can't depend on the NaCl gyp file because it
// depends on chrome.gyp (circular dependency). // depends on chrome.gyp (circular dependency).
......
...@@ -121,7 +121,7 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance, ...@@ -121,7 +121,7 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
if (!invalid_handle) if (!invalid_handle)
g_instance_info.Get()[instance] = instance_info; g_instance_info.Get()[instance] = instance_info;
*(static_cast<nacl::Handle*>(imc_handle)) = *(static_cast<NaClHandle*>(imc_handle)) =
nacl::ToNativeHandle(result_socket); nacl::ToNativeHandle(result_socket);
return PP_NACL_OK; return PP_NACL_OK;
......
...@@ -36,7 +36,7 @@ enum PP_NaClError { ...@@ -36,7 +36,7 @@ enum PP_NaClError {
/* PPB_NaCl_Private */ /* PPB_NaCl_Private */
interface PPB_NaCl_Private { interface PPB_NaCl_Private {
/* Launches NaCl's sel_ldr process. Returns PP_NACL_OK on success and /* Launches NaCl's sel_ldr process. Returns PP_NACL_OK on success and
* writes a nacl::Handle to imc_handle. Returns PP_NACL_FAILED on failure. * writes a NaClHandle to imc_handle. Returns PP_NACL_FAILED on failure.
* The |enable_ppapi_dev| parameter controls whether GetInterface * The |enable_ppapi_dev| parameter controls whether GetInterface
* returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag * returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag
* indicates that the nexe run by sel_ldr will use the PPAPI APIs. * indicates that the nexe run by sel_ldr will use the PPAPI APIs.
......
...@@ -61,7 +61,7 @@ typedef enum { ...@@ -61,7 +61,7 @@ typedef enum {
/* PPB_NaCl_Private */ /* PPB_NaCl_Private */
struct PPB_NaCl_Private_1_0 { struct PPB_NaCl_Private_1_0 {
/* Launches NaCl's sel_ldr process. Returns PP_NACL_OK on success and /* Launches NaCl's sel_ldr process. Returns PP_NACL_OK on success and
* writes a nacl::Handle to imc_handle. Returns PP_NACL_FAILED on failure. * writes a NaClHandle to imc_handle. Returns PP_NACL_FAILED on failure.
* The |enable_ppapi_dev| parameter controls whether GetInterface * The |enable_ppapi_dev| parameter controls whether GetInterface
* returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag * returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag
* indicates that the nexe run by sel_ldr will use the PPAPI APIs. * indicates that the nexe run by sel_ldr will use the PPAPI APIs.
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <map> #include <map>
#include <string> #include <string>
#include "native_client/src/shared/imc/nacl_imc.h" #include "native_client/src/shared/imc/nacl_imc_c.h"
#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_instance.h"
#include "ppapi/c/private/ppb_nacl_private.h" #include "ppapi/c/private/ppb_nacl_private.h"
...@@ -21,7 +21,7 @@ typedef PP_NaClResult (*LaunchNaClProcessFunc)(PP_Instance instance, ...@@ -21,7 +21,7 @@ typedef PP_NaClResult (*LaunchNaClProcessFunc)(PP_Instance instance,
PP_Bool uses_irt, PP_Bool uses_irt,
PP_Bool uses_ppapi, PP_Bool uses_ppapi,
PP_Bool enable_ppapi_dev, PP_Bool enable_ppapi_dev,
nacl::Handle* result_socket); NaClHandle* result_socket);
extern LaunchNaClProcessFunc launch_nacl_process; extern LaunchNaClProcessFunc launch_nacl_process;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "native_client/src/include/nacl_macros.h" #include "native_client/src/include/nacl_macros.h"
#include "native_client/src/include/nacl_scoped_ptr.h" #include "native_client/src/include/nacl_scoped_ptr.h"
#include "native_client/src/include/nacl_string.h" #include "native_client/src/include/nacl_string.h"
#include "native_client/src/shared/imc/nacl_imc.h"
#include "native_client/src/shared/platform/nacl_check.h" #include "native_client/src/shared/platform/nacl_check.h"
#include "native_client/src/shared/platform/nacl_log.h" #include "native_client/src/shared/platform/nacl_log.h"
#include "native_client/src/shared/platform/nacl_sync.h" #include "native_client/src/shared/platform/nacl_sync.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment