Skip to content

Commit

Permalink
NaCl: Remove use of the C++ IMC interface; use the C version instead
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mseaborn@chromium.org committed Feb 13, 2013
1 parent e4b1429 commit c8e1ea3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 24 deletions.
34 changes: 17 additions & 17 deletions chrome/browser/nacl_host/nacl_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "extensions/common/url_pattern.h"
#include "ipc/ipc_channel.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/tcp_listen_socket.h"
#include "ppapi/proxy/ppapi_messages.h"
Expand Down Expand Up @@ -77,7 +77,7 @@ bool RunningOnWOW64() {
}
#endif

void SetCloseOnExec(nacl::Handle fd) {
void SetCloseOnExec(NaClHandle fd) {
#if defined(OS_POSIX)
int flags = fcntl(fd, F_GETFD);
CHECK_NE(flags, -1);
Expand All @@ -88,7 +88,7 @@ void SetCloseOnExec(nacl::Handle fd) {

bool ShareHandleToSelLdr(
base::ProcessHandle processh,
nacl::Handle sourceh,
NaClHandle sourceh,
bool close_source,
std::vector<nacl::FileDescriptor> *handles_for_sel_ldr) {
#if defined(OS_WIN)
Expand Down Expand Up @@ -128,12 +128,12 @@ ppapi::PpapiPermissions GetNaClPermissions(uint32 permission_bits) {
} // namespace

struct NaClProcessHost::NaClInternal {
nacl::Handle socket_for_renderer;
nacl::Handle socket_for_sel_ldr;
NaClHandle socket_for_renderer;
NaClHandle socket_for_sel_ldr;

NaClInternal()
: socket_for_renderer(nacl::kInvalidHandle),
socket_for_sel_ldr(nacl::kInvalidHandle) { }
: socket_for_renderer(NACL_INVALID_HANDLE),
socket_for_sel_ldr(NACL_INVALID_HANDLE) { }
};

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -203,15 +203,15 @@ NaClProcessHost::~NaClProcessHost() {
LOG(ERROR) << message;
}

if (internal_->socket_for_renderer != nacl::kInvalidHandle) {
if (nacl::Close(internal_->socket_for_renderer) != 0) {
NOTREACHED() << "nacl::Close() failed";
if (internal_->socket_for_renderer != NACL_INVALID_HANDLE) {
if (NaClClose(internal_->socket_for_renderer) != 0) {
NOTREACHED() << "NaClClose() failed";
}
}

if (internal_->socket_for_sel_ldr != nacl::kInvalidHandle) {
if (nacl::Close(internal_->socket_for_sel_ldr) != 0) {
NOTREACHED() << "nacl::Close() failed";
if (internal_->socket_for_sel_ldr != NACL_INVALID_HANDLE) {
if (NaClClose(internal_->socket_for_sel_ldr) != 0) {
NOTREACHED() << "NaClClose() failed";
}
}

Expand Down Expand Up @@ -278,9 +278,9 @@ void NaClProcessHost::Launch(
// This means the sandboxed renderer cannot send handles to the
// browser process.

nacl::Handle pair[2];
NaClHandle pair[2];
// 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";
delete this;
return;
Expand Down Expand Up @@ -667,7 +667,7 @@ bool NaClProcessHost::ReplyToRenderer(
chrome_render_message_filter_->Send(reply_msg_);
chrome_render_message_filter_ = NULL;
reply_msg_ = NULL;
internal_->socket_for_renderer = nacl::kInvalidHandle;
internal_->socket_for_renderer = NACL_INVALID_HANDLE;
return true;
}

Expand Down Expand Up @@ -768,7 +768,7 @@ bool NaClProcessHost::StartNaClExecution() {

process_->Send(new NaClProcessMsg_Start(params));

internal_->socket_for_sel_ldr = nacl::kInvalidHandle;
internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE;
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/nacl_host/nacl_process_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate {
private:
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
// included by src\content, which can't depend on the NaCl gyp file because it
// depends on chrome.gyp (circular dependency).
Expand Down
2 changes: 1 addition & 1 deletion chrome/renderer/pepper/ppb_nacl_private_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
if (!invalid_handle)
g_instance_info.Get()[instance] = instance_info;

*(static_cast<nacl::Handle*>(imc_handle)) =
*(static_cast<NaClHandle*>(imc_handle)) =
nacl::ToNativeHandle(result_socket);

return PP_NACL_OK;
Expand Down
2 changes: 1 addition & 1 deletion ppapi/api/private/ppb_nacl_private.idl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum PP_NaClError {
/* PPB_NaCl_Private */
interface PPB_NaCl_Private {
/* 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
* returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag
* indicates that the nexe run by sel_ldr will use the PPAPI APIs.
Expand Down
2 changes: 1 addition & 1 deletion ppapi/c/private/ppb_nacl_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef enum {
/* PPB_NaCl_Private */
struct PPB_NaCl_Private_1_0 {
/* 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
* returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag
* indicates that the nexe run by sel_ldr will use the PPAPI APIs.
Expand Down
4 changes: 2 additions & 2 deletions ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <map>
#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/private/ppb_nacl_private.h"

Expand All @@ -21,7 +21,7 @@ typedef PP_NaClResult (*LaunchNaClProcessFunc)(PP_Instance instance,
PP_Bool uses_irt,
PP_Bool uses_ppapi,
PP_Bool enable_ppapi_dev,
nacl::Handle* result_socket);
NaClHandle* result_socket);


extern LaunchNaClProcessFunc launch_nacl_process;
Expand Down
1 change: 0 additions & 1 deletion ppapi/native_client/src/trusted/plugin/service_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/include/nacl_scoped_ptr.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_log.h"
#include "native_client/src/shared/platform/nacl_sync.h"
Expand Down

0 comments on commit c8e1ea3

Please sign in to comment.