| Index: ppapi/native_client/src/trusted/plugin/nacl_subprocess.cc
|
| ===================================================================
|
| --- ppapi/native_client/src/trusted/plugin/nacl_subprocess.cc (revision 121986)
|
| +++ ppapi/native_client/src/trusted/plugin/nacl_subprocess.cc (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -6,18 +6,12 @@
|
|
|
| #include <stdarg.h>
|
|
|
| -#include "native_client/src/trusted/plugin/browser_interface.h"
|
| -#include "native_client/src/trusted/plugin/method_map.h"
|
| #include "native_client/src/trusted/plugin/plugin_error.h"
|
| -#include "native_client/src/trusted/plugin/scriptable_handle.h"
|
| #include "native_client/src/trusted/plugin/service_runtime.h"
|
| +#include "native_client/src/trusted/plugin/srpc_params.h"
|
|
|
| namespace plugin {
|
|
|
| -nacl::string NaClSubprocess::description() const {
|
| - return description_;
|
| -}
|
| -
|
| nacl::string NaClSubprocess::detailed_description() const {
|
| nacl::stringstream ss;
|
| ss << description()
|
| @@ -50,27 +44,6 @@
|
| return srpc_client_->StartJSObjectProxy(plugin, error_info);
|
| }
|
|
|
| -bool NaClSubprocess::HasMethod(uintptr_t method_id) const {
|
| - if (NULL == srpc_client_.get()) {
|
| - return false;
|
| - }
|
| - return srpc_client_->HasMethod(method_id);
|
| -}
|
| -
|
| -bool NaClSubprocess::InitParams(uintptr_t method_id, SrpcParams* params) const {
|
| - if (NULL == srpc_client_.get()) {
|
| - return false;
|
| - }
|
| - return srpc_client_->InitParams(method_id, params);
|
| -}
|
| -
|
| -bool NaClSubprocess::Invoke(uintptr_t method_id, SrpcParams* params) const {
|
| - if (NULL == srpc_client_.get()) {
|
| - return false;
|
| - }
|
| - return srpc_client_->Invoke(method_id, params);
|
| -}
|
| -
|
| bool NaClSubprocess::InvokeSrpcMethod(const nacl::string& method_name,
|
| const nacl::string& input_signature,
|
| SrpcParams* params,
|
| @@ -86,12 +59,20 @@
|
| const nacl::string& input_signature,
|
| SrpcParams* params,
|
| va_list vl) {
|
| - uintptr_t method_ident;
|
| - if (!SetupSrpcInvocation(method_name, params, &method_ident)) {
|
| + if (NULL == srpc_client_.get()) {
|
| + PLUGIN_PRINTF(("VInvokeSrpcMethod (no srpc_client_)\n"));
|
| return false;
|
| }
|
| -
|
| - // Set up inputs.
|
| + if (!srpc_client_->HasMethod(method_name)) {
|
| + PLUGIN_PRINTF(("VInvokeSrpcMethod (no %s method found)\n",
|
| + method_name.c_str()));
|
| + return false;
|
| + }
|
| + if (!srpc_client_->InitParams(method_name, params)) {
|
| + PLUGIN_PRINTF(("VInvokeSrpcMethod (InitParams failed)\n"));
|
| + return false;
|
| + }
|
| + // Marshall inputs.
|
| for (size_t i = 0; i < input_signature.length(); ++i) {
|
| char c = input_signature[i];
|
| // Only handle the limited number of SRPC types used for PNaCl.
|
| @@ -135,20 +116,7 @@
|
| }
|
| }
|
| }
|
| -
|
| - return Invoke(method_ident, params);
|
| + return srpc_client_->Invoke(method_name, params);
|
| }
|
|
|
| -bool NaClSubprocess::SetupSrpcInvocation(const nacl::string& method_name,
|
| - SrpcParams* params,
|
| - uintptr_t* method_ident) {
|
| - *method_ident = browser_interface_->StringToIdentifier(method_name);
|
| - if (!HasMethod(*method_ident)) {
|
| - PLUGIN_PRINTF(("SetupSrpcInvocation (no %s method found)\n",
|
| - method_name.c_str()));
|
| - return false;
|
| - }
|
| - return InitParams(*method_ident, params);
|
| -}
|
| -
|
| } // namespace plugin
|
|
|