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

Unified Diff: ppapi/shared_impl/array_var.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | ppapi/shared_impl/array_var.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/array_var.h
diff --git a/ppapi/shared_impl/array_var.h b/ppapi/shared_impl/array_var.h
new file mode 100644
index 0000000000000000000000000000000000000000..1214d87500c386e28ecc8da52bd598b8d833da69
--- /dev/null
+++ b/ppapi/shared_impl/array_var.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2013 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.
+
+#ifndef PPAPI_SHARED_IMPL_ARRAY_VAR_H_
+#define PPAPI_SHARED_IMPL_ARRAY_VAR_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
+#include "ppapi/shared_impl/var.h"
+
+namespace ppapi {
+
+class PPAPI_SHARED_EXPORT ArrayVar : public Var {
+ public:
+ typedef std::vector<ScopedPPVar> ElementVector;
+
+ ArrayVar();
+
+ // Helper function that converts a PP_Var to an ArrayVar. This will return
+ // NULL if the PP_Var is not of type PP_VARTYPE_ARRAY or the array cannot be
+ // found from the var tracker.
+ static ArrayVar* FromPPVar(const PP_Var& var);
+
+ // Var overrides.
+ virtual ArrayVar* AsArrayVar() OVERRIDE;
+ virtual PP_VarType GetType() const OVERRIDE;
+
+ // The returned PP_Var has had a ref added on behalf of the caller.
+ PP_Var Get(uint32_t index) const;
+ PP_Bool Set(uint32_t index, const PP_Var& value);
+ uint32_t GetLength() const;
+ PP_Bool SetLength(uint32_t length);
+
+ const ElementVector& elements() const {
+ return elements_;
+ }
+
+ ElementVector& elements() {
+ return elements_;
+ }
+
+ protected:
+ virtual ~ArrayVar();
+
+ private:
+ ElementVector elements_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArrayVar);
+};
+
+} // namespace ppapi
+
+#endif // PPAPI_SHARED_IMPL_ARRAY_VAR_H_
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | ppapi/shared_impl/array_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698