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

Side by Side Diff: src/trusted/plugin/array_ppapi.h

Issue 7799028: Remove src/trusted/plugin (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: fix gyp file for necessary -I Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/trusted/plugin/arch_x86/sandbox_isa.cc ('k') | src/trusted/plugin/array_ppapi.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client 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.
4
5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_ARRAY_PPAPI_H_
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_ARRAY_PPAPI_H_
7
8 #include <vector>
9
10 #include "native_client/src/include/checked_cast.h"
11 #include "native_client/src/include/nacl_macros.h"
12 #include "native_client/src/trusted/plugin/plugin.h"
13 #include "ppapi/cpp/dev/scriptable_object_deprecated.h"
14 #include "ppapi/cpp/instance.h"
15 #include "ppapi/cpp/private/var_private.h"
16
17 namespace plugin {
18
19 // Wraps a JavaScript array where each element is an indexed property.
20 // Can be used to represent single arguments and return values of array type
21 // as well as multiple return values from invoking SRPC methods.
22 class ArrayPpapi : public pp::deprecated::ScriptableObject {
23 public:
24 explicit ArrayPpapi(Plugin* instance);
25 virtual ~ArrayPpapi() {}
26
27 virtual bool HasProperty(const pp::Var& name, pp::Var* exception) {
28 return js_array_.HasProperty(name, exception);
29 }
30 virtual pp::Var GetProperty(const pp::Var& name, pp::Var* exception) {
31 return js_array_.GetProperty(name, exception);
32 }
33 virtual void GetAllPropertyNames(std::vector<pp::Var>* properties,
34 pp::Var* exception) {
35 js_array_.GetAllPropertyNames(properties, exception);
36 }
37 virtual void SetProperty(const pp::Var& name,
38 const pp::Var& value, pp::Var* exception) {
39 js_array_.SetProperty(name, value, exception);
40 }
41 virtual void RemoveProperty(const pp::Var& name, pp::Var* exception) {
42 js_array_.RemoveProperty(name, exception);
43 }
44 virtual pp::Var Call(const pp::Var& method_name,
45 const std::vector<pp::Var>& args, pp::Var* exception) {
46 // Assuming the number of arguments will fit into 32 bits.
47 uint32_t argc = nacl::assert_cast<uint32_t>(args.size());
48 pp::Var* argv = const_cast<pp::Var*>(&args[0]); // elements are contiguous
49 return js_array_.Call(method_name, argc, argv, exception);
50 }
51
52 private:
53 NACL_DISALLOW_COPY_AND_ASSIGN(ArrayPpapi);
54
55 pp::VarPrivate js_array_;
56 };
57
58 } // namespace plugin
59
60 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_ARRAY_PPAPI_H_
OLDNEW
« no previous file with comments | « src/trusted/plugin/arch_x86/sandbox_isa.cc ('k') | src/trusted/plugin/array_ppapi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698