Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #ifndef PPAPI_SHARED_IMPL_ARRAY_VAR_H_ | |
| 6 #define PPAPI_SHARED_IMPL_ARRAY_VAR_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "ppapi/c/pp_var.h" | |
| 13 #include "ppapi/shared_impl/ppapi_shared_export.h" | |
| 14 #include "ppapi/shared_impl/scoped_pp_var.h" | |
| 15 #include "ppapi/shared_impl/var.h" | |
| 16 | |
| 17 namespace ppapi { | |
| 18 | |
| 19 class PPAPI_SHARED_EXPORT ArrayVar : public Var { | |
| 20 public: | |
| 21 typedef std::vector<ScopedPPVar> ElementVector; | |
| 22 | |
| 23 ArrayVar(); | |
| 24 | |
| 25 // Helper function that converts a PP_Var to an ArrayVar. This will return | |
| 26 // NULL if the PP_Var is not of type PP_VARTYPE_ARRAY or the array cannot be | |
| 27 // found from the var tracker. | |
| 28 static ArrayVar* FromPPVar(const PP_Var& var); | |
| 29 | |
| 30 // Var overrides. | |
| 31 virtual ArrayVar* AsArrayVar() OVERRIDE; | |
| 32 virtual PP_VarType GetType() const OVERRIDE; | |
| 33 | |
| 34 // The returned PP_Var has been added ref on behalf of the caller. | |
|
raymes
2013/03/05 18:19:16
I think this needs to be re-worded. Maybe:
// The
yzshen1
2013/03/14 22:36:48
Thanks. It sounds better this way.
On 2013/03/05 1
| |
| 35 PP_Var Get(uint32_t index) const; | |
| 36 PP_Bool Set(uint32_t index, const PP_Var& value); | |
| 37 uint32_t GetLength() const; | |
| 38 PP_Bool SetLength(uint32_t length); | |
| 39 | |
| 40 const ElementVector& elements() const { | |
| 41 return elements_; | |
| 42 } | |
| 43 | |
| 44 ElementVector& elements() { | |
| 45 return elements_; | |
| 46 } | |
| 47 | |
| 48 protected: | |
| 49 virtual ~ArrayVar(); | |
| 50 | |
| 51 private: | |
| 52 ElementVector elements_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(ArrayVar); | |
| 55 }; | |
| 56 | |
| 57 } // namespace ppapi | |
| 58 | |
| 59 #endif // PPAPI_SHARED_IMPL_ARRAY_VAR_H_ | |
| OLD | NEW |