Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / components / nacl / renderer / plugin / srpc_params.h
blob1052b6f895041280cdb126df0980a487aeb785c6
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Parameter types for SRPC Invocation.
7 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_SRPC_PARAMS_H
8 #define COMPONENTS_NACL_RENDERER_PLUGIN_SRPC_PARAMS_H
10 #include "native_client/src/include/nacl_macros.h"
11 #include "native_client/src/include/portability_string.h"
12 #include "native_client/src/shared/srpc/nacl_srpc.h"
14 namespace plugin {
16 // A utility class that builds and deletes parameter vectors used in rpcs.
17 class SrpcParams {
18 public:
19 SrpcParams() {
20 memset(ins_, 0, sizeof(ins_));
21 memset(outs_, 0, sizeof(outs_));
24 ~SrpcParams() {
25 FreeAll();
28 bool Init(const char* in_types, const char* out_types);
30 NaClSrpcArg** ins() const { return const_cast<NaClSrpcArg**>(ins_); }
31 NaClSrpcArg** outs() const { return const_cast<NaClSrpcArg**>(outs_); }
33 private:
34 NACL_DISALLOW_COPY_AND_ASSIGN(SrpcParams);
35 void FreeAll();
36 // The ins_ and outs_ arrays contain one more element, to hold a NULL pointer
37 // to indicate the end of the list.
38 NaClSrpcArg* ins_[NACL_SRPC_MAX_ARGS + 1];
39 NaClSrpcArg* outs_[NACL_SRPC_MAX_ARGS + 1];
42 } // namespace plugin
44 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_SRPC_PARAMS_H