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

Side by Side Diff: ppapi/thunk/ppb_var_array_thunk.cc

Issue 12388083: Add PPB_VarArray_Dev support - part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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 | « ppapi/thunk/interfaces_ppb_public_dev.h ('k') | webkit/plugins/ppapi/plugin_module.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) 2013 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.
4
5 #include "ppapi/c/dev/ppb_var_array_dev.h"
6 #include "ppapi/shared_impl/array_var.h"
7 #include "ppapi/shared_impl/proxy_lock.h"
8 #include "ppapi/thunk/thunk.h"
9
10 namespace ppapi {
11 namespace thunk {
12
13 namespace {
14
15 PP_Var Create() {
16 ProxyAutoLock lock;
17
18 // Var tracker will hold a reference to this object.
19 ArrayVar* var = new ArrayVar();
20 return var->GetPPVar();
21 }
22
23 PP_Var Get(PP_Var array, uint32_t index) {
24 ProxyAutoLock lock;
25
26 ArrayVar* array_var = ArrayVar::FromPPVar(array);
27 if (!array_var)
28 return PP_MakeUndefined();
29 return array_var->Get(index);
30 }
31
32 PP_Bool Set(PP_Var array, uint32_t index, PP_Var value) {
33 ProxyAutoLock lock;
34
35 ArrayVar* array_var = ArrayVar::FromPPVar(array);
36 if (!array_var)
37 return PP_FALSE;
38 return array_var->Set(index, value);
39 }
40
41 uint32_t GetLength(PP_Var array) {
42 ProxyAutoLock lock;
43
44 ArrayVar* array_var = ArrayVar::FromPPVar(array);
45 if (!array_var)
46 return 0;
47 return array_var->GetLength();
48 }
49
50 PP_Bool SetLength(PP_Var array, uint32_t length) {
51 ProxyAutoLock lock;
52
53 ArrayVar* array_var = ArrayVar::FromPPVar(array);
54 if (!array_var)
55 return PP_FALSE;
56 return array_var->SetLength(length);
57 }
58
59 const PPB_VarArray_Dev_0_1 g_ppb_vararray_0_1_thunk = {
60 &Create,
61 &Get,
62 &Set,
63 &GetLength,
64 &SetLength
65 };
66
67 } // namespace
68
69 const PPB_VarArray_Dev_0_1* GetPPB_VarArray_Dev_0_1_Thunk() {
70 return &g_ppb_vararray_0_1_thunk;
71 }
72
73 } // namespace thunk
74 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/interfaces_ppb_public_dev.h ('k') | webkit/plugins/ppapi/plugin_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698